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.
- package/README.md +26 -6
- package/dist/adapters/index.js +2 -1
- package/dist/adapters/index.js.map +1 -1
- package/dist/adapters/index.mjs +2 -1
- package/dist/adapters/index.mjs.map +1 -1
- package/dist/backend/index.d.mts +2 -2
- package/dist/backend/index.d.ts +2 -2
- package/dist/backend/index.js +262 -32
- package/dist/backend/index.js.map +1 -1
- package/dist/backend/index.mjs +252 -33
- package/dist/backend/index.mjs.map +1 -1
- package/dist/{index-DRDWlAcU.d.ts → index--bevvYU9.d.ts} +1 -1
- package/dist/{index-CtxLKroV.d.mts → index-B2i1mGpW.d.mts} +1 -1
- package/dist/{index-DMSZJyZ9.d.mts → index-ClOAmprt.d.mts} +221 -21
- package/dist/{index-AGj6ViCS.d.ts → index-DNTFp6WT.d.ts} +221 -21
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +262 -32
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +252 -33
- package/dist/index.mjs.map +1 -1
- package/dist/providers/algorand/index.js +2 -1
- package/dist/providers/algorand/index.js.map +1 -1
- package/dist/providers/algorand/index.mjs +2 -1
- package/dist/providers/algorand/index.mjs.map +1 -1
- package/dist/providers/evm/index.js +2 -1
- package/dist/providers/evm/index.js.map +1 -1
- package/dist/providers/evm/index.mjs +2 -1
- package/dist/providers/evm/index.mjs.map +1 -1
- package/dist/providers/near/index.js +2 -1
- package/dist/providers/near/index.js.map +1 -1
- package/dist/providers/near/index.mjs +2 -1
- package/dist/providers/near/index.mjs.map +1 -1
- package/dist/providers/solana/index.js +2 -1
- package/dist/providers/solana/index.js.map +1 -1
- package/dist/providers/solana/index.mjs +2 -1
- package/dist/providers/solana/index.mjs.map +1 -1
- package/dist/providers/stellar/index.js +2 -1
- package/dist/providers/stellar/index.js.map +1 -1
- package/dist/providers/stellar/index.mjs +2 -1
- package/dist/providers/stellar/index.mjs.map +1 -1
- package/dist/providers/sui/index.js +2 -1
- package/dist/providers/sui/index.js.map +1 -1
- package/dist/providers/sui/index.mjs +2 -1
- package/dist/providers/sui/index.mjs.map +1 -1
- package/dist/providers/xrpl/index.js +2 -1
- package/dist/providers/xrpl/index.js.map +1 -1
- package/dist/providers/xrpl/index.mjs +2 -1
- package/dist/providers/xrpl/index.mjs.map +1 -1
- package/dist/react/index.d.mts +2 -2
- package/dist/react/index.d.ts +2 -2
- package/dist/react/index.js +2 -1
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +2 -1
- package/dist/react/index.mjs.map +1 -1
- package/dist/react/picker/index.js +2 -1
- package/dist/react/picker/index.js.map +1 -1
- package/dist/react/picker/index.mjs +2 -1
- package/dist/react/picker/index.mjs.map +1 -1
- package/dist/{receipts-CwaG8BpU.d.ts → receipts-Co6C9FPO.d.ts} +13 -1
- package/dist/{receipts-sEYlpK10.d.mts → receipts-D0zg-8uK.d.mts} +13 -1
- package/dist/utils/index.js +2 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +2 -1
- package/dist/utils/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/backend/facilitator-error.ts +87 -2
- package/src/backend/index.ts +408 -45
- package/src/chains/index.ts +2 -1
- package/src/index.ts +16 -0
- 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.
|
|
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
|
|
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
|
-
|
|
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.
|
package/dist/adapters/index.js
CHANGED
|
@@ -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;
|
|
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",
|