uvd-x402-sdk 2.96.0 → 2.98.0

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.
Files changed (71) hide show
  1. package/README.md +38 -13
  2. package/dist/adapters/index.js +2 -1
  3. package/dist/adapters/index.js.map +1 -1
  4. package/dist/adapters/index.mjs +2 -1
  5. package/dist/adapters/index.mjs.map +1 -1
  6. package/dist/backend/index.d.mts +2 -2
  7. package/dist/backend/index.d.ts +2 -2
  8. package/dist/backend/index.js +283 -34
  9. package/dist/backend/index.js.map +1 -1
  10. package/dist/backend/index.mjs +273 -35
  11. package/dist/backend/index.mjs.map +1 -1
  12. package/dist/{index-DRDWlAcU.d.ts → index--bevvYU9.d.ts} +1 -1
  13. package/dist/{index-CtxLKroV.d.mts → index-B2i1mGpW.d.mts} +1 -1
  14. package/dist/{index-AGj6ViCS.d.ts → index-BUlo1dYN.d.ts} +233 -25
  15. package/dist/{index-DMSZJyZ9.d.mts → index-Dy7eJ6hX.d.mts} +233 -25
  16. package/dist/index.d.mts +3 -3
  17. package/dist/index.d.ts +3 -3
  18. package/dist/index.js +262 -32
  19. package/dist/index.js.map +1 -1
  20. package/dist/index.mjs +252 -33
  21. package/dist/index.mjs.map +1 -1
  22. package/dist/providers/algorand/index.js +2 -1
  23. package/dist/providers/algorand/index.js.map +1 -1
  24. package/dist/providers/algorand/index.mjs +2 -1
  25. package/dist/providers/algorand/index.mjs.map +1 -1
  26. package/dist/providers/evm/index.js +2 -1
  27. package/dist/providers/evm/index.js.map +1 -1
  28. package/dist/providers/evm/index.mjs +2 -1
  29. package/dist/providers/evm/index.mjs.map +1 -1
  30. package/dist/providers/near/index.js +2 -1
  31. package/dist/providers/near/index.js.map +1 -1
  32. package/dist/providers/near/index.mjs +2 -1
  33. package/dist/providers/near/index.mjs.map +1 -1
  34. package/dist/providers/solana/index.js +2 -1
  35. package/dist/providers/solana/index.js.map +1 -1
  36. package/dist/providers/solana/index.mjs +2 -1
  37. package/dist/providers/solana/index.mjs.map +1 -1
  38. package/dist/providers/stellar/index.js +2 -1
  39. package/dist/providers/stellar/index.js.map +1 -1
  40. package/dist/providers/stellar/index.mjs +2 -1
  41. package/dist/providers/stellar/index.mjs.map +1 -1
  42. package/dist/providers/sui/index.js +2 -1
  43. package/dist/providers/sui/index.js.map +1 -1
  44. package/dist/providers/sui/index.mjs +2 -1
  45. package/dist/providers/sui/index.mjs.map +1 -1
  46. package/dist/providers/xrpl/index.js +2 -1
  47. package/dist/providers/xrpl/index.js.map +1 -1
  48. package/dist/providers/xrpl/index.mjs +2 -1
  49. package/dist/providers/xrpl/index.mjs.map +1 -1
  50. package/dist/react/index.d.mts +2 -2
  51. package/dist/react/index.d.ts +2 -2
  52. package/dist/react/index.js +2 -1
  53. package/dist/react/index.js.map +1 -1
  54. package/dist/react/index.mjs +2 -1
  55. package/dist/react/index.mjs.map +1 -1
  56. package/dist/react/picker/index.js +2 -1
  57. package/dist/react/picker/index.js.map +1 -1
  58. package/dist/react/picker/index.mjs +2 -1
  59. package/dist/react/picker/index.mjs.map +1 -1
  60. package/dist/{receipts-CwaG8BpU.d.ts → receipts-Co6C9FPO.d.ts} +13 -1
  61. package/dist/{receipts-sEYlpK10.d.mts → receipts-D0zg-8uK.d.mts} +13 -1
  62. package/dist/utils/index.js +2 -1
  63. package/dist/utils/index.js.map +1 -1
  64. package/dist/utils/index.mjs +2 -1
  65. package/dist/utils/index.mjs.map +1 -1
  66. package/package.json +1 -1
  67. package/src/backend/facilitator-error.ts +87 -2
  68. package/src/backend/index.ts +445 -54
  69. package/src/chains/index.ts +2 -1
  70. package/src/index.ts +16 -0
  71. package/src/receipts.ts +28 -0
package/README.md CHANGED
@@ -4,7 +4,7 @@ Gasless crypto payments across 29 blockchain networks using the x402 protocol.
4
4
 
5
5
  Users sign a message or transaction, and the Ultravioleta facilitator handles on-chain settlement. No gas fees for users.
6
6
 
7
- **New in v2.94.0**: EURC on Arc mainnet and testnet, six-decimal euro amounts and token-specific signatures. Gas remains USDC. Contract metadata and offline tests verified; funded EURC payments pending. [Arc EURC guide](docs/networks/arc.md#eurc-prices-in-euros).
7
+ **New in v2.94.0**: EURC on Arc mainnet and testnet, six-decimal euro amounts and token-specific signatures. Gas remains USDC. Funded EURC payments confirmed on Arc mainnet (x402 v1 and v2, 2026-09-22); Arc testnet funded acceptance pending. [Arc EURC guide](docs/networks/arc.md#eurc-prices-in-euros).
8
8
 
9
9
  **New in v2.95.0**: Hedera mainnet and testnet accept native USDC payments only, with offline signing and buyer/merchant helpers. HBAR funds sponsor network fees and is rejected as payment. [Hedera guide](docs/networks/hedera.md). Arc USDC/EURC remains supported on mainnet and testnet.
10
10
 
@@ -19,7 +19,7 @@ Users sign a message or transaction, and the Ultravioleta facilitator handles on
19
19
  - **React & Wagmi**: First-class integrations
20
20
  - **Signing Wallet Adapters**: EnvKeyAdapter (server/CLI), OWSWalletAdapter (Open Wallet Standard), or bring your own
21
21
  - **ERC-8128 Signed Requests**: Authenticate HTTP requests with a wallet (RFC 9421 + EIP-191) — no API keys
22
- - **ERC-8004 Trustless Agents**: On-chain reputation and identity across 21 networks (19 EVM + 2 Solana)
22
+ - **ERC-8004 Trustless Agents**: On-chain reputation and identity across 23 networks (21 EVM + 2 Solana)
23
23
  - **Escrow & Refunds**: Hold payments with dispute resolution
24
24
  - **Advanced Escrow**: Full escrow lifecycle (authorize, release, refund, charge) with SigningWalletAdapter support
25
25
  - **Escrow Pre-Auth**: Sign-on-assignment `X-Payment-Auth` builder (`buildEscrowPreAuth`) — vector-pinned parity with the Python SDK and Execution Market
@@ -746,10 +746,10 @@ const header = svm.encodePaymentHeader(payload, chainConfig);
746
746
  | SKALE Base Sepolia | 324705682 | USDC.e |
747
747
  | Robinhood Chain | 4663 | USDG |
748
748
  | Robinhood Chain Testnet | 46630 | USDG |
749
- | Arc | 5042 | USDC |
750
- | Arc Testnet | 5042002 | USDC |
749
+ | Arc | 5042 | USDC, EURC |
750
+ | Arc Testnet | 5042002 | USDC, EURC |
751
751
 
752
- > **Arc mainnet and testnet:** payment amounts use 6 decimals and the `USDC` / `2` domain. Native gas uses 18 decimals on the same balance. Use `arc` / `eip155:5042` for mainnet and `arc-testnet` / `eip155:5042002` for testnet. See [Arc usage and validation](docs/networks/arc.md).
752
+ > **Arc mainnet and testnet:** payment amounts use 6 decimals. USDC signs with the `USDC` / `2` domain; EURC (`0xbEf5…21c1` mainnet, `0x89B5…D72a` testnet) signs with `EURC` / `2` and its amounts are **euros**, not dollars (`tokenType: 'eurc'`, `usdPegged: false`). Native gas uses 18 decimals on the same balance. Use `arc` / `eip155:5042` for mainnet and `arc-testnet` / `eip155:5042002` for testnet. See [Arc usage and validation](docs/networks/arc.md).
753
753
 
754
754
  > **Robinhood Chain / USDG:** Robinhood Chain has no USDC — the settlement stablecoin is Paxos **USDG** (Global Dollar, 6 decimals, EIP-3009). Its on-chain `version()` getter reverts, so the EIP-712 domain `{ name: "Global Dollar", version: "1" }` can never be resolved on-chain. The SDK carries this domain in the chain config; when constructing `PaymentRequirements` yourself, send it in `extra`: `{ "name": "Global Dollar", "version": "1" }`. Use `tokenType: 'usdg'` (or the default, which resolves to USDG on these networks).
755
755
 
@@ -1194,7 +1194,9 @@ The same reading applies to `Erc8004LookupError` (`POST /register` goes through
1194
1194
  the same EVM path, so a mint can come back unconfirmed too) and to every gasless
1195
1195
  escrow call. An explicit `retryable: false` in a facilitator body always wins
1196
1196
  over the status — but only ever **downgrades**: a body claiming `retryable: true`
1197
- on a `402` will not make this SDK resend a genuinely refused credential.
1197
+ on a `402` will not make this SDK resend a genuinely refused credential. The one
1198
+ exception is named, not read from a flag: `409 authorization_in_flight` is
1199
+ `retryable` (see [Portable facilitator receipts](#portable-facilitator-receipts)).
1198
1200
 
1199
1201
  Three independent signals stop a retry, because the cost of missing one is a
1200
1202
  second payment: the explicit `retryable: false`, the named
@@ -1216,18 +1218,30 @@ An unconfirmed settlement is the one 5xx that goes out as **`500`, with no
1216
1218
  be mining. The body carries `transaction`, `paymentId` and `retryable: false`, so
1217
1219
  the buyer's client can reconcile instead of paying again.
1218
1220
 
1221
+ An X-PAYMENT the facilitator already admitted for another request is answered
1222
+ **`409`** (`authorization_already_settled`, `receipt_request_conflict`: it was
1223
+ used, the handler does not run) or **`503` + `Retry-After`** while it is
1224
+ `authorization_in_flight` — never `402` and never `500`. Both middlewares add
1225
+ `PAYMENT-RESPONSE` to an existing `Access-Control-Expose-Headers` and `no-store`
1226
+ to an existing `Cache-Control` instead of replacing them, and in `'manual'` mode
1227
+ a `settle()` after the handler already answered no longer touches the sent
1228
+ response.
1229
+
1219
1230
  ## ERC-8004 Trustless Agents
1220
1231
 
1221
- Build verifiable on-chain reputation for AI agents and services. Supports **21 networks** (19 EVM + 2 Solana).
1232
+ Build verifiable on-chain reputation for AI agents and services. Supports **23 networks** (21 EVM + 2 Solana).
1222
1233
 
1223
1234
  > Name Base as `'base'`. The old `'base-mainnet'` spelling is rejected by the facilitator
1224
1235
  > (`400 Invalid network`); the SDK now rewrites it for you, but new code should use `'base'`.
1225
1236
 
1226
1237
  On EVM networks, agent IDs are sequential numbers. On Solana, agent IDs are base58 pubkey strings. The `AgentId` type (`number | string`) handles both.
1227
1238
 
1228
- ### EVM Networks (18)
1239
+ ### EVM Networks (21)
1240
+
1241
+ ethereum, base, polygon, arbitrum, optimism, celo, bsc, monad, avalanche, scroll, skale-base, arc, ethereum-sepolia, base-sepolia, polygon-amoy, arbitrum-sepolia, optimism-sepolia, celo-sepolia, avalanche-fuji, skale-base-sepolia, arc-testnet
1229
1242
 
1230
- ethereum, base-mainnet, polygon, arbitrum, optimism, celo, bsc, monad, avalanche, skale-base, ethereum-sepolia, base-sepolia, polygon-amoy, arbitrum-sepolia, optimism-sepolia, celo-sepolia, avalanche-fuji, skale-base-sepolia
1243
+ Arc (`arc`, `arc-testnet`) since 2.98.0, with the canonical registries on both; see
1244
+ [ERC-8004 on Arc](docs/networks/arc.md#erc-8004-on-arc-2980).
1231
1245
 
1232
1246
  ### Solana Networks (2)
1233
1247
 
@@ -1345,14 +1359,16 @@ Pass the **same** feedback parameters, `deadline` and `nonce` back to
1345
1359
  registry calldata from them and refuses to relay anything the rater's signature
1346
1360
  does not cover.
1347
1361
 
1348
- Available on the nine networks in `RELAYED_FEEDBACK_NETWORKS` -- the eight
1362
+ Available on the ten networks in `RELAYED_FEEDBACK_NETWORKS` -- the nine
1349
1363
  mainnets with a deployed `FeedbackDelegate` (base, ethereum, polygon, arbitrum,
1350
- optimism, celo, bsc, monad) plus base-sepolia. **Avalanche is not one of them
1364
+ optimism, celo, bsc, monad, arc) plus base-sepolia. **Avalanche is not one of them
1351
1365
  and is not waiting to become one**: its C-Chain rejects the transaction type
1352
1366
  itself (`-32000 transaction type not supported`), so anchor the rating on a
1353
1367
  chain that supports EIP-7702 -- the payment stays where it was made.
1368
+ `arc-testnet` serves ERC-8004 reads but not this rail: no delegate is deployed
1369
+ there, and `prepare` answers 400.
1354
1370
 
1355
- Requires facilitator v1.93.0+ for the mainnets; base-sepolia since v1.74.0.
1371
+ Requires facilitator v1.93.0+ for the mainnets (2.38.0+ for arc); base-sepolia since v1.74.0.
1356
1372
 
1357
1373
  ### The same thing on Solana, without a delegate
1358
1374
 
@@ -1986,4 +2002,13 @@ facilitator receipts: network, asset, atomic amount, payTo, request hash,
1986
2002
  settlement ID, status and refusal reason. Persist purchase context before sending
1987
2003
  the authorization and reuse it after uncertainty. Payment confirmation does not
1988
2004
  prove merchant delivery. See [the receipt guide](docs/facilitator-receipts.md).
1989
- Live EURC acceptance remains pending.
2005
+
2006
+ Every `/verify` and `/settle` carries an `Idempotency-Key`, the same one for both
2007
+ calls of a payment and for their retries: `verifyAndSettle` and both middlewares
2008
+ create one per payment, and `verify`/`settle` accept `{ idempotencyKey }`
2009
+ (`createIdempotencyKey()`). The facilitator returns an admitted payment's original
2010
+ answer (`SettleResponse.replayed`, from `Idempotent-Replayed: true`) only to that
2011
+ key or to the buyer's `X-UVD-Purchase`; a resend without them is
2012
+ `authorization_already_settled`, `authorization_in_flight` or
2013
+ `receipt_request_conflict`, and the SDK never serves it again.
2014
+ Funded EURC payments settled on Arc mainnet (x402 v1/v2, 2026-09-22); Arc testnet funded acceptance is pending.
@@ -683,7 +683,8 @@ var SUPPORTED_CHAINS = {
683
683
  // Pinned by src/arc-testnet.test.ts.
684
684
  //
685
685
  // Mainnet (5042) and testnet (5042002) were verified independently against
686
- // their official RPCs on 2026-09-16. EURC domains checked on 2026-09-17; live payments pending.
686
+ // their official RPCs on 2026-09-16. EURC domains checked on 2026-09-17; funded EURC payments settled on Arc mainnet on
687
+ // 2026-09-22 (x402 v1/v2, docs/networks/arc.md); testnet pending.
687
688
  arc: {
688
689
  chainId: 5042,
689
690
  chainIdHex: "0x13b2",