@piprail/sdk 2.4.0 → 2.6.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 +55 -0
- package/dist/index.cjs +177 -7
- package/dist/index.d.cts +31 -9
- package/dist/index.d.ts +31 -9
- package/dist/index.js +175 -5
- package/dist/{near-DI2I3MAV.cjs → near-H5AQ253I.cjs} +300 -24
- package/dist/{near-MTYBCUYM.js → near-OTPQD6BI.js} +287 -11
- package/package.json +6 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,59 @@ 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.6.0] — 2026-06-18 — keyless-gasless `exact` on 7 more EVM mainnets (6 → 13 chains)
|
|
8
|
+
|
|
9
|
+
Additive and backward-compatible — defaults and the zero-config 402 stay byte-identical; this only
|
|
10
|
+
grows the `KNOWN_FACILITATORS` seed map, so `exact: true` now resolves a keyless, gas-sponsoring
|
|
11
|
+
facilitator zero-config on **7 more chains**.
|
|
12
|
+
|
|
13
|
+
- **`exact: true` is now zero-config truly-gasless (buyer AND merchant pay zero native) on Ethereum,
|
|
14
|
+
Polygon, Arbitrum, Optimism, Avalanche, Sei, and Unichain** — joining Base, Monad, BNB, HyperEVM,
|
|
15
|
+
Algorand, and Solana (**6 → 13 chains**). Every new (chain, facilitator) pair was LIVE-settled on
|
|
16
|
+
mainnet with the buyer holding **zero native gas** (provably gasless), per the seed-map RULE
|
|
17
|
+
(settle-proven, never a `/supported` read). **17 new pairs**, e.g. Polygon now lists five keyless
|
|
18
|
+
facilitators (PayAI, Polygon Labs, Corbits, Ultravioleta DAO, Dexter).
|
|
19
|
+
- **Base** gains two more keyless facilitators (Cascade, Satoshi/bitcoinsapi).
|
|
20
|
+
- **Not seeded (advertised ≠ settles):** Celo and Scroll — Ultravioleta DAO lists them but its sponsor
|
|
21
|
+
contract reverts there (`contract_call_failed`), so neither was ever live-settled. They stay on
|
|
22
|
+
`onchain-proof` until a facilitator actually settles them.
|
|
23
|
+
- No API surface change. Merchants on an unseeded network still pass an explicit
|
|
24
|
+
`exact: { settle: { facilitator } }`.
|
|
25
|
+
|
|
26
|
+
## [2.5.0] — 2026-06-18 — gasless NEAR `exact` rail (NEP-366 meta-transactions)
|
|
27
|
+
|
|
28
|
+
Additive and backward-compatible — defaults and the zero-config 402 stay byte-identical; pure-EVM
|
|
29
|
+
installs still never download a non-EVM library (NEAR + its borsh decoder stay lazy-loaded — verified:
|
|
30
|
+
the built EVM bundle has zero static non-EVM imports, only lazy chunks).
|
|
31
|
+
|
|
32
|
+
### Added
|
|
33
|
+
|
|
34
|
+
- **NEAR `exact` rail — gasless for the buyer on a fifth family.** PipRail's `exact` scheme now covers
|
|
35
|
+
NEAR (NEP-141 tokens — USDC / USDT) via the ratified
|
|
36
|
+
[`scheme_exact_near`](https://github.com/x402-foundation/x402/blob/main/specs/schemes/exact/scheme_exact_near.md)
|
|
37
|
+
(x402 v2). The buyer signs a **NEP-366 `SignedDelegateAction`** authorizing exactly one `ft_transfer`
|
|
38
|
+
with a **full-access key** and never broadcasts it or holds any NEAR; a relayer wraps it, prepays the
|
|
39
|
+
gas + the 1 yoctoNEAR, and submits — the agent is **completely gasless**. Opt-in
|
|
40
|
+
(`schemes: ['onchain-proof', 'exact']`); native NEAR is **not** exact-payable (the scheme is over
|
|
41
|
+
`ft_transfer`) and stays `onchain-proof`. Proven on NEAR mainnet for both USDC and USDT.
|
|
42
|
+
- New `payExactNear` (buyer build/sign) and `verifyAndSettleExactNear` (seller verify + relay) driver
|
|
43
|
+
functions; `resolveExactRail` / `payExact` / `settleExactSelf` are now implemented for NEAR.
|
|
44
|
+
- **Self-settle today** (`exact: { settle: 'self', relayer: { accountId, key } }`): the merchant runs
|
|
45
|
+
a small funded relayer that pays the sub-cent settle gas — the buyer stays gasless, exactly like the
|
|
46
|
+
Solana / Algorand / Aptos self-settle. The **facilitator** path (`settle: { facilitator }`) is wired
|
|
47
|
+
and will work the moment a real NEAR x402 facilitator ships; **none does yet** (some advertise
|
|
48
|
+
`near:mainnet` in `/supported` without settling it), so `exact: true` deliberately excludes NEAR and
|
|
49
|
+
self-settle is the supported gasless-for-buyer config. See the NEAR chain doc for the caveat.
|
|
50
|
+
- **Sponsor fee-drain guard**: the relayer prepays both the gas and the attached deposit, so the gate
|
|
51
|
+
rejects any delegate whose attached `deposit` ≠ exactly 1 yoctoNEAR or whose `gas` exceeds the
|
|
52
|
+
300 TGas cap (re-derived from the trusted rail) **before** the relayer signs.
|
|
53
|
+
|
|
54
|
+
### Dependencies
|
|
55
|
+
|
|
56
|
+
- Added **`borsh` (`>=2 <3`) as an OPTIONAL peer dependency** — used only to decode the inbound NEAR
|
|
57
|
+
`SignedDelegateAction` during self-settle, lazy-loaded inside the NEAR driver. NEAR users already have
|
|
58
|
+
it via `near-api-js`; pure-EVM (and non-NEAR) installs never load it.
|
|
59
|
+
|
|
7
60
|
## [2.4.0] — 2026-06-17 — gasless Algorand & Aptos rails + keyless gasless on SIX chains (incl. Algorand & BNB)
|
|
8
61
|
|
|
9
62
|
Additive and backward-compatible — defaults and the zero-config 402 stay byte-identical; pure-EVM
|
|
@@ -1347,6 +1400,8 @@ straight into your wallet. The API is small and self-contained.
|
|
|
1347
1400
|
to your wallet; PipRail never holds funds.
|
|
1348
1401
|
- `viem ^2.21` is a peer dependency. Node 20+ or a modern browser.
|
|
1349
1402
|
|
|
1403
|
+
[2.6.0]: https://www.npmjs.com/package/@piprail/sdk
|
|
1404
|
+
[2.5.0]: https://www.npmjs.com/package/@piprail/sdk
|
|
1350
1405
|
[2.4.0]: https://www.npmjs.com/package/@piprail/sdk
|
|
1351
1406
|
[2.3.0]: https://www.npmjs.com/package/@piprail/sdk
|
|
1352
1407
|
[2.2.0]: https://www.npmjs.com/package/@piprail/sdk
|
package/dist/index.cjs
CHANGED
|
@@ -1396,7 +1396,7 @@ function chainIdFromNetwork(network) {
|
|
|
1396
1396
|
const match = /^eip155:(\d+)$/.exec(network);
|
|
1397
1397
|
if (!match || !match[1]) return null;
|
|
1398
1398
|
const n = Number(match[1]);
|
|
1399
|
-
return Number.isSafeInteger(n) ? n : null;
|
|
1399
|
+
return Number.isSafeInteger(n) && n > 0 ? n : null;
|
|
1400
1400
|
}
|
|
1401
1401
|
function buildChallengeHeader(challenge) {
|
|
1402
1402
|
return toBase64Json(challenge);
|
|
@@ -1469,6 +1469,9 @@ function parseExactPaymentHeader(value) {
|
|
|
1469
1469
|
const x402Version = typeof v.x402Version === "number" ? v.x402Version : 2;
|
|
1470
1470
|
const asset = accepted && typeof accepted.asset === "string" ? accepted.asset : void 0;
|
|
1471
1471
|
const base2 = { x402Version, network, ...asset ? { asset } : {}, raw: v };
|
|
1472
|
+
if (typeof payload.signedDelegateAction === "string") {
|
|
1473
|
+
return { ...base2, method: "near", payload: { signedDelegateAction: payload.signedDelegateAction } };
|
|
1474
|
+
}
|
|
1472
1475
|
if (typeof payload.transaction === "string" && typeof payload.senderAuth === "string") {
|
|
1473
1476
|
return { ...base2, method: "aptos", payload: { transaction: payload.transaction, senderAuth: payload.senderAuth } };
|
|
1474
1477
|
}
|
|
@@ -1810,6 +1813,9 @@ function makeEvmNetwork(resolved) {
|
|
|
1810
1813
|
if ("paymentGroup" in payload) {
|
|
1811
1814
|
return { ok: false, error: "signature_invalid", detail: "An Algorand payload was submitted to an EVM exact rail." };
|
|
1812
1815
|
}
|
|
1816
|
+
if ("signedDelegateAction" in payload) {
|
|
1817
|
+
return { ok: false, error: "signature_invalid", detail: "A NEAR payload was submitted to an EVM exact rail." };
|
|
1818
|
+
}
|
|
1813
1819
|
return verifyAndSettleExactEvm({
|
|
1814
1820
|
publicClient,
|
|
1815
1821
|
walletClient: a.walletClient,
|
|
@@ -1906,7 +1912,7 @@ var loaders = {
|
|
|
1906
1912
|
near: async () => {
|
|
1907
1913
|
let mod;
|
|
1908
1914
|
try {
|
|
1909
|
-
mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./near-
|
|
1915
|
+
mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./near-H5AQ253I.cjs")));
|
|
1910
1916
|
} catch (cause) {
|
|
1911
1917
|
throw new (0, _chunkJG6KRAW6cjs.MissingDriverError)(
|
|
1912
1918
|
`NEAR selected, but its package isn't installed. Run: npm install near-api-js`,
|
|
@@ -3242,7 +3248,7 @@ var PipRailClient = (_class2 = class {
|
|
|
3242
3248
|
);
|
|
3243
3249
|
if (schemes.includes("exact") && exactOnNet && typeof net.payExact !== "function") {
|
|
3244
3250
|
throw new (0, _chunkJG6KRAW6cjs.UnsupportedSchemeError)(
|
|
3245
|
-
`This 402 offers a standard 'exact' rail on ${net.network}, but the ${net.family} family can't pay 'exact' (supported on EVM, Solana +
|
|
3251
|
+
`This 402 offers a standard 'exact' rail on ${net.network}, but the ${net.family} family can't pay 'exact' (supported on EVM, Solana, Algorand + NEAR today), and no 'onchain-proof' rail was offered.`
|
|
3246
3252
|
);
|
|
3247
3253
|
}
|
|
3248
3254
|
if (!schemes.includes("exact") && exactOnNet && typeof net.payExact === "function") {
|
|
@@ -3638,7 +3644,7 @@ var PipRailClient = (_class2 = class {
|
|
|
3638
3644
|
async payExactRail(net, wallet, accept, url, init, quote) {
|
|
3639
3645
|
if (!net.payExact) {
|
|
3640
3646
|
throw new (0, _chunkJG6KRAW6cjs.UnsupportedSchemeError)(
|
|
3641
|
-
`the ${net.family} family can't pay a standard 'exact' rail (supported on EVM, Solana +
|
|
3647
|
+
`the ${net.family} family can't pay a standard 'exact' rail (supported on EVM, Solana, Algorand + NEAR today).`
|
|
3642
3648
|
);
|
|
3643
3649
|
}
|
|
3644
3650
|
throwIfAborted(_optionalChain([init, 'optionalAccess', _48 => _48.signal]));
|
|
@@ -4956,6 +4962,20 @@ var KNOWN_FACILITATORS = {
|
|
|
4956
4962
|
schemes: ["exact"],
|
|
4957
4963
|
settles: ["eip3009"],
|
|
4958
4964
|
note: "GoPlausible \u2014 keyless, sponsors gas (Base USDC EIP-3009). LIVE-settled on Base 2026-06-17 (tx 0x9bcbc1f01fe1fd1aed2a79e5582555164cc4185e9800189df378a6b46eb9c59e). 2nd GoPlausible validation chain (after Algorand)."
|
|
4965
|
+
},
|
|
4966
|
+
{
|
|
4967
|
+
url: "https://facilitator.cascade.fyi",
|
|
4968
|
+
keyless: true,
|
|
4969
|
+
schemes: ["exact"],
|
|
4970
|
+
settles: ["eip3009"],
|
|
4971
|
+
note: "Cascade \u2014 keyless, sponsors gas (Base USDC EIP-3009). LIVE-settled on Base 2026-06-18 (tx 0x2e784725f3c66e170720cc8df43a9248f02ad80914fcbe05dadbdbe411c3b52b)."
|
|
4972
|
+
},
|
|
4973
|
+
{
|
|
4974
|
+
url: "https://facilitator.bitcoinsapi.com",
|
|
4975
|
+
keyless: true,
|
|
4976
|
+
schemes: ["exact"],
|
|
4977
|
+
settles: ["eip3009"],
|
|
4978
|
+
note: "Satoshi (bitcoinsapi) \u2014 keyless, sponsors gas (Base USDC EIP-3009). LIVE-settled on Base 2026-06-18 (tx 0xbb2b6c354b12c6d07cce91e2b337e38327d4b0833bbd1dfbeda3ad495b67b819)."
|
|
4959
4979
|
}
|
|
4960
4980
|
],
|
|
4961
4981
|
// Monad (eip155:143). Corbits + Ultravioleta DAO each keyless-settle the EVM EIP-3009 exact rail
|
|
@@ -5018,6 +5038,139 @@ var KNOWN_FACILITATORS = {
|
|
|
5018
5038
|
note: "Ultravioleta DAO \u2014 keyless, 100% gas-sponsored (HyperEVM native USDC EIP-3009). LIVE-settled on HyperEVM 2026-06-17 (tx 0x56af8148a92a291f0ce362e250919f7742074e5464ac0f315ad68abaec93bd0a)."
|
|
5019
5039
|
}
|
|
5020
5040
|
],
|
|
5041
|
+
// ── gasless-extension (2026-06-18): 7 more EVM mainnets, each LIVE-settled by us — a real EIP-3009
|
|
5042
|
+
// exact payment with the buyer holding ZERO native (so PROVABLY gasless), funded self-service by
|
|
5043
|
+
// bridging USDC in (LI.FI/Eco/Relay), never a /supported read. Dexter enforces a ~$0.004 dynamic
|
|
5044
|
+
// floor on some chains (we cleared it at $0.005); UVD has no floor (100%-sponsors) but its sponsor
|
|
5045
|
+
// contract is NOT deployed on every chain it advertises (Avalanche/Celo/Scroll → contract_call_failed,
|
|
5046
|
+
// left UNSEEDED — the NEAR lesson: advertising ≠ settling).
|
|
5047
|
+
// Ethereum L1 (eip155:1) — UVD (no floor, sponsors L1 gas). 2nd keyless ETH option vs Primev, which
|
|
5048
|
+
// rejected PipRail's exact as unsupported_scheme.
|
|
5049
|
+
"eip155:1": [
|
|
5050
|
+
{
|
|
5051
|
+
url: "https://facilitator.ultravioletadao.xyz",
|
|
5052
|
+
keyless: true,
|
|
5053
|
+
schemes: ["exact"],
|
|
5054
|
+
settles: ["eip3009"],
|
|
5055
|
+
note: "Ultravioleta DAO \u2014 keyless, 100% gas-sponsored (Ethereum native USDC EIP-3009; no settlement floor). LIVE-settled on Ethereum mainnet 2026-06-18 (tx 0x7fcc3cafdf43c52888f0117cde633eff35371f832dfb8dbd84e6fd7704ae5cfc)."
|
|
5056
|
+
}
|
|
5057
|
+
],
|
|
5058
|
+
// Polygon PoS (eip155:137) — FIVE keyless facilitators (the broadest after Base), all live-settled.
|
|
5059
|
+
"eip155:137": [
|
|
5060
|
+
{
|
|
5061
|
+
url: "https://facilitator.payai.network",
|
|
5062
|
+
keyless: true,
|
|
5063
|
+
schemes: ["exact"],
|
|
5064
|
+
settles: ["eip3009"],
|
|
5065
|
+
note: "PayAI \u2014 keyless, sponsors gas (Polygon native USDC EIP-3009). LIVE-settled on Polygon 2026-06-18 (tx 0xb37630871504618c4db35e8ef0edd3c99deac102b143b7e5eb738c03fb13a619)."
|
|
5066
|
+
},
|
|
5067
|
+
{
|
|
5068
|
+
url: "https://x402.polygon.technology",
|
|
5069
|
+
keyless: true,
|
|
5070
|
+
schemes: ["exact"],
|
|
5071
|
+
settles: ["eip3009"],
|
|
5072
|
+
note: "Polygon Labs (the official Polygon facilitator) \u2014 keyless, sponsors gas. LIVE-settled on Polygon 2026-06-18 (tx 0x6a8ca60ea111959a61a85ad6c4f2ed99e192052ec7b9ffb59baa33691a86f419)."
|
|
5073
|
+
},
|
|
5074
|
+
{
|
|
5075
|
+
url: "https://facilitator.corbits.dev",
|
|
5076
|
+
keyless: true,
|
|
5077
|
+
schemes: ["exact"],
|
|
5078
|
+
settles: ["eip3009"],
|
|
5079
|
+
note: "Corbits (Faremeter) \u2014 keyless, sponsors gas. LIVE-settled on Polygon 2026-06-18 (tx 0x2fadca2ee3cd7fcff32d015e8b06109de6b747d7cd0f80dcd8fb022b2d58d008)."
|
|
5080
|
+
},
|
|
5081
|
+
{
|
|
5082
|
+
url: "https://facilitator.ultravioletadao.xyz",
|
|
5083
|
+
keyless: true,
|
|
5084
|
+
schemes: ["exact"],
|
|
5085
|
+
settles: ["eip3009"],
|
|
5086
|
+
note: "Ultravioleta DAO \u2014 keyless, 100% gas-sponsored. LIVE-settled on Polygon 2026-06-18 (tx 0x0922cd78f3b7c35cc294cf0c0d9b7609e6596eb337be0d197fa5fc511eacba34)."
|
|
5087
|
+
},
|
|
5088
|
+
{
|
|
5089
|
+
url: "https://x402.dexter.cash",
|
|
5090
|
+
keyless: true,
|
|
5091
|
+
schemes: ["exact"],
|
|
5092
|
+
settles: ["eip3009"],
|
|
5093
|
+
note: "Dexter \u2014 keyless, sponsors gas; ~$0.004 dynamic settlement floor (sub-floor \u2192 amount_too_low). LIVE-settled on Polygon 2026-06-18 at $0.005 (tx 0x4a7cfc96e4e2496652435c77b0021db4a459e7bcd97948c15e6bea09077c164b)."
|
|
5094
|
+
}
|
|
5095
|
+
],
|
|
5096
|
+
// Arbitrum One (eip155:42161) — PayAI + UVD + Dexter.
|
|
5097
|
+
"eip155:42161": [
|
|
5098
|
+
{
|
|
5099
|
+
url: "https://facilitator.payai.network",
|
|
5100
|
+
keyless: true,
|
|
5101
|
+
schemes: ["exact"],
|
|
5102
|
+
settles: ["eip3009"],
|
|
5103
|
+
note: "PayAI \u2014 keyless, sponsors gas (Arbitrum native USDC EIP-3009). LIVE-settled on Arbitrum 2026-06-18 (tx 0x4c7fbfb37ef087bb9bc8872b1b2b0b83ea7ca4cf6b50bc883e51f9b85be61199)."
|
|
5104
|
+
},
|
|
5105
|
+
{
|
|
5106
|
+
url: "https://facilitator.ultravioletadao.xyz",
|
|
5107
|
+
keyless: true,
|
|
5108
|
+
schemes: ["exact"],
|
|
5109
|
+
settles: ["eip3009"],
|
|
5110
|
+
note: "Ultravioleta DAO \u2014 keyless, 100% gas-sponsored. LIVE-settled on Arbitrum 2026-06-18 (tx 0xd1fa7e6ffbd59502bba5809ce181d7936749b93a45c8c2277b4f6d8638326dec)."
|
|
5111
|
+
},
|
|
5112
|
+
{
|
|
5113
|
+
url: "https://x402.dexter.cash",
|
|
5114
|
+
keyless: true,
|
|
5115
|
+
schemes: ["exact"],
|
|
5116
|
+
settles: ["eip3009"],
|
|
5117
|
+
note: "Dexter \u2014 keyless, sponsors gas; ~$0.004 dynamic floor. LIVE-settled on Arbitrum 2026-06-18 at $0.005 (tx 0x0993d51b3859dfd7e8d5b2af709ce64f01ff34ed14bfef665dbb340e7373d599)."
|
|
5118
|
+
}
|
|
5119
|
+
],
|
|
5120
|
+
// Optimism (eip155:10) — Dexter + UVD.
|
|
5121
|
+
"eip155:10": [
|
|
5122
|
+
{
|
|
5123
|
+
url: "https://x402.dexter.cash",
|
|
5124
|
+
keyless: true,
|
|
5125
|
+
schemes: ["exact"],
|
|
5126
|
+
settles: ["eip3009"],
|
|
5127
|
+
note: "Dexter \u2014 keyless, sponsors gas; ~$0.004 dynamic floor. LIVE-settled on Optimism 2026-06-18 at $0.005 (tx 0x98b282a5dd698054eff4900ff8547170d4f7605b51140c55147fc5ae485f81da)."
|
|
5128
|
+
},
|
|
5129
|
+
{
|
|
5130
|
+
url: "https://facilitator.ultravioletadao.xyz",
|
|
5131
|
+
keyless: true,
|
|
5132
|
+
schemes: ["exact"],
|
|
5133
|
+
settles: ["eip3009"],
|
|
5134
|
+
note: "Ultravioleta DAO \u2014 keyless, 100% gas-sponsored. LIVE-settled on Optimism 2026-06-18 (tx 0xdd91dfdf12bed2d196e37fa1dea9a0da71a97e3c39a0ec0ed114be6a9af22837)."
|
|
5135
|
+
}
|
|
5136
|
+
],
|
|
5137
|
+
// Avalanche C-Chain (eip155:43114) — PayAI + Dexter. (UVD advertises it but contract_call_failed → unseeded.)
|
|
5138
|
+
"eip155:43114": [
|
|
5139
|
+
{
|
|
5140
|
+
url: "https://facilitator.payai.network",
|
|
5141
|
+
keyless: true,
|
|
5142
|
+
schemes: ["exact"],
|
|
5143
|
+
settles: ["eip3009"],
|
|
5144
|
+
note: "PayAI \u2014 keyless, sponsors gas (Avalanche native USDC EIP-3009). LIVE-settled on Avalanche 2026-06-18 (tx 0x6a1307bc48a157de236ea03440ea2cb6ad4f27e22dd9c89a4345b4c3edb270c7)."
|
|
5145
|
+
},
|
|
5146
|
+
{
|
|
5147
|
+
url: "https://x402.dexter.cash",
|
|
5148
|
+
keyless: true,
|
|
5149
|
+
schemes: ["exact"],
|
|
5150
|
+
settles: ["eip3009"],
|
|
5151
|
+
note: "Dexter \u2014 keyless, sponsors gas (no floor hit at $0.001 here). LIVE-settled on Avalanche 2026-06-18 (tx 0xb2263e9a4ea3917eee6acabcb454d42a50264fdd69a0781ed8fcaec5590e264b)."
|
|
5152
|
+
}
|
|
5153
|
+
],
|
|
5154
|
+
// Sei (eip155:1329) — PayAI (the only keyless facilitator that lists Sei).
|
|
5155
|
+
"eip155:1329": [
|
|
5156
|
+
{
|
|
5157
|
+
url: "https://facilitator.payai.network",
|
|
5158
|
+
keyless: true,
|
|
5159
|
+
schemes: ["exact"],
|
|
5160
|
+
settles: ["eip3009"],
|
|
5161
|
+
note: "PayAI \u2014 keyless, sponsors gas (Sei native USDC EIP-3009). LIVE-settled on Sei 2026-06-18 (tx 0xde63679b64749cb59625527e5c7682503c851d66b9b8b8ba217ed7b099461312)."
|
|
5162
|
+
}
|
|
5163
|
+
],
|
|
5164
|
+
// Unichain (eip155:130) — UVD (the only keyless facilitator that lists Unichain).
|
|
5165
|
+
"eip155:130": [
|
|
5166
|
+
{
|
|
5167
|
+
url: "https://facilitator.ultravioletadao.xyz",
|
|
5168
|
+
keyless: true,
|
|
5169
|
+
schemes: ["exact"],
|
|
5170
|
+
settles: ["eip3009"],
|
|
5171
|
+
note: "Ultravioleta DAO \u2014 keyless, 100% gas-sponsored (Unichain native USDC EIP-3009). LIVE-settled on Unichain 2026-06-18 (tx 0xf8bf4a9a200f24159ac67c6315c30b194257999d7da21471b39d5f2cc32b2236)."
|
|
5172
|
+
}
|
|
5173
|
+
],
|
|
5021
5174
|
// Algorand (mainnet, CAIP-2 = full base64 genesis hash). GoPlausible keyless-settles the ratified
|
|
5022
5175
|
// x402 Algorand `exact` rail (atomic-group fee pooling): its sponsor pools the whole group fee and
|
|
5023
5176
|
// submits, so NEITHER the buyer NOR the merchant pays ALGO — both-sides gasless. LIVE-settled by us
|
|
@@ -5061,6 +5214,17 @@ var KNOWN_FACILITATORS = {
|
|
|
5061
5214
|
note: "Corbits \u2014 keyless, Solana-first fee-payer sponsor. LIVE-settled on Solana 2026-06-15 (tx BCreYer\u2026)."
|
|
5062
5215
|
}
|
|
5063
5216
|
]
|
|
5217
|
+
// NEAR (near:mainnet) — DELIBERATELY UNSEEDED: no x402 facilitator settles NEAR yet.
|
|
5218
|
+
// The NEAR `exact` BUYER payload PipRail builds (drivers/near/exact.ts) is LIVE-PROVEN on mainnet —
|
|
5219
|
+
// a real NEP-366 meta-transaction settles a USDC/USDT ft_transfer gaslessly (buyer 0 NEAR, single-use
|
|
5220
|
+
// via the access-key nonce; relay txs CMnQJzrLvwk… USDT + BCCnVHbSCMY… USDC, 2026-06-18). What's
|
|
5221
|
+
// missing is the FACILITATOR side: the public x402-rs (which Ultravioleta DAO runs) has NO NEAR chain
|
|
5222
|
+
// crate (only eip155/solana/aptos), and UVD's `/verify` 400s on a near:mainnet request even though its
|
|
5223
|
+
// `/supported` ADVERTISES `near:mainnet` + feePayer `uvd-facilitator.near` — i.e. the listing is
|
|
5224
|
+
// aspirational, not settle-capable (verified 2026-06-18). So `exact: true` must NOT auto-pick a NEAR
|
|
5225
|
+
// facilitator. Seed here ONLY after a real keyless settle through a facilitator that actually
|
|
5226
|
+
// implements scheme_exact_near.md (THE RULE). Merchants can still pass an explicit
|
|
5227
|
+
// `exact: { settle: { facilitator } }` for any facilitator they've confirmed settles near:mainnet.
|
|
5064
5228
|
};
|
|
5065
5229
|
function knownFacilitatorsFor(network) {
|
|
5066
5230
|
return _nullishCoalesce(KNOWN_FACILITATORS[network], () => ( []));
|
|
@@ -5476,6 +5640,12 @@ function createPaymentGate(options) {
|
|
|
5476
5640
|
return t;
|
|
5477
5641
|
}
|
|
5478
5642
|
}).join("|");
|
|
5643
|
+
} else if ("signedDelegateAction" in exact.payload) {
|
|
5644
|
+
try {
|
|
5645
|
+
nonce = Buffer.from(exact.payload.signedDelegateAction, "base64").toString("base64");
|
|
5646
|
+
} catch (e41) {
|
|
5647
|
+
nonce = exact.payload.signedDelegateAction;
|
|
5648
|
+
}
|
|
5479
5649
|
} else if ("permit2Authorization" in exact.payload) {
|
|
5480
5650
|
evmAuth = exact.payload.permit2Authorization;
|
|
5481
5651
|
nonce = evmAuth.nonce;
|
|
@@ -5494,7 +5664,7 @@ function createPaymentGate(options) {
|
|
|
5494
5664
|
result = await spec.net.settleExactSelf({ relayer: mode.relayer, payload: exact.payload, accept });
|
|
5495
5665
|
} else {
|
|
5496
5666
|
const ftMethod = accept.extra.assetTransferMethod;
|
|
5497
|
-
const needsFeePayer = ftMethod === "svm" || ftMethod === "algorand" || ftMethod === "aptos";
|
|
5667
|
+
const needsFeePayer = ftMethod === "svm" || ftMethod === "algorand" || ftMethod === "aptos" || ftMethod === "near";
|
|
5498
5668
|
if (needsFeePayer && !accept.extra.feePayer) {
|
|
5499
5669
|
throw new (0, _chunkJG6KRAW6cjs.SettlementError)(
|
|
5500
5670
|
`exact settle: the ${ftMethod} facilitator rail is missing extra.feePayer (the gas sponsor) \u2014 cannot settle.`
|
|
@@ -5614,7 +5784,7 @@ async function signBody(secret, body) {
|
|
|
5614
5784
|
const sig = await subtle.sign("HMAC", key, enc.encode(body));
|
|
5615
5785
|
const hex = Array.from(new Uint8Array(sig)).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
5616
5786
|
return `sha256=${hex}`;
|
|
5617
|
-
} catch (
|
|
5787
|
+
} catch (e42) {
|
|
5618
5788
|
return null;
|
|
5619
5789
|
}
|
|
5620
5790
|
}
|
|
@@ -5675,7 +5845,7 @@ async function deliverReceipt(receipt, options) {
|
|
|
5675
5845
|
const willRetry = !ok && retryable && attempt < maxAttempts;
|
|
5676
5846
|
try {
|
|
5677
5847
|
_optionalChain([onAttempt, 'optionalCall', _91 => _91({ attempt, ok, ...status !== void 0 ? { status } : {}, ...error ? { error } : {}, willRetry })]);
|
|
5678
|
-
} catch (
|
|
5848
|
+
} catch (e43) {
|
|
5679
5849
|
}
|
|
5680
5850
|
if (ok) return { delivered: true, attempts: attempt, status };
|
|
5681
5851
|
if (!willRetry) {
|
package/dist/index.d.cts
CHANGED
|
@@ -94,8 +94,11 @@ interface X402ExactAcceptEntry {
|
|
|
94
94
|
* keyless facilitator) signs that fee txn + submits. **Aptos: `'aptos'`** — the payer signs a
|
|
95
95
|
* fee-payer (sponsored) `primary_fungible_store::transfer` to `payTo` (per
|
|
96
96
|
* `scheme_exact_aptos.md`); the gate (or a keyless facilitator) adds the fee-payer signature
|
|
97
|
-
* + submits, paying gas.
|
|
98
|
-
|
|
97
|
+
* + submits, paying gas. **NEAR: `'near'`** — the payer signs a NEP-366 `SignedDelegateAction`
|
|
98
|
+
* authorizing exactly one NEP-141 `ft_transfer` to `payTo` (per `scheme_exact_near.md`); a
|
|
99
|
+
* facilitator-selected relayer (`feePayer` below) prepays gas + the 1 yoctoNEAR and submits, so
|
|
100
|
+
* the buyer holds zero NEAR. PipRail self-settles ALL. */
|
|
101
|
+
assetTransferMethod: 'eip3009' | 'permit2' | 'svm' | 'algorand' | 'aptos' | 'near';
|
|
99
102
|
/** EIP-712 domain name of the token. OPTIONAL per the exact-EVM scheme (only
|
|
100
103
|
* `assetTransferMethod` is required) — a foreign rail may omit it. NEVER assumed
|
|
101
104
|
* from the symbol (USDC's on-chain name() is "USD Coin", not "USDC"); a PipRail gate
|
|
@@ -255,9 +258,24 @@ interface ExactAptosPaymentPayload {
|
|
|
255
258
|
/** Base64 BCS-serialized buyer (sender) `AccountAuthenticator`. */
|
|
256
259
|
senderAuth: string;
|
|
257
260
|
}
|
|
261
|
+
/**
|
|
262
|
+
* The `payload` a client sends for the **NEAR `exact`** variant, per `scheme_exact_near.md`:
|
|
263
|
+
* a base64-encoded, Borsh-serialized NEP-366 `SignedDelegateAction` whose single delegated action
|
|
264
|
+
* is one NEP-141 `ft_transfer` (to `payTo`, the exact `amount`, `deposit: 1` yoctoNEAR). The buyer
|
|
265
|
+
* signs the delegate action with a FULL-ACCESS key (a function-call key can't attach the 1 yocto and
|
|
266
|
+
* is rejected); a facilitator-selected relayer wraps it, prepays gas + the yocto, and submits. The
|
|
267
|
+
* signed delegate action IS the proof — there's no separate authorization object (the NEAR analogue
|
|
268
|
+
* of EIP-3009's `authorization` / SVM's `transaction`). Its single self-contained string field also
|
|
269
|
+
* distinguishes it from every other family's payload shape.
|
|
270
|
+
*/
|
|
271
|
+
interface ExactNearPaymentPayload {
|
|
272
|
+
/** Base64 of the Borsh-encoded NEP-366 `SignedDelegateAction` (one `ft_transfer`). */
|
|
273
|
+
signedDelegateAction: string;
|
|
274
|
+
}
|
|
258
275
|
/** Any `exact`-rail payload shape — EIP-3009 (`authorization`), Permit2 (`permit2Authorization`),
|
|
259
|
-
* SVM (`transaction`), Algorand (`paymentGroup`),
|
|
260
|
-
|
|
276
|
+
* SVM (`transaction`), Algorand (`paymentGroup`), Aptos (`transaction` + `senderAuth`), or NEAR
|
|
277
|
+
* (`signedDelegateAction`). */
|
|
278
|
+
type ExactPaymentPayloadAny = ExactPaymentPayload | Permit2PaymentPayload | ExactSvmPaymentPayload | ExactAlgorandPaymentPayload | ExactAptosPaymentPayload | ExactNearPaymentPayload;
|
|
261
279
|
interface ParsedExactBase {
|
|
262
280
|
x402Version: number;
|
|
263
281
|
/** The client's claimed network (slug or CAIP-2) — for matching, not trust. */
|
|
@@ -277,7 +295,8 @@ interface ParsedExactBase {
|
|
|
277
295
|
* (`authorization`), `'permit2'` → {@link Permit2PaymentPayload} (`permit2Authorization`),
|
|
278
296
|
* `'svm'` → {@link ExactSvmPaymentPayload} (`transaction`), `'algorand'` →
|
|
279
297
|
* {@link ExactAlgorandPaymentPayload} (`paymentGroup`); `'aptos'` →
|
|
280
|
-
* {@link ExactAptosPaymentPayload} (`transaction` + `senderAuth`)
|
|
298
|
+
* {@link ExactAptosPaymentPayload} (`transaction` + `senderAuth`); `'near'` →
|
|
299
|
+
* {@link ExactNearPaymentPayload} (`signedDelegateAction`).
|
|
281
300
|
*/
|
|
282
301
|
type ParsedExactPayment = (ParsedExactBase & {
|
|
283
302
|
method: 'eip3009';
|
|
@@ -294,6 +313,9 @@ type ParsedExactPayment = (ParsedExactBase & {
|
|
|
294
313
|
}) | (ParsedExactBase & {
|
|
295
314
|
method: 'aptos';
|
|
296
315
|
payload: ExactAptosPaymentPayload;
|
|
316
|
+
}) | (ParsedExactBase & {
|
|
317
|
+
method: 'near';
|
|
318
|
+
payload: ExactNearPaymentPayload;
|
|
297
319
|
});
|
|
298
320
|
interface X402Receipt {
|
|
299
321
|
scheme: 'onchain-proof' | 'exact';
|
|
@@ -4313,10 +4335,10 @@ interface DiscoverySigner {
|
|
|
4313
4335
|
* chain-agnostic — it never names a family, it just merges `extra`.
|
|
4314
4336
|
*/
|
|
4315
4337
|
interface ExactRailInfo {
|
|
4316
|
-
method: 'eip3009' | 'permit2' | 'svm' | 'algorand' | 'aptos';
|
|
4338
|
+
method: 'eip3009' | 'permit2' | 'svm' | 'algorand' | 'aptos' | 'near';
|
|
4317
4339
|
/** Family-specific `extra` keys merged into the exact accept (e.g. `{ name, version }`
|
|
4318
4340
|
* for EVM EIP-3009, `{ feePayer, tokenProgram }` for Solana, `{ feePayer }` for
|
|
4319
|
-
* Algorand/Aptos). */
|
|
4341
|
+
* Algorand/Aptos/NEAR). */
|
|
4320
4342
|
extra?: Record<string, unknown>;
|
|
4321
4343
|
}
|
|
4322
4344
|
/**
|
|
@@ -6759,7 +6781,7 @@ interface KnownFacilitator {
|
|
|
6759
6781
|
/** The x402 schemes it settles (today only `exact`). */
|
|
6760
6782
|
schemes: ReadonlyArray<'exact'>;
|
|
6761
6783
|
/** The exact transfer methods it can settle on this network. */
|
|
6762
|
-
settles: ReadonlyArray<'eip3009' | 'permit2' | 'svm' | 'algorand' | 'aptos'>;
|
|
6784
|
+
settles: ReadonlyArray<'eip3009' | 'permit2' | 'svm' | 'algorand' | 'aptos' | 'near'>;
|
|
6763
6785
|
/** A short human note (who it is / caveat). */
|
|
6764
6786
|
note?: string;
|
|
6765
6787
|
}
|
|
@@ -6780,7 +6802,7 @@ declare function knownFacilitatorsFor(network: Caip2): ReadonlyArray<KnownFacili
|
|
|
6780
6802
|
* specific transfer `method`). Returns `undefined` when none is known — the `exact: true`
|
|
6781
6803
|
* shorthand branches on that to throw a coverage-specific guidance error.
|
|
6782
6804
|
*/
|
|
6783
|
-
declare function firstKeylessFacilitator(network: Caip2, method?: 'eip3009' | 'permit2' | 'svm' | 'algorand' | 'aptos'): KnownFacilitator | undefined;
|
|
6805
|
+
declare function firstKeylessFacilitator(network: Caip2, method?: 'eip3009' | 'permit2' | 'svm' | 'algorand' | 'aptos' | 'near'): KnownFacilitator | undefined;
|
|
6784
6806
|
|
|
6785
6807
|
/**
|
|
6786
6808
|
* Reliable receipt delivery — the durable webhook a stateless gate can't be.
|
package/dist/index.d.ts
CHANGED
|
@@ -94,8 +94,11 @@ interface X402ExactAcceptEntry {
|
|
|
94
94
|
* keyless facilitator) signs that fee txn + submits. **Aptos: `'aptos'`** — the payer signs a
|
|
95
95
|
* fee-payer (sponsored) `primary_fungible_store::transfer` to `payTo` (per
|
|
96
96
|
* `scheme_exact_aptos.md`); the gate (or a keyless facilitator) adds the fee-payer signature
|
|
97
|
-
* + submits, paying gas.
|
|
98
|
-
|
|
97
|
+
* + submits, paying gas. **NEAR: `'near'`** — the payer signs a NEP-366 `SignedDelegateAction`
|
|
98
|
+
* authorizing exactly one NEP-141 `ft_transfer` to `payTo` (per `scheme_exact_near.md`); a
|
|
99
|
+
* facilitator-selected relayer (`feePayer` below) prepays gas + the 1 yoctoNEAR and submits, so
|
|
100
|
+
* the buyer holds zero NEAR. PipRail self-settles ALL. */
|
|
101
|
+
assetTransferMethod: 'eip3009' | 'permit2' | 'svm' | 'algorand' | 'aptos' | 'near';
|
|
99
102
|
/** EIP-712 domain name of the token. OPTIONAL per the exact-EVM scheme (only
|
|
100
103
|
* `assetTransferMethod` is required) — a foreign rail may omit it. NEVER assumed
|
|
101
104
|
* from the symbol (USDC's on-chain name() is "USD Coin", not "USDC"); a PipRail gate
|
|
@@ -255,9 +258,24 @@ interface ExactAptosPaymentPayload {
|
|
|
255
258
|
/** Base64 BCS-serialized buyer (sender) `AccountAuthenticator`. */
|
|
256
259
|
senderAuth: string;
|
|
257
260
|
}
|
|
261
|
+
/**
|
|
262
|
+
* The `payload` a client sends for the **NEAR `exact`** variant, per `scheme_exact_near.md`:
|
|
263
|
+
* a base64-encoded, Borsh-serialized NEP-366 `SignedDelegateAction` whose single delegated action
|
|
264
|
+
* is one NEP-141 `ft_transfer` (to `payTo`, the exact `amount`, `deposit: 1` yoctoNEAR). The buyer
|
|
265
|
+
* signs the delegate action with a FULL-ACCESS key (a function-call key can't attach the 1 yocto and
|
|
266
|
+
* is rejected); a facilitator-selected relayer wraps it, prepays gas + the yocto, and submits. The
|
|
267
|
+
* signed delegate action IS the proof — there's no separate authorization object (the NEAR analogue
|
|
268
|
+
* of EIP-3009's `authorization` / SVM's `transaction`). Its single self-contained string field also
|
|
269
|
+
* distinguishes it from every other family's payload shape.
|
|
270
|
+
*/
|
|
271
|
+
interface ExactNearPaymentPayload {
|
|
272
|
+
/** Base64 of the Borsh-encoded NEP-366 `SignedDelegateAction` (one `ft_transfer`). */
|
|
273
|
+
signedDelegateAction: string;
|
|
274
|
+
}
|
|
258
275
|
/** Any `exact`-rail payload shape — EIP-3009 (`authorization`), Permit2 (`permit2Authorization`),
|
|
259
|
-
* SVM (`transaction`), Algorand (`paymentGroup`),
|
|
260
|
-
|
|
276
|
+
* SVM (`transaction`), Algorand (`paymentGroup`), Aptos (`transaction` + `senderAuth`), or NEAR
|
|
277
|
+
* (`signedDelegateAction`). */
|
|
278
|
+
type ExactPaymentPayloadAny = ExactPaymentPayload | Permit2PaymentPayload | ExactSvmPaymentPayload | ExactAlgorandPaymentPayload | ExactAptosPaymentPayload | ExactNearPaymentPayload;
|
|
261
279
|
interface ParsedExactBase {
|
|
262
280
|
x402Version: number;
|
|
263
281
|
/** The client's claimed network (slug or CAIP-2) — for matching, not trust. */
|
|
@@ -277,7 +295,8 @@ interface ParsedExactBase {
|
|
|
277
295
|
* (`authorization`), `'permit2'` → {@link Permit2PaymentPayload} (`permit2Authorization`),
|
|
278
296
|
* `'svm'` → {@link ExactSvmPaymentPayload} (`transaction`), `'algorand'` →
|
|
279
297
|
* {@link ExactAlgorandPaymentPayload} (`paymentGroup`); `'aptos'` →
|
|
280
|
-
* {@link ExactAptosPaymentPayload} (`transaction` + `senderAuth`)
|
|
298
|
+
* {@link ExactAptosPaymentPayload} (`transaction` + `senderAuth`); `'near'` →
|
|
299
|
+
* {@link ExactNearPaymentPayload} (`signedDelegateAction`).
|
|
281
300
|
*/
|
|
282
301
|
type ParsedExactPayment = (ParsedExactBase & {
|
|
283
302
|
method: 'eip3009';
|
|
@@ -294,6 +313,9 @@ type ParsedExactPayment = (ParsedExactBase & {
|
|
|
294
313
|
}) | (ParsedExactBase & {
|
|
295
314
|
method: 'aptos';
|
|
296
315
|
payload: ExactAptosPaymentPayload;
|
|
316
|
+
}) | (ParsedExactBase & {
|
|
317
|
+
method: 'near';
|
|
318
|
+
payload: ExactNearPaymentPayload;
|
|
297
319
|
});
|
|
298
320
|
interface X402Receipt {
|
|
299
321
|
scheme: 'onchain-proof' | 'exact';
|
|
@@ -4313,10 +4335,10 @@ interface DiscoverySigner {
|
|
|
4313
4335
|
* chain-agnostic — it never names a family, it just merges `extra`.
|
|
4314
4336
|
*/
|
|
4315
4337
|
interface ExactRailInfo {
|
|
4316
|
-
method: 'eip3009' | 'permit2' | 'svm' | 'algorand' | 'aptos';
|
|
4338
|
+
method: 'eip3009' | 'permit2' | 'svm' | 'algorand' | 'aptos' | 'near';
|
|
4317
4339
|
/** Family-specific `extra` keys merged into the exact accept (e.g. `{ name, version }`
|
|
4318
4340
|
* for EVM EIP-3009, `{ feePayer, tokenProgram }` for Solana, `{ feePayer }` for
|
|
4319
|
-
* Algorand/Aptos). */
|
|
4341
|
+
* Algorand/Aptos/NEAR). */
|
|
4320
4342
|
extra?: Record<string, unknown>;
|
|
4321
4343
|
}
|
|
4322
4344
|
/**
|
|
@@ -6759,7 +6781,7 @@ interface KnownFacilitator {
|
|
|
6759
6781
|
/** The x402 schemes it settles (today only `exact`). */
|
|
6760
6782
|
schemes: ReadonlyArray<'exact'>;
|
|
6761
6783
|
/** The exact transfer methods it can settle on this network. */
|
|
6762
|
-
settles: ReadonlyArray<'eip3009' | 'permit2' | 'svm' | 'algorand' | 'aptos'>;
|
|
6784
|
+
settles: ReadonlyArray<'eip3009' | 'permit2' | 'svm' | 'algorand' | 'aptos' | 'near'>;
|
|
6763
6785
|
/** A short human note (who it is / caveat). */
|
|
6764
6786
|
note?: string;
|
|
6765
6787
|
}
|
|
@@ -6780,7 +6802,7 @@ declare function knownFacilitatorsFor(network: Caip2): ReadonlyArray<KnownFacili
|
|
|
6780
6802
|
* specific transfer `method`). Returns `undefined` when none is known — the `exact: true`
|
|
6781
6803
|
* shorthand branches on that to throw a coverage-specific guidance error.
|
|
6782
6804
|
*/
|
|
6783
|
-
declare function firstKeylessFacilitator(network: Caip2, method?: 'eip3009' | 'permit2' | 'svm' | 'algorand' | 'aptos'): KnownFacilitator | undefined;
|
|
6805
|
+
declare function firstKeylessFacilitator(network: Caip2, method?: 'eip3009' | 'permit2' | 'svm' | 'algorand' | 'aptos' | 'near'): KnownFacilitator | undefined;
|
|
6784
6806
|
|
|
6785
6807
|
/**
|
|
6786
6808
|
* Reliable receipt delivery — the durable webhook a stateless gate can't be.
|