diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md index 6524b9d..8318dfb 100644 --- a/docs/SUMMARY.md +++ b/docs/SUMMARY.md @@ -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) diff --git a/docs/advanced/request-network-sdk/get-started/quickstart-node.js.md b/docs/advanced/request-network-sdk/get-started/quickstart-node.js.md index a1ed903..7b5f667 100644 --- a/docs/advanced/request-network-sdk/get-started/quickstart-node.js.md +++ b/docs/advanced/request-network-sdk/get-started/quickstart-node.js.md @@ -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 @@ -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: @@ -171,7 +188,31 @@ const payerWallet = new Wallet( {% endtab %} {% tab title="viem" %} -Coming soon. Probably involves `publicClientToProvider()` and `walletClientToSigner()`. +```javascript +const { createPublicClient, createWalletClient, http } = require("viem"); +const { mainnet } = require("viem/chains"); +const { privateKeyToAccount } = require("viem/accounts"); +const { providers } = require("ethers"); + +const publicClient = createPublicClient({ + chain: mainnet, + transport: http(process.env.JSON_RPC_PROVIDER_URL), +}); + +const account = privateKeyToAccount(process.env.PAYER_PRIVATE_KEY); +const walletClient = createWalletClient({ + account, + chain: mainnet, + transport: http(process.env.JSON_RPC_PROVIDER_URL), +}); + +// Convert viem WalletClient to ethers v5 Signer +const provider = new providers.Web3Provider(walletClient.transport, { + chainId: mainnet.id, + name: mainnet.name, +}); +const signer = provider.getSigner(account.address); +``` {% endtab %} {% endtabs %} diff --git a/docs/advanced/request-network-sdk/sdk-guides/request-client/updating-a-request.md b/docs/advanced/request-network-sdk/sdk-guides/request-client/updating-a-request.md index fb0aa83..8327216 100644 --- a/docs/advanced/request-network-sdk/sdk-guides/request-client/updating-a-request.md +++ b/docs/advanced/request-network-sdk/sdk-guides/request-client/updating-a-request.md @@ -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. -
NameDescriptionRole Authorized
acceptaccept a request, indicating that it will be paidpayer
cancelcancel a requestpayee, payer
reduceExpectedAmountreduce the expected amountpayee
increaseExpectedAmountincrease the expected amountpayer
addStakeholdersgrant 1 or more third parties access to view an encrypted requestpayee, payer, third party
+## 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(); +``` diff --git a/docs/faq.md b/docs/faq.md index df523f7..28db250 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -151,6 +151,14 @@ Yes. See:
+How can I contribute to the Request Network as an advocate? + +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! + +
+ +
+ Does Request Network support private payments? Yes. See [hinkal-private-payments.md](advanced/request-network-sdk/sdk-guides/payment/hinkal-private-payments.md "mention") diff --git a/docs/general/advocates-welcome-kit.md b/docs/general/advocates-welcome-kit.md new file mode 100644 index 0000000..54bf032 --- /dev/null +++ b/docs/general/advocates-welcome-kit.md @@ -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! +