uvd-x402-sdk 2.96.0 → 2.97.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 +26 -6
  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 +262 -32
  9. package/dist/backend/index.js.map +1 -1
  10. package/dist/backend/index.mjs +252 -33
  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-DMSZJyZ9.d.mts → index-ClOAmprt.d.mts} +221 -21
  15. package/dist/{index-AGj6ViCS.d.ts → index-DNTFp6WT.d.ts} +221 -21
  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 +408 -45
  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
 
@@ -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,6 +1218,15 @@ 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
1232
  Build verifiable on-chain reputation for AI agents and services. Supports **21 networks** (19 EVM + 2 Solana).
@@ -1986,4 +1997,13 @@ facilitator receipts: network, asset, atomic amount, payTo, request hash,
1986
1997
  settlement ID, status and refusal reason. Persist purchase context before sending
1987
1998
  the authorization and reuse it after uncertainty. Payment confirmation does not
1988
1999
  prove merchant delivery. See [the receipt guide](docs/facilitator-receipts.md).
1989
- Live EURC acceptance remains pending.
2000
+
2001
+ Every `/verify` and `/settle` carries an `Idempotency-Key`, the same one for both
2002
+ calls of a payment and for their retries: `verifyAndSettle` and both middlewares
2003
+ create one per payment, and `verify`/`settle` accept `{ idempotencyKey }`
2004
+ (`createIdempotencyKey()`). The facilitator returns an admitted payment's original
2005
+ answer (`SettleResponse.replayed`, from `Idempotent-Replayed: true`) only to that
2006
+ key or to the buyer's `X-UVD-Purchase`; a resend without them is
2007
+ `authorization_already_settled`, `authorization_in_flight` or
2008
+ `receipt_request_conflict`, and the SDK never serves it again.
2009
+ 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",