@piprail/sdk 1.8.0 → 1.9.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/CHAINS.md +5 -3
- package/CHANGELOG.md +17 -0
- package/README.md +3 -0
- package/dist/index.cjs +12 -0
- package/dist/index.d.cts +58 -4
- package/dist/index.d.ts +58 -4
- package/dist/index.js +12 -0
- package/package.json +2 -2
package/CHAINS.md
CHANGED
|
@@ -13,7 +13,7 @@ read those sections before you ship them.
|
|
|
13
13
|
|
|
14
14
|
| Chain(s) | Pay in native coin? | Built-in stablecoins | Receiver needs setup? | Wallet input |
|
|
15
15
|
|---|:--:|---|---|---|
|
|
16
|
-
| **EVM** (Ethereum, Base, Arbitrum, Optimism, Polygon, BNB, Avalanche, Mantle, Sonic, Linea, Scroll, Celo, zkSync, Unichain, World Chain, Sei, Injective, HyperEVM, Monad, + any EVM chain) | ✅ ETH/BNB/POL/… | USDC (all) · USDT (all **except Base, World Chain, Sei, HyperEVM, Monad**) | No | `{ privateKey }` |
|
|
16
|
+
| **EVM** (Ethereum, Base, Arbitrum, Optimism, Polygon, BNB, Avalanche, Mantle, Sonic, Linea, Scroll, Celo, zkSync, Unichain, World Chain, Sei, Injective, HyperEVM, Monad, Kaia, + any EVM chain) | ✅ ETH/BNB/POL/… | USDC (all **except Kaia**) · USDT (all **except Base, World Chain, Sei, HyperEVM, Monad**) | No | `{ privateKey }` |
|
|
17
17
|
| **Solana** | ✅ SOL | USDC · USDT | No (payer creates the recipient's token account) | `{ secretKey }` |
|
|
18
18
|
| **Sui** | ✅ SUI | USDC (no USDT) | No | `{ privateKey }` (`suiprivkey1…`) |
|
|
19
19
|
| **Aptos** | ✅ APT | USDC · USDT | No (primary FA store auto-creates) | `{ privateKey }` (`ed25519-priv-0x…`) |
|
|
@@ -45,9 +45,11 @@ read those sections before you ship them.
|
|
|
45
45
|
|
|
46
46
|
### EVM — Ethereum, Base, Arbitrum, Optimism, Polygon, BNB, Avalanche, …
|
|
47
47
|
- **Pay in:** native coin (`'native'`), `'USDC'`, `'USDT'`, or a custom `{ address, decimals }`.
|
|
48
|
-
- **USDT gap:** built in on every preset **except Base, World Chain, Sei, HyperEVM, and Monad** (USDC only there).
|
|
48
|
+
- **USDT gap:** built in on every preset **except Base, World Chain, Sei, HyperEVM, and Monad** (USDC only there). **Kaia** is the inverse — **USD₮ only** (no Circle-native USDC on Kaia).
|
|
49
49
|
- **Decimals:** on **BNB Chain**, Binance-Peg USDC/USDT are **18 decimals**, not 6 (the SDK handles it; don't hardcode 6).
|
|
50
|
-
- **
|
|
50
|
+
- **Stablecoin provenance — issuer-native vs bridged (every shipped address verified on-chain 2026-06-08, incl. bridge markers).** Every address is the correct, canonical, 1:1-redeemable dollar token on its chain; what varies is *who issues it*. You request it as `'USDC'` / `'USDT'` either way — provenance matters only if you specifically require issuer-native settlement.
|
|
51
|
+
- **USDC** is **Circle-native** on every preset **except** **BNB** (Binance-Peg, 18-dp), **Mantle** (OP canonical-bridge), and **Scroll** (Bridged-USDC-Standard) — the last two are backed 1:1 by Circle USDC on Ethereum but are **not** Circle-issued on that chain (absent from Circle's native-USDC list).
|
|
52
|
+
- **USDT** is **Tether-native** on **Ethereum, Avalanche, Celo, Kaia** (EVM) and **Solana, Tron, TON, NEAR, Aptos** (non-EVM). Everywhere else it's bridged: **USDT0** (LayerZero omnichain, on-chain `symbol()` = `USD₮0`) on **Arbitrum, Polygon, Unichain**; a **canonical-bridge** token (chain-minted, backed by Tether's Ethereum USDT — not Tether-issued) on **Optimism, zkSync, Sonic, Linea, Injective, Mantle, Scroll**; and **Binance-Peg** (18-dp) on **BNB**. The on-chain `symbol()` may read `USDT`, `USD₮`, `USDt`, or `USD₮0`; all resolve via `token: 'USDT'`.
|
|
51
53
|
- **Receiver setup:** none — any `0x…` address receives ERC-20 or native immediately.
|
|
52
54
|
- **Any other EVM chain:** pass a viem `Chain` or `{ id, rpcUrl }` + `token: { address, decimals }`.
|
|
53
55
|
|
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,22 @@ 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
|
+
## [1.9.0] — 2026-06-08
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
- **Kaia** (ex-Klaytn, chainId 8217) — EVM preset for South Korea's stablecoin-settlement chain
|
|
11
|
+
(born from Kakao + LINE). Pay **native KAIA** or **Tether-native USD₮**
|
|
12
|
+
(`0xd077A400968890Eacc75cdc901F0356c943e4fDb`, verified on-chain: symbol `USD₮`, name
|
|
13
|
+
"Tether USD", 6 dp, no bridge markers). Circle issues no native USDC on Kaia, so USDC is
|
|
14
|
+
intentionally omitted (pass it as a custom token if you need a bridged one). Brings the built-in
|
|
15
|
+
set to **29 chains across 10 families** (20 EVM mainnets).
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
- **CHAINS.md — verified stablecoin provenance.** Now documents, per chain, whether the shipped
|
|
19
|
+
USDC/USDT is issuer-native, **USDT0** (LayerZero), a **canonical-bridge** token, or **Binance-Peg** —
|
|
20
|
+
every address re-verified on-chain. Documentation only; no code or behaviour change, all tokens
|
|
21
|
+
unchanged.
|
|
22
|
+
|
|
7
23
|
## [1.8.0] — 2026-06-06
|
|
8
24
|
|
|
9
25
|
### Added
|
|
@@ -492,6 +508,7 @@ straight into your wallet. The API is small and self-contained.
|
|
|
492
508
|
to your wallet; PipRail never holds funds.
|
|
493
509
|
- `viem ^2.21` is a peer dependency. Node 20+ or a modern browser.
|
|
494
510
|
|
|
511
|
+
[1.9.0]: https://www.npmjs.com/package/@piprail/sdk
|
|
495
512
|
[1.8.0]: https://www.npmjs.com/package/@piprail/sdk
|
|
496
513
|
[1.7.0]: https://www.npmjs.com/package/@piprail/sdk
|
|
497
514
|
[1.6.0]: https://www.npmjs.com/package/@piprail/sdk
|
package/README.md
CHANGED
|
@@ -272,6 +272,7 @@ Every token address below was verified on-chain (symbol + decimals) before shipp
|
|
|
272
272
|
| `'injective'` | Injective | USDC, USDT |
|
|
273
273
|
| `'hyperevm'` | HyperEVM (Hyperliquid) | USDC |
|
|
274
274
|
| `'monad'` | Monad | USDC |
|
|
275
|
+
| `'kaia'` | Kaia (ex-Klaytn) | USDT |
|
|
275
276
|
| `'solana'` | Solana | USDC, USDT |
|
|
276
277
|
| `'ton'` | TON | USDT |
|
|
277
278
|
| `'tron'` | Tron | USDT |
|
|
@@ -507,6 +508,8 @@ Agent Your server
|
|
|
507
508
|
|
|
508
509
|
Verification is local and confirms the transaction **succeeded, is recent, and actually moved the required amount of the right token to `payTo`** — then your handler runs and returns the data. The same proof can't be redeemed twice. **Self-custody throughout:** the payer signs and broadcasts their own transfer straight to your wallet; PipRail never holds funds and never takes a cut of a payment.
|
|
509
510
|
|
|
511
|
+
It's a **pull** model: the caller hands you the exact tx ref in the `payment-signature` header, so `verify()` does a **targeted lookup on your own RPC** and answers **synchronously, in the same request** — no chain listener, no indexer, no accounts DB, no async notify. Why that matters vs. "just send a raw transfer" — with runnable proof and an honest scorecard — is laid out in [`examples/why-402/`](../examples/why-402/) (and the [root README](../README.md#-why-402-and-not-just-a-raw-transfer)).
|
|
512
|
+
|
|
510
513
|
## Receipts — record every payment
|
|
511
514
|
|
|
512
515
|
Every verified payment produces an `X402Receipt` with exactly what you'd persist — the on-chain tx ref, who paid, the amount, and the token. The SDK stays **database-free**; it hands you the data and you store it however you like.
|
package/dist/index.cjs
CHANGED
|
@@ -85,6 +85,7 @@ var _viem = require('viem');
|
|
|
85
85
|
|
|
86
86
|
|
|
87
87
|
|
|
88
|
+
|
|
88
89
|
|
|
89
90
|
|
|
90
91
|
var _chains = require('viem/chains');
|
|
@@ -236,6 +237,17 @@ var CHAINS = {
|
|
|
236
237
|
tokens: {
|
|
237
238
|
USDC: { address: "0x754704Bc059F8C67012fEd69BC8A327a5aafb603", decimals: 6, symbol: "USDC" }
|
|
238
239
|
}
|
|
240
|
+
},
|
|
241
|
+
// Kaia (ex-Klaytn, chainId 8217) — Tether-native USD₮ verified on-chain 2026-06-08
|
|
242
|
+
// (0xd077…4fDb: symbol "USD₮", name "Tether USD", 6 dp, no bridge markers). Circle issues
|
|
243
|
+
// NO native USDC on Kaia (absent from Circle's list), so USDC is intentionally omitted —
|
|
244
|
+
// pay native KAIA or USD₮ (or pass a custom { address, decimals }). Asia's stablecoin-
|
|
245
|
+
// settlement chain, born from Kakao + LINE.
|
|
246
|
+
kaia: {
|
|
247
|
+
chain: _chains.kaia,
|
|
248
|
+
tokens: {
|
|
249
|
+
USDT: { address: "0xd077A400968890Eacc75cdc901F0356c943e4fDb", decimals: 6, symbol: "USDT" }
|
|
250
|
+
}
|
|
239
251
|
}
|
|
240
252
|
};
|
|
241
253
|
function isViemChain(input) {
|
package/dist/index.d.cts
CHANGED
|
@@ -838,7 +838,7 @@ declare const CHAINS: {
|
|
|
838
838
|
gasPrice: bigint;
|
|
839
839
|
maxFeePerBlobGas?: undefined | undefined;
|
|
840
840
|
maxFeePerGas?: undefined | undefined;
|
|
841
|
-
maxPriorityFeePerGas
|
|
841
|
+
maxPriorityFeePerGas?: undefined | undefined;
|
|
842
842
|
isSystemTx?: undefined | undefined;
|
|
843
843
|
mint?: undefined | undefined;
|
|
844
844
|
sourceHash?: undefined | undefined;
|
|
@@ -3340,9 +3340,7 @@ declare const CHAINS: {
|
|
|
3340
3340
|
value: bigint;
|
|
3341
3341
|
yParity: number;
|
|
3342
3342
|
accessList: viem.AccessList;
|
|
3343
|
-
authorizationList
|
|
3344
|
-
/** JSON-RPC endpoint. */
|
|
3345
|
-
? /** JSON-RPC endpoint. */: undefined | undefined;
|
|
3343
|
+
authorizationList?: undefined | undefined;
|
|
3346
3344
|
blobVersionedHashes?: undefined | undefined;
|
|
3347
3345
|
chainId: number;
|
|
3348
3346
|
type: "eip2930";
|
|
@@ -3732,6 +3730,62 @@ declare const CHAINS: {
|
|
|
3732
3730
|
};
|
|
3733
3731
|
};
|
|
3734
3732
|
};
|
|
3733
|
+
kaia: {
|
|
3734
|
+
chain: {
|
|
3735
|
+
blockExplorers: {
|
|
3736
|
+
readonly default: {
|
|
3737
|
+
readonly name: "KaiaScan";
|
|
3738
|
+
readonly url: "https://kaiascan.io";
|
|
3739
|
+
readonly apiUrl: "https://api-cypress.klaytnscope.com/api";
|
|
3740
|
+
};
|
|
3741
|
+
};
|
|
3742
|
+
blockTime?: number | undefined | undefined;
|
|
3743
|
+
contracts: {
|
|
3744
|
+
readonly multicall3: {
|
|
3745
|
+
readonly address: "0xcA11bde05977b3631167028862bE2a173976CA11";
|
|
3746
|
+
readonly blockCreated: 96002415;
|
|
3747
|
+
};
|
|
3748
|
+
};
|
|
3749
|
+
ensTlds?: readonly string[] | undefined;
|
|
3750
|
+
id: 8217;
|
|
3751
|
+
name: "Kaia";
|
|
3752
|
+
nativeCurrency: {
|
|
3753
|
+
readonly decimals: 18;
|
|
3754
|
+
readonly name: "Kaia";
|
|
3755
|
+
readonly symbol: "KAIA";
|
|
3756
|
+
};
|
|
3757
|
+
experimental_preconfirmationTime?: number | undefined | undefined;
|
|
3758
|
+
rpcUrls: {
|
|
3759
|
+
readonly default: {
|
|
3760
|
+
readonly http: readonly ["https://public-en.node.kaia.io"];
|
|
3761
|
+
};
|
|
3762
|
+
};
|
|
3763
|
+
sourceId?: number | undefined | undefined;
|
|
3764
|
+
testnet?: boolean | undefined | undefined;
|
|
3765
|
+
custom?: Record<string, unknown> | undefined;
|
|
3766
|
+
extendSchema?: Record<string, unknown> | undefined;
|
|
3767
|
+
fees?: viem.ChainFees<undefined> | undefined;
|
|
3768
|
+
formatters?: undefined;
|
|
3769
|
+
prepareTransactionRequest?: ((args: viem.PrepareTransactionRequestParameters, options: {
|
|
3770
|
+
client: viem.Client;
|
|
3771
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
3772
|
+
}) => Promise<viem.PrepareTransactionRequestParameters>) | [fn: ((args: viem.PrepareTransactionRequestParameters, options: {
|
|
3773
|
+
client: viem.Client;
|
|
3774
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
3775
|
+
}) => Promise<viem.PrepareTransactionRequestParameters>) | undefined, options: {
|
|
3776
|
+
runAt: readonly ("beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters")[];
|
|
3777
|
+
}] | undefined;
|
|
3778
|
+
serializers?: viem.ChainSerializers<undefined, viem.TransactionSerializable> | undefined;
|
|
3779
|
+
verifyHash?: ((client: viem.Client, parameters: viem.VerifyHashActionParameters) => Promise<viem.VerifyHashActionReturnType>) | undefined;
|
|
3780
|
+
};
|
|
3781
|
+
tokens: {
|
|
3782
|
+
USDT: {
|
|
3783
|
+
address: "0xd077A400968890Eacc75cdc901F0356c943e4fDb";
|
|
3784
|
+
decimals: number;
|
|
3785
|
+
symbol: string;
|
|
3786
|
+
};
|
|
3787
|
+
};
|
|
3788
|
+
};
|
|
3735
3789
|
};
|
|
3736
3790
|
/** A built-in EVM chain name. */
|
|
3737
3791
|
type ChainName = keyof typeof CHAINS;
|
package/dist/index.d.ts
CHANGED
|
@@ -838,7 +838,7 @@ declare const CHAINS: {
|
|
|
838
838
|
gasPrice: bigint;
|
|
839
839
|
maxFeePerBlobGas?: undefined | undefined;
|
|
840
840
|
maxFeePerGas?: undefined | undefined;
|
|
841
|
-
maxPriorityFeePerGas
|
|
841
|
+
maxPriorityFeePerGas?: undefined | undefined;
|
|
842
842
|
isSystemTx?: undefined | undefined;
|
|
843
843
|
mint?: undefined | undefined;
|
|
844
844
|
sourceHash?: undefined | undefined;
|
|
@@ -3340,9 +3340,7 @@ declare const CHAINS: {
|
|
|
3340
3340
|
value: bigint;
|
|
3341
3341
|
yParity: number;
|
|
3342
3342
|
accessList: viem.AccessList;
|
|
3343
|
-
authorizationList
|
|
3344
|
-
/** JSON-RPC endpoint. */
|
|
3345
|
-
? /** JSON-RPC endpoint. */: undefined | undefined;
|
|
3343
|
+
authorizationList?: undefined | undefined;
|
|
3346
3344
|
blobVersionedHashes?: undefined | undefined;
|
|
3347
3345
|
chainId: number;
|
|
3348
3346
|
type: "eip2930";
|
|
@@ -3732,6 +3730,62 @@ declare const CHAINS: {
|
|
|
3732
3730
|
};
|
|
3733
3731
|
};
|
|
3734
3732
|
};
|
|
3733
|
+
kaia: {
|
|
3734
|
+
chain: {
|
|
3735
|
+
blockExplorers: {
|
|
3736
|
+
readonly default: {
|
|
3737
|
+
readonly name: "KaiaScan";
|
|
3738
|
+
readonly url: "https://kaiascan.io";
|
|
3739
|
+
readonly apiUrl: "https://api-cypress.klaytnscope.com/api";
|
|
3740
|
+
};
|
|
3741
|
+
};
|
|
3742
|
+
blockTime?: number | undefined | undefined;
|
|
3743
|
+
contracts: {
|
|
3744
|
+
readonly multicall3: {
|
|
3745
|
+
readonly address: "0xcA11bde05977b3631167028862bE2a173976CA11";
|
|
3746
|
+
readonly blockCreated: 96002415;
|
|
3747
|
+
};
|
|
3748
|
+
};
|
|
3749
|
+
ensTlds?: readonly string[] | undefined;
|
|
3750
|
+
id: 8217;
|
|
3751
|
+
name: "Kaia";
|
|
3752
|
+
nativeCurrency: {
|
|
3753
|
+
readonly decimals: 18;
|
|
3754
|
+
readonly name: "Kaia";
|
|
3755
|
+
readonly symbol: "KAIA";
|
|
3756
|
+
};
|
|
3757
|
+
experimental_preconfirmationTime?: number | undefined | undefined;
|
|
3758
|
+
rpcUrls: {
|
|
3759
|
+
readonly default: {
|
|
3760
|
+
readonly http: readonly ["https://public-en.node.kaia.io"];
|
|
3761
|
+
};
|
|
3762
|
+
};
|
|
3763
|
+
sourceId?: number | undefined | undefined;
|
|
3764
|
+
testnet?: boolean | undefined | undefined;
|
|
3765
|
+
custom?: Record<string, unknown> | undefined;
|
|
3766
|
+
extendSchema?: Record<string, unknown> | undefined;
|
|
3767
|
+
fees?: viem.ChainFees<undefined> | undefined;
|
|
3768
|
+
formatters?: undefined;
|
|
3769
|
+
prepareTransactionRequest?: ((args: viem.PrepareTransactionRequestParameters, options: {
|
|
3770
|
+
client: viem.Client;
|
|
3771
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
3772
|
+
}) => Promise<viem.PrepareTransactionRequestParameters>) | [fn: ((args: viem.PrepareTransactionRequestParameters, options: {
|
|
3773
|
+
client: viem.Client;
|
|
3774
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
3775
|
+
}) => Promise<viem.PrepareTransactionRequestParameters>) | undefined, options: {
|
|
3776
|
+
runAt: readonly ("beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters")[];
|
|
3777
|
+
}] | undefined;
|
|
3778
|
+
serializers?: viem.ChainSerializers<undefined, viem.TransactionSerializable> | undefined;
|
|
3779
|
+
verifyHash?: ((client: viem.Client, parameters: viem.VerifyHashActionParameters) => Promise<viem.VerifyHashActionReturnType>) | undefined;
|
|
3780
|
+
};
|
|
3781
|
+
tokens: {
|
|
3782
|
+
USDT: {
|
|
3783
|
+
address: "0xd077A400968890Eacc75cdc901F0356c943e4fDb";
|
|
3784
|
+
decimals: number;
|
|
3785
|
+
symbol: string;
|
|
3786
|
+
};
|
|
3787
|
+
};
|
|
3788
|
+
};
|
|
3735
3789
|
};
|
|
3736
3790
|
/** A built-in EVM chain name. */
|
|
3737
3791
|
type ChainName = keyof typeof CHAINS;
|
package/dist/index.js
CHANGED
|
@@ -75,6 +75,7 @@ import {
|
|
|
75
75
|
celo,
|
|
76
76
|
hyperEvm,
|
|
77
77
|
injective,
|
|
78
|
+
kaia,
|
|
78
79
|
linea,
|
|
79
80
|
mainnet,
|
|
80
81
|
mantle,
|
|
@@ -236,6 +237,17 @@ var CHAINS = {
|
|
|
236
237
|
tokens: {
|
|
237
238
|
USDC: { address: "0x754704Bc059F8C67012fEd69BC8A327a5aafb603", decimals: 6, symbol: "USDC" }
|
|
238
239
|
}
|
|
240
|
+
},
|
|
241
|
+
// Kaia (ex-Klaytn, chainId 8217) — Tether-native USD₮ verified on-chain 2026-06-08
|
|
242
|
+
// (0xd077…4fDb: symbol "USD₮", name "Tether USD", 6 dp, no bridge markers). Circle issues
|
|
243
|
+
// NO native USDC on Kaia (absent from Circle's list), so USDC is intentionally omitted —
|
|
244
|
+
// pay native KAIA or USD₮ (or pass a custom { address, decimals }). Asia's stablecoin-
|
|
245
|
+
// settlement chain, born from Kakao + LINE.
|
|
246
|
+
kaia: {
|
|
247
|
+
chain: kaia,
|
|
248
|
+
tokens: {
|
|
249
|
+
USDT: { address: "0xd077A400968890Eacc75cdc901F0356c943e4fDb", decimals: 6, symbol: "USDT" }
|
|
250
|
+
}
|
|
239
251
|
}
|
|
240
252
|
};
|
|
241
253
|
function isViemChain(input) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@piprail/sdk",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Accept x402 crypto payments across
|
|
3
|
+
"version": "1.9.0",
|
|
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",
|
|
7
7
|
"module": "./dist/index.js",
|