@bankofai/x402-cli 1.0.1-beta.2 → 1.0.1-beta.4
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 -14
- package/dist/cli.js +4 -4
- package/dist/gateway/tokens.js +11 -5
- package/dist/tokens.js +11 -5
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
TypeScript command-line client for BankofAI x402 payments. This version uses
|
|
4
4
|
the npm TypeScript SDK packages only:
|
|
5
5
|
|
|
6
|
-
- `@bankofai/x402-core@1.0.1-beta.
|
|
7
|
-
- `@bankofai/x402-evm@1.0.1-beta.
|
|
8
|
-
- `@bankofai/x402-tron@1.0.1-beta.
|
|
6
|
+
- `@bankofai/x402-core@1.0.1-beta.4`
|
|
7
|
+
- `@bankofai/x402-evm@1.0.1-beta.4`
|
|
8
|
+
- `@bankofai/x402-tron@1.0.1-beta.4`
|
|
9
9
|
|
|
10
10
|
Stablecoin payments support `scheme=exact` and TRON `scheme=exact_gasfree`.
|
|
11
11
|
The GasFree flow lets the relayer pay network energy while deducting its fee
|
|
@@ -21,7 +21,7 @@ npm run build
|
|
|
21
21
|
Run from source during development:
|
|
22
22
|
|
|
23
23
|
```bash
|
|
24
|
-
npm run dev -- serve --pay-to <recipient> --amount 0.0001 --network tron:
|
|
24
|
+
npm run dev -- serve --pay-to <recipient> --amount 0.0001 --network tron:0xcd8690dc --token USDT
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
Run the compiled CLI:
|
|
@@ -52,7 +52,7 @@ Start a local x402 paywall endpoint:
|
|
|
52
52
|
node dist/cli.js serve \
|
|
53
53
|
--pay-to <recipient> \
|
|
54
54
|
--amount 0.0001 \
|
|
55
|
-
--network tron:
|
|
55
|
+
--network tron:0xcd8690dc \
|
|
56
56
|
--token USDT \
|
|
57
57
|
--port 4020
|
|
58
58
|
```
|
|
@@ -71,7 +71,7 @@ Pay an x402-protected URL:
|
|
|
71
71
|
```bash
|
|
72
72
|
TRON_PRIVATE_KEY=<hex> \
|
|
73
73
|
node dist/cli.js pay http://127.0.0.1:4020/pay \
|
|
74
|
-
--network tron:
|
|
74
|
+
--network tron:0xcd8690dc \
|
|
75
75
|
--token USDT
|
|
76
76
|
```
|
|
77
77
|
|
|
@@ -81,7 +81,7 @@ the server challenge):
|
|
|
81
81
|
```bash
|
|
82
82
|
TRON_PRIVATE_KEY=<hex> \
|
|
83
83
|
node dist/cli.js pay https://api.example.com/pay \
|
|
84
|
-
--network tron:
|
|
84
|
+
--network tron:0xcd8690dc \
|
|
85
85
|
--token USDT \
|
|
86
86
|
--scheme exact_gasfree
|
|
87
87
|
```
|
|
@@ -100,7 +100,7 @@ TRON_PRIVATE_KEY=<hex> \
|
|
|
100
100
|
node dist/cli.js roundtrip \
|
|
101
101
|
--pay-to <recipient> \
|
|
102
102
|
--amount 0.0001 \
|
|
103
|
-
--network tron:
|
|
103
|
+
--network tron:0xcd8690dc \
|
|
104
104
|
--token USDT
|
|
105
105
|
```
|
|
106
106
|
|
|
@@ -108,16 +108,16 @@ node dist/cli.js roundtrip \
|
|
|
108
108
|
|
|
109
109
|
Supported built-in token registry:
|
|
110
110
|
|
|
111
|
-
- `tron:
|
|
112
|
-
- `tron:
|
|
113
|
-
- `tron:
|
|
111
|
+
- `tron:0x2b6653dc` USDT, USDD
|
|
112
|
+
- `tron:0xcd8690dc` USDT, USDD
|
|
113
|
+
- `tron:0x94a9059e` USDT
|
|
114
114
|
- `eip155:56` USDT
|
|
115
115
|
- `eip155:97` USDT, USDC
|
|
116
116
|
|
|
117
|
-
|
|
117
|
+
Non-CAIP TRON aliases are rejected. Use the canonical TRON IDs above.
|
|
118
|
+
|
|
119
|
+
EVM convenience aliases accepted:
|
|
118
120
|
|
|
119
|
-
- `tron-mainnet` -> `tron:mainnet`
|
|
120
|
-
- `tron-nile` -> `tron:nile`
|
|
121
121
|
- `bsc-mainnet` -> `eip155:56`
|
|
122
122
|
- `bsc-testnet` -> `eip155:97`
|
|
123
123
|
|
package/dist/cli.js
CHANGED
|
@@ -335,7 +335,7 @@ Options:
|
|
|
335
335
|
--pay-to <address> Recipient wallet address
|
|
336
336
|
--amount <amount> Human-readable token amount (default: 0.0001)
|
|
337
337
|
--raw-amount <amount> Smallest-unit amount
|
|
338
|
-
--network <caip2> Payment network (default: tron:
|
|
338
|
+
--network <caip2> Payment network (default: tron:0xcd8690dc)
|
|
339
339
|
--scheme <scheme> Payment scheme: exact or exact_gasfree (default: exact)
|
|
340
340
|
--token <symbol> Token symbol (default: USDT)
|
|
341
341
|
--asset <address> Explicit token address
|
|
@@ -349,7 +349,7 @@ Options:
|
|
|
349
349
|
--json Print JSON envelope
|
|
350
350
|
|
|
351
351
|
Examples:
|
|
352
|
-
x402-cli serve --pay-to T... --network tron:
|
|
352
|
+
x402-cli serve --pay-to T... --network tron:0xcd8690dc --token USDT
|
|
353
353
|
x402-cli serve --pay-to 0x... --network eip155:97 --token USDT --amount 0.0001
|
|
354
354
|
`,
|
|
355
355
|
roundtrip: `Usage:
|
|
@@ -968,7 +968,7 @@ async function catalogExportGateway(gatewayUrl, options) {
|
|
|
968
968
|
emit({ command: "catalog export-gateway", mode: outputMode(options), result: { provider: providerFqn, catalog: catalogPath, payMd: payMdPath } });
|
|
969
969
|
}
|
|
970
970
|
function buildRequirement(options) {
|
|
971
|
-
const network = normalizeNetwork(opt(options, "network", "tron:
|
|
971
|
+
const network = normalizeNetwork(opt(options, "network", "tron:0xcd8690dc"));
|
|
972
972
|
const scheme = opt(options, "scheme", "exact");
|
|
973
973
|
if (!["exact", "exact_gasfree"].includes(scheme))
|
|
974
974
|
throw new Error(`unsupported scheme ${scheme}`);
|
|
@@ -1372,7 +1372,7 @@ routing:
|
|
|
1372
1372
|
type: proxy
|
|
1373
1373
|
|
|
1374
1374
|
operator:
|
|
1375
|
-
network: tron
|
|
1375
|
+
network: tron:0xcd8690dc
|
|
1376
1376
|
currencies:
|
|
1377
1377
|
usd: ["USDT"]
|
|
1378
1378
|
recipient: <provider-recipient-address>
|
package/dist/gateway/tokens.js
CHANGED
|
@@ -16,19 +16,25 @@ export const TOKENS = {
|
|
|
16
16
|
},
|
|
17
17
|
};
|
|
18
18
|
export function normalizeNetwork(network) {
|
|
19
|
-
|
|
19
|
+
const legacyTronIds = {
|
|
20
20
|
"tron-mainnet": "tron:0x2b6653dc",
|
|
21
21
|
"tron:mainnet": "tron:0x2b6653dc",
|
|
22
|
-
|
|
22
|
+
mainnet: "tron:0x2b6653dc",
|
|
23
23
|
"tron-shasta": "tron:0x94a9059e",
|
|
24
24
|
"tron:shasta": "tron:0x94a9059e",
|
|
25
|
-
|
|
25
|
+
shasta: "tron:0x94a9059e",
|
|
26
26
|
"tron-nile": "tron:0xcd8690dc",
|
|
27
27
|
"tron:nile": "tron:0xcd8690dc",
|
|
28
|
-
|
|
28
|
+
nile: "tron:0xcd8690dc",
|
|
29
|
+
};
|
|
30
|
+
const canonical = legacyTronIds[network];
|
|
31
|
+
if (canonical) {
|
|
32
|
+
throw new Error(`legacy TRON network identifier ${network} is not supported; use ${canonical}`);
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
29
35
|
"bsc-mainnet": "eip155:56",
|
|
30
36
|
"bsc-testnet": "eip155:97",
|
|
31
|
-
}[network] ?? network
|
|
37
|
+
}[network] ?? network;
|
|
32
38
|
}
|
|
33
39
|
export function getToken(network, symbol) {
|
|
34
40
|
const normalized = normalizeNetwork(network);
|
package/dist/tokens.js
CHANGED
|
@@ -74,19 +74,25 @@ export const TOKENS = {
|
|
|
74
74
|
},
|
|
75
75
|
};
|
|
76
76
|
export function normalizeNetwork(network) {
|
|
77
|
-
|
|
77
|
+
const legacyTronIds = {
|
|
78
78
|
"tron-mainnet": "tron:0x2b6653dc",
|
|
79
79
|
"tron:mainnet": "tron:0x2b6653dc",
|
|
80
|
-
|
|
80
|
+
mainnet: "tron:0x2b6653dc",
|
|
81
81
|
"tron-shasta": "tron:0x94a9059e",
|
|
82
82
|
"tron:shasta": "tron:0x94a9059e",
|
|
83
|
-
|
|
83
|
+
shasta: "tron:0x94a9059e",
|
|
84
84
|
"tron-nile": "tron:0xcd8690dc",
|
|
85
85
|
"tron:nile": "tron:0xcd8690dc",
|
|
86
|
-
|
|
86
|
+
nile: "tron:0xcd8690dc",
|
|
87
|
+
};
|
|
88
|
+
const canonical = legacyTronIds[network];
|
|
89
|
+
if (canonical) {
|
|
90
|
+
throw new Error(`legacy TRON network identifier ${network} is not supported; use ${canonical}`);
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
87
93
|
"bsc-mainnet": "eip155:56",
|
|
88
94
|
"bsc-testnet": "eip155:97",
|
|
89
|
-
}[network] ?? network
|
|
95
|
+
}[network] ?? network;
|
|
90
96
|
}
|
|
91
97
|
export function getToken(network, symbol) {
|
|
92
98
|
const token = TOKENS[normalizeNetwork(network)]?.[symbol.toUpperCase()];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bankofai/x402-cli",
|
|
3
|
-
"version": "1.0.1-beta.
|
|
3
|
+
"version": "1.0.1-beta.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@bankofai/x402-core": "1.0.1-beta.4",
|
|
24
24
|
"@bankofai/x402-evm": "1.0.1-beta.4",
|
|
25
|
-
"@bankofai/x402-gateway": "1.0.1-beta.
|
|
25
|
+
"@bankofai/x402-gateway": "1.0.1-beta.4",
|
|
26
26
|
"@bankofai/x402-tron": "1.0.1-beta.4",
|
|
27
27
|
"tronweb": "6.4.0",
|
|
28
28
|
"viem": "^2.55.0",
|