-
Notifications
You must be signed in to change notification settings - Fork 10
docs: update SDK quickstart and request update guide #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
Merged
MantisClone
merged 7 commits into
RequestNetwork:main
from
AllenAJ:feat/advocate-onboarding-and-sdk-docs
Jan 28, 2026
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7c6248a
docs: add advocate welcome kit and update SDK quickstart
AllenAJ 087dc01
fix: correct viem tab and restore addStakeholders in docs
MantisClone 26bd317
fix: use consistent Discord link format
MantisClone f0060af
chore: remove Advocates Welcome Kit from technical docs
MantisClone 66eb942
Merge branch 'main' into feat/advocate-onboarding-and-sdk-docs
MantisClone 487f609
fix: use payerIdentity for consistency in quickstart update example
MantisClone e42f66d
fix: use *Identity naming convention and fix repo URL typo
MantisClone 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
88 changes: 85 additions & 3 deletions
88
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,89 @@ | ||
| # 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 | | ||
| | **addStakeholders** | Grant 1 or more third parties access to view an encrypted request | Payee, Payer, or Third Party | | ||
|
|
||
| ## 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: payerIdentity, | ||
| }); | ||
|
|
||
| // 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: signerIdentity, | ||
| }); | ||
|
|
||
| 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: payerIdentity, | ||
| } | ||
| ); | ||
|
|
||
| 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: payeeIdentity, | ||
| } | ||
| ); | ||
|
|
||
| await request.waitForConfirmation(); | ||
| ``` | ||
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.
Uh oh!
There was an error while loading. Please reload this page.