@piprail/sdk 2.2.0 → 2.4.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 +130 -1
- package/dist/algorand-TMA62DN2.cjs +678 -0
- package/dist/algorand-WB6PBJU4.js +678 -0
- package/dist/aptos-JQMZNTMD.cjs +673 -0
- package/dist/aptos-QAAXIUY3.js +673 -0
- package/dist/index.cjs +262 -86
- package/dist/index.d.cts +88 -26
- package/dist/index.d.ts +88 -26
- package/dist/index.js +255 -79
- package/dist/{solana-E4MD6JJ6.js → solana-3FMCWSEE.js} +20 -0
- package/dist/{solana-TLHL2KNY.cjs → solana-M3VOHCMO.cjs} +20 -0
- package/package.json +1 -1
- package/dist/algorand-GSFVZTBF.js +0 -389
- package/dist/algorand-HZS43N4P.cjs +0 -389
- package/dist/aptos-RIL56C7L.js +0 -352
- package/dist/aptos-TRCCJRZA.cjs +0 -352
package/CHANGELOG.md
CHANGED
|
@@ -4,7 +4,134 @@ 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.
|
|
7
|
+
## [2.4.0] — 2026-06-17 — gasless Algorand & Aptos rails + keyless gasless on SIX chains (incl. Algorand & BNB)
|
|
8
|
+
|
|
9
|
+
Additive and backward-compatible — defaults and the zero-config 402 stay byte-identical; pure-EVM
|
|
10
|
+
installs still never download a non-EVM library (Algorand and Aptos stay lazy-loaded — verified: the
|
|
11
|
+
built EVM bundle has zero static non-EVM imports, only lazy chunks).
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- **Algorand `exact` rail — gasless on a fourth family.** PipRail's `exact` scheme now covers Algorand
|
|
16
|
+
(ASAs) alongside EVM and Solana, via the ratified `scheme_exact_algo`. The buyer signs an ASA
|
|
17
|
+
`axfer` to `payTo` at **fee 0**, atomically grouped with a 0-ALGO `pay` whose pooled fee covers the
|
|
18
|
+
group; the sponsor (the merchant's relayer in self-settle, or a keyless facilitator) signs the fee
|
|
19
|
+
txn and submits — the buyer spends **zero ALGO**. New `payExactAlgorand` / `verifyAndSettleExactAlgorand`
|
|
20
|
+
driver functions; `resolveExactRail` / `payExact` / `settleExactSelf` are now implemented for the
|
|
21
|
+
Algorand family. **Live-proven on Algorand mainnet** (self-settle round-trip, buyer paid 0 ALGO).
|
|
22
|
+
Unlike Solana, **`feePayer === payTo` is allowed** (the fee txn is separate — no isolation rule), so
|
|
23
|
+
a single merchant account can self-settle. Native ALGO stays `onchain-proof`-only.
|
|
24
|
+
- **Aptos `exact` rail — gasless on a fifth family.** PipRail's `exact` scheme now also covers Aptos
|
|
25
|
+
(Fungible Assets), via the ratified `scheme_exact_aptos`. The buyer builds a fee-payer (sponsored,
|
|
26
|
+
AIP-39) `0x1::primary_fungible_store::transfer` to `payTo` and signs **only the sender slot** — spending
|
|
27
|
+
**zero APT**; the sponsor (the merchant's relayer in self-settle, or a keyless facilitator) adds the
|
|
28
|
+
fee-payer signature and submits, paying the sub-cent gas. It's **one-shot** (no gas-station round-trip,
|
|
29
|
+
unlike Sui's sponsorship — which is why Aptos fits PipRail's backendless model and Sui's gasless path
|
|
30
|
+
doesn't). New `payExactAptos` / `verifyAndSettleExactAptos` driver functions; `resolveExactRail` /
|
|
31
|
+
`payExact` / `settleExactSelf` are now implemented for the Aptos family; the seller verifies by
|
|
32
|
+
**decoding the entry function** and binding the FA metadata/recipient/amount to its trusted rail, caps
|
|
33
|
+
the fee payer's gas exposure, and verifies the sender signature off-chain before settling.
|
|
34
|
+
**Live-proven on Aptos mainnet** (self-settle round-trip, buyer paid 0 APT). Like Algorand,
|
|
35
|
+
**`feePayer === payTo` is allowed**. Any Fungible Asset (USDC + USD₮) is gasless; native APT stays
|
|
36
|
+
`onchain-proof`-only.
|
|
37
|
+
- **`exact: true` zero-config gasless now spans SIX chains** — Base, **BNB**, HyperEVM, Monad, Solana,
|
|
38
|
+
and **Algorand** — where a **keyless facilitator sponsors gas for *both* sides** (neither buyer nor
|
|
39
|
+
merchant pays). Each `KNOWN_FACILITATORS` row was added only after a real mainnet keyless settle (THE
|
|
40
|
+
RULE), all 2026-06-17:
|
|
41
|
+
- **Algorand** (`algorand:wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=`) — **new keyless chain, the
|
|
42
|
+
first non-EVM/non-Solana one**, via **GoPlausible** (the only keyless Algorand x402 facilitator).
|
|
43
|
+
Atomic-group fee pooling: the sponsor pools the whole group fee, so the **buyer AND the merchant both
|
|
44
|
+
pay 0 ALGO** (tx `PDVDVRFGJAG2K6AJ7L26OTSCSRL7AURVKEX4D4KHBAOLNSCYENXA`).
|
|
45
|
+
- **BNB** (`eip155:56`) — **new keyless chain** via **Dexter** + **Pieverse**, settling the EIP-3009
|
|
46
|
+
tokens **FDUSD/USD1** (BNB's Binance-Peg USDC/USDT are Permit2 → not facilitator-settleable; Dexter
|
|
47
|
+
has a ~$0.003 floor). This beats the BNB token-overlap wall that blocks AEON.
|
|
48
|
+
- **Monad** (`eip155:143`) — **Corbits** + **Ultravioleta DAO** + **Pieverse** (3 facilitators).
|
|
49
|
+
- **HyperEVM** (`eip155:999`) — **Ultravioleta DAO**.
|
|
50
|
+
- **Base** (`eip155:8453`) — PayAI + xpay + **Ultravioleta DAO** + **Dexter** + **Corbits** +
|
|
51
|
+
**GoPlausible** (6 facilitators → automatic failover).
|
|
52
|
+
- **Solana** — PayAI + OpenFacilitator + Corbits (SVM).
|
|
53
|
+
Ultravioleta DAO (the broadest endpoint — 18 PipRail networks) is live-validated on **3** chains
|
|
54
|
+
(HyperEVM, Base, Monad); **GoPlausible** on **2** (Algorand, Base). As more chains are funded the same
|
|
55
|
+
sweep seeds them — **9 more EVM chains have a keyless facilitator awaiting funding** (Polygon, Arbitrum,
|
|
56
|
+
Optimism, Avalanche, Ethereum, Celo, Unichain, Scroll, Sei).
|
|
57
|
+
- The `exact` transfer-method union (`ExactRailInfo.method`, `KnownFacilitator.settles`,
|
|
58
|
+
`assetTransferMethod`, the parsed-payment + wire types) now includes **`'algorand'`** and **`'aptos'`**,
|
|
59
|
+
and two new wire payloads are parsed/validated: `ExactAlgorandPaymentPayload` (`{ paymentIndex,
|
|
60
|
+
paymentGroup }`) and `ExactAptosPaymentPayload` (`{ transaction, senderAuth }`).
|
|
61
|
+
|
|
62
|
+
### Changed
|
|
63
|
+
|
|
64
|
+
- The gate's facilitator-settle path forwards the sponsor `feePayer` for Algorand and Aptos (as it
|
|
65
|
+
already does for Solana), and the replay claim canonicalizes the Algorand `paymentGroup` and the Aptos
|
|
66
|
+
`{ transaction, senderAuth }` (so a base64-malleated re-submission of the same payment can't slip past
|
|
67
|
+
the used-proof set). All additive — EVM/Solana behaviour is unchanged.
|
|
68
|
+
- **Algorand's CAIP-2 is now the FULL 44-char base64 genesis hash**
|
|
69
|
+
(`algorand:wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=`, was a 32-char prefix) — the exact form the
|
|
70
|
+
ratified x402 Algorand scheme and its facilitators (GoPlausible) use, so a facilitator-settled rail
|
|
71
|
+
interops on the wire and `fetchFacilitatorFeePayer` auto-matches. The on-chain `exact` group is
|
|
72
|
+
**byte-identical** (GoPlausible accepts PipRail's group as-is — the gate already sends the `amount`
|
|
73
|
+
field it needs); self-settle is **behaviour-neutral** (re-proven live on mainnet). Safe because 2.4.0
|
|
74
|
+
is unreleased, so no published version emitted the prefix form.
|
|
75
|
+
- `verifyExact` now matches a v2 `exact` payment's CAIP-2 network **family-agnostically** (any
|
|
76
|
+
`namespace:reference`, not just `eip155:`), so a foreign non-EVM v2 payment (`solana:…`/`algorand:…`/
|
|
77
|
+
`aptos:…`) routes precisely by network on a multi-rail gate instead of relying on the asset filter.
|
|
78
|
+
PipRail's own buyer (which always echoes the asset) is unaffected.
|
|
79
|
+
|
|
80
|
+
### Security
|
|
81
|
+
|
|
82
|
+
A pre-release adversarial sweep of every `exact` rail found — and this release fixes — a **sponsor
|
|
83
|
+
fee-drain** class on the two rails where the buyer constructs a fee/gas parameter the gate co-signs and
|
|
84
|
+
submits from the sponsor's balance (the keyless facilitator, or the merchant's self-settle relayer). In
|
|
85
|
+
both cases the buyer signs a valid, correctly-bound transfer, so every other check (recipient, amount,
|
|
86
|
+
asset, fee-payer isolation) passed and simulation succeeded — only the fee magnitude was unbounded. Both
|
|
87
|
+
now cap it, mirroring the Aptos rail's existing gas caps. Neither shipped in a released version (the
|
|
88
|
+
Algorand/Aptos rails are new in 2.4.0; the Solana cap hardens a rail first released in 2.x), and both are
|
|
89
|
+
covered by a new red-then-green adversarial test.
|
|
90
|
+
|
|
91
|
+
- **Algorand** (`drivers/algorand/exact.ts`): the seller co-signed the buyer-supplied pooled-fee `pay`
|
|
92
|
+
txn **without bounding its fee**. A malicious buyer could name the sponsor as fee payer and set an
|
|
93
|
+
arbitrarily large fee, draining it for a sub-cent transfer. Fixed with `MAX_GROUP_FEE` (20 000 µALGO,
|
|
94
|
+
~10× the honest `minFee × 2`).
|
|
95
|
+
- **Solana** (`drivers/solana/exact.ts`): the seller did not bound the **compute-unit limit/price**
|
|
96
|
+
(the priority fee the fee payer pays). A malicious buyer could set a huge `setComputeUnitLimit` ×
|
|
97
|
+
`setComputeUnitPrice` and drain the sponsor's SOL (Solana's max budget makes this multi-SOL per
|
|
98
|
+
request). Fixed with `MAX_COMPUTE_UNIT_LIMIT` (300 000) + `MAX_COMPUTE_UNIT_PRICE_MICROLAMPORTS`
|
|
99
|
+
(100 000), enforced before co-signing — worst case ≈ 0.00003 SOL, vs the canonical 20 000-unit @
|
|
100
|
+
1-µlamport path.
|
|
101
|
+
- EVM (EIP-3009 / Permit2) and Aptos were reviewed and found **not** exposed: EVM derives gas at
|
|
102
|
+
broadcast (never from the buyer payload), and Aptos already caps gas. The fee-payer drain guards are
|
|
103
|
+
now consistent across all four rails.
|
|
104
|
+
|
|
105
|
+
## [2.3.0] — 2026-06-17 — `exact: true` zero-config gasless gate
|
|
106
|
+
|
|
107
|
+
Additive and backward-compatible — defaults and the zero-config 402 stay byte-identical. A new
|
|
108
|
+
opt-in shorthand makes the gasless `exact` rail one line, and it degrades gracefully instead of
|
|
109
|
+
breaking when no facilitator covers a chain.
|
|
110
|
+
|
|
111
|
+
### Added
|
|
112
|
+
|
|
113
|
+
- **`exact: true` on `requirePayment` / `createPaymentGate` — zero-config gasless.** Equivalent to
|
|
114
|
+
`exact: { settle: 'keyless' }`: the gate auto-advertises a gasless `exact` rail and, at settle
|
|
115
|
+
time, picks the first known **keyless** (no-API-key) facilitator for the chain from the built-in
|
|
116
|
+
`KNOWN_FACILITATORS` map, so buyers pay no gas and the merchant runs no relayer. One line, no
|
|
117
|
+
facilitator URL, no relayer key.
|
|
118
|
+
- **`ExactRailOption.settle` accepts `'keyless'`** alongside `'self'` and `{ facilitator }`, and
|
|
119
|
+
`exact` accepts `boolean | ExactRailOption`. The boolean shorthand normalizes to
|
|
120
|
+
`{ settle: 'keyless' }`.
|
|
121
|
+
|
|
122
|
+
### Changed
|
|
123
|
+
|
|
124
|
+
- **Graceful degrade for the soft path.** When `exact: true` (or `settle: 'keyless'`) is set but no
|
|
125
|
+
keyless facilitator covers the offered chain, the gate **does not throw** — it logs a clear,
|
|
126
|
+
production-visible warning and serves the `onchain-proof` floor (buyers pay their own gas), so a
|
|
127
|
+
resource never goes dark over a coverage gap. An **explicit** `settle: 'self'` or
|
|
128
|
+
`settle: { facilitator }` still throws on a coverage gap (you asked for a specific rail; a silent
|
|
129
|
+
fallback would hide a misconfiguration). Suppress the soft-path hints with `PIPRAIL_NO_HINTS=1`.
|
|
130
|
+
- **A failed gasless settlement returns a clear fallback hint.** When a facilitator settle fails at
|
|
131
|
+
pay time, the 502 body now carries a `fallback` field telling the caller the resource also accepts
|
|
132
|
+
`onchain-proof` — retry by paying that rail yourself.
|
|
133
|
+
|
|
134
|
+
|
|
8
135
|
|
|
9
136
|
Both changes are additive and backward-compatible — defaults and the zero-config 402 stay
|
|
10
137
|
byte-identical; only previously-skipped cases become newly handled.
|
|
@@ -1220,6 +1347,8 @@ straight into your wallet. The API is small and self-contained.
|
|
|
1220
1347
|
to your wallet; PipRail never holds funds.
|
|
1221
1348
|
- `viem ^2.21` is a peer dependency. Node 20+ or a modern browser.
|
|
1222
1349
|
|
|
1350
|
+
[2.4.0]: https://www.npmjs.com/package/@piprail/sdk
|
|
1351
|
+
[2.3.0]: https://www.npmjs.com/package/@piprail/sdk
|
|
1223
1352
|
[2.2.0]: https://www.npmjs.com/package/@piprail/sdk
|
|
1224
1353
|
[2.1.1]: https://www.npmjs.com/package/@piprail/sdk
|
|
1225
1354
|
[2.1.0]: https://www.npmjs.com/package/@piprail/sdk
|