@toon-protocol/client 3.2.0 → 3.3.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/dist/{chunk-ZHWYFPOP.js → chunk-G36D22II.js} +288 -93
- package/dist/chunk-G36D22II.js.map +1 -0
- package/dist/{chunk-GOLBDUNV.js → chunk-LJSOTVUT.js} +36 -3
- package/dist/chunk-LJSOTVUT.js.map +1 -0
- package/dist/{chunk-7MPONJW5.js → chunk-O6KX7MHD.js} +4 -4
- package/dist/{chunk-7MPONJW5.js.map → chunk-O6KX7MHD.js.map} +1 -1
- package/dist/{chunk-4I3JQ7KA.js → chunk-PTTRHLYV.js} +2 -2
- package/dist/cli/main.js +3 -3
- package/dist/{client-SCEP67S5.js → client-FFEFAMJ4.js} +5 -3
- package/dist/hidden-service-BsBH2HNi.d.ts +301 -0
- package/dist/index.d.ts +124 -143
- package/dist/index.js +9 -3
- package/dist/index.js.map +1 -1
- package/dist/socks-K6QOOWJ5.js +23 -0
- package/dist/transport/hidden-service.d.ts +1 -116
- package/dist/transport/hidden-service.js +9 -1
- package/package.json +1 -1
- package/dist/chunk-GOLBDUNV.js.map +0 -1
- package/dist/chunk-ZHWYFPOP.js.map +0 -1
- package/dist/socks-CCMHMB35.js +0 -15
- /package/dist/{chunk-4I3JQ7KA.js.map → chunk-PTTRHLYV.js.map} +0 -0
- /package/dist/{client-SCEP67S5.js.map → client-FFEFAMJ4.js.map} +0 -0
- /package/dist/{socks-CCMHMB35.js.map → socks-K6QOOWJ5.js.map} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,131 +1,8 @@
|
|
|
1
|
+
import { C as ChainKind, a as ChannelStatus, b as ChannelTerms, c as ChannelClient, O as OnChainChannelStatus, d as OpenChannelResult, e as OpenChannelParams } from './hidden-service-BsBH2HNi.js';
|
|
2
|
+
export { H as HiddenServiceTransport, f as HiddenServiceTransportOptions, v as validateSocks5hUrl } from './hidden-service-BsBH2HNi.js';
|
|
1
3
|
import { PrivateKeyAccount } from 'viem/accounts';
|
|
2
|
-
export { HiddenServiceTransport, HiddenServiceTransportOptions, validateSocks5hUrl } from './transport/hidden-service.js';
|
|
3
4
|
import { http } from 'viem';
|
|
4
5
|
|
|
5
|
-
/**
|
|
6
|
-
* The on-chain channel port: what the client needs a chain to be able to do,
|
|
7
|
-
* independent of which chain it is.
|
|
8
|
-
*
|
|
9
|
-
* These types were `@toon-protocol/core`'s `ConnectorChannelClient` family,
|
|
10
|
-
* whose names still carried the retired admin-API model — a channel opened by
|
|
11
|
-
* `POST /admin/channels` on the connector. That is not how a channel comes into
|
|
12
|
-
* existence any more, and the naming mattered: **a connector has no endpoint
|
|
13
|
-
* that opens a channel** (`self-description-spec.md` ND-03). The client opens,
|
|
14
|
-
* funds, closes and settles the channel itself, directly on chain, and the
|
|
15
|
-
* connector discovers it by reading the chain
|
|
16
|
-
* ([ADR 0052](https://github.com/toon-protocol/connector/blob/main/docs/adr/0052-permissionless-payment-is-guaranteed-and-a-claim-is-what-authorises.md)).
|
|
17
|
-
* So this is a port over *chains*, not over the connector.
|
|
18
|
-
*/
|
|
19
|
-
/** Which settlement family a channel lives in. Mina is gone (connector ADR 0002). */
|
|
20
|
-
type ChainKind = 'evm' | 'solana';
|
|
21
|
-
/**
|
|
22
|
-
* Everything needed to open one channel, as read off the connector's own
|
|
23
|
-
* self-description (`GET /ilp` → `settlements[]`) rather than configured.
|
|
24
|
-
*
|
|
25
|
-
* The connector proved each of these against a live chain at startup
|
|
26
|
-
* (`self-description-spec.md` ND-07), which is why they are taken from the
|
|
27
|
-
* document instead of from a preset: two declarations of one fact is how a
|
|
28
|
-
* mainnet node comes to describe itself as devnet.
|
|
29
|
-
*/
|
|
30
|
-
interface ChannelTerms {
|
|
31
|
-
kind: ChainKind;
|
|
32
|
-
/** The chain key exactly as published: `evm:84532`, or `solana`. */
|
|
33
|
-
chain: string;
|
|
34
|
-
/** EVM only: the numeric chain id parsed out of `chain`. The EIP-712 domain's `chainId`. */
|
|
35
|
-
chainId?: number;
|
|
36
|
-
/**
|
|
37
|
-
* The connector's own settlement address — the counterparty this channel is
|
|
38
|
-
* opened *with*. `0x…` on EVM, base58 on Solana.
|
|
39
|
-
*/
|
|
40
|
-
counterparty: string;
|
|
41
|
-
/** ERC-20 address, or the SPL mint. */
|
|
42
|
-
token: string;
|
|
43
|
-
/** Base units per whole token, as the connector reports it. */
|
|
44
|
-
decimals: number;
|
|
45
|
-
/** EVM: the `TokenNetwork` — the EIP-712 `verifyingContract` a claim is signed under. */
|
|
46
|
-
tokenNetwork?: string;
|
|
47
|
-
/** EVM: the `TokenNetworkRegistry` that minted the `TokenNetwork`; the stable address. */
|
|
48
|
-
tokenNetworkRegistry?: string;
|
|
49
|
-
/** Solana: the settlement program the channel account lives under, bound into every claim (ADR 0053). */
|
|
50
|
-
programId?: string;
|
|
51
|
-
}
|
|
52
|
-
/** Parameters for opening a channel on chain. */
|
|
53
|
-
interface OpenChannelParams {
|
|
54
|
-
terms: ChannelTerms;
|
|
55
|
-
/** Initial collateral, in the token's base units. */
|
|
56
|
-
initialDeposit?: bigint;
|
|
57
|
-
/**
|
|
58
|
-
* Challenge period in seconds. The EVM `TokenNetwork` enforces a one-hour
|
|
59
|
-
* floor; the Solana program takes it as the channel's `challenge_duration`.
|
|
60
|
-
*/
|
|
61
|
-
settlementTimeout?: number;
|
|
62
|
-
}
|
|
63
|
-
/** What opening produced. */
|
|
64
|
-
interface OpenChannelResult {
|
|
65
|
-
/** `0x…` 32 bytes on EVM; the channel account's base58 pubkey on Solana. */
|
|
66
|
-
channelId: string;
|
|
67
|
-
status: ChannelStatus;
|
|
68
|
-
/** The transaction that opened it. Absent when an existing channel was adopted. */
|
|
69
|
-
txHash?: string;
|
|
70
|
-
/** On-chain collateral after opening, when the opener read it back. */
|
|
71
|
-
depositTotal?: bigint;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Where a channel is in its lifecycle.
|
|
75
|
-
*
|
|
76
|
-
* `opening` is real and worth distinguishing: the opening transaction is
|
|
77
|
-
* submitted but not yet confirmed, so the channel does not exist for anyone
|
|
78
|
-
* reading the chain — including the connector, which resolves a claim's channel
|
|
79
|
-
* by reading it. A claim signed in that window is refused as naming an unknown
|
|
80
|
-
* channel, and the remedy is to wait rather than to re-sign.
|
|
81
|
-
*/
|
|
82
|
-
type ChannelStatus = 'opening' | 'open' | 'closed' | 'settled' | 'missing';
|
|
83
|
-
/** A channel as the chain currently reports it. */
|
|
84
|
-
interface OnChainChannelStatus {
|
|
85
|
-
channelId: string;
|
|
86
|
-
status: ChannelStatus;
|
|
87
|
-
/** The chain key this channel lives on, when the reader knows it. */
|
|
88
|
-
chain?: string;
|
|
89
|
-
/** This participant's collateral, in base units. */
|
|
90
|
-
deposit?: bigint;
|
|
91
|
-
/** Unix seconds the channel was closed, when it is closed. */
|
|
92
|
-
closedAt?: bigint;
|
|
93
|
-
/** Unix seconds after which `settle` is permitted. */
|
|
94
|
-
settleableAt?: bigint;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* One chain's implementation of the lifecycle.
|
|
98
|
-
*
|
|
99
|
-
* Every method here is a transaction the *client* signs and pays gas for. None
|
|
100
|
-
* of them talks to a connector.
|
|
101
|
-
*/
|
|
102
|
-
interface ChannelClient {
|
|
103
|
-
openChannel(params: OpenChannelParams): Promise<OpenChannelResult>;
|
|
104
|
-
/**
|
|
105
|
-
* Add collateral. `currentDeposit` is the channel's present total, which EVM
|
|
106
|
-
* needs because `setTotalDeposit` takes the new cumulative figure rather than
|
|
107
|
-
* a delta — a contract shape that makes a lost or duplicated call harmless.
|
|
108
|
-
*/
|
|
109
|
-
depositToChannel(channelId: string, amount: bigint, opts: {
|
|
110
|
-
currentDeposit: bigint;
|
|
111
|
-
}): Promise<{
|
|
112
|
-
txHash?: string;
|
|
113
|
-
depositTotal: bigint;
|
|
114
|
-
}>;
|
|
115
|
-
/** Start the challenge period. */
|
|
116
|
-
closeChannel(channelId: string): Promise<{
|
|
117
|
-
txHash?: string;
|
|
118
|
-
closedAt: bigint;
|
|
119
|
-
settlementTimeout: bigint;
|
|
120
|
-
settleableAt: bigint;
|
|
121
|
-
}>;
|
|
122
|
-
/** Pay out and finish. Only permitted once the challenge period has elapsed. */
|
|
123
|
-
settleChannel(channelId: string): Promise<{
|
|
124
|
-
txHash?: string;
|
|
125
|
-
}>;
|
|
126
|
-
getChannelState(channelId: string): Promise<OnChainChannelStatus>;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
6
|
/**
|
|
130
7
|
* What a mnemonic derives to.
|
|
131
8
|
*
|
|
@@ -978,6 +855,27 @@ declare function isInsufficientGasError(err: unknown): boolean;
|
|
|
978
855
|
* offered so the remedy is in the error rather than in the docs.
|
|
979
856
|
*/
|
|
980
857
|
declare function chainUnavailableMessage(wanted: ChainKind | undefined, offered: string[], reason: 'no-key' | 'not-offered' | 'none'): string;
|
|
858
|
+
/**
|
|
859
|
+
* A chain write that was sent and did not end confirmed and clean. It names the
|
|
860
|
+
* transaction, so whoever handles it can look the transaction up before doing
|
|
861
|
+
* anything that would repeat it (connector ADR 0073, decision 5).
|
|
862
|
+
*
|
|
863
|
+
* - `failed`: it landed and its execution failed. Nothing to reconcile.
|
|
864
|
+
* - `expired`: Solana only. Its blockhash is past `lastValidBlockHeight` and it
|
|
865
|
+
* never appeared, so it cannot land. Safe to send again.
|
|
866
|
+
* - `unknown`: no answer settled it before the deadline, usually because the RPC
|
|
867
|
+
* stopped answering. It may still land. Repeating it blindly can do the thing
|
|
868
|
+
* twice. A Solana deposit is incremental, so a repeated one deposits twice.
|
|
869
|
+
*
|
|
870
|
+
* Distinct from a {@link NetworkError}: that one means the request may never
|
|
871
|
+
* have reached the chain. This one means it did, or may have.
|
|
872
|
+
*/
|
|
873
|
+
declare class TransactionOutcomeError extends ToonClientError {
|
|
874
|
+
readonly chain: ChainKind;
|
|
875
|
+
readonly txHash: string;
|
|
876
|
+
readonly outcome: 'failed' | 'expired' | 'unknown';
|
|
877
|
+
constructor(message: string, chain: ChainKind, txHash: string, outcome: 'failed' | 'expired' | 'unknown', cause?: Error);
|
|
878
|
+
}
|
|
981
879
|
|
|
982
880
|
/**
|
|
983
881
|
* The x402 "payment required" greeting a connector answers an unpaid request
|
|
@@ -1849,6 +1747,8 @@ declare function readSolanaNativeBalance(opts: {
|
|
|
1849
1747
|
rpcUrl: string;
|
|
1850
1748
|
owner: string;
|
|
1851
1749
|
fetchImpl?: typeof fetch;
|
|
1750
|
+
/** The fetch rides the SOCKS5h proxy: allow a circuit's latency. */
|
|
1751
|
+
proxied?: boolean;
|
|
1852
1752
|
}): Promise<WalletTokenAmount>;
|
|
1853
1753
|
/** Read the SPL-token balance for `owner`'s token account(s) of `mint`. */
|
|
1854
1754
|
declare function readSolanaTokenBalance(opts: {
|
|
@@ -1856,6 +1756,8 @@ declare function readSolanaTokenBalance(opts: {
|
|
|
1856
1756
|
mint: string;
|
|
1857
1757
|
owner: string;
|
|
1858
1758
|
fetchImpl?: typeof fetch;
|
|
1759
|
+
/** The fetch rides the SOCKS5h proxy: allow a circuit's latency. */
|
|
1760
|
+
proxied?: boolean;
|
|
1859
1761
|
}): Promise<WalletBalance>;
|
|
1860
1762
|
/**
|
|
1861
1763
|
* Per-chain inputs for {@link readWalletBalances}: the resolved RPC URL, the
|
|
@@ -1884,6 +1786,8 @@ interface WalletBalanceSources {
|
|
|
1884
1786
|
};
|
|
1885
1787
|
/** Injectable fetch (the Solana JSON-RPC calls) for tests. */
|
|
1886
1788
|
fetchImpl?: typeof fetch;
|
|
1789
|
+
/** `fetchImpl` rides the SOCKS5h proxy, so the Solana reads allow a circuit's latency. */
|
|
1790
|
+
solanaProxied?: boolean;
|
|
1887
1791
|
}
|
|
1888
1792
|
/**
|
|
1889
1793
|
* Read the full wallet view — native coin + configured tokens — for every chain
|
|
@@ -2181,7 +2085,8 @@ declare function sendTransfer(config: TransferConfig, params: SendTransferParams
|
|
|
2181
2085
|
* Solana `POST {faucetUrl}/api/solana/usdc-request` body `{ address }`
|
|
2182
2086
|
*
|
|
2183
2087
|
* The request shape is identical on both; only the path differs. The EVM leg
|
|
2184
|
-
* mints
|
|
2088
|
+
* mints devnet USDC (Circle FiatToken v2.2; the faucet key is its minter) on
|
|
2089
|
+
* Base Sepolia and best-effort tops up gas; the
|
|
2185
2090
|
* **Solana leg drips USDC and no SOL**, so a Solana wallet needs devnet SOL
|
|
2186
2091
|
* from somewhere else (`solana airdrop`) before it can pay for a transaction.
|
|
2187
2092
|
*
|
|
@@ -2317,13 +2222,15 @@ interface ToonClientConfig {
|
|
|
2317
2222
|
/** Faucet base URL for {@link WalletFacade.faucet}. Devnet only. */
|
|
2318
2223
|
faucetUrl?: string;
|
|
2319
2224
|
/**
|
|
2320
|
-
* The `socks5h://` proxy
|
|
2321
|
-
*
|
|
2322
|
-
* `socks5h://127.0.0.1:9050`.
|
|
2225
|
+
* The `socks5h://` proxy every byte this client sends goes through: a running
|
|
2226
|
+
* Anyone Protocol `anon` daemon's SOCKS port, e.g. `socks5h://127.0.0.1:9050`.
|
|
2323
2227
|
*
|
|
2324
|
-
* Required when `connector` is a `.anyone` address
|
|
2325
|
-
*
|
|
2326
|
-
*
|
|
2228
|
+
* Required when `connector` is a `.anyone` address. Beside a clearnet
|
|
2229
|
+
* connector it makes this client a hidden payer (TOON_Network#167): the
|
|
2230
|
+
* client edge, the BTP socket and each chain's RPC, on a pinned circuit per
|
|
2231
|
+
* chain, all ride it. Nothing falls back to a direct dial. `socks5://` is
|
|
2232
|
+
* refused either way. This library never starts a daemon itself; the `toon`
|
|
2233
|
+
* CLI will start one for you (ADR 0001).
|
|
2327
2234
|
*
|
|
2328
2235
|
* Node only: a browser cannot dial a hidden service by any route.
|
|
2329
2236
|
*/
|
|
@@ -2332,8 +2239,8 @@ interface ToonClientConfig {
|
|
|
2332
2239
|
* Send chain RPC through `socksProxy` as well as the packets. Default `true`.
|
|
2333
2240
|
*
|
|
2334
2241
|
* Set `false` only when the RPC endpoint is already private — your own node on
|
|
2335
|
-
* loopback
|
|
2336
|
-
* for a public provider is the point: see ADR 0002.
|
|
2242
|
+
* loopback or a private address, which no exit could reach anyway. Leaving it
|
|
2243
|
+
* on for a public provider is the point: see ADR 0002.
|
|
2337
2244
|
*/
|
|
2338
2245
|
proxyRpc?: boolean;
|
|
2339
2246
|
/** Injected `fetch`, for tests and non-standard runtimes. */
|
|
@@ -2952,6 +2859,16 @@ declare const DEFAULT_TIMEOUT_MS = 30000;
|
|
|
2952
2859
|
declare const DEFAULT_DEPOSIT = 100000n;
|
|
2953
2860
|
/** Challenge period in seconds when the caller sets none. */
|
|
2954
2861
|
declare const DEFAULT_SETTLEMENT_TIMEOUT = 86400;
|
|
2862
|
+
/**
|
|
2863
|
+
* How one chain's RPC leaves this process when it rides the proxy: two shapes of
|
|
2864
|
+
* one pinned circuit, because the two chains' clients take different objects.
|
|
2865
|
+
*/
|
|
2866
|
+
interface ProxiedChainRpc {
|
|
2867
|
+
/** The undici dispatcher, for viem, which calls the global `fetch` itself (EVM). */
|
|
2868
|
+
dispatcher: unknown;
|
|
2869
|
+
/** `fetch` bound to that dispatcher, for Solana's JSON-RPC. */
|
|
2870
|
+
fetch: typeof fetch;
|
|
2871
|
+
}
|
|
2955
2872
|
/** The keys this client holds, per chain. Absent means "no key for that chain". */
|
|
2956
2873
|
interface ResolvedIdentity {
|
|
2957
2874
|
evm?: {
|
|
@@ -2978,13 +2895,15 @@ interface ResolvedConfig {
|
|
|
2978
2895
|
/** Whether chain RPC rides that proxy too (ADR 0002). */
|
|
2979
2896
|
proxyRpc: boolean;
|
|
2980
2897
|
/**
|
|
2981
|
-
*
|
|
2898
|
+
* Per chain, the proxy-bound route its RPC takes, each on its own pinned
|
|
2899
|
+
* circuit; `undefined` when chain RPC dials directly.
|
|
2900
|
+
*
|
|
2982
2901
|
* Deliberately not filled in here: building it means loading a Node-only
|
|
2983
2902
|
* module, and resolving a config must stay synchronous and browser-safe. It is
|
|
2984
|
-
* the client's job to construct
|
|
2985
|
-
* the slot and leaves it `undefined`.
|
|
2903
|
+
* the client's job to construct the routes, so {@link resolveConfig} only
|
|
2904
|
+
* reserves the slot and leaves it `undefined`.
|
|
2986
2905
|
*/
|
|
2987
|
-
|
|
2906
|
+
chainRpc: Record<ChainKind, ProxiedChainRpc> | undefined;
|
|
2988
2907
|
identity: ResolvedIdentity;
|
|
2989
2908
|
/** The caller's chain preference, or `undefined` to take the node's first. */
|
|
2990
2909
|
chain: ChainKind | undefined;
|
|
@@ -5906,10 +5825,53 @@ declare const ERC20_ABI: readonly [{
|
|
|
5906
5825
|
}];
|
|
5907
5826
|
}];
|
|
5908
5827
|
|
|
5828
|
+
/**
|
|
5829
|
+
* Solana payment-channel primitives — parity with the deployed program.
|
|
5830
|
+
*
|
|
5831
|
+
* Pure, dependency-light helpers that reproduce the EXACT on-chain contract of
|
|
5832
|
+
* the connector's `payment-channel` program
|
|
5833
|
+
* (`toon-protocol/connector` `packages/solana-program/src/{instruction,state,processor}.rs`),
|
|
5834
|
+
* mirrored the same way the connector's own client half is
|
|
5835
|
+
* (`crates/connector-settlement-solana/src/wire.rs`). A mismatch anywhere below
|
|
5836
|
+
* makes the connector refuse the claim, or makes the chain refuse the
|
|
5837
|
+
* transaction — so every discriminator, account order and byte offset here is
|
|
5838
|
+
* cited to the Rust it was read from, and must move in lock-step with it.
|
|
5839
|
+
*
|
|
5840
|
+
* 1. PDA derivation — `[b"channel", min_pubkey, max_pubkey, token_mint]`,
|
|
5841
|
+
* participants sorted lexicographically by raw 32-byte pubkey, derived
|
|
5842
|
+
* against the program id (`processor.rs::derive_channel_pda`). This base58
|
|
5843
|
+
* PDA is the claim's `channelAccount` and the channel-state account both
|
|
5844
|
+
* the connector and the program read.
|
|
5845
|
+
* 2. The **96-byte** balance-proof message a claim's Ed25519 signature covers
|
|
5846
|
+
* — see {@link buildBalanceProofMessage} for the layout and for why it
|
|
5847
|
+
* grew from 48 bytes (connector ADR 0053).
|
|
5848
|
+
* 3. The six instructions the program implements: `01` initialize, `02`
|
|
5849
|
+
* deposit, `03` close, `04` settle, `05` force-close-expired and `06`
|
|
5850
|
+
* claim-from-channel — built and submitted over raw Solana JSON-RPC (no
|
|
5851
|
+
* `@solana/web3.js` / `@solana/kit` runtime dependency: only
|
|
5852
|
+
* `@noble/curves` + `@noble/hashes`, already client deps).
|
|
5853
|
+
* 4. The 178-byte `ChannelState` account (`state.rs`), decoded in full.
|
|
5854
|
+
*/
|
|
5855
|
+
|
|
5909
5856
|
interface Signer {
|
|
5910
5857
|
publicKey: Uint8Array;
|
|
5911
5858
|
privateKey: Uint8Array;
|
|
5912
5859
|
}
|
|
5860
|
+
/**
|
|
5861
|
+
* A Solana JSON-RPC call that got no answer from the node: every try was lost in
|
|
5862
|
+
* transit, timed out, or was turned away at the HTTP layer.
|
|
5863
|
+
*
|
|
5864
|
+
* `mayHaveArrived` is `false` only when every try failed before a byte of the
|
|
5865
|
+
* request could have been written, because the connection or the proxy refused
|
|
5866
|
+
* it. That is the one case in which a failed `sendTransaction` is known not to
|
|
5867
|
+
* have been sent.
|
|
5868
|
+
*/
|
|
5869
|
+
declare class SolanaRpcTransportError extends NetworkError {
|
|
5870
|
+
readonly method: string;
|
|
5871
|
+
readonly attempts: number;
|
|
5872
|
+
readonly mayHaveArrived: boolean;
|
|
5873
|
+
constructor(method: string, attempts: number, mayHaveArrived: boolean, cause: unknown);
|
|
5874
|
+
}
|
|
5913
5875
|
|
|
5914
5876
|
/**
|
|
5915
5877
|
* Solana wire transactions this client did NOT build.
|
|
@@ -6814,12 +6776,31 @@ declare function assertRoutableHsHostname(hostname: unknown): string;
|
|
|
6814
6776
|
interface RpcTransportOptions {
|
|
6815
6777
|
timeout?: number;
|
|
6816
6778
|
retryCount?: number;
|
|
6779
|
+
retryDelay?: number;
|
|
6817
6780
|
}
|
|
6781
|
+
/**
|
|
6782
|
+
* What a proxied RPC request gets when its caller names nothing else, sized
|
|
6783
|
+
* from connector ADR 0073's measurements through `anon` (decisions 4 and 5).
|
|
6784
|
+
*
|
|
6785
|
+
* - `timeout` 30s, not viem's 10s. The worst call measured that needed a new
|
|
6786
|
+
* circuit took 13s. Under 10s that one would have been reported as a failure,
|
|
6787
|
+
* and retried on another new circuit.
|
|
6788
|
+
* - `retryDelay` 500ms, not viem's 150ms. viem already retries 403, 408, 429,
|
|
6789
|
+
* 5xx and dropped connections. Exit IPs are shared, so a 429 is the error to
|
|
6790
|
+
* expect, and retrying it at 150ms mostly earns another one.
|
|
6791
|
+
* - `retryCount` 3, viem's own.
|
|
6792
|
+
*/
|
|
6793
|
+
declare const PROXIED_RPC_DEFAULTS: {
|
|
6794
|
+
readonly timeout: 30000;
|
|
6795
|
+
readonly retryCount: 3;
|
|
6796
|
+
readonly retryDelay: 500;
|
|
6797
|
+
};
|
|
6818
6798
|
/**
|
|
6819
6799
|
* A viem HTTP transport for `url`, bound to `dispatcher` when there is one.
|
|
6820
6800
|
*
|
|
6821
6801
|
* `undefined` dispatcher means clearnet, and produces exactly the transport this
|
|
6822
|
-
* package built before hidden services existed.
|
|
6802
|
+
* package built before hidden services existed. A dispatcher also brings
|
|
6803
|
+
* {@link PROXIED_RPC_DEFAULTS}, under anything the caller set explicitly.
|
|
6823
6804
|
*/
|
|
6824
6805
|
declare function rpcTransport(url: string, dispatcher: unknown | undefined, options?: RpcTransportOptions): ReturnType<typeof http>;
|
|
6825
6806
|
/**
|
|
@@ -6910,9 +6891,9 @@ declare const DEVNET: {
|
|
|
6910
6891
|
readonly chainId: 84532;
|
|
6911
6892
|
readonly rpcUrl: "https://sepolia.base.org";
|
|
6912
6893
|
readonly tokenNetworkRegistry: "0x0c41D9D424d6B075A3cEa1068a694f7847a8CCa5";
|
|
6913
|
-
readonly tokenNetwork: "
|
|
6914
|
-
/**
|
|
6915
|
-
readonly tokenAddress: "
|
|
6894
|
+
readonly tokenNetwork: "0x1B4606218ceE5Bf02B546e416905F4D3FC8a0249";
|
|
6895
|
+
/** Devnet USDC: Circle FiatToken v2.2 (ERC-3009, EIP-2612), 6 decimals, minter-gated — fund via the faucet (connector#1337). */
|
|
6896
|
+
readonly tokenAddress: "0x0C996d7c934c79a6255254875607Fe69df25C0E1";
|
|
6916
6897
|
readonly decimals: 6;
|
|
6917
6898
|
};
|
|
6918
6899
|
/** Solana devnet — the public cluster, not a local validator. */
|
|
@@ -6984,4 +6965,4 @@ interface RetryOptions {
|
|
|
6984
6965
|
*/
|
|
6985
6966
|
declare function withRetry<T>(operation: () => Promise<T>, options: RetryOptions): Promise<T>;
|
|
6986
6967
|
|
|
6987
|
-
export { ACCUMULATED_COST_HEADER, ACCUMULATED_COST_PROTOCOL, ARNS_KIND, type AntSpawnOutcome, type AntSpawnParams, type AntSpawnRefused, type AntSpawnStep, type AntSpawned, type ArnsAntPrepareReceipt, type ArnsBuyOutcome, type ArnsBuyParams, type ArnsBuyReceipt, type ArnsNameType, type ArnsNameWithAntOutcome, type ArnsNetwork, type BTPMessage, BTPMessageType, type BTPProtocolData, type BalanceProofParams, BeforePayRefusedError, BtpAuthError, type BtpChannelDeclaration, BtpConnectionError, type BtpPacketResponse, BtpPaidWriteTransport, type BtpPaidWriteTransportConfig, BtpRuntimeClient, type BtpRuntimeClientConfig, CLAIM_ACK_HEADER, CLAIM_ACK_PROTOCOL, CLAIM_REJECT_CODE, CLAIM_REJECT_REASONS,
|
|
6968
|
+
export { ACCUMULATED_COST_HEADER, ACCUMULATED_COST_PROTOCOL, ARNS_KIND, type AntSpawnOutcome, type AntSpawnParams, type AntSpawnRefused, type AntSpawnStep, type AntSpawned, type ArnsAntPrepareReceipt, type ArnsBuyOutcome, type ArnsBuyParams, type ArnsBuyReceipt, type ArnsNameType, type ArnsNameWithAntOutcome, type ArnsNetwork, type BTPMessage, BTPMessageType, type BTPProtocolData, type BalanceProofParams, BeforePayRefusedError, BtpAuthError, type BtpChannelDeclaration, BtpConnectionError, type BtpPacketResponse, BtpPaidWriteTransport, type BtpPaidWriteTransportConfig, BtpRuntimeClient, type BtpRuntimeClientConfig, CLAIM_ACK_HEADER, CLAIM_ACK_PROTOCOL, CLAIM_REJECT_CODE, CLAIM_REJECT_REASONS, ChainKind, type ChainMetadata, type ChainSigner, ChainUnavailableError, type ChannelBinding, type ChannelBindingContext, ChannelClient, type ChannelFacade, type ChannelFacadeDeps, ChannelFundingError, ChannelManager, type ChannelManagerConfig, ChannelNotOpenError, ChannelResumeError, type ChannelState, ChannelStatus, type ChannelStore, type ChannelStoreEntry, ChannelTerms, type ClaimAck, type ClaimMessage, type ClaimSendingTransport$1 as ClaimSendingTransport, type ClaimStateFailed, type ClaimStateOk, type ClaimStateRequestEntry, type ClaimStateResult, type ClaimSummary, ClientChannelFacade, ClientWalletFacade, ConfigError, type ConnectorChainSettlementTerms, ConnectorEdgeClient, type ConnectorEdgeClientConfig, ConnectorEdgeError, type ConnectorEdgeErrorCode, ConnectorError, type ConnectorIdentity, type ConnectorRoutePrice, type ConnectorRouteTerms, type ConnectorSettlementTerms, type ConnectorSolanaSettlementTerms, type CounterpartyVerdict, DEFAULT_DEPOSIT, DEFAULT_SETTLEMENT_TIMEOUT, DEFAULT_TIMEOUT_MS, DEVNET, type Decoded, type DeriveIdentityOptions, type DerivedIdentity, type DevnetNode, ERC20_ABI, type EVMClaimMessage, type EdgeIdentity, type EncryptedKeystore, type EnsureChannelOptions, type Envelope, EnvelopeError, EnvelopeErrorKind, type EnvelopeHeader, type EnvelopeRequest, type EnvelopeResponse, type EvmChannelRecord, type EvmReadConsistencyConfig, EvmSigner, type ExchangeOutcome, FULFILLMENT_MISMATCH_CODE, FULFILLMENT_MISMATCH_MESSAGE, type FaucetChain, type FundWalletOptions, type FundWalletResult, GIFTWRAP_NONCE_LENGTH, GIFTWRAP_PUBLIC_KEY_LENGTH, GIFTWRAP_SECRET_LENGTH, GIFTWRAP_TYPE_REQUEST, GIFTWRAP_TYPE_RESPONSE, type GasStationExecuteReceipt, type GasStationFailureReason, type GasStationFailureReceipt, type GasStationQuoteReceipt, type GasStationReceipt, type GiftWrapEcdh, GiftWrapError, GiftWrapErrorKind, HS_HOSTNAME_MAX_LENGTH, HS_HOSTNAME_REGEX, HttpIlpClient, type HttpIlpClientConfig, type ILPFulfillPacket, ILPPacketType, type ILPPreparePacket, type ILPRejectPacket, type ILPResponsePacket, ILP_CLAIM_HEADER, ILP_PEER_ID_HEADER, type IlpClient, type IlpResponseMeta, type IlpSendParams, type IlpSendResult, type IlpSendResultWithFulfillment, InMemoryChannelStore, InsufficientBalanceError, InvalidAddressError, IsomorphicBtpClient, type JobAnswer, type JobEndpoint, type JobEvent, type JobEventParams, type JobSender, JsonFileChannelStore, KEYSTORE_VERSION, type KeyDerivationScheme, MIN_SETTLEMENT_TIMEOUT_SECONDS, NetworkError, type NodeSelfDescription, OerError, OerErrorKind, OnChainChannelClient, type OnChainChannelClientConfig, OnChainChannelStatus, type OpenChannelOptions, OpenChannelParams, OpenChannelResult, type OpenOrAdoptParams, type OpenedKeystore, type OpenedRequest, PACKET_EXPIRY_HEADROOM_MS, PAYMENT_REQUIRED_HEADER, PAYMENT_REQUIRED_PROTOCOL, PROXIED_RPC_DEFAULTS, type PaidWriteTransport, type ParsedX402Challenge, PaymentRequiredError, type PaymentTerms, type ProxiedChainRpc, type RequiredTransport, type ResolvedConfig, type ResolvedIdentity, type ResponseHeaderSource, type RetryOptions, type RouteCharge, RouteNotPricedError, type RoutePrice, type RpcTransportOptions, SOLANA_GAS_KIND, type SealedExchange, type SealedRequest, SealedResponseError, type SealedResponseErrorKind, type SendContext, type SendFulfilled, type SendOptions, type SendRefused, type SendRequest, type SendResult, type SendTransferParams, type SendTransferResult, type SignedBalanceProof, type SolanaChannelConfig, type SolanaClaimMessage, type Signer as SolanaKeypair, type SolanaNetwork, SolanaRpcTransportError, SolanaSigner, type SolanaWireTransaction, StaleRpcReadError, TOKEN_NETWORK_ABI, TOKEN_NETWORK_REGISTRY_ABI, TokenNetworkClient, type TokenNetworkClientConfig, type ToonChannelAccept, ToonClient, type ToonClientConfig, ToonClientError, type ToonClientLike, type ToonIdentity, TransactionOutcomeError, type TransferConfig, TransferNotDeliveredError, TransferUnsupportedError, type TransportChoice, type TransportPreference, TransportRequiredError, type TxRef, UnknownChainError, ValidationError, type WalletBalance, type WalletBalanceSources, type WalletChainBalances, type WalletFacade, type WalletFacadeDeps, type WalletTokenAmount, type WriteKeystoreOptions, type X402ChannelExtra, addressFor, assertRoutableHsHostname, buildJobEvent, buildResponseMeta, buyArnsName, buyArnsNameWithNewAnt, chainUnavailableMessage, chargeFor, connectorEdgeBaseUrl, counterpartyMatch, decodeAccumulatedCost, decodeBase64Text, decodeClaimAck, decodeEnvelope, decodeEnvelopeRequest, decodeEnvelopeResponse, decodePaymentRequired, decodeVarOctetString, decodeVarUint, decryptMnemonic, defaultDestinationFor, defaultFaucetTimeout, defaultRpcUrl, deriveEvmChannelId, deriveFulfillment, deriveFullIdentity, deserializeIlpPacket, deserializeIlpPrepare, encodeEnvelope, encodeEnvelopeRequest, encodeEnvelopeResponse, encodeVarOctetString, encodeVarUint, encryptMnemonic, envelopeHeader, evmDerivationPath, evmIdentityFromKey, fundWallet, generateKeystore, generateMnemonic, generateRandomIdentity, generateSolanaKeypair, giftWrapPublicKey, httpEndpointToBtpUrl, importKeystore, isGasStationFailure, isHiddenServiceUrl, isInsufficientGasError, isRoutableHsHostname, isUnknownChannelReject, jobEventParam, keystoreDerivation, loadKeystore, localGiftWrapEcdh, looksLikeSealedResponse, mapIlpResponse, openKeystore, openRequest, openResponse, parseBtpMessage, parseEvmChainId, parsePaymentTerms, parseSelfDescription, parseSettlementEntry, parseSolanaWireTransaction, parseX402Body, parseX402Challenge, patchSolanaRecentBlockhash, readBaseUnits, readResponseMeta$1 as readBtpResponseMeta, readEvmNativeBalance, readEvmTokenBalance, readExchangeOutcome, readResponseMeta, readSolanaNativeBalance, readSolanaTokenBalance, readWalletBalances, rejectNamesChannel, resolveConfig, resolveExpectedFulfillment, resolveExpiresAt, routeFor, routePriceFor, rpcFetch, rpcTransport, sameSettlementAddress, sealExchange, sealRequest, sealRequestWithRandomness, sealResponse, sealResponseWithRandomness, selectTransport, send, sendJob, sendTransfer, serializeBtpMessage, serializeIlpFulfill, serializeIlpPrepare, serializeIlpReject, settlementToTerms, signSolanaWireTransaction, solanaKeypair, sortParticipants, spawnAnt, toEnvelopeRequest, trimTrailingSlashes, validateMnemonic, withRetry, writeKeystoreFile };
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
loadKeystore,
|
|
9
9
|
openKeystore,
|
|
10
10
|
writeKeystoreFile
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-PTTRHLYV.js";
|
|
12
12
|
import {
|
|
13
13
|
ACCUMULATED_COST_HEADER,
|
|
14
14
|
ACCUMULATED_COST_PROTOCOL,
|
|
@@ -66,9 +66,11 @@ import {
|
|
|
66
66
|
PACKET_EXPIRY_HEADROOM_MS,
|
|
67
67
|
PAYMENT_REQUIRED_HEADER,
|
|
68
68
|
PAYMENT_REQUIRED_PROTOCOL,
|
|
69
|
+
PROXIED_RPC_DEFAULTS,
|
|
69
70
|
PaymentRequiredError,
|
|
70
71
|
RouteNotPricedError,
|
|
71
72
|
SealedResponseError,
|
|
73
|
+
SolanaRpcTransportError,
|
|
72
74
|
SolanaSigner,
|
|
73
75
|
StaleRpcReadError,
|
|
74
76
|
TOKEN_NETWORK_ABI,
|
|
@@ -76,6 +78,7 @@ import {
|
|
|
76
78
|
TokenNetworkClient,
|
|
77
79
|
ToonClient,
|
|
78
80
|
ToonClientError,
|
|
81
|
+
TransactionOutcomeError,
|
|
79
82
|
TransferNotDeliveredError,
|
|
80
83
|
TransferUnsupportedError,
|
|
81
84
|
TransportRequiredError,
|
|
@@ -165,7 +168,7 @@ import {
|
|
|
165
168
|
toHex,
|
|
166
169
|
trimTrailingSlashes,
|
|
167
170
|
withRetry
|
|
168
|
-
} from "./chunk-
|
|
171
|
+
} from "./chunk-G36D22II.js";
|
|
169
172
|
import {
|
|
170
173
|
DEVNET,
|
|
171
174
|
HS_HOSTNAME_MAX_LENGTH,
|
|
@@ -182,7 +185,7 @@ import {
|
|
|
182
185
|
isHiddenServiceUrl,
|
|
183
186
|
isRoutableHsHostname,
|
|
184
187
|
validateMnemonic
|
|
185
|
-
} from "./chunk-
|
|
188
|
+
} from "./chunk-O6KX7MHD.js";
|
|
186
189
|
import {
|
|
187
190
|
validateSocks5hUrl
|
|
188
191
|
} from "./chunk-32MD3CXE.js";
|
|
@@ -737,10 +740,12 @@ export {
|
|
|
737
740
|
PACKET_EXPIRY_HEADROOM_MS,
|
|
738
741
|
PAYMENT_REQUIRED_HEADER,
|
|
739
742
|
PAYMENT_REQUIRED_PROTOCOL,
|
|
743
|
+
PROXIED_RPC_DEFAULTS,
|
|
740
744
|
PaymentRequiredError,
|
|
741
745
|
RouteNotPricedError,
|
|
742
746
|
SOLANA_GAS_KIND,
|
|
743
747
|
SealedResponseError,
|
|
748
|
+
SolanaRpcTransportError,
|
|
744
749
|
SolanaSigner,
|
|
745
750
|
StaleRpcReadError,
|
|
746
751
|
TOKEN_NETWORK_ABI,
|
|
@@ -748,6 +753,7 @@ export {
|
|
|
748
753
|
TokenNetworkClient,
|
|
749
754
|
ToonClient,
|
|
750
755
|
ToonClientError,
|
|
756
|
+
TransactionOutcomeError,
|
|
751
757
|
TransferNotDeliveredError,
|
|
752
758
|
TransferUnsupportedError,
|
|
753
759
|
TransportRequiredError,
|