Skip to content

Commit 7c6248a

Browse files
committed
docs: add advocate welcome kit and update SDK quickstart
1 parent c6a93ce commit 7c6248a

5 files changed

Lines changed: 186 additions & 5 deletions

File tree

docs/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
## General
2222

23+
* [Advocates Welcome Kit](general/advocates-welcome-kit.md)
2324
* [Lifecycle of a Request](general/lifecycle-of-a-request.md)
2425
* [Request Scan](general/request-scan.md)
2526
* [Supported Chains](general/supported-chains/README.md)

docs/advanced/request-network-sdk/get-started/quickstart-node.js.md

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This approach works well for Node.js environments _without_ access to a Web3 wal
88
You will learn:
99

1010
* How to create a request
11-
* How to update a request (coming soon...)
11+
* How to update a request
1212
* How to pay a request
1313
* How to detect a payment
1414
* How to retrieve a user’s requests
@@ -127,6 +127,23 @@ Altogether it looks like this:
127127

128128
{% @github-files/github-code-block url="https://github.com/RequestNetwork/quickstart-node-js/blob/main/src/createRequest.js" %}
129129

130+
## Update a request
131+
132+
After creating a request, you might need to update it (e.g., to cancel it or adjust the amount). Updates require a `signatureProvider`.
133+
134+
```javascript
135+
const request = await requestClient.fromRequestId('YOUR_REQUEST_ID');
136+
137+
// Payer accepts the request
138+
await request.accept({
139+
type: Types.Identity.TYPE.ETHEREUM_ADDRESS,
140+
value: payerAddress,
141+
});
142+
await request.waitForConfirmation();
143+
```
144+
145+
See the [Updating a Request](../sdk-guides/request-client/updating-a-request.md) guide for more details.
146+
130147
## Pay a request / Detect a payment
131148

132149
First, construct a `RequestNetwork` object and connect it to a Request Node. In this example, we use the Sepolia Request Node Gateway:
@@ -171,7 +188,31 @@ const payerWallet = new Wallet(
171188
{% endtab %}
172189

173190
{% tab title="viem" %}
174-
Coming soon. Probably involves `publicClientToProvider()` and `walletClientToSigner()`.
191+
```javascript
192+
const { createPublicClient, createWalletClient, http } = require("viem");
193+
const { mainnet } = require("viem/chains");
194+
const { privateKeyToAccount } = require("viem/accounts");
195+
const { providers } = require("ethers");
196+
197+
const publicClient = createPublicClient({
198+
chain: mainnet,
199+
transport: http(process.env.JSON_RPC_PROVIDER_URL),
200+
});
201+
202+
const account = privateKeyToAccount(process.env.PAYER_PRIVATE_KEY);
203+
const walletClient = createWalletClient({
204+
account,
205+
chain: mainnet,
206+
transport: http(process.env.JSON_RPC_PROVIDER_URL),
207+
});
208+
209+
// Convert viem WalletClient to ethers v5 Signer
210+
const provider = new providers.Web3Provider(walletClient.transport, {
211+
chainId: mainnet.id,
212+
name: mainnet.name,
213+
});
214+
const signer = provider.getSigner(account.address);
215+
```
175216
{% endtab %}
176217
{% endtabs %}
177218

Lines changed: 84 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,88 @@
11
# Updating a Request
22

3-
After a request is created, it can be updated:
3+
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.
44

5-
<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>
5+
## Summary of Actions
66

7-
Feature exists. More docs coming soon...
7+
| Action | Description | Authorized Role |
8+
| :--- | :--- | :--- |
9+
| **accept** | Accept a request, indicating that it will be paid | Payer |
10+
| **cancel** | Cancel a request | Payee or Payer |
11+
| **reduceExpectedAmount** | Reduce the expected amount | Payee |
12+
| **increaseExpectedAmount** | Increase the expected amount | Payer |
13+
14+
## Examples
15+
16+
### Initialize the Request Client
17+
18+
First, retrieve the request you want to update. You must provide a `signatureProvider` to sign the update transactions.
19+
20+
```javascript
21+
const { RequestNetwork, Types } = require("@requestnetwork/request-client.js");
22+
23+
const requestClient = new RequestNetwork({
24+
nodeConnectionConfig: { baseURL: "https://sepolia.gateway.request.network/" },
25+
signatureProvider: epkSignatureProvider, // Required for updates
26+
});
27+
28+
const request = await requestClient.fromRequestId('YOUR_REQUEST_ID');
29+
```
30+
31+
### Accept a Request (Payer)
32+
33+
The payer can accept a request to signal their intention to pay.
34+
35+
```javascript
36+
const updatedRequestData = await request.accept({
37+
type: Types.Identity.TYPE.ETHEREUM_ADDRESS,
38+
value: payerAddress,
39+
});
40+
41+
// Wait for the update to be persisted
42+
await request.waitForConfirmation();
43+
```
44+
45+
### Cancel a Request (Payee or Payer)
46+
47+
Either the payee or the payer can cancel a request.
48+
49+
```javascript
50+
const updatedRequestData = await request.cancel({
51+
type: Types.Identity.TYPE.ETHEREUM_ADDRESS,
52+
value: signerAddress,
53+
});
54+
55+
await request.waitForConfirmation();
56+
```
57+
58+
### Increase Expected Amount (Payer)
59+
60+
The payer can increase the expected amount (e.g., adding a tip or adjusting for additional services).
61+
62+
```javascript
63+
const updatedRequestData = await request.increaseExpectedAmountRequest(
64+
'100000000000000000', // Amount to add in base units (e.g., 0.1 ETH)
65+
{
66+
type: Types.Identity.TYPE.ETHEREUM_ADDRESS,
67+
value: payerAddress,
68+
}
69+
);
70+
71+
await request.waitForConfirmation();
72+
```
73+
74+
### Reduce Expected Amount (Payee)
75+
76+
The payee can reduce the expected amount (e.g., applying a discount).
77+
78+
```javascript
79+
const updatedRequestData = await request.reduceExpectedAmountRequest(
80+
'100000000000000000', // Amount to subtract in base units
81+
{
82+
type: Types.Identity.TYPE.ETHEREUM_ADDRESS,
83+
value: payeeAddress,
84+
}
85+
);
86+
87+
await request.waitForConfirmation();
88+
```

docs/faq.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,14 @@ Yes. See:
151151
152152
<details>
153153
154+
<summary>How can I contribute to the Request Network as an advocate?</summary>
155+
156+
We have an Advocates program where you can earn REQ tokens by contributing to the protocol's growth, documentation, and community. Check out our [Advocates Welcome Kit](general/advocates-welcome-kit.md) to get started!
157+
158+
</details>
159+
160+
<details>
161+
154162
<summary>Does Request Network support private payments?</summary>
155163
156164
Yes. See [hinkal-private-payments.md](advanced/request-network-sdk/sdk-guides/payment/hinkal-private-payments.md "mention")
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Advocates Welcome Kit
2+
3+
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.
4+
5+
## Mission & Vision
6+
7+
**Our Mission:** To rebuild the world of payments by creating a financial layer that is open, decentralized, and interoperable.
8+
9+
**Our Vision:** A world where every transaction is seamless, transparent, and controlled by the users, not by intermediaries.
10+
11+
## Getting Started
12+
13+
As an advocate, your first week is about getting to know the team and the tools.
14+
15+
### 1. Join the Community
16+
* **Discord:** Join our [Discord server](https://discord.gg/request) and introduce yourself in the `#advocates` channel.
17+
* **Twitter/X:** Follow [@RequestNetwork](https://twitter.com/RequestNetwork) for updates.
18+
19+
### 2. Access Your Tools
20+
* **Notion:** You will receive an invite to our private Advocates workspace.
21+
* **Canva:** Access our brand assets and templates for creating content.
22+
* **GitHub:** Star our [repositories](https://github.com/RequestNetwork) and join the discussions.
23+
24+
### 3. Your First Tasks
25+
* Complete your onboarding profile.
26+
* Read the [Technical Documentation](https://docs.request.network).
27+
* Say hello to the team in the private advocate channel.
28+
29+
## Reward Program
30+
31+
Advocates are rewarded in **REQ tokens** based on their monthly contributions.
32+
33+
### Point Categories
34+
1. **Developer Support & Documentation:** GitHub PRs, tutorials, Discord support.
35+
2. **Content & Awareness:** Blog posts, X threads, videos, memes.
36+
3. **Community Engagement & Growth:** AMAs, moderation, onboarding new developers.
37+
38+
### Reward Tiers
39+
* **I'm around (5-9 points):** Share in 10% of the monthly REQ pool.
40+
* **I'm active (10-14 points):** Share in 40% of the monthly REQ pool.
41+
* **I'm a champ (15+ points):** Share in 50% of the monthly REQ pool.
42+
43+
*Total Monthly Pool: $1,200 USD worth of REQ.*
44+
45+
## Support
46+
47+
If you have any questions, reach out to the program managers in Discord or via email at advocates@request.network.
48+
49+
Let's build the future of payments together!
50+

0 commit comments

Comments
 (0)