Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

## General

* [Advocates Welcome Kit](general/advocates-welcome-kit.md)
* [Lifecycle of a Request](general/lifecycle-of-a-request.md)
* [Request Scan](general/request-scan.md)
* [Supported Chains](general/supported-chains/README.md)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This approach works well for Node.js environments _without_ access to a Web3 wal
You will learn:

* How to create a request
* How to update a request (coming soon...)
* How to update a request
* How to pay a request
* How to detect a payment
* How to retrieve a user’s requests
Expand Down Expand Up @@ -127,6 +127,23 @@ Altogether it looks like this:

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

## Update a request

After creating a request, you might need to update it (e.g., to cancel it or adjust the amount). Updates require a `signatureProvider`.

```javascript
const request = await requestClient.fromRequestId('YOUR_REQUEST_ID');

// Payer accepts the request
await request.accept({
type: Types.Identity.TYPE.ETHEREUM_ADDRESS,
value: payerAddress,
});
await request.waitForConfirmation();
```

See the [Updating a Request](../sdk-guides/request-client/updating-a-request.md) guide for more details.

## Pay a request / Detect a payment

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

{% tab title="viem" %}
Coming soon. Probably involves `publicClientToProvider()` and `walletClientToSigner()`.
In Node.js with a private key, use ethers v5 directly (see tab above).

The viem-to-ethers adapter patterns in the [Browser Quickstart](quickstart-browser.md) are designed for browser wallets with EIP-1193 interfaces. In Node.js, simply create an ethers `JsonRpcProvider` and `Wallet` from your RPC URL and private key.
{% endtab %}
{% endtabs %}

Expand Down
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: 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();
```
8 changes: 8 additions & 0 deletions docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,14 @@ Yes. See:

<details>

<summary>How can I contribute to the Request Network as an advocate?</summary>

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!

</details>

<details>

<summary>Does Request Network support private payments?</summary>

Yes. See [hinkal-private-payments.md](advanced/request-network-sdk/sdk-guides/payment/hinkal-private-payments.md "mention")
Expand Down
50 changes: 50 additions & 0 deletions docs/general/advocates-welcome-kit.md
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://request.network/discord) 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!