qorbitpay-sdk 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -4
- package/package.json +2 -2
- package/src/config.js +1 -1
- package/src/index.js +4 -1
package/README.md
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
# qorbitpay-sdk
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/qorbitpay-sdk)
|
|
4
|
+
[](./LICENSE)
|
|
5
|
+
|
|
6
|
+
Payments SDK for autonomous AI agents on [Qorbitpay](https://qorbitpay.xyz), running on Arc
|
|
4
7
|
(Circle's L1 testnet, chainId `5042002`, native gas token USDC).
|
|
5
8
|
|
|
9
|
+
- **Website:** [qorbitpay.xyz](https://qorbitpay.xyz)
|
|
10
|
+
- **npm:** [npmjs.com/package/qorbitpay-sdk](https://www.npmjs.com/package/qorbitpay-sdk)
|
|
11
|
+
- **GitHub:** [github.com/davieslennox0/Qorbit](https://github.com/davieslennox0/Qorbit)
|
|
12
|
+
- **Explorer:** [testnet.arcscan.app](https://testnet.arcscan.app)
|
|
13
|
+
- **Faucet:** [faucet.circle.com](https://faucet.circle.com) (select Arc Testnet)
|
|
14
|
+
|
|
6
15
|
```bash
|
|
7
16
|
npm install qorbitpay-sdk
|
|
8
17
|
```
|
|
@@ -46,15 +55,16 @@ pass `apiUrl` pointing at a Qorbitpay backend deployment to use them.
|
|
|
46
55
|
| option | required | default | description |
|
|
47
56
|
|---|---|---|---|
|
|
48
57
|
| `privateKey` | yes | - | your agent's wallet private key |
|
|
49
|
-
| `rpcUrl` | no | Arc testnet RPC |
|
|
58
|
+
| `rpcUrl` | no | `https://rpc.testnet.arc.network` | Arc testnet RPC |
|
|
50
59
|
| `chainId` | no | `5042002` | |
|
|
51
60
|
| `routerAddress` | no | deployed QorbitpayRouter | |
|
|
52
61
|
| `registryAddress` | no | deployed QorbitpayRegistry | |
|
|
53
62
|
| `apiUrl` | no | `null` | base URL of a Qorbitpay backend, required for `checkFraud`/`findRoute` |
|
|
54
63
|
|
|
55
64
|
### `await q.pay({ to, amount, memo })`
|
|
56
|
-
Sends `amount`
|
|
57
|
-
(
|
|
65
|
+
Sends `amount` USDC to `to`. A `0.001 USDC` platform fee is automatically added on top
|
|
66
|
+
(the router deducts it; `to` receives exactly `amount`). `memo` is hashed (keccak256)
|
|
67
|
+
on-chain. Returns `{ txHash, status, blockNumber, explorerUrl, ... }`.
|
|
58
68
|
|
|
59
69
|
### `q.receive({ onPayment })`
|
|
60
70
|
Subscribes to incoming `PaymentSent` events addressed to your agent. Returns an
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qorbitpay-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "SDK for autonomous AI agents to send and receive payments on Qorbitpay (Arc testnet)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"homepage": "https://qorbitpay.xyz",
|
|
31
31
|
"repository": {
|
|
32
32
|
"type": "git",
|
|
33
|
-
"url": "https://github.com/davieslennox0/Qorbit.git",
|
|
33
|
+
"url": "git+https://github.com/davieslennox0/Qorbit.git",
|
|
34
34
|
"directory": "sdk"
|
|
35
35
|
},
|
|
36
36
|
"bugs": {
|
package/src/config.js
CHANGED
|
@@ -3,7 +3,7 @@ export const DEFAULT_NETWORK = {
|
|
|
3
3
|
rpcUrl: 'https://rpc.testnet.arc.network',
|
|
4
4
|
chainId: 5042002,
|
|
5
5
|
explorer: 'https://testnet.arcscan.app',
|
|
6
|
-
routerAddress: '
|
|
6
|
+
routerAddress: '0x529D65da046EFA1240093F15cF7B6AfeaA64CFb6',
|
|
7
7
|
registryAddress: '0x3fbCdaD38f40d932A5574562BB72B9115c265093',
|
|
8
8
|
verifierAddress: '0xca8FbCFb990A77B130939Ec5E0B98e4324fE0c79',
|
|
9
9
|
billingAddress: '0xdF87E0c0cfcA0AEa1e899073c36F29Fd865B5e97',
|
package/src/index.js
CHANGED
|
@@ -58,7 +58,10 @@ class Qorbitpay {
|
|
|
58
58
|
if (!amount || Number(amount) <= 0) throw new Error('pay() requires a positive `amount`');
|
|
59
59
|
|
|
60
60
|
const memoHash = memo ? ethers.keccak256(ethers.toUtf8Bytes(memo)) : ethers.ZeroHash;
|
|
61
|
-
|
|
61
|
+
// Router deducts 0.001 USDC platformFee and forwards the remainder to `to`.
|
|
62
|
+
// msg.value must be amount + fee so the recipient gets exactly `amount`.
|
|
63
|
+
const PLATFORM_FEE = ethers.parseEther('0.001');
|
|
64
|
+
const value = ethers.parseEther(String(amount)) + PLATFORM_FEE;
|
|
62
65
|
|
|
63
66
|
const tx = await this._withNonceLock((nonce) => this.router.pay(to, memoHash, { value, nonce }));
|
|
64
67
|
const receipt = await tx.wait();
|