-
Notifications
You must be signed in to change notification settings - Fork 9
docs: add advocate welcome kit and update SDK quickstart #134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
AllenAJ
wants to merge
1
commit into
RequestNetwork:main
Choose a base branch
from
AllenAJ:feat/advocate-onboarding-and-sdk-docs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+186
−5
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 84 additions & 3 deletions
87
docs/advanced/request-network-sdk/sdk-guides/request-client/updating-a-request.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,88 @@ | ||
| # Updating a Request | ||
|
|
||
| After a request is created, it can be updated: | ||
| After a request is created, it can be updated by the authorized parties. Each update requires a signature and is persisted to the Request Network. | ||
|
|
||
| <table data-full-width="true"><thead><tr><th>Name</th><th>Description</th><th>Role Authorized</th></tr></thead><tbody><tr><td><strong>accept</strong></td><td>accept a request, indicating that it will be paid</td><td>payer</td></tr><tr><td><strong>cancel</strong></td><td>cancel a request</td><td>payee, payer</td></tr><tr><td><strong>reduceExpectedAmount</strong></td><td>reduce the expected amount</td><td>payee</td></tr><tr><td><strong>increaseExpectedAmount</strong></td><td>increase the expected amount</td><td>payer</td></tr><tr><td><strong>addStakeholders</strong></td><td>grant 1 or more third parties access to view an encrypted request</td><td>payee, payer, third party</td></tr></tbody></table> | ||
| ## Summary of Actions | ||
|
|
||
| Feature exists. More docs coming soon... | ||
| | Action | Description | Authorized Role | | ||
| | :--- | :--- | :--- | | ||
| | **accept** | Accept a request, indicating that it will be paid | Payer | | ||
| | **cancel** | Cancel a request | Payee or Payer | | ||
| | **reduceExpectedAmount** | Reduce the expected amount | Payee | | ||
| | **increaseExpectedAmount** | Increase the expected amount | Payer | | ||
|
|
||
| ## Examples | ||
|
|
||
| ### Initialize the Request Client | ||
|
|
||
| First, retrieve the request you want to update. You must provide a `signatureProvider` to sign the update transactions. | ||
|
|
||
| ```javascript | ||
| const { RequestNetwork, Types } = require("@requestnetwork/request-client.js"); | ||
|
|
||
| const requestClient = new RequestNetwork({ | ||
| nodeConnectionConfig: { baseURL: "https://sepolia.gateway.request.network/" }, | ||
| signatureProvider: epkSignatureProvider, // Required for updates | ||
| }); | ||
|
|
||
| const request = await requestClient.fromRequestId('YOUR_REQUEST_ID'); | ||
| ``` | ||
|
|
||
| ### Accept a Request (Payer) | ||
|
|
||
| The payer can accept a request to signal their intention to pay. | ||
|
|
||
| ```javascript | ||
| const updatedRequestData = await request.accept({ | ||
| type: Types.Identity.TYPE.ETHEREUM_ADDRESS, | ||
| value: payerAddress, | ||
| }); | ||
|
|
||
| // Wait for the update to be persisted | ||
| await request.waitForConfirmation(); | ||
| ``` | ||
|
|
||
| ### Cancel a Request (Payee or Payer) | ||
|
|
||
| Either the payee or the payer can cancel a request. | ||
|
|
||
| ```javascript | ||
| const updatedRequestData = await request.cancel({ | ||
| type: Types.Identity.TYPE.ETHEREUM_ADDRESS, | ||
| value: signerAddress, | ||
| }); | ||
|
|
||
| await request.waitForConfirmation(); | ||
| ``` | ||
|
|
||
| ### Increase Expected Amount (Payer) | ||
|
|
||
| The payer can increase the expected amount (e.g., adding a tip or adjusting for additional services). | ||
|
|
||
| ```javascript | ||
| const updatedRequestData = await request.increaseExpectedAmountRequest( | ||
| '100000000000000000', // Amount to add in base units (e.g., 0.1 ETH) | ||
| { | ||
| type: Types.Identity.TYPE.ETHEREUM_ADDRESS, | ||
| value: payerAddress, | ||
| } | ||
| ); | ||
|
|
||
| await request.waitForConfirmation(); | ||
| ``` | ||
|
|
||
| ### Reduce Expected Amount (Payee) | ||
|
|
||
| The payee can reduce the expected amount (e.g., applying a discount). | ||
|
|
||
| ```javascript | ||
| const updatedRequestData = await request.reduceExpectedAmountRequest( | ||
| '100000000000000000', // Amount to subtract in base units | ||
| { | ||
| type: Types.Identity.TYPE.ETHEREUM_ADDRESS, | ||
| value: payeeAddress, | ||
| } | ||
| ); | ||
|
|
||
| await request.waitForConfirmation(); | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| # Advocates Welcome Kit | ||
|
|
||
| Welcome to the Request Network Advocates program! We are excited to have you onboard to help us grow the protocol and support the developer community. | ||
|
|
||
| ## Mission & Vision | ||
|
|
||
| **Our Mission:** To rebuild the world of payments by creating a financial layer that is open, decentralized, and interoperable. | ||
|
|
||
| **Our Vision:** A world where every transaction is seamless, transparent, and controlled by the users, not by intermediaries. | ||
|
|
||
| ## Getting Started | ||
|
|
||
| As an advocate, your first week is about getting to know the team and the tools. | ||
|
|
||
| ### 1. Join the Community | ||
| * **Discord:** Join our [Discord server](https://discord.gg/request) and introduce yourself in the `#advocates` channel. | ||
| * **Twitter/X:** Follow [@RequestNetwork](https://twitter.com/RequestNetwork) for updates. | ||
|
|
||
| ### 2. Access Your Tools | ||
| * **Notion:** You will receive an invite to our private Advocates workspace. | ||
| * **Canva:** Access our brand assets and templates for creating content. | ||
| * **GitHub:** Star our [repositories](https://github.com/RequestNetwork) and join the discussions. | ||
|
|
||
| ### 3. Your First Tasks | ||
| * Complete your onboarding profile. | ||
| * Read the [Technical Documentation](https://docs.request.network). | ||
| * Say hello to the team in the private advocate channel. | ||
|
|
||
| ## Reward Program | ||
|
|
||
| Advocates are rewarded in **REQ tokens** based on their monthly contributions. | ||
|
|
||
| ### Point Categories | ||
| 1. **Developer Support & Documentation:** GitHub PRs, tutorials, Discord support. | ||
| 2. **Content & Awareness:** Blog posts, X threads, videos, memes. | ||
| 3. **Community Engagement & Growth:** AMAs, moderation, onboarding new developers. | ||
|
|
||
| ### Reward Tiers | ||
| * **I'm around (5-9 points):** Share in 10% of the monthly REQ pool. | ||
| * **I'm active (10-14 points):** Share in 40% of the monthly REQ pool. | ||
| * **I'm a champ (15+ points):** Share in 50% of the monthly REQ pool. | ||
|
|
||
| *Total Monthly Pool: $1,200 USD worth of REQ.* | ||
|
|
||
| ## Support | ||
|
|
||
| If you have any questions, reach out to the program managers in Discord or via email at advocates@request.network. | ||
|
|
||
| Let's build the future of payments together! | ||
|
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
viem http transport EIP-1193 compatible ethers Web3Provider💡 Result:
Short answer — use viem's custom transport for an EIP‑1193 provider (like ethers' Web3Provider/window.ethereum) and viem's http transport for JSON‑RPC endpoints. Example patterns:
Use an injected EIP‑1193 provider (MetaMask / ethers Web3Provider.window.ethereum) with viem wallet/public clients:
import { createWalletClient, createPublicClient, custom } from 'viem'
import { mainnet } from 'viem/chains'
// EIP‑1193 provider (window.ethereum or providers.Web3Provider(window.ethereum).provider)
const eip1193 = window.ethereum
const walletClient = createWalletClient({
chain: mainnet,
transport: custom(eip1193),
})
const publicClient = createPublicClient({
chain: mainnet,
transport: custom(eip1193), // or use http() for a read‑only RPC
})
Use HTTP RPC for a read/backup transport:
import { createPublicClient, http } from 'viem'
const publicClient = createPublicClient({
chain: mainnet,
transport: http('https://eth-mainnet.g.alchemy.com/v2/<API_KEY>'),
})
Notes:
Sources:
[1] viem — Custom transport (EIP‑1193).
[2] viem migration examples (Web3Provider -> custom).
[3] viem http/fallback transport examples.
🌐 Web query:
viem WalletClient to ethers v5 Signer conversion💡 Result:
Summary — simple approach
Example (TypeScript)
import { providers } from "ethers";
function walletClientToEthersSigner(walletClient: any) {
const provider = new providers.Web3Provider(walletClient.transport as any);
return provider.getSigner(walletClient.account.address);
}
Notes
Sources
🌐 Web query:
ethers v5 Web3Provider constructor requirements EIP-1193 provider💡 Result:
Short answer:
ethers v5's Web3Provider accepts an "ExternalProvider" that is either a Web3-compatible provider or an EIP‑1193 provider. It will accept one of these provider method signatures (first match used): provider.request(request) → Promise; or legacy provider.sendAsync(request, callback); or provider.send(request, callback). [1]
If you supply an EIP‑1193 provider, it should implement the EIP‑1193 request(...) API and the event methods required by EIP‑1193 (on, removeListener, and emit the connect / disconnect / chainChanged / accountsChanged semantics). See the EIP‑1193 spec for the required request signature and event semantics. [2]
Sources:
[1] ethers v5 docs — Web3Provider / ExternalProvider (ethers.js).
[2] EIP‑1193: Ethereum Provider JavaScript API (request, events).
🏁 Script executed:
Repository: RequestNetwork/docs.request.network
Length of output: 1481
Fix the viem-to-ethers conversion; current code will fail at runtime.
The
walletClientis created with viem'shttp()transport (line 206), which is a JSON-RPC transport and not EIP-1193 compatible. Passing it to ethers'Web3Providerconstructor (line 210) will fail because Web3Provider expects an EIP-1193 provider with arequest()method. The working pattern requires an EIP-1193 compatible transport created with viem'scustom()function, nothttp().🤖 Prompt for AI Agents