@bankofai/x402-gateway 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 CHANGED
@@ -66,7 +66,7 @@ curl http://127.0.0.1:4020/__402/health
66
66
  Paid provider path:
67
67
 
68
68
  ```bash
69
- curl -i http://127.0.0.1:4020/providers/tron-nile-usdt/v1/ping
69
+ curl -i http://127.0.0.1:4020/providers/example-price-tron/v1/ping
70
70
  ```
71
71
 
72
72
  If the endpoint has metering, the gateway returns `402 Payment Required` with a
@@ -118,7 +118,7 @@ deliberately public test deployment, set `X402_GATEWAY_ADMIN_ALLOW_PUBLIC=true`.
118
118
  Provider files stay in YAML:
119
119
 
120
120
  ```yaml
121
- name: tron-nile-usdt
121
+ name: example-price-tron
122
122
  forward_url: ${X402_PROVIDER_FORWARD_URL}
123
123
 
124
124
  routing:
@@ -129,7 +129,7 @@ routing:
129
129
  value_from_env: X402_PROVIDER_API_TOKEN
130
130
 
131
131
  operator:
132
- network: tron-nile
132
+ network: tron:0xcd8690dc
133
133
  currencies:
134
134
  usd: ["USDT"]
135
135
  recipient: ${X402_PROVIDER_RECIPIENT_TRON}
@@ -149,16 +149,17 @@ endpoints:
149
149
  - price_usd: 0.002
150
150
  ```
151
151
 
152
- `@bankofai/x402-*` 1.0.1-beta.2 uses `scheme: exact` with
152
+ `@bankofai/x402-*` 1.0.1-beta.4 uses `scheme: exact` with
153
153
  `extra.assetTransferMethod: permit2`, or TRON `scheme: exact_gasfree`. Older
154
154
  provider configs that say `exact_permit` are normalized to `exact`. For GasFree,
155
155
  set both `scheme` and `protocol` to `exact_gasfree`; the facilitator must support
156
156
  GasFree for the selected TRON network and token.
157
157
 
158
- Network aliases accepted:
158
+ Non-CAIP TRON aliases are rejected. Provider files must use canonical TRON
159
+ CAIP-2 IDs.
160
+
161
+ EVM convenience aliases accepted:
159
162
 
160
- - `tron-mainnet` -> `tron:mainnet`
161
- - `tron-nile` -> `tron:nile`
162
163
  - `bsc-mainnet` -> `eip155:56`
163
164
  - `bsc-testnet` -> `eip155:97`
164
165
 
package/dist/tokens.js CHANGED
@@ -16,19 +16,25 @@ export const TOKENS = {
16
16
  },
17
17
  };
18
18
  export function normalizeNetwork(network) {
19
- return ({
19
+ const legacyTronIds = {
20
20
  "tron-mainnet": "tron:0x2b6653dc",
21
21
  "tron:mainnet": "tron:0x2b6653dc",
22
- "mainnet": "tron:0x2b6653dc",
22
+ mainnet: "tron:0x2b6653dc",
23
23
  "tron-shasta": "tron:0x94a9059e",
24
24
  "tron:shasta": "tron:0x94a9059e",
25
- "shasta": "tron:0x94a9059e",
25
+ shasta: "tron:0x94a9059e",
26
26
  "tron-nile": "tron:0xcd8690dc",
27
27
  "tron:nile": "tron:0xcd8690dc",
28
- "nile": "tron:0xcd8690dc",
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);
@@ -1,4 +1,4 @@
1
- name: tron-nile-usdt
1
+ name: example-price-tron
2
2
  title: "TRON Nile USDT Provider"
3
3
  description: "TRON Nile provider protected by x402 exact Permit2 USDT payment"
4
4
  category: data
@@ -8,8 +8,8 @@ forward_url: ${X402_PROVIDER_FORWARD_URL}
8
8
  openapi_url: ${X402_PROVIDER_OPENAPI_URL}
9
9
 
10
10
  display:
11
- service_url: ${X402_GATEWAY_PUBLIC_BASE_URL}/providers/tron-nile-usdt
12
- tags: ["tron-nile", "usdt", "x402"]
11
+ service_url: ${X402_GATEWAY_PUBLIC_BASE_URL}/providers/example-price-tron
12
+ tags: ["nile", "usdt", "x402"]
13
13
 
14
14
  discovery:
15
15
  use_case: "Use for validating TRON Nile USDT x402 payments."
@@ -18,7 +18,7 @@ discovery:
18
18
  when_to_use:
19
19
  - "Use when testing x402 exact Permit2 payments on TRON Nile."
20
20
  request_examples:
21
- - "GET /providers/tron-nile-usdt/v1/ping"
21
+ - "GET /providers/example-price-tron/v1/ping"
22
22
 
23
23
  routing:
24
24
  type: proxy
@@ -29,7 +29,7 @@ routing:
29
29
  value_from_env: X402_PROVIDER_API_TOKEN
30
30
 
31
31
  operator:
32
- network: tron-nile
32
+ network: tron:0xcd8690dc
33
33
  currencies:
34
34
  usd: ["USDT"]
35
35
  recipient: ${X402_PROVIDER_RECIPIENT_TRON}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bankofai/x402-gateway",
3
- "version": "1.0.1-beta.2",
3
+ "version": "1.0.1-beta.4",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "files": [