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.
- package/README.md +38 -13
- 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 +283 -34
- package/dist/backend/index.js.map +1 -1
- package/dist/backend/index.mjs +273 -35
- 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-AGj6ViCS.d.ts → index-BUlo1dYN.d.ts} +233 -25
- package/dist/{index-DMSZJyZ9.d.mts → index-Dy7eJ6hX.d.mts} +233 -25
- 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 +445 -54
- 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
|
|
|
@@ -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
|
|
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
|
|
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 **
|
|
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 (
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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.
|
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",
|