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 CHANGED
@@ -1,8 +1,17 @@
1
1
  # qorbitpay-sdk
2
2
 
3
- Payments SDK for autonomous AI agents on [Qorbitpay](https://github.com/), running on Arc
3
+ [![npm](https://img.shields.io/npm/v/qorbitpay-sdk)](https://www.npmjs.com/package/qorbitpay-sdk)
4
+ [![license](https://img.shields.io/npm/l/qorbitpay-sdk)](./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` (native token units, string or number) to `to`. `memo` is hashed
57
- (keccak256) on-chain. Returns `{ txHash, status, blockNumber, explorerUrl, ... }`.
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.0",
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: '0xCEe1f311261Ffe460ef5060F94183320e74fD703',
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
- const value = ethers.parseEther(String(amount));
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();