@piprail/sdk 2.10.0 → 2.12.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/CHANGELOG.md CHANGED
@@ -4,6 +4,46 @@ All notable changes to `@piprail/sdk` are documented here. The format
4
4
  follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the
5
5
  versions follow [Semantic Versioning](https://semver.org/).
6
6
 
7
+ ## [2.12.0] — 2026-06-21 — BNB: the `U` (United Stables) token + Binance `permit2-exact` interop
8
+
9
+ BNB Chain max-out — full token parity with Binance's own x402 set, plus tolerance for Binance's
10
+ Permit2 dialect. Additive; no default changes, every other chain/rail byte-identical to 2.11.0.
11
+
12
+ - **feat(bnb): add `U` (United Stables) as a built-in BNB token.** `0xcE24439F2D9C6a2289F741120FE202248B666666`
13
+ (18dp) — the **first-listed token in Binance's own x402 set** (U/USD1/USDT/USDC) and the BNB Agent
14
+ Survival Pack settlement unit. Native **EIP-3009** (domain name `"United Stables"`, version `"1"`
15
+ derived from `DOMAIN_SEPARATOR`, no `version()`), so it routes onto the existing gasless
16
+ `transferWithAuthorization` rail with **no new protocol code** — like FDUSD/USD1. On-chain-verified,
17
+ and **live-proven on BNB mainnet**: a keyless facilitator (Pieverse) sponsored the gas — buyer AND
18
+ merchant paid **zero BNB** (settle tx `0x2b3b8c51ae81df441551301c44a64652c84c796af3b9d03ec58ea38f1cb013d5`).
19
+ Dexter + Pieverse both accept `U`; self-settle gasless also works. Grouped as `USD` for budget policy.
20
+ - **feat(x402): the buyer tolerates the `permit2-exact` `assetTransferMethod` label.** Binance's x402
21
+ facilitator ("b402") labels its EVM-Permit2 exact rail `permit2-exact` (the coinbase/x402 spec uses
22
+ bare `permit2`). PipRail still **emits** `permit2`; the buyer now treats `permit2-exact` as the same
23
+ Permit2 rail, so it can pay a Binance-issued 402. The gate/seller side already discriminates on
24
+ payload shape, so it was unaffected. Additive — no existing `permit2`/`eip3009` rail changes.
25
+
26
+ ## [2.11.0] — 2026-06-21 — A2A interop hardening: spec-correct merchant status + verified x402-V2 conformance
27
+
28
+ A2A transport correctness, after a **live cross-check against Google's official `x402` / `x402_a2a`
29
+ libraries** (reproducible harness + verdict in `examples/a2a-interop/`). One behavior fix on the A2A rejection path;
30
+ HTTP and every other rail are byte-identical to 2.10.0.
31
+
32
+ - **fix(a2a): a rejected proof now re-challenges as `payment-required`, not the client-only
33
+ `payment-rejected`.** Per the A2A x402 spec §5.1 and Google's reference merchant executor, a MERCHANT
34
+ emits only `payment-required` / `payment-completed` / `payment-failed`; `payment-rejected` and
35
+ `payment-submitted` are CLIENT→merchant statuses. A rejection is now signalled by the appended failure
36
+ receipt + the `x402.payment.error` code — the retry loop and the `input-required` state are unchanged.
37
+ - **interop: PipRail's A2A envelopes are byte-conformant with the current x402 V2 standard.** The
38
+ canonical `x402` lib parses our `PaymentRequired` + `PaymentPayload` (CAIP-2 networks, `amount`,
39
+ `x402Version: 2`, nested `accepted`); the five `x402.payment.*` keys + the extension URI match
40
+ `x402_a2a` verbatim. The deferred emit-version question is resolved — **v2** (the live standard; the
41
+ legacy v0.1 `x402-a2a` package is bitrotted and not targeted). New always-on guard:
42
+ `test/transports/a2a-wire-conformance.test.ts`; reproducible cross-check harness: `examples/a2a-interop/`.
43
+ - **docs(a2a):** the A2A guide is now fully runnable — a real `@a2a-js/sdk` `AgentExecutor` mount, a
44
+ complete AgentCard, where the buyer's payload comes from, and the co-resident one-gate pattern.
45
+ - No public API change. A2A remains seller-side (the `A2APayer` buyer + AP2 mandate carriage stay deferred).
46
+
7
47
  ## [2.10.0] — 2026-06-20 — x402 parity: verifiable receipts · the `upto` metered rail · A2A transport
8
48
 
9
49
  Four ratified-x402 capabilities, all **additive and opt-in** — omit the new options and the 402, the
@@ -1589,6 +1629,10 @@ straight into your wallet. The API is small and self-contained.
1589
1629
  to your wallet; PipRail never holds funds.
1590
1630
  - `viem ^2.21` is a peer dependency. Node 20+ or a modern browser.
1591
1631
 
1632
+ [2.12.0]: https://www.npmjs.com/package/@piprail/sdk
1633
+ [2.11.0]: https://www.npmjs.com/package/@piprail/sdk
1634
+ [2.10.0]: https://www.npmjs.com/package/@piprail/sdk
1635
+ [2.9.0]: https://www.npmjs.com/package/@piprail/sdk
1592
1636
  [2.8.0]: https://www.npmjs.com/package/@piprail/sdk
1593
1637
  [2.7.0]: https://www.npmjs.com/package/@piprail/sdk
1594
1638
  [2.6.0]: https://www.npmjs.com/package/@piprail/sdk
package/dist/index.cjs CHANGED
@@ -149,11 +149,15 @@ var CHAINS = {
149
149
  // Binance-Peg (NOT EIP-3009) → the `exact` rail uses Permit2.
150
150
  USDC: { address: "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d", decimals: 18, symbol: "USDC" },
151
151
  USDT: { address: "0x55d398326f99059fF775485246999027B3197955", decimals: 18, symbol: "USDT" },
152
- // FDUSD + USD1 ARE EIP-3009 (transferWithAuthorization) → the `exact` rail uses the gasless,
153
- // no-Permit2-approve path. Both hardcode EIP-712 domain version "1" (no version() — the SDK
154
- // derives it from DOMAIN_SEPARATOR). Verified on-chain (symbol/decimals/domain match).
152
+ // FDUSD, USD1 + U ARE EIP-3009 (transferWithAuthorization) → the `exact` rail uses the gasless,
153
+ // no-Permit2-approve path. All three hardcode EIP-712 domain version "1" (no version() — the
154
+ // SDK derives it from DOMAIN_SEPARATOR). Verified on-chain (symbol/decimals/domain match).
155
155
  FDUSD: { address: "0xc5f0f7b66764F6ec8C8Dff7BA683102295E16409", decimals: 18, symbol: "FDUSD" },
156
- USD1: { address: "0x8d0D000Ee44948FC98c9B98A4FA4921476f08B0d", decimals: 18, symbol: "USD1" }
156
+ USD1: { address: "0x8d0D000Ee44948FC98c9B98A4FA4921476f08B0d", decimals: 18, symbol: "USD1" },
157
+ // U (United Stables) — the first-listed token in Binance's own x402 set (U/USD1/USDT/USDC) and
158
+ // the BNB Agent Survival Pack settlement unit. EIP-3009 (domain name "United Stables",
159
+ // version "1" derived from DOMAIN_SEPARATOR 0x358738…1679b6). On-chain-verified 2026-06-21.
160
+ U: { address: "0xcE24439F2D9C6a2289F741120FE202248B666666", decimals: 18, symbol: "U" }
157
161
  }
158
162
  },
159
163
  avalanche: {
@@ -2118,7 +2122,8 @@ function makeEvmNetwork(resolved) {
2118
2122
  async estimateCost(accept) {
2119
2123
  const { decimals, symbol } = resolved.chain.nativeCurrency;
2120
2124
  if (accept.scheme === "exact") {
2121
- const permit2 = accept.extra.assetTransferMethod === "permit2";
2125
+ const m = accept.extra.assetTransferMethod;
2126
+ const permit2 = m === "permit2" || m === "permit2-exact";
2122
2127
  return _chunkMWBT7MCEcjs.nativeCost.call(void 0, {
2123
2128
  symbol,
2124
2129
  decimals,
@@ -2198,10 +2203,12 @@ function makeEvmNetwork(resolved) {
2198
2203
  // `assetTransferMethod`: `permit2` (any ERC-20 — e.g. Binance-Peg USDC on BNB, signs a
2199
2204
  // Permit2 witness transfer + lazily does the one-time approval) or `eip3009` (re-derives
2200
2205
  // the token's EIP-712 domain on-chain + signs transferWithAuthorization). Never broadcasts.
2206
+ // `permit2-exact` is Binance b402's foreign-dialect alias for `permit2` — treated identically.
2201
2207
  // Throws UnsupportedSchemeError for a contract signer (or a non-EIP-3009 token on the eip3009 path).
2202
2208
  async payExact(wallet, accept) {
2203
2209
  const a = wallet._native;
2204
- if (accept.extra.assetTransferMethod === "permit2") {
2210
+ const method = accept.extra.assetTransferMethod;
2211
+ if (method === "permit2" || method === "permit2-exact") {
2205
2212
  const { payload: payload2, payerFrom: payerFrom2, nonce: nonce2 } = await payPermit2Evm({
2206
2213
  publicClient,
2207
2214
  walletClient: a.walletClient,
@@ -3070,6 +3077,8 @@ var BUILTIN_DENOMS = {
3070
3077
  USDT: "USD",
3071
3078
  USD1: "USD",
3072
3079
  FDUSD: "USD",
3080
+ U: "USD",
3081
+ // United Stables — BNB EIP-3009 stablecoin (1:1 USDC/USDT/USD1-backed)
3073
3082
  RLUSD: "USD",
3074
3083
  EURC: "EUR"
3075
3084
  };
@@ -6332,25 +6341,25 @@ var KNOWN_FACILITATORS = {
6332
6341
  note: "Pieverse \u2014 keyless, sponsors gas (Monad USDC EIP-3009). LIVE-settled on Monad 2026-06-17 (tx 0x00cfeb93876e5ef57dcb002510038b7304913233ca286d7ab33c72a8b119eb0d)."
6333
6342
  }
6334
6343
  ],
6335
- // BNB Chain (eip155:56). Dexter keyless-settles the EVM EIP-3009 exact rail — but ONLY for BNB's
6336
- // EIP-3009 tokens (FDUSD / USD1); BNB's USDC/USDT are Binance-Peg (Permit2), which no facilitator
6344
+ // BNB Chain (eip155:56). Dexter + Pieverse keyless-settle the EVM EIP-3009 exact rail for BNB's
6345
+ // EIP-3009 tokens (FDUSD / USD1 / U); BNB's USDC/USDT are Binance-Peg (Permit2), which no facilitator
6337
6346
  // settles. Dexter also enforces a ~$0.003 dynamic settlement floor on BNB, so a sub-$0.003 payment
6338
6347
  // is rejected (amount_too_low) — fine for real prices, but the floor is real. LIVE-settled with
6339
- // FDUSD, buyer paid zero BNB — this beats the BNB token-overlap wall that blocked AEON/Pieverse.
6348
+ // FDUSD + U, buyer paid zero BNB — this beats the BNB token-overlap wall that blocked AEON/Pieverse.
6340
6349
  "eip155:56": [
6341
6350
  {
6342
6351
  url: "https://x402.dexter.cash",
6343
6352
  keyless: true,
6344
6353
  schemes: ["exact"],
6345
6354
  settles: ["eip3009"],
6346
- note: "Dexter \u2014 keyless, gas-sponsored. BNB EIP-3009 tokens FDUSD/USD1 ONLY (Binance-Peg USDC/USDT are Permit2 \u2192 not facilitator-settleable); ~$0.003 dynamic floor. LIVE-settled on BNB 2026-06-17 with FDUSD (tx 0x6d9eb4e4939f3f3c74cb19424cc7822d66ec8ed5c5c7c330d9f88a5f9ad59e9e)."
6355
+ note: "Dexter \u2014 keyless, gas-sponsored. BNB EIP-3009 tokens FDUSD/USD1/U (Binance-Peg USDC/USDT are Permit2 \u2192 not facilitator-settleable); ~$0.003 dynamic floor. LIVE-settled on BNB 2026-06-17 with FDUSD (tx 0x6d9eb4e4939f3f3c74cb19424cc7822d66ec8ed5c5c7c330d9f88a5f9ad59e9e); accepts U (verify confirmed 2026-06-21)."
6347
6356
  },
6348
6357
  {
6349
6358
  url: "https://facilitator.pieverse.io",
6350
6359
  keyless: true,
6351
6360
  schemes: ["exact"],
6352
6361
  settles: ["eip3009"],
6353
- note: "Pieverse \u2014 keyless, sponsors gas. BNB EIP-3009 tokens FDUSD/USD1 (same Binance-Peg caveat as Dexter). LIVE-settled on BNB 2026-06-17 with FDUSD (tx 0xb9c76affc45bd07a51559efd813ca71516fc30625478724476c2cf42fc2203d3) \u2014 a 2nd keyless BNB facilitator (failover for Dexter)."
6362
+ note: "Pieverse \u2014 keyless, sponsors gas. BNB EIP-3009 tokens FDUSD/USD1/U (same Binance-Peg caveat as Dexter). LIVE-settled on BNB with FDUSD 2026-06-17 (tx 0xb9c76affc45bd07a51559efd813ca71516fc30625478724476c2cf42fc2203d3) AND with the U / United Stables token 2026-06-21 (tx 0x2b3b8c51ae81df441551301c44a64652c84c796af3b9d03ec58ea38f1cb013d5, buyer 0 BNB) \u2014 a 2nd keyless BNB facilitator (failover for Dexter)."
6354
6363
  }
6355
6364
  ],
6356
6365
  // HyperEVM (eip155:999). Ultravioleta DAO keyless-settles the EVM EIP-3009 exact rail (HyperEVM's
@@ -7586,7 +7595,7 @@ function createA2APaymentHandler(options) {
7586
7595
  const network = _nullishCoalesce(attempted, () => ( singleNetworkOf(result.challenge)));
7587
7596
  const receipts = appendReceiptFailed(taskId, result.error, result.detail, network);
7588
7597
  const metadata = {
7589
- [A2A_STATUS_KEY]: "payment-rejected",
7598
+ [A2A_STATUS_KEY]: "payment-required",
7590
7599
  [A2A_ERROR_KEY]: toA2AErrorCode(result.error),
7591
7600
  [A2A_REQUIRED_KEY]: result.challenge,
7592
7601
  ...toA2APaymentReceipts(receipts)
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as Caip2, X as X402AcceptEntry, x as X402AnyAccept, z as X402ExactAcceptEntry, d as ExactPaymentPayloadAny, p as SignedReceipt, w as VerifyResult, G as X402UptoAcceptEntry, n as Permit2UptoPaymentPayload, v as SpendSummary, y as X402Challenge, D as X402Receipt, S as SettleOutcome, u as SpendStore, s as SpendLedger, t as SpendRecord, o as PipRailReceipt, V as VerifyErrorCode, a as AssetId, A as AddressId, P as PaidReceipt } from './ledger-OQos-tmj.cjs';
2
- export { E as EXT_OFFER_RECEIPT, b as ExactAuthorizationWire, c as ExactPaymentPayload, H as HEADER_REQUIRED, e as HEADER_RESPONSE, f as HEADER_RESPONSE_V1, g as HEADER_SIGNATURE, h as HEADER_SIGNATURE_V1, i as ParsedExactPayment, j as ParsedUptoPayment, k as Permit2Authorization, l as Permit2PaymentPayload, m as Permit2UptoAuthorization, q as SpendAssetTotal, r as SpendDenomTotal, B as X402PaymentSignature, F as X402ResourceObject, I as buildChallengeHeader, J as buildExactSignatureHeader, K as buildReceiptExtension, L as buildReceiptHeader, M as buildSignatureHeader, N as buildUptoSignatureHeader, O as decodeBase64Json, Q as memorySpendStore, R as parseChallenge, T as parseExactObject, U as parseExactPaymentHeader, W as parseReceipt, Y as parseReceiptExtension, Z as parseSettleResponse, _ as parseSignatureHeader, $ as parseSignatureObject, a0 as parseUptoObject, a1 as parseUptoPaymentHeader, a2 as pickAccept } from './ledger-OQos-tmj.cjs';
1
+ import { C as Caip2, X as X402AcceptEntry, x as X402AnyAccept, z as X402ExactAcceptEntry, d as ExactPaymentPayloadAny, p as SignedReceipt, w as VerifyResult, G as X402UptoAcceptEntry, n as Permit2UptoPaymentPayload, v as SpendSummary, y as X402Challenge, D as X402Receipt, S as SettleOutcome, u as SpendStore, s as SpendLedger, t as SpendRecord, o as PipRailReceipt, V as VerifyErrorCode, a as AssetId, A as AddressId, P as PaidReceipt } from './ledger-mF_SoiDB.cjs';
2
+ export { E as EXT_OFFER_RECEIPT, b as ExactAuthorizationWire, c as ExactPaymentPayload, H as HEADER_REQUIRED, e as HEADER_RESPONSE, f as HEADER_RESPONSE_V1, g as HEADER_SIGNATURE, h as HEADER_SIGNATURE_V1, i as ParsedExactPayment, j as ParsedUptoPayment, k as Permit2Authorization, l as Permit2PaymentPayload, m as Permit2UptoAuthorization, q as SpendAssetTotal, r as SpendDenomTotal, B as X402PaymentSignature, F as X402ResourceObject, I as buildChallengeHeader, J as buildExactSignatureHeader, K as buildReceiptExtension, L as buildReceiptHeader, M as buildSignatureHeader, N as buildUptoSignatureHeader, O as decodeBase64Json, Q as memorySpendStore, R as parseChallenge, T as parseExactObject, U as parseExactPaymentHeader, W as parseReceipt, Y as parseReceiptExtension, Z as parseSettleResponse, _ as parseSignatureHeader, $ as parseSignatureObject, a0 as parseUptoObject, a1 as parseUptoPaymentHeader, a2 as pickAccept } from './ledger-mF_SoiDB.cjs';
3
3
  import * as viem_zksync from 'viem/zksync';
4
4
  import * as abitype from 'abitype';
5
5
  import * as viem_chains from 'viem/chains';
@@ -740,9 +740,7 @@ declare const CHAINS: {
740
740
  } | {
741
741
  blockHash: `0x${string}` | null;
742
742
  blockNumber: bigint | null;
743
- blockTimestamp
744
- /** EVM chain id, e.g. 5000 for Mantle. */
745
- ? /** EVM chain id, e.g. 5000 for Mantle. */: bigint | undefined;
743
+ blockTimestamp?: bigint | undefined;
746
744
  from: abitype.Address;
747
745
  gas: bigint;
748
746
  hash: viem.Hash;
@@ -986,6 +984,11 @@ declare const CHAINS: {
986
984
  decimals: number;
987
985
  symbol: string;
988
986
  };
987
+ U: {
988
+ address: "0xcE24439F2D9C6a2289F741120FE202248B666666";
989
+ decimals: number;
990
+ symbol: string;
991
+ };
989
992
  };
990
993
  };
991
994
  avalanche: {
@@ -2454,9 +2457,7 @@ declare const CHAINS: {
2454
2457
  chainId: number;
2455
2458
  type: "eip7702";
2456
2459
  gasPrice?: undefined | undefined;
2457
- maxFeePerBlobGas
2458
- /** JSON-RPC endpoint. */
2459
- ? /** JSON-RPC endpoint. */: undefined | undefined;
2460
+ maxFeePerBlobGas?: undefined | undefined;
2460
2461
  maxFeePerGas: bigint;
2461
2462
  maxPriorityFeePerGas: bigint;
2462
2463
  l1BatchNumber: bigint | null;
@@ -3293,7 +3294,15 @@ declare const CHAINS: {
3293
3294
  maxPriorityFeePerGas: bigint;
3294
3295
  isSystemTx?: undefined | undefined;
3295
3296
  mint?: undefined | undefined;
3296
- sourceHash?: undefined | undefined;
3297
+ sourceHash
3298
+ /**
3299
+ * Normalise a `ChainInput` (+ optional rpc override) into the
3300
+ * `{ chain, chainId, rpcUrl, tokens }` the wallet and verifier need.
3301
+ */
3302
+ ? /**
3303
+ * Normalise a `ChainInput` (+ optional rpc override) into the
3304
+ * `{ chain, chainId, rpcUrl, tokens }` the wallet and verifier need.
3305
+ */: undefined | undefined;
3297
3306
  } | {
3298
3307
  blockHash: `0x${string}` | null;
3299
3308
  blockNumber: bigint | null;
@@ -7964,15 +7973,21 @@ interface A2ATaskRecord {
7964
7973
  * • B7 — `receipts[]` is the UNION `(X402Receipt | SettleOutcome)[]` (it carries FAILED
7965
7974
  * attempts); a fulfill-throws-AFTER-settle ends the Task `completed` with the successful
7966
7975
  * receipt + an error annotation (NEVER re-challenge / failed — the money already moved).
7967
- * • Emit strict `x402Version: 2` (the inbound object-cores absorb v1). The emit version is
7968
- * the deferred B8 live-interop ship-gate do NOT change it here.
7976
+ * • Emit `x402Version: 2` RESOLVED 2026-06-21: v2 IS the live x402 standard. A live cross-check
7977
+ * against Google's official libs (reproducible harness in `examples/a2a-interop/`) showed the canonical
7978
+ * `x402` lib (2.13.1, V2: `amount` / CAIP-2 / nested `accepted`) parses our PaymentRequired +
7979
+ * PaymentPayload byte-identically, while the legacy v0.1 `x402_a2a` package (x402Version 1,
7980
+ * `maxAmountRequired`, chain slugs) is bitrotted. Inbound v1 object-cores are absorbed for the
7981
+ * standard `exact` scheme; PipRail-native `onchain-proof` is always v2 (never sent v1-flat).
7982
+ * • Merchant statuses are spec-bounded: `payment-required` (incl. a retryable re-challenge of a
7983
+ * rejected proof) / `payment-completed` / `payment-failed`. `payment-rejected` + `payment-submitted`
7984
+ * are CLIENT→merchant statuses we never emit.
7969
7985
  *
7970
7986
  * ── DEFERRED (NOT built here — see the x402-parity/03-a2a-transport plan) ──────
7971
- * • Phase 4 — the A2A BUYER (`A2APayer`): trails on live interop.
7972
- * • Phase 5 — AP2 `CartMandate`/`PaymentMandate` carriage (payment-carriage only, no
7973
- * mandate-trust machinery).
7974
- * B8 ship-gate the live Google `adk-demo` reference-client run + the final v1-vs-v2
7975
- * emit-version decision (a live-runtime gate, not buildable offline).
7987
+ * • Phase 4 — the A2A BUYER (`A2APayer`): the HTTP buyer mints the payload that rides A2A today.
7988
+ * • Phase 5 — AP2 `CartMandate`/`PaymentMandate` carriage (the Embedded Flow; no mandate-trust machinery).
7989
+ * • B8 ship-gate — RESOLVED at the wire level (above). A live `adk-demo` AGENT run is blocked by that
7990
+ * package's dependency bitrot (won't import on current `x402`/`a2a-sdk`), not by PipRail.
7976
7991
  */
7977
7992
 
7978
7993
  /** The x402 A2A extension URI the x402-foundation doc + ALL Google reference code cite
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as Caip2, X as X402AcceptEntry, x as X402AnyAccept, z as X402ExactAcceptEntry, d as ExactPaymentPayloadAny, p as SignedReceipt, w as VerifyResult, G as X402UptoAcceptEntry, n as Permit2UptoPaymentPayload, v as SpendSummary, y as X402Challenge, D as X402Receipt, S as SettleOutcome, u as SpendStore, s as SpendLedger, t as SpendRecord, o as PipRailReceipt, V as VerifyErrorCode, a as AssetId, A as AddressId, P as PaidReceipt } from './ledger-OQos-tmj.js';
2
- export { E as EXT_OFFER_RECEIPT, b as ExactAuthorizationWire, c as ExactPaymentPayload, H as HEADER_REQUIRED, e as HEADER_RESPONSE, f as HEADER_RESPONSE_V1, g as HEADER_SIGNATURE, h as HEADER_SIGNATURE_V1, i as ParsedExactPayment, j as ParsedUptoPayment, k as Permit2Authorization, l as Permit2PaymentPayload, m as Permit2UptoAuthorization, q as SpendAssetTotal, r as SpendDenomTotal, B as X402PaymentSignature, F as X402ResourceObject, I as buildChallengeHeader, J as buildExactSignatureHeader, K as buildReceiptExtension, L as buildReceiptHeader, M as buildSignatureHeader, N as buildUptoSignatureHeader, O as decodeBase64Json, Q as memorySpendStore, R as parseChallenge, T as parseExactObject, U as parseExactPaymentHeader, W as parseReceipt, Y as parseReceiptExtension, Z as parseSettleResponse, _ as parseSignatureHeader, $ as parseSignatureObject, a0 as parseUptoObject, a1 as parseUptoPaymentHeader, a2 as pickAccept } from './ledger-OQos-tmj.js';
1
+ import { C as Caip2, X as X402AcceptEntry, x as X402AnyAccept, z as X402ExactAcceptEntry, d as ExactPaymentPayloadAny, p as SignedReceipt, w as VerifyResult, G as X402UptoAcceptEntry, n as Permit2UptoPaymentPayload, v as SpendSummary, y as X402Challenge, D as X402Receipt, S as SettleOutcome, u as SpendStore, s as SpendLedger, t as SpendRecord, o as PipRailReceipt, V as VerifyErrorCode, a as AssetId, A as AddressId, P as PaidReceipt } from './ledger-mF_SoiDB.js';
2
+ export { E as EXT_OFFER_RECEIPT, b as ExactAuthorizationWire, c as ExactPaymentPayload, H as HEADER_REQUIRED, e as HEADER_RESPONSE, f as HEADER_RESPONSE_V1, g as HEADER_SIGNATURE, h as HEADER_SIGNATURE_V1, i as ParsedExactPayment, j as ParsedUptoPayment, k as Permit2Authorization, l as Permit2PaymentPayload, m as Permit2UptoAuthorization, q as SpendAssetTotal, r as SpendDenomTotal, B as X402PaymentSignature, F as X402ResourceObject, I as buildChallengeHeader, J as buildExactSignatureHeader, K as buildReceiptExtension, L as buildReceiptHeader, M as buildSignatureHeader, N as buildUptoSignatureHeader, O as decodeBase64Json, Q as memorySpendStore, R as parseChallenge, T as parseExactObject, U as parseExactPaymentHeader, W as parseReceipt, Y as parseReceiptExtension, Z as parseSettleResponse, _ as parseSignatureHeader, $ as parseSignatureObject, a0 as parseUptoObject, a1 as parseUptoPaymentHeader, a2 as pickAccept } from './ledger-mF_SoiDB.js';
3
3
  import * as viem_zksync from 'viem/zksync';
4
4
  import * as abitype from 'abitype';
5
5
  import * as viem_chains from 'viem/chains';
@@ -740,9 +740,7 @@ declare const CHAINS: {
740
740
  } | {
741
741
  blockHash: `0x${string}` | null;
742
742
  blockNumber: bigint | null;
743
- blockTimestamp
744
- /** EVM chain id, e.g. 5000 for Mantle. */
745
- ? /** EVM chain id, e.g. 5000 for Mantle. */: bigint | undefined;
743
+ blockTimestamp?: bigint | undefined;
746
744
  from: abitype.Address;
747
745
  gas: bigint;
748
746
  hash: viem.Hash;
@@ -986,6 +984,11 @@ declare const CHAINS: {
986
984
  decimals: number;
987
985
  symbol: string;
988
986
  };
987
+ U: {
988
+ address: "0xcE24439F2D9C6a2289F741120FE202248B666666";
989
+ decimals: number;
990
+ symbol: string;
991
+ };
989
992
  };
990
993
  };
991
994
  avalanche: {
@@ -2454,9 +2457,7 @@ declare const CHAINS: {
2454
2457
  chainId: number;
2455
2458
  type: "eip7702";
2456
2459
  gasPrice?: undefined | undefined;
2457
- maxFeePerBlobGas
2458
- /** JSON-RPC endpoint. */
2459
- ? /** JSON-RPC endpoint. */: undefined | undefined;
2460
+ maxFeePerBlobGas?: undefined | undefined;
2460
2461
  maxFeePerGas: bigint;
2461
2462
  maxPriorityFeePerGas: bigint;
2462
2463
  l1BatchNumber: bigint | null;
@@ -3293,7 +3294,15 @@ declare const CHAINS: {
3293
3294
  maxPriorityFeePerGas: bigint;
3294
3295
  isSystemTx?: undefined | undefined;
3295
3296
  mint?: undefined | undefined;
3296
- sourceHash?: undefined | undefined;
3297
+ sourceHash
3298
+ /**
3299
+ * Normalise a `ChainInput` (+ optional rpc override) into the
3300
+ * `{ chain, chainId, rpcUrl, tokens }` the wallet and verifier need.
3301
+ */
3302
+ ? /**
3303
+ * Normalise a `ChainInput` (+ optional rpc override) into the
3304
+ * `{ chain, chainId, rpcUrl, tokens }` the wallet and verifier need.
3305
+ */: undefined | undefined;
3297
3306
  } | {
3298
3307
  blockHash: `0x${string}` | null;
3299
3308
  blockNumber: bigint | null;
@@ -7964,15 +7973,21 @@ interface A2ATaskRecord {
7964
7973
  * • B7 — `receipts[]` is the UNION `(X402Receipt | SettleOutcome)[]` (it carries FAILED
7965
7974
  * attempts); a fulfill-throws-AFTER-settle ends the Task `completed` with the successful
7966
7975
  * receipt + an error annotation (NEVER re-challenge / failed — the money already moved).
7967
- * • Emit strict `x402Version: 2` (the inbound object-cores absorb v1). The emit version is
7968
- * the deferred B8 live-interop ship-gate do NOT change it here.
7976
+ * • Emit `x402Version: 2` RESOLVED 2026-06-21: v2 IS the live x402 standard. A live cross-check
7977
+ * against Google's official libs (reproducible harness in `examples/a2a-interop/`) showed the canonical
7978
+ * `x402` lib (2.13.1, V2: `amount` / CAIP-2 / nested `accepted`) parses our PaymentRequired +
7979
+ * PaymentPayload byte-identically, while the legacy v0.1 `x402_a2a` package (x402Version 1,
7980
+ * `maxAmountRequired`, chain slugs) is bitrotted. Inbound v1 object-cores are absorbed for the
7981
+ * standard `exact` scheme; PipRail-native `onchain-proof` is always v2 (never sent v1-flat).
7982
+ * • Merchant statuses are spec-bounded: `payment-required` (incl. a retryable re-challenge of a
7983
+ * rejected proof) / `payment-completed` / `payment-failed`. `payment-rejected` + `payment-submitted`
7984
+ * are CLIENT→merchant statuses we never emit.
7969
7985
  *
7970
7986
  * ── DEFERRED (NOT built here — see the x402-parity/03-a2a-transport plan) ──────
7971
- * • Phase 4 — the A2A BUYER (`A2APayer`): trails on live interop.
7972
- * • Phase 5 — AP2 `CartMandate`/`PaymentMandate` carriage (payment-carriage only, no
7973
- * mandate-trust machinery).
7974
- * B8 ship-gate the live Google `adk-demo` reference-client run + the final v1-vs-v2
7975
- * emit-version decision (a live-runtime gate, not buildable offline).
7987
+ * • Phase 4 — the A2A BUYER (`A2APayer`): the HTTP buyer mints the payload that rides A2A today.
7988
+ * • Phase 5 — AP2 `CartMandate`/`PaymentMandate` carriage (the Embedded Flow; no mandate-trust machinery).
7989
+ * • B8 ship-gate — RESOLVED at the wire level (above). A live `adk-demo` AGENT run is blocked by that
7990
+ * package's dependency bitrot (won't import on current `x402`/`a2a-sdk`), not by PipRail.
7976
7991
  */
7977
7992
 
7978
7993
  /** The x402 A2A extension URI the x402-foundation doc + ALL Google reference code cite
package/dist/index.js CHANGED
@@ -149,11 +149,15 @@ var CHAINS = {
149
149
  // Binance-Peg (NOT EIP-3009) → the `exact` rail uses Permit2.
150
150
  USDC: { address: "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d", decimals: 18, symbol: "USDC" },
151
151
  USDT: { address: "0x55d398326f99059fF775485246999027B3197955", decimals: 18, symbol: "USDT" },
152
- // FDUSD + USD1 ARE EIP-3009 (transferWithAuthorization) → the `exact` rail uses the gasless,
153
- // no-Permit2-approve path. Both hardcode EIP-712 domain version "1" (no version() — the SDK
154
- // derives it from DOMAIN_SEPARATOR). Verified on-chain (symbol/decimals/domain match).
152
+ // FDUSD, USD1 + U ARE EIP-3009 (transferWithAuthorization) → the `exact` rail uses the gasless,
153
+ // no-Permit2-approve path. All three hardcode EIP-712 domain version "1" (no version() — the
154
+ // SDK derives it from DOMAIN_SEPARATOR). Verified on-chain (symbol/decimals/domain match).
155
155
  FDUSD: { address: "0xc5f0f7b66764F6ec8C8Dff7BA683102295E16409", decimals: 18, symbol: "FDUSD" },
156
- USD1: { address: "0x8d0D000Ee44948FC98c9B98A4FA4921476f08B0d", decimals: 18, symbol: "USD1" }
156
+ USD1: { address: "0x8d0D000Ee44948FC98c9B98A4FA4921476f08B0d", decimals: 18, symbol: "USD1" },
157
+ // U (United Stables) — the first-listed token in Binance's own x402 set (U/USD1/USDT/USDC) and
158
+ // the BNB Agent Survival Pack settlement unit. EIP-3009 (domain name "United Stables",
159
+ // version "1" derived from DOMAIN_SEPARATOR 0x358738…1679b6). On-chain-verified 2026-06-21.
160
+ U: { address: "0xcE24439F2D9C6a2289F741120FE202248B666666", decimals: 18, symbol: "U" }
157
161
  }
158
162
  },
159
163
  avalanche: {
@@ -2118,7 +2122,8 @@ function makeEvmNetwork(resolved) {
2118
2122
  async estimateCost(accept) {
2119
2123
  const { decimals, symbol } = resolved.chain.nativeCurrency;
2120
2124
  if (accept.scheme === "exact") {
2121
- const permit2 = accept.extra.assetTransferMethod === "permit2";
2125
+ const m = accept.extra.assetTransferMethod;
2126
+ const permit2 = m === "permit2" || m === "permit2-exact";
2122
2127
  return nativeCost({
2123
2128
  symbol,
2124
2129
  decimals,
@@ -2198,10 +2203,12 @@ function makeEvmNetwork(resolved) {
2198
2203
  // `assetTransferMethod`: `permit2` (any ERC-20 — e.g. Binance-Peg USDC on BNB, signs a
2199
2204
  // Permit2 witness transfer + lazily does the one-time approval) or `eip3009` (re-derives
2200
2205
  // the token's EIP-712 domain on-chain + signs transferWithAuthorization). Never broadcasts.
2206
+ // `permit2-exact` is Binance b402's foreign-dialect alias for `permit2` — treated identically.
2201
2207
  // Throws UnsupportedSchemeError for a contract signer (or a non-EIP-3009 token on the eip3009 path).
2202
2208
  async payExact(wallet, accept) {
2203
2209
  const a = wallet._native;
2204
- if (accept.extra.assetTransferMethod === "permit2") {
2210
+ const method = accept.extra.assetTransferMethod;
2211
+ if (method === "permit2" || method === "permit2-exact") {
2205
2212
  const { payload: payload2, payerFrom: payerFrom2, nonce: nonce2 } = await payPermit2Evm({
2206
2213
  publicClient,
2207
2214
  walletClient: a.walletClient,
@@ -3070,6 +3077,8 @@ var BUILTIN_DENOMS = {
3070
3077
  USDT: "USD",
3071
3078
  USD1: "USD",
3072
3079
  FDUSD: "USD",
3080
+ U: "USD",
3081
+ // United Stables — BNB EIP-3009 stablecoin (1:1 USDC/USDT/USD1-backed)
3073
3082
  RLUSD: "USD",
3074
3083
  EURC: "EUR"
3075
3084
  };
@@ -6332,25 +6341,25 @@ var KNOWN_FACILITATORS = {
6332
6341
  note: "Pieverse \u2014 keyless, sponsors gas (Monad USDC EIP-3009). LIVE-settled on Monad 2026-06-17 (tx 0x00cfeb93876e5ef57dcb002510038b7304913233ca286d7ab33c72a8b119eb0d)."
6333
6342
  }
6334
6343
  ],
6335
- // BNB Chain (eip155:56). Dexter keyless-settles the EVM EIP-3009 exact rail — but ONLY for BNB's
6336
- // EIP-3009 tokens (FDUSD / USD1); BNB's USDC/USDT are Binance-Peg (Permit2), which no facilitator
6344
+ // BNB Chain (eip155:56). Dexter + Pieverse keyless-settle the EVM EIP-3009 exact rail for BNB's
6345
+ // EIP-3009 tokens (FDUSD / USD1 / U); BNB's USDC/USDT are Binance-Peg (Permit2), which no facilitator
6337
6346
  // settles. Dexter also enforces a ~$0.003 dynamic settlement floor on BNB, so a sub-$0.003 payment
6338
6347
  // is rejected (amount_too_low) — fine for real prices, but the floor is real. LIVE-settled with
6339
- // FDUSD, buyer paid zero BNB — this beats the BNB token-overlap wall that blocked AEON/Pieverse.
6348
+ // FDUSD + U, buyer paid zero BNB — this beats the BNB token-overlap wall that blocked AEON/Pieverse.
6340
6349
  "eip155:56": [
6341
6350
  {
6342
6351
  url: "https://x402.dexter.cash",
6343
6352
  keyless: true,
6344
6353
  schemes: ["exact"],
6345
6354
  settles: ["eip3009"],
6346
- note: "Dexter \u2014 keyless, gas-sponsored. BNB EIP-3009 tokens FDUSD/USD1 ONLY (Binance-Peg USDC/USDT are Permit2 \u2192 not facilitator-settleable); ~$0.003 dynamic floor. LIVE-settled on BNB 2026-06-17 with FDUSD (tx 0x6d9eb4e4939f3f3c74cb19424cc7822d66ec8ed5c5c7c330d9f88a5f9ad59e9e)."
6355
+ note: "Dexter \u2014 keyless, gas-sponsored. BNB EIP-3009 tokens FDUSD/USD1/U (Binance-Peg USDC/USDT are Permit2 \u2192 not facilitator-settleable); ~$0.003 dynamic floor. LIVE-settled on BNB 2026-06-17 with FDUSD (tx 0x6d9eb4e4939f3f3c74cb19424cc7822d66ec8ed5c5c7c330d9f88a5f9ad59e9e); accepts U (verify confirmed 2026-06-21)."
6347
6356
  },
6348
6357
  {
6349
6358
  url: "https://facilitator.pieverse.io",
6350
6359
  keyless: true,
6351
6360
  schemes: ["exact"],
6352
6361
  settles: ["eip3009"],
6353
- note: "Pieverse \u2014 keyless, sponsors gas. BNB EIP-3009 tokens FDUSD/USD1 (same Binance-Peg caveat as Dexter). LIVE-settled on BNB 2026-06-17 with FDUSD (tx 0xb9c76affc45bd07a51559efd813ca71516fc30625478724476c2cf42fc2203d3) \u2014 a 2nd keyless BNB facilitator (failover for Dexter)."
6362
+ note: "Pieverse \u2014 keyless, sponsors gas. BNB EIP-3009 tokens FDUSD/USD1/U (same Binance-Peg caveat as Dexter). LIVE-settled on BNB with FDUSD 2026-06-17 (tx 0xb9c76affc45bd07a51559efd813ca71516fc30625478724476c2cf42fc2203d3) AND with the U / United Stables token 2026-06-21 (tx 0x2b3b8c51ae81df441551301c44a64652c84c796af3b9d03ec58ea38f1cb013d5, buyer 0 BNB) \u2014 a 2nd keyless BNB facilitator (failover for Dexter)."
6354
6363
  }
6355
6364
  ],
6356
6365
  // HyperEVM (eip155:999). Ultravioleta DAO keyless-settles the EVM EIP-3009 exact rail (HyperEVM's
@@ -7586,7 +7595,7 @@ function createA2APaymentHandler(options) {
7586
7595
  const network = attempted ?? singleNetworkOf(result.challenge);
7587
7596
  const receipts = appendReceiptFailed(taskId, result.error, result.detail, network);
7588
7597
  const metadata = {
7589
- [A2A_STATUS_KEY]: "payment-rejected",
7598
+ [A2A_STATUS_KEY]: "payment-required",
7590
7599
  [A2A_ERROR_KEY]: toA2AErrorCode(result.error),
7591
7600
  [A2A_REQUIRED_KEY]: result.challenge,
7592
7601
  ...toA2APaymentReceipts(receipts)
@@ -92,7 +92,13 @@ interface X402ExactAcceptEntry {
92
92
  * authorizing exactly one NEP-141 `ft_transfer` to `payTo` (per `scheme_exact_near.md`); a
93
93
  * facilitator-selected relayer (`feePayer` below) prepays gas + the 1 yoctoNEAR and submits, so
94
94
  * the buyer holds zero NEAR. PipRail self-settles ALL. */
95
- assetTransferMethod: 'eip3009' | 'permit2' | 'svm' | 'algorand' | 'aptos' | 'near';
95
+ assetTransferMethod: 'eip3009' | 'permit2'
96
+ /** A FOREIGN-dialect alias for `'permit2'` — Binance's x402 ("b402") facilitator labels its
97
+ * EVM-Permit2 exact rail `'permit2-exact'` (the coinbase/x402 spec uses bare `'permit2'`).
98
+ * PipRail EMITS only `'permit2'`; it TOLERATES `'permit2-exact'` inbound so the buyer pays a
99
+ * Binance-issued 402 (the buyer treats the two as one rail). NB: settlement still requires the
100
+ * rail to bind PipRail's canonical x402ExactPermit2Proxy — see the buyer in drivers/evm. */
101
+ | 'permit2-exact' | 'svm' | 'algorand' | 'aptos' | 'near';
96
102
  /** EIP-712 domain name of the token. OPTIONAL per the exact-EVM scheme (only
97
103
  * `assetTransferMethod` is required) — a foreign rail may omit it. NEVER assumed
98
104
  * from the symbol (USDC's on-chain name() is "USD Coin", not "USDC"); a PipRail gate
@@ -92,7 +92,13 @@ interface X402ExactAcceptEntry {
92
92
  * authorizing exactly one NEP-141 `ft_transfer` to `payTo` (per `scheme_exact_near.md`); a
93
93
  * facilitator-selected relayer (`feePayer` below) prepays gas + the 1 yoctoNEAR and submits, so
94
94
  * the buyer holds zero NEAR. PipRail self-settles ALL. */
95
- assetTransferMethod: 'eip3009' | 'permit2' | 'svm' | 'algorand' | 'aptos' | 'near';
95
+ assetTransferMethod: 'eip3009' | 'permit2'
96
+ /** A FOREIGN-dialect alias for `'permit2'` — Binance's x402 ("b402") facilitator labels its
97
+ * EVM-Permit2 exact rail `'permit2-exact'` (the coinbase/x402 spec uses bare `'permit2'`).
98
+ * PipRail EMITS only `'permit2'`; it TOLERATES `'permit2-exact'` inbound so the buyer pays a
99
+ * Binance-issued 402 (the buyer treats the two as one rail). NB: settlement still requires the
100
+ * rail to bind PipRail's canonical x402ExactPermit2Proxy — see the buyer in drivers/evm. */
101
+ | 'permit2-exact' | 'svm' | 'algorand' | 'aptos' | 'near';
96
102
  /** EIP-712 domain name of the token. OPTIONAL per the exact-EVM scheme (only
97
103
  * `assetTransferMethod` is required) — a foreign rail may omit it. NEVER assumed
98
104
  * from the symbol (USDC's on-chain name() is "USD Coin", not "USDC"); a PipRail gate
package/dist/node.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { u as SpendStore } from './ledger-OQos-tmj.cjs';
2
- export { Q as memorySpendStore } from './ledger-OQos-tmj.cjs';
1
+ import { u as SpendStore } from './ledger-mF_SoiDB.cjs';
2
+ export { Q as memorySpendStore } from './ledger-mF_SoiDB.cjs';
3
3
 
4
4
  /**
5
5
  * A durable {@link SpendStore} backed by a local JSONL file (one settled payment per
package/dist/node.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { u as SpendStore } from './ledger-OQos-tmj.js';
2
- export { Q as memorySpendStore } from './ledger-OQos-tmj.js';
1
+ import { u as SpendStore } from './ledger-mF_SoiDB.js';
2
+ export { Q as memorySpendStore } from './ledger-mF_SoiDB.js';
3
3
 
4
4
  /**
5
5
  * A durable {@link SpendStore} backed by a local JSONL file (one settled payment per
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@piprail/sdk",
3
- "version": "2.10.0",
3
+ "version": "2.12.0",
4
4
  "description": "Accept x402 crypto payments across 29 chains — every major EVM chain plus Solana, TON, Tron, NEAR, Sui, Aptos, Algorand, Stellar & XRPL — in a couple of lines. No backend, no database, no fee; payments settle straight to your wallet.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",