@piprail/sdk 1.7.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 +31 -0
- package/README.md +19 -3
- package/dist/index.cjs +54 -0
- package/dist/index.d.cts +80 -5
- package/dist/index.d.ts +80 -5
- package/dist/index.js +54 -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,35 @@ 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
|
+
|
|
23
|
+
## [1.8.0] — 2026-06-06
|
|
24
|
+
|
|
25
|
+
### Added
|
|
26
|
+
- **Agent tool annotations.** Each of the five `paymentTools(client)` descriptors now carries an
|
|
27
|
+
advisory `annotations` object (MCP-style `ToolAnnotations`: `title`, `readOnlyHint`,
|
|
28
|
+
`destructiveHint`, `idempotentHint`, `openWorldHint`), so an MCP client or agent can reason about a
|
|
29
|
+
tool's nature and render the right consent. The three reads (`piprail_discover` / `quote` / `plan`)
|
|
30
|
+
are flagged **read-only**; `piprail_pay_request` is flagged **value-moving** (not read-only,
|
|
31
|
+
destructive, non-idempotent) so a client can surface that it's the one tool that spends;
|
|
32
|
+
`piprail_register` writes a listing but is non-destructive. New exported type `ToolAnnotations`.
|
|
33
|
+
Backward-compatible — `annotations` is optional and non-MCP runtimes ignore it. (`@piprail/mcp`
|
|
34
|
+
≥ 0.2.2 passes them through on the wire.)
|
|
35
|
+
|
|
7
36
|
## [1.7.0] — 2026-06-06
|
|
8
37
|
|
|
9
38
|
### Added
|
|
@@ -479,6 +508,8 @@ straight into your wallet. The API is small and self-contained.
|
|
|
479
508
|
to your wallet; PipRail never holds funds.
|
|
480
509
|
- `viem ^2.21` is a peer dependency. Node 20+ or a modern browser.
|
|
481
510
|
|
|
511
|
+
[1.9.0]: https://www.npmjs.com/package/@piprail/sdk
|
|
512
|
+
[1.8.0]: https://www.npmjs.com/package/@piprail/sdk
|
|
482
513
|
[1.7.0]: https://www.npmjs.com/package/@piprail/sdk
|
|
483
514
|
[1.6.0]: https://www.npmjs.com/package/@piprail/sdk
|
|
484
515
|
[1.5.1]: https://www.npmjs.com/package/@piprail/sdk
|
package/README.md
CHANGED
|
@@ -113,9 +113,15 @@ For **every rail the 402 offers on your chain**, the plan reads **token balance
|
|
|
113
113
|
|
|
114
114
|
```ts
|
|
115
115
|
import { paymentTools } from '@piprail/sdk'
|
|
116
|
-
const tools = paymentTools(client) // → [piprail_quote_payment, piprail_plan_payment, piprail_pay_request]
|
|
116
|
+
const tools = paymentTools(client) // → [piprail_discover, piprail_quote_payment, piprail_plan_payment, piprail_pay_request, piprail_register]
|
|
117
117
|
```
|
|
118
118
|
|
|
119
|
+
Each descriptor also carries advisory **`annotations`** (MCP-style `ToolAnnotations` — `title`,
|
|
120
|
+
`readOnlyHint`, `destructiveHint`, `idempotentHint`, `openWorldHint`): the three reads are flagged
|
|
121
|
+
**read-only**, `piprail_pay_request` is flagged **value-moving** (the one tool that spends), and
|
|
122
|
+
`piprail_register` is non-destructive — so an MCP client can render the right consent. They're hints,
|
|
123
|
+
not the boundary; the spend policy is. `@piprail/mcp` advertises them on the wire.
|
|
124
|
+
|
|
119
125
|
See [`examples/agent-tools.mjs`](../examples/agent-tools.mjs) for MCP / AI-SDK wiring.
|
|
120
126
|
|
|
121
127
|
## Be discoverable — find and be found ($0, no backend)
|
|
@@ -162,6 +168,11 @@ const hits = await client.discover({ query: 'weather', maxPrice: 0.01 })
|
|
|
162
168
|
const res = await client.fetch(hits[0].resource) // then quote → plan → pay as usual
|
|
163
169
|
```
|
|
164
170
|
|
|
171
|
+
`network` defaults to `'self'` (your chain only); pass `'any'` to search every chain, or a CAIP-2 id
|
|
172
|
+
(`'eip155:8453'`) for a specific one. Chain slugs map to CAIP-2 through the `SLUG_TO_CAIP2` table —
|
|
173
|
+
adding a chain adds one entry there (see [DISCOVERY.md](./DISCOVERY.md) §2.5), and an unresolved
|
|
174
|
+
network is kept, never hidden.
|
|
175
|
+
|
|
165
176
|
**3) Emit a discovery file** — turn your gate's config into the artifacts a crawler reads (pure, no
|
|
166
177
|
I/O); serve the result as a static file on **your own** origin:
|
|
167
178
|
|
|
@@ -173,11 +184,13 @@ const openapi = buildOpenApi({
|
|
|
173
184
|
origin: 'https://api.example.com',
|
|
174
185
|
resources: [await gate.describe('https://api.example.com/report')],
|
|
175
186
|
})
|
|
176
|
-
// serve `openapi` at https://api.example.com/openapi.json
|
|
187
|
+
// serve `openapi` at https://api.example.com/openapi.json — each priced op carries an `x-payment-info`
|
|
188
|
+
// block (the field indexes crawl) plus a default root `x-generator` attribution stamp.
|
|
177
189
|
// buildWellKnownX402(...) emits the legacy /.well-known/x402 file; buildX402DnsTxt(...) the _x402 DNS line
|
|
178
190
|
```
|
|
179
191
|
|
|
180
|
-
For an LLM/MCP
|
|
192
|
+
For an LLM/MCP these are two more tools — **`piprail_discover`** (find) and **`piprail_register`**
|
|
193
|
+
(be found) — on top of the three payment tools, so `paymentTools(client)` / `@piprail/mcp` expose **five**.
|
|
181
194
|
|
|
182
195
|
> **Two honest caveats.** The open indexes assume the mainstream `exact` scheme, so to be *usefully*
|
|
183
196
|
> listed also offer a standard `exact` USDC rail on Base/Solana (`discover()` results are
|
|
@@ -259,6 +272,7 @@ Every token address below was verified on-chain (symbol + decimals) before shipp
|
|
|
259
272
|
| `'injective'` | Injective | USDC, USDT |
|
|
260
273
|
| `'hyperevm'` | HyperEVM (Hyperliquid) | USDC |
|
|
261
274
|
| `'monad'` | Monad | USDC |
|
|
275
|
+
| `'kaia'` | Kaia (ex-Klaytn) | USDT |
|
|
262
276
|
| `'solana'` | Solana | USDC, USDT |
|
|
263
277
|
| `'ton'` | TON | USDT |
|
|
264
278
|
| `'tron'` | Tron | USDT |
|
|
@@ -494,6 +508,8 @@ Agent Your server
|
|
|
494
508
|
|
|
495
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.
|
|
496
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
|
+
|
|
497
513
|
## Receipts — record every payment
|
|
498
514
|
|
|
499
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) {
|
|
@@ -2040,6 +2052,13 @@ function paymentTools(client) {
|
|
|
2040
2052
|
{
|
|
2041
2053
|
name: "piprail_discover",
|
|
2042
2054
|
description: `Find x402 payment-gated resources on the OPEN indexes (a phone book of payable APIs) WITHOUT paying. Use it to answer "what can I buy?" \u2014 search by topic, then quote/plan/pay a chosen one. By default returns only resources payable on your wallet's chain (network='self'); pass 'any' for every chain. Results are cross-scheme: ALWAYS call piprail_quote_payment on a chosen resource (it re-checks the live price) before piprail_pay_request.`,
|
|
2055
|
+
annotations: {
|
|
2056
|
+
title: "Discover payable x402 APIs",
|
|
2057
|
+
readOnlyHint: true,
|
|
2058
|
+
// reads the open indexes only; never pays
|
|
2059
|
+
openWorldHint: true
|
|
2060
|
+
// reaches external indexes (402 Index, CDP Bazaar)
|
|
2061
|
+
},
|
|
2043
2062
|
parameters: {
|
|
2044
2063
|
type: "object",
|
|
2045
2064
|
properties: {
|
|
@@ -2076,6 +2095,13 @@ function paymentTools(client) {
|
|
|
2076
2095
|
{
|
|
2077
2096
|
name: "piprail_quote_payment",
|
|
2078
2097
|
description: "Get the price of an x402 payment-gated URL WITHOUT paying. Returns the amount, token, chain, recipient, and whether it is within the spend policy. Returns { gated: false } when the URL needs no payment. Call this first to decide whether a resource is worth buying.",
|
|
2098
|
+
annotations: {
|
|
2099
|
+
title: "Quote an x402 price",
|
|
2100
|
+
readOnlyHint: true,
|
|
2101
|
+
// reads the 402 challenge; never pays
|
|
2102
|
+
openWorldHint: true
|
|
2103
|
+
// fetches an arbitrary URL
|
|
2104
|
+
},
|
|
2079
2105
|
parameters: {
|
|
2080
2106
|
type: "object",
|
|
2081
2107
|
properties: {
|
|
@@ -2092,6 +2118,13 @@ function paymentTools(client) {
|
|
|
2092
2118
|
{
|
|
2093
2119
|
name: "piprail_plan_payment",
|
|
2094
2120
|
description: "Check whether you CAN pay an x402-gated URL before paying. Reads your wallet balance, native gas, and whether the recipient can receive \u2014 across every rail the URL offers on your chain \u2014 and returns { gated, payable, best, options, fundingHint }. payable:false means do NOT attempt the payment; fundingHint says exactly what to top up. Call this before piprail_pay_request so you never commit to a payment you cannot finish. Returns { gated: false } when no payment is needed.",
|
|
2121
|
+
annotations: {
|
|
2122
|
+
title: "Plan an x402 payment",
|
|
2123
|
+
readOnlyHint: true,
|
|
2124
|
+
// reads balances + the challenge; never pays
|
|
2125
|
+
openWorldHint: true
|
|
2126
|
+
// fetches a URL and reads chain state
|
|
2127
|
+
},
|
|
2095
2128
|
parameters: {
|
|
2096
2129
|
type: "object",
|
|
2097
2130
|
properties: {
|
|
@@ -2130,6 +2163,17 @@ function paymentTools(client) {
|
|
|
2130
2163
|
{
|
|
2131
2164
|
name: "piprail_pay_request",
|
|
2132
2165
|
description: "Fetch an x402 payment-gated URL, automatically paying the required on-chain payment if needed (subject to the spend policy + approval hook). Returns the HTTP status, the response body, and a payment receipt if one settled. If the payment is refused by policy or the approval hook, returns { declined: true, reason } \u2014 no funds moved.",
|
|
2166
|
+
annotations: {
|
|
2167
|
+
title: "Pay an x402 request",
|
|
2168
|
+
readOnlyHint: false,
|
|
2169
|
+
// this is the one tool that MOVES FUNDS
|
|
2170
|
+
destructiveHint: true,
|
|
2171
|
+
// an on-chain payment is value-moving and not reversible
|
|
2172
|
+
idempotentHint: false,
|
|
2173
|
+
// paying twice = two payments
|
|
2174
|
+
openWorldHint: true
|
|
2175
|
+
// fetches a URL and settles on-chain
|
|
2176
|
+
},
|
|
2133
2177
|
parameters: {
|
|
2134
2178
|
type: "object",
|
|
2135
2179
|
properties: {
|
|
@@ -2180,6 +2224,16 @@ function paymentTools(client) {
|
|
|
2180
2224
|
{
|
|
2181
2225
|
name: "piprail_register",
|
|
2182
2226
|
description: "List an x402 payment-gated resource YOU run on the open indexes so other agents can discover it. Default target is 402 Index \u2014 no auth, no signature, no payment; searchable within seconds. Returns one outcome per index ({ source, ok, detail }); a step the chain can't satisfy comes back ok:false with the reason. Moves no funds; nothing is PipRail-hosted.",
|
|
2227
|
+
annotations: {
|
|
2228
|
+
title: "Register an x402 endpoint",
|
|
2229
|
+
readOnlyHint: false,
|
|
2230
|
+
// writes a listing to an external index
|
|
2231
|
+
destructiveHint: false,
|
|
2232
|
+
// adds a listing; nothing is destroyed and no funds move
|
|
2233
|
+
openWorldHint: true
|
|
2234
|
+
// posts to external indexes (402 Index)
|
|
2235
|
+
// idempotentHint intentionally omitted — index dedup behaviour isn't guaranteed.
|
|
2236
|
+
},
|
|
2183
2237
|
parameters: {
|
|
2184
2238
|
type: "object",
|
|
2185
2239
|
properties: {
|
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;
|
|
@@ -4636,6 +4690,25 @@ declare class PipRailClient {
|
|
|
4636
4690
|
*/
|
|
4637
4691
|
declare function planAcross(clients: PipRailClient[], url: string, init?: RequestInit): Promise<PaymentPlan | null>;
|
|
4638
4692
|
|
|
4693
|
+
/**
|
|
4694
|
+
* MCP-style tool annotations — optional, advisory hints that let an MCP client or
|
|
4695
|
+
* agent reason about a tool's *nature* (is it safe to call freely? does it move
|
|
4696
|
+
* value?). They mirror the MCP spec's `ToolAnnotations`. NOTE: hints only — a
|
|
4697
|
+
* client must never make a security decision solely on these; the spend policy is
|
|
4698
|
+
* the real boundary.
|
|
4699
|
+
*/
|
|
4700
|
+
interface ToolAnnotations {
|
|
4701
|
+
/** Human-friendly title for the tool. */
|
|
4702
|
+
title?: string;
|
|
4703
|
+
/** True when the tool only READS — no state change, no funds moved. */
|
|
4704
|
+
readOnlyHint?: boolean;
|
|
4705
|
+
/** True when the tool may move value or do something not easily undone (only meaningful when not read-only). */
|
|
4706
|
+
destructiveHint?: boolean;
|
|
4707
|
+
/** True when calling repeatedly with the same args has no additional effect. */
|
|
4708
|
+
idempotentHint?: boolean;
|
|
4709
|
+
/** True when the tool reaches the open world — external indexes, chains, or arbitrary URLs. */
|
|
4710
|
+
openWorldHint?: boolean;
|
|
4711
|
+
}
|
|
4639
4712
|
/** A framework-agnostic tool definition an agent runtime can register. */
|
|
4640
4713
|
interface AgentTool {
|
|
4641
4714
|
/** Unique tool name (snake_case, namespaced `piprail_…`). */
|
|
@@ -4644,6 +4717,8 @@ interface AgentTool {
|
|
|
4644
4717
|
description: string;
|
|
4645
4718
|
/** JSON Schema (draft-07 object) describing the arguments. */
|
|
4646
4719
|
parameters: Record<string, unknown>;
|
|
4720
|
+
/** Advisory MCP-style hints about the tool's nature (read-only, value-moving, …). */
|
|
4721
|
+
annotations?: ToolAnnotations;
|
|
4647
4722
|
/** Execute the tool. Returns a JSON-serialisable result. */
|
|
4648
4723
|
invoke: (args: Record<string, unknown>) => Promise<unknown>;
|
|
4649
4724
|
}
|
|
@@ -5296,4 +5371,4 @@ declare function encodeXPaymentHeader(input: {
|
|
|
5296
5371
|
x402Version?: number;
|
|
5297
5372
|
}): string;
|
|
5298
5373
|
|
|
5299
|
-
export { type AcceptOption, type AddressId, type AgentTool, type AlgorandToken, type AptosToken, type AssetId, type BuildExactParams, CHAINS, type Caip2, type ChainFamily, type ChainInput, type ChainName, type ChainPreset, type ChainSelector, type ConfirmInfo, ConfirmationTimeoutError, type CostEstimate, type DiscoverOptions, type DiscoveredRail, type DiscoveredResource, type DiscoverySigner, type DiscoverySource, EIP3009_TYPES, EXACT_NETWORK_SLUGS, type EvmToken, type ExactAccept, type ExactAuthorization, type ExpressLikeMiddleware, type ExpressLikeNext, type ExpressLikeRequest, type ExpressLikeResponse, GENERATOR, InsufficientFundsError, InvalidEnvelopeError, type ManifestInput, MaxRetriesExceededError, MissingDriverError, type NearToken, NoCompatibleAcceptError, NonReplayableBodyError, type OpenApiDocument, type OpenApiOperation, type PayBlocker, type PayOption, type PayWarning, PaymentDeclinedError, type PaymentDriver, type PaymentGate, type PaymentIntent, type PaymentPlan, type PaymentPolicy, type PaymentRail, PaymentTimeoutError, PipRailClient, type PipRailClientOptions, type PipRailCostQuote, PipRailError, type PipRailEvent, type PipRailQuote, type PolicyDecision, RecipientNotReadyError, type RecipientReason, type RegisterInput, type RegisterOptions, type RegisterOutcome, type RequirePaymentOptions, type ResolveOptions, type ResolvedChain, type ResolvedNetwork, type ResolvedToken, type ResourceDescription, type SearchOpenIndexesOptions, type SolanaToken, type SpendAssetTotal, type SpendRecord, type SpendSummary, type StellarToken, type SuiToken, type TokenInfo, type TokenInput, type TonToken, type TronToken, UnknownTokenError, UnsupportedNetworkError, type VerifyErrorCode, type VerifyPaymentResult, type VerifyResult, type WalletBalance, type WalletHandle, type WalletInput, type WellKnownX402, WrongChainError, WrongFamilyError, type X402AcceptEntry, type X402Challenge, type X402DnsRecord, type X402InvalidBody, type X402PaymentSignature, type X402Receipt, type X402ResourceObject, type XrplToken, buildChallengeHeader, buildExactAuthorization, buildOpenApi, buildReceiptHeader, buildSignatureHeader, buildWellKnownX402, buildX402DnsTxt, chainIdForExactNetwork, createPaymentGate, encodeXPaymentHeader, evaluatePolicy, normalizeNetwork, parseChallenge, parseExactRequirements, parseReceipt, parseSignatureHeader, paymentTools, pickAccept, planAcross, register402Index, registerDriver, registerX402Scan, requirePayment, resolveChain, searchOpenIndexes, toInsufficientFundsError, toInvalidBody };
|
|
5374
|
+
export { type AcceptOption, type AddressId, type AgentTool, type AlgorandToken, type AptosToken, type AssetId, type BuildExactParams, CHAINS, type Caip2, type ChainFamily, type ChainInput, type ChainName, type ChainPreset, type ChainSelector, type ConfirmInfo, ConfirmationTimeoutError, type CostEstimate, type DiscoverOptions, type DiscoveredRail, type DiscoveredResource, type DiscoverySigner, type DiscoverySource, EIP3009_TYPES, EXACT_NETWORK_SLUGS, type EvmToken, type ExactAccept, type ExactAuthorization, type ExpressLikeMiddleware, type ExpressLikeNext, type ExpressLikeRequest, type ExpressLikeResponse, GENERATOR, InsufficientFundsError, InvalidEnvelopeError, type ManifestInput, MaxRetriesExceededError, MissingDriverError, type NearToken, NoCompatibleAcceptError, NonReplayableBodyError, type OpenApiDocument, type OpenApiOperation, type PayBlocker, type PayOption, type PayWarning, PaymentDeclinedError, type PaymentDriver, type PaymentGate, type PaymentIntent, type PaymentPlan, type PaymentPolicy, type PaymentRail, PaymentTimeoutError, PipRailClient, type PipRailClientOptions, type PipRailCostQuote, PipRailError, type PipRailEvent, type PipRailQuote, type PolicyDecision, RecipientNotReadyError, type RecipientReason, type RegisterInput, type RegisterOptions, type RegisterOutcome, type RequirePaymentOptions, type ResolveOptions, type ResolvedChain, type ResolvedNetwork, type ResolvedToken, type ResourceDescription, type SearchOpenIndexesOptions, type SolanaToken, type SpendAssetTotal, type SpendRecord, type SpendSummary, type StellarToken, type SuiToken, type TokenInfo, type TokenInput, type TonToken, type ToolAnnotations, type TronToken, UnknownTokenError, UnsupportedNetworkError, type VerifyErrorCode, type VerifyPaymentResult, type VerifyResult, type WalletBalance, type WalletHandle, type WalletInput, type WellKnownX402, WrongChainError, WrongFamilyError, type X402AcceptEntry, type X402Challenge, type X402DnsRecord, type X402InvalidBody, type X402PaymentSignature, type X402Receipt, type X402ResourceObject, type XrplToken, buildChallengeHeader, buildExactAuthorization, buildOpenApi, buildReceiptHeader, buildSignatureHeader, buildWellKnownX402, buildX402DnsTxt, chainIdForExactNetwork, createPaymentGate, encodeXPaymentHeader, evaluatePolicy, normalizeNetwork, parseChallenge, parseExactRequirements, parseReceipt, parseSignatureHeader, paymentTools, pickAccept, planAcross, register402Index, registerDriver, registerX402Scan, requirePayment, resolveChain, searchOpenIndexes, toInsufficientFundsError, toInvalidBody };
|
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;
|
|
@@ -4636,6 +4690,25 @@ declare class PipRailClient {
|
|
|
4636
4690
|
*/
|
|
4637
4691
|
declare function planAcross(clients: PipRailClient[], url: string, init?: RequestInit): Promise<PaymentPlan | null>;
|
|
4638
4692
|
|
|
4693
|
+
/**
|
|
4694
|
+
* MCP-style tool annotations — optional, advisory hints that let an MCP client or
|
|
4695
|
+
* agent reason about a tool's *nature* (is it safe to call freely? does it move
|
|
4696
|
+
* value?). They mirror the MCP spec's `ToolAnnotations`. NOTE: hints only — a
|
|
4697
|
+
* client must never make a security decision solely on these; the spend policy is
|
|
4698
|
+
* the real boundary.
|
|
4699
|
+
*/
|
|
4700
|
+
interface ToolAnnotations {
|
|
4701
|
+
/** Human-friendly title for the tool. */
|
|
4702
|
+
title?: string;
|
|
4703
|
+
/** True when the tool only READS — no state change, no funds moved. */
|
|
4704
|
+
readOnlyHint?: boolean;
|
|
4705
|
+
/** True when the tool may move value or do something not easily undone (only meaningful when not read-only). */
|
|
4706
|
+
destructiveHint?: boolean;
|
|
4707
|
+
/** True when calling repeatedly with the same args has no additional effect. */
|
|
4708
|
+
idempotentHint?: boolean;
|
|
4709
|
+
/** True when the tool reaches the open world — external indexes, chains, or arbitrary URLs. */
|
|
4710
|
+
openWorldHint?: boolean;
|
|
4711
|
+
}
|
|
4639
4712
|
/** A framework-agnostic tool definition an agent runtime can register. */
|
|
4640
4713
|
interface AgentTool {
|
|
4641
4714
|
/** Unique tool name (snake_case, namespaced `piprail_…`). */
|
|
@@ -4644,6 +4717,8 @@ interface AgentTool {
|
|
|
4644
4717
|
description: string;
|
|
4645
4718
|
/** JSON Schema (draft-07 object) describing the arguments. */
|
|
4646
4719
|
parameters: Record<string, unknown>;
|
|
4720
|
+
/** Advisory MCP-style hints about the tool's nature (read-only, value-moving, …). */
|
|
4721
|
+
annotations?: ToolAnnotations;
|
|
4647
4722
|
/** Execute the tool. Returns a JSON-serialisable result. */
|
|
4648
4723
|
invoke: (args: Record<string, unknown>) => Promise<unknown>;
|
|
4649
4724
|
}
|
|
@@ -5296,4 +5371,4 @@ declare function encodeXPaymentHeader(input: {
|
|
|
5296
5371
|
x402Version?: number;
|
|
5297
5372
|
}): string;
|
|
5298
5373
|
|
|
5299
|
-
export { type AcceptOption, type AddressId, type AgentTool, type AlgorandToken, type AptosToken, type AssetId, type BuildExactParams, CHAINS, type Caip2, type ChainFamily, type ChainInput, type ChainName, type ChainPreset, type ChainSelector, type ConfirmInfo, ConfirmationTimeoutError, type CostEstimate, type DiscoverOptions, type DiscoveredRail, type DiscoveredResource, type DiscoverySigner, type DiscoverySource, EIP3009_TYPES, EXACT_NETWORK_SLUGS, type EvmToken, type ExactAccept, type ExactAuthorization, type ExpressLikeMiddleware, type ExpressLikeNext, type ExpressLikeRequest, type ExpressLikeResponse, GENERATOR, InsufficientFundsError, InvalidEnvelopeError, type ManifestInput, MaxRetriesExceededError, MissingDriverError, type NearToken, NoCompatibleAcceptError, NonReplayableBodyError, type OpenApiDocument, type OpenApiOperation, type PayBlocker, type PayOption, type PayWarning, PaymentDeclinedError, type PaymentDriver, type PaymentGate, type PaymentIntent, type PaymentPlan, type PaymentPolicy, type PaymentRail, PaymentTimeoutError, PipRailClient, type PipRailClientOptions, type PipRailCostQuote, PipRailError, type PipRailEvent, type PipRailQuote, type PolicyDecision, RecipientNotReadyError, type RecipientReason, type RegisterInput, type RegisterOptions, type RegisterOutcome, type RequirePaymentOptions, type ResolveOptions, type ResolvedChain, type ResolvedNetwork, type ResolvedToken, type ResourceDescription, type SearchOpenIndexesOptions, type SolanaToken, type SpendAssetTotal, type SpendRecord, type SpendSummary, type StellarToken, type SuiToken, type TokenInfo, type TokenInput, type TonToken, type TronToken, UnknownTokenError, UnsupportedNetworkError, type VerifyErrorCode, type VerifyPaymentResult, type VerifyResult, type WalletBalance, type WalletHandle, type WalletInput, type WellKnownX402, WrongChainError, WrongFamilyError, type X402AcceptEntry, type X402Challenge, type X402DnsRecord, type X402InvalidBody, type X402PaymentSignature, type X402Receipt, type X402ResourceObject, type XrplToken, buildChallengeHeader, buildExactAuthorization, buildOpenApi, buildReceiptHeader, buildSignatureHeader, buildWellKnownX402, buildX402DnsTxt, chainIdForExactNetwork, createPaymentGate, encodeXPaymentHeader, evaluatePolicy, normalizeNetwork, parseChallenge, parseExactRequirements, parseReceipt, parseSignatureHeader, paymentTools, pickAccept, planAcross, register402Index, registerDriver, registerX402Scan, requirePayment, resolveChain, searchOpenIndexes, toInsufficientFundsError, toInvalidBody };
|
|
5374
|
+
export { type AcceptOption, type AddressId, type AgentTool, type AlgorandToken, type AptosToken, type AssetId, type BuildExactParams, CHAINS, type Caip2, type ChainFamily, type ChainInput, type ChainName, type ChainPreset, type ChainSelector, type ConfirmInfo, ConfirmationTimeoutError, type CostEstimate, type DiscoverOptions, type DiscoveredRail, type DiscoveredResource, type DiscoverySigner, type DiscoverySource, EIP3009_TYPES, EXACT_NETWORK_SLUGS, type EvmToken, type ExactAccept, type ExactAuthorization, type ExpressLikeMiddleware, type ExpressLikeNext, type ExpressLikeRequest, type ExpressLikeResponse, GENERATOR, InsufficientFundsError, InvalidEnvelopeError, type ManifestInput, MaxRetriesExceededError, MissingDriverError, type NearToken, NoCompatibleAcceptError, NonReplayableBodyError, type OpenApiDocument, type OpenApiOperation, type PayBlocker, type PayOption, type PayWarning, PaymentDeclinedError, type PaymentDriver, type PaymentGate, type PaymentIntent, type PaymentPlan, type PaymentPolicy, type PaymentRail, PaymentTimeoutError, PipRailClient, type PipRailClientOptions, type PipRailCostQuote, PipRailError, type PipRailEvent, type PipRailQuote, type PolicyDecision, RecipientNotReadyError, type RecipientReason, type RegisterInput, type RegisterOptions, type RegisterOutcome, type RequirePaymentOptions, type ResolveOptions, type ResolvedChain, type ResolvedNetwork, type ResolvedToken, type ResourceDescription, type SearchOpenIndexesOptions, type SolanaToken, type SpendAssetTotal, type SpendRecord, type SpendSummary, type StellarToken, type SuiToken, type TokenInfo, type TokenInput, type TonToken, type ToolAnnotations, type TronToken, UnknownTokenError, UnsupportedNetworkError, type VerifyErrorCode, type VerifyPaymentResult, type VerifyResult, type WalletBalance, type WalletHandle, type WalletInput, type WellKnownX402, WrongChainError, WrongFamilyError, type X402AcceptEntry, type X402Challenge, type X402DnsRecord, type X402InvalidBody, type X402PaymentSignature, type X402Receipt, type X402ResourceObject, type XrplToken, buildChallengeHeader, buildExactAuthorization, buildOpenApi, buildReceiptHeader, buildSignatureHeader, buildWellKnownX402, buildX402DnsTxt, chainIdForExactNetwork, createPaymentGate, encodeXPaymentHeader, evaluatePolicy, normalizeNetwork, parseChallenge, parseExactRequirements, parseReceipt, parseSignatureHeader, paymentTools, pickAccept, planAcross, register402Index, registerDriver, registerX402Scan, requirePayment, resolveChain, searchOpenIndexes, toInsufficientFundsError, toInvalidBody };
|
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) {
|
|
@@ -2040,6 +2052,13 @@ function paymentTools(client) {
|
|
|
2040
2052
|
{
|
|
2041
2053
|
name: "piprail_discover",
|
|
2042
2054
|
description: `Find x402 payment-gated resources on the OPEN indexes (a phone book of payable APIs) WITHOUT paying. Use it to answer "what can I buy?" \u2014 search by topic, then quote/plan/pay a chosen one. By default returns only resources payable on your wallet's chain (network='self'); pass 'any' for every chain. Results are cross-scheme: ALWAYS call piprail_quote_payment on a chosen resource (it re-checks the live price) before piprail_pay_request.`,
|
|
2055
|
+
annotations: {
|
|
2056
|
+
title: "Discover payable x402 APIs",
|
|
2057
|
+
readOnlyHint: true,
|
|
2058
|
+
// reads the open indexes only; never pays
|
|
2059
|
+
openWorldHint: true
|
|
2060
|
+
// reaches external indexes (402 Index, CDP Bazaar)
|
|
2061
|
+
},
|
|
2043
2062
|
parameters: {
|
|
2044
2063
|
type: "object",
|
|
2045
2064
|
properties: {
|
|
@@ -2076,6 +2095,13 @@ function paymentTools(client) {
|
|
|
2076
2095
|
{
|
|
2077
2096
|
name: "piprail_quote_payment",
|
|
2078
2097
|
description: "Get the price of an x402 payment-gated URL WITHOUT paying. Returns the amount, token, chain, recipient, and whether it is within the spend policy. Returns { gated: false } when the URL needs no payment. Call this first to decide whether a resource is worth buying.",
|
|
2098
|
+
annotations: {
|
|
2099
|
+
title: "Quote an x402 price",
|
|
2100
|
+
readOnlyHint: true,
|
|
2101
|
+
// reads the 402 challenge; never pays
|
|
2102
|
+
openWorldHint: true
|
|
2103
|
+
// fetches an arbitrary URL
|
|
2104
|
+
},
|
|
2079
2105
|
parameters: {
|
|
2080
2106
|
type: "object",
|
|
2081
2107
|
properties: {
|
|
@@ -2092,6 +2118,13 @@ function paymentTools(client) {
|
|
|
2092
2118
|
{
|
|
2093
2119
|
name: "piprail_plan_payment",
|
|
2094
2120
|
description: "Check whether you CAN pay an x402-gated URL before paying. Reads your wallet balance, native gas, and whether the recipient can receive \u2014 across every rail the URL offers on your chain \u2014 and returns { gated, payable, best, options, fundingHint }. payable:false means do NOT attempt the payment; fundingHint says exactly what to top up. Call this before piprail_pay_request so you never commit to a payment you cannot finish. Returns { gated: false } when no payment is needed.",
|
|
2121
|
+
annotations: {
|
|
2122
|
+
title: "Plan an x402 payment",
|
|
2123
|
+
readOnlyHint: true,
|
|
2124
|
+
// reads balances + the challenge; never pays
|
|
2125
|
+
openWorldHint: true
|
|
2126
|
+
// fetches a URL and reads chain state
|
|
2127
|
+
},
|
|
2095
2128
|
parameters: {
|
|
2096
2129
|
type: "object",
|
|
2097
2130
|
properties: {
|
|
@@ -2130,6 +2163,17 @@ function paymentTools(client) {
|
|
|
2130
2163
|
{
|
|
2131
2164
|
name: "piprail_pay_request",
|
|
2132
2165
|
description: "Fetch an x402 payment-gated URL, automatically paying the required on-chain payment if needed (subject to the spend policy + approval hook). Returns the HTTP status, the response body, and a payment receipt if one settled. If the payment is refused by policy or the approval hook, returns { declined: true, reason } \u2014 no funds moved.",
|
|
2166
|
+
annotations: {
|
|
2167
|
+
title: "Pay an x402 request",
|
|
2168
|
+
readOnlyHint: false,
|
|
2169
|
+
// this is the one tool that MOVES FUNDS
|
|
2170
|
+
destructiveHint: true,
|
|
2171
|
+
// an on-chain payment is value-moving and not reversible
|
|
2172
|
+
idempotentHint: false,
|
|
2173
|
+
// paying twice = two payments
|
|
2174
|
+
openWorldHint: true
|
|
2175
|
+
// fetches a URL and settles on-chain
|
|
2176
|
+
},
|
|
2133
2177
|
parameters: {
|
|
2134
2178
|
type: "object",
|
|
2135
2179
|
properties: {
|
|
@@ -2180,6 +2224,16 @@ function paymentTools(client) {
|
|
|
2180
2224
|
{
|
|
2181
2225
|
name: "piprail_register",
|
|
2182
2226
|
description: "List an x402 payment-gated resource YOU run on the open indexes so other agents can discover it. Default target is 402 Index \u2014 no auth, no signature, no payment; searchable within seconds. Returns one outcome per index ({ source, ok, detail }); a step the chain can't satisfy comes back ok:false with the reason. Moves no funds; nothing is PipRail-hosted.",
|
|
2227
|
+
annotations: {
|
|
2228
|
+
title: "Register an x402 endpoint",
|
|
2229
|
+
readOnlyHint: false,
|
|
2230
|
+
// writes a listing to an external index
|
|
2231
|
+
destructiveHint: false,
|
|
2232
|
+
// adds a listing; nothing is destroyed and no funds move
|
|
2233
|
+
openWorldHint: true
|
|
2234
|
+
// posts to external indexes (402 Index)
|
|
2235
|
+
// idempotentHint intentionally omitted — index dedup behaviour isn't guaranteed.
|
|
2236
|
+
},
|
|
2183
2237
|
parameters: {
|
|
2184
2238
|
type: "object",
|
|
2185
2239
|
properties: {
|
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",
|