@toon-protocol/client 0.14.2 → 0.14.4

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/README.md CHANGED
@@ -2,17 +2,17 @@
2
2
 
3
3
  The **client library** for TOON Protocol — _pay-to-write Nostr over Interledger (ILP)_. Use it to **pay for and publish** writes to a network of service nodes. **Reads are free; writes cost a signed EIP-712 payment-channel claim** against an on-chain deposit.
4
4
 
5
- > **`client` vs `townhouse`.** This package (`@toon-protocol/client`) is what an _app or end user_ uses to **pay** and publish. It does **not** run any relay or node. The nodes are operated separately by **`@toon-protocol/townhouse`** (the operator product, which runs an _apex_ connector plus `town` / `mill` / `dvm` children). Don't confuse the **client** (pays) with **townhouse** (operates), or **`town`** (a single Nostr-relay node) with **townhouse** (the whole operator stack).
5
+ > **`client` vs `relay`.** This package (`@toon-protocol/client`) is what an _app or end user_ uses to **pay** and publish. It does **not** run any relay or node. The nodes are operated separately by **`@toon-protocol/relay`** (the operator product, which runs an _apex_ connector plus `town` / `swap` / `store` children). Don't confuse the **client** (pays) with **relay** (operates), or **`town`** (a single Nostr-relay node) with **relay** (the whole operator stack).
6
6
 
7
7
  ## Which call pays which node
8
8
 
9
- Every write is an ILP packet carrying a signed payment-channel claim. The client reaches all node types **through a townhouse apex** (`g.townhouse`): the apex validates the claim, takes its fee, and forwards the packet to the destination node, which returns FULFILL (accepted) or REJECT. The method you call determines which node type you pay:
9
+ Every write is an ILP packet carrying a signed payment-channel claim. The client reaches all node types **through a relay apex** (`g.proxy`): the apex validates the claim, takes its fee, and forwards the packet to the destination node, which returns FULFILL (accepted) or REJECT. The method you call determines which node type you pay:
10
10
 
11
11
  | Client call | Node type | What it does |
12
12
  | --------------------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
13
13
  | `client.publishEvent(event)` | **town** | Publish a Nostr event (e.g. `kind:1`) to the relay. |
14
- | `requestBlobStorage(client, …)` | **dvm** | NIP-90 compute/storage. Builds and publishes a `kind:5094` event that uploads a blob to Arweave — the job request **is** the payment — and decodes the Arweave tx ID from the FULFILL response. |
15
- | `client.sendSwapPacket(…)` | **mill** | Multi-chain token swap (low-level). Most callers use the higher-level `streamSwap()` from `@toon-protocol/sdk`, which is built on `sendSwapPacket`. |
14
+ | `requestBlobStorage(client, …)` | **store** | NIP-90 compute/storage. Builds and publishes a `kind:5094` event that uploads a blob to Arweave — the job request **is** the payment — and decodes the Arweave tx ID from the FULFILL response. |
15
+ | `client.sendSwapPacket(…)` | **swap** | Multi-chain token swap (low-level). Most callers use the higher-level `streamSwap()` from `@toon-protocol/sdk`, which is built on `sendSwapPacket`. |
16
16
 
17
17
  ## What It Does
18
18
 
@@ -21,7 +21,7 @@ This client handles:
21
21
  - **ILP Micropayments**: Pay to publish Nostr events (reads are free)
22
22
  - **Payment Channels**: Automatic on-chain channel creation with off-chain settlement via signed balance proofs
23
23
  - **Unified Identity**: One Nostr key = one EVM address (both secp256k1, derived automatically) — or a single BIP-39 **mnemonic** to derive a full multi-chain identity
24
- - **Multi-Chain Settlement**: Sign payment-channel claims on EVM (EIP-712), Solana (Ed25519), and Mina (Pallas) from one mnemonic. A Townhouse apex validates the claim and redeems it on-chain on the matching chain (EVM/Solana credit the recipient; Mina redeems each claim on-chain with recipient credit-at-close deferred — see [Multi-Chain Settlement notes](#identity--multi-chain-settlement))
24
+ - **Multi-Chain Settlement**: Sign payment-channel claims on EVM (EIP-712), Solana (Ed25519), and Mina (Pallas) from one mnemonic. A relay apex validates the claim and redeems it on-chain on the matching chain (EVM/Solana credit the recipient; Mina redeems each claim on-chain with recipient credit-at-close deferred — see [Multi-Chain Settlement notes](#identity--multi-chain-settlement))
25
25
  - **Multi-Hop Routing**: Publish to any destination address (`destination` / `destinationAddress`), not just your direct peer
26
26
  - **Network Bootstrap**: Automatically discover and register with ILP peers via NIP-02 follow lists
27
27
  - **TOON Encoding**: Native binary format for agent-friendly event encoding
@@ -41,7 +41,7 @@ pnpm add mina-signer
41
41
 
42
42
  - **Node.js ≥ 20** — these packages are ESM.
43
43
  - **A TOON apex to pay.** You don't run any node yourself; you connect to a running
44
- [`@toon-protocol/townhouse`](https://www.npmjs.com/package/@toon-protocol/townhouse) apex (or any
44
+ [`@toon-protocol/relay`](https://www.npmjs.com/package/@toon-protocol/relay) apex (or any
45
45
  TOON connector) and pay it. From its operator you need:
46
46
  - a **connector endpoint** — an HTTP `connectorUrl` and/or a BTP WebSocket `btpUrl`;
47
47
  - a **settlement-chain RPC URL** and a **funded key** on that chain, so the client can open a
@@ -167,13 +167,13 @@ console.log('Mina: ', client.getMinaAddress()); // base58, after start() (nee
167
167
  - **Mina is optional**: it requires the `mina-signer` peer dependency (see Installation). Without it, the client still works for Nostr/EVM/Solana and `getMinaAddress()` returns `undefined`.
168
168
  - **Security**: JavaScript strings can't be zeroed from memory, so a `mnemonic` may linger in the heap. For high-security contexts, derive keys yourself (e.g. via `KeyManager`) and pass a pre-derived `secretKey`.
169
169
  - **Per-chain claim formats.** Each publish carries a balance-proof claim in the format that destination chain's connector verifier expects — EVM via EIP-712, Solana as a raw Ed25519 message over the on-chain payment-channel message (`channel_pda ‖ nonce ‖ transferredAmount`), Mina as a Pallas-Schnorr claim over a Poseidon `balanceCommitment`. `ToonClient` selects the right signer for the negotiated channel automatically; you do not pick the format. Canonical layouts live in `@toon-protocol/core` (`packages/core/src/settlement/`) so client signers and connector verifiers cannot drift.
170
- - **On-chain redemption is automatic, and driven by the apex — not the client.** You sign off-chain claims; the Townhouse apex validates them, fulfills, and (once a per-channel threshold is crossed) submits the on-chain redemption itself. EVM and Solana credit the recipient on-chain (Solana at channel close, `SETTLE_CHANNEL`). On **Mina** each paid publish redeems on-chain (`claimFromChannel`, the apex co-signs the counterparty signature; the zkApp nonce and balance commitment advance), and **the recipient's tokens are credited at channel close** via the Story 34.4 fund-custody zkApp (`@toon-protocol/connector` ≥3.10.0): the deposit is escrowed on the zkApp account and `settle()` drains it to the participants (recipient + depositor refund). Verified against `@toon-protocol/connector` 3.10.0.
170
+ - **On-chain redemption is automatic, and driven by the apex — not the client.** You sign off-chain claims; the relay apex validates them, fulfills, and (once a per-channel threshold is crossed) submits the on-chain redemption itself. EVM and Solana credit the recipient on-chain (Solana at channel close, `SETTLE_CHANNEL`). On **Mina** each paid publish redeems on-chain (`claimFromChannel`, the apex co-signs the counterparty signature; the zkApp nonce and balance commitment advance), and **the recipient's tokens are credited at channel close** via the Story 34.4 fund-custody zkApp (`@toon-protocol/connector` ≥3.10.0): the deposit is escrowed on the zkApp account and `settle()` drains it to the participants (recipient + depositor refund). Verified against `@toon-protocol/connector` 3.10.0.
171
171
 
172
172
  ---
173
173
 
174
174
  ## Uploading a blob to a DVM (Arweave storage)
175
175
 
176
- To store a blob permanently on Arweave, pay a **dvm** node with a `kind:5094` NIP-90 request. The `requestBlobStorage` helper builds the signed event, publishes it through your `ToonClient` (reusing its claim/channel plumbing), and decodes the Arweave transaction ID from the FULFILL response:
176
+ To store a blob permanently on Arweave, pay a **store** node with a `kind:5094` NIP-90 request. The `requestBlobStorage` helper builds the signed event, publishes it through your `ToonClient` (reusing its claim/channel plumbing), and decodes the Arweave transaction ID from the FULFILL response:
177
177
 
178
178
  ```typescript
179
179
  import { ToonClient, requestBlobStorage } from '@toon-protocol/client';
@@ -183,7 +183,7 @@ const result = await requestBlobStorage(client, secretKey, {
183
183
  blobData: new Uint8Array([1, 2, 3, 4]),
184
184
  contentType: 'application/octet-stream',
185
185
  ilpAmount: 50_000n, // USDC micro-units; also used as the event's `bid` if `bid` is omitted
186
- destination: 'g.toon.peer1', // the DVM's ILP address (defaults to the client's destinationAddress)
186
+ destination: 'g.toon.peer1', // the store node's ILP address (defaults to the client's destinationAddress)
187
187
  });
188
188
 
189
189
  if (result.success) {
@@ -239,7 +239,7 @@ await client.publishEvent(event, { claim });
239
239
  2. **Channel Creation**: Opens an on-chain payment channel on the negotiated chain — using your derived EVM address (EVM), the Ed25519 channel PDA (Solana), or the deployed zkApp account (Mina) when the matching `solanaChannel` / `minaChannel` config is provided
240
240
  3. **Off-chain Payments**: Signed balance proofs (chain-appropriate format) settle payments off-chain
241
241
  4. **Auto-tracking**: ChannelManager automatically tracks channels and increments nonces
242
- 5. **On-chain redemption**: A Townhouse apex auto-redeems claims on-chain once a per-channel threshold is crossed (see [Multi-Chain Settlement](#identity--multi-chain-settlement) for the EVM/Solana/Mina specifics and the Mina credit-at-close deferral)
242
+ 5. **On-chain redemption**: A relay apex auto-redeems claims on-chain once a per-channel threshold is crossed (see [Multi-Chain Settlement](#identity--multi-chain-settlement) for the EVM/Solana/Mina specifics and the Mina credit-at-close deferral)
243
243
 
244
244
  ### Using a Separate EVM Key (Advanced)
245
245
 
@@ -304,10 +304,9 @@ See [examples/client-example/](../../examples/client-example/) for standalone cl
304
304
  ## Related Packages
305
305
 
306
306
  - **[@toon-protocol/core](../core/)** — Core protocol (peer discovery, bootstrap, `buildBlobStorageRequest`)
307
- - **[@toon-protocol/relay](../relay/)** — Nostr relay with ILP payment gating (`encodeEventToToon` / `decodeEventFromToon`)
308
- - **[@toon-protocol/sdk](../sdk/)** — Higher-level helpers including `streamSwap()` for multi-chain swaps via a **mill**
307
+ - **[@toon-protocol/relay](../relay/)** — Operator product running the apex connector plus town/swap/store nodes; also exports `encodeEventToToon` / `decodeEventFromToon` for event encoding
308
+ - **[@toon-protocol/sdk](../sdk/)** — Higher-level helpers including `streamSwap()` for multi-chain swaps via a **swap**
309
309
  - **[@toon-protocol/bls](../bls/)** — Business Logic Server (pricing, validation, storage)
310
- - **[@toon-protocol/townhouse](../townhouse/)** — The operator product that runs the apex + town/mill/dvm nodes you pay
311
310
 
312
311
  ---
313
312
 
package/dist/index.d.ts CHANGED
@@ -172,7 +172,7 @@ interface ToonClientConfig {
172
172
  * preferred tokens, EVM TokenNetwork addresses, and the Solana/Mina channel
173
173
  * params (programId / zkApp) — from the shared core presets
174
174
  * (`resolveClientNetwork`), so the caller no longer hand-wires every address.
175
- * This is the client-side mirror of the townhouse node's `network` selector;
175
+ * This is the client-side mirror of the relay node's `network` selector;
176
176
  * both resolve the SAME deployed contracts.
177
177
  *
178
178
  * Precedence: any explicit per-chain field (`supportedChains`,
@@ -1013,7 +1013,7 @@ declare class ToonClient {
1013
1013
  }): Promise<RequestBlobStorageResult>;
1014
1014
  /**
1015
1015
  * Per-chain settlement readiness for the configured `network` tier, mirroring
1016
- * the townhouse node's status. Returns `undefined` when no named `network` is
1016
+ * the relay node's status. Returns `undefined` when no named `network` is
1017
1017
  * set (or `network: 'custom'`), since there is no preset tier to report on.
1018
1018
  */
1019
1019
  getNetworkStatus(): NetworkFamilyStatus | undefined;
@@ -1099,7 +1099,7 @@ declare class ToonClient {
1099
1099
  */
1100
1100
  h402Fetch(url: string, opts?: H402FetchOptions): Promise<Response>;
1101
1101
  /**
1102
- * Sends a raw swap ILP packet (Story 12.5) to a Mill peer with an attached
1102
+ * Sends a raw swap ILP packet (Story 12.5) to a swap peer with an attached
1103
1103
  * balance-proof claim. This is a lower-level surface than `publishEvent`:
1104
1104
  * it forwards the raw `IlpSendResult` so the sender (`streamSwap()`) can
1105
1105
  * decode FULFILL metadata itself.
@@ -1864,7 +1864,7 @@ declare class EvmSigner {
1864
1864
  * is what makes a client-issued Solana payment-channel claim (paying the apex
1865
1865
  * to write) acceptable on connector 3.9.0.
1866
1866
  *
1867
- * NOTE: this is a DIFFERENT message from the Mill ↔ sender swap-claim wire
1867
+ * NOTE: this is a DIFFERENT message from the swap peer ↔ sender swap-claim wire
1868
1868
  * contract (`balanceProofHashSolana`, SDK `verifyEd25519Signature`). The client
1869
1869
  * here is paying a payment-channel claim to the apex, not issuing a swap claim,
1870
1870
  * so it must sign the connector's on-chain payment-channel message. `channelId`
@@ -1934,7 +1934,7 @@ interface MinaSignerOptions {
1934
1934
  * off-chain `verifyBalanceProof` accepts EITHER, so off-chain store/FULFILL works
1935
1935
  * in both cases — only on-chain settle requires the participant form.
1936
1936
  *
1937
- * NOTE: this is a DIFFERENT message + format from the Mill ↔ sender swap-claim
1937
+ * NOTE: this is a DIFFERENT message + format from the swap peer ↔ sender swap-claim
1938
1938
  * wire contract (`balanceProofFieldsMina` in `@toon-protocol/core`, verified by
1939
1939
  * the SDK's `verifyMinaSignature`). The client here pays a payment-channel claim
1940
1940
  * to the apex, so it signs the connector's on-chain payment-channel scheme; the
@@ -2406,7 +2406,7 @@ declare function buildStoreWriteEnvelope(event: NostrEvent, requestTarget?: stri
2406
2406
  * dependency-free helper that returns the status code + raw body string, which
2407
2407
  * is all the publish/upload paths need.
2408
2408
  *
2409
- * DEFENSIVE: not every FULFILL is HTTP-enveloped (e.g. Mill-swap raw-TOON
2409
+ * DEFENSIVE: not every FULFILL is HTTP-enveloped (e.g. swap peer raw-TOON
2410
2410
  * FULFILLs go through `sendSwapPacket`, not these paths). If the decoded data
2411
2411
  * does not begin with an `HTTP/<v>` status line, `isHttp` is `false` and the
2412
2412
  * caller should fall back to its prior (non-HTTP) interpretation rather than
@@ -2467,7 +2467,7 @@ interface ClientSettlementInfo {
2467
2467
  declare function applyNetworkPresets(config: ToonClientConfig): ToonClientConfig;
2468
2468
  /**
2469
2469
  * Returns per-chain settlement readiness for the configured `network` tier,
2470
- * mirroring the townhouse node's status. Returns `undefined` when `network` is
2470
+ * mirroring the relay node's status. Returns `undefined` when `network` is
2471
2471
  * unset or `'custom'` (no preset tier to report on).
2472
2472
  */
2473
2473
  declare function getNetworkStatus(config: ToonClientConfig): NetworkFamilyStatus | undefined;
@@ -2977,9 +2977,24 @@ interface FundWalletResult {
2977
2977
  interface FundWalletOptions {
2978
2978
  /** Custom fetch implementation (for testing / custom transports). */
2979
2979
  fetchImpl?: typeof fetch;
2980
- /** Request timeout in milliseconds (default: 30000). */
2980
+ /**
2981
+ * Request timeout in milliseconds. Defaults to {@link defaultFaucetTimeout}
2982
+ * for the chain (fast 30s for evm/solana, a longer 120s for the slow-settling
2983
+ * mina faucet).
2984
+ */
2981
2985
  timeout?: number;
2982
2986
  }
2987
+ /**
2988
+ * Default faucet request timeout (ms) for a chain.
2989
+ *
2990
+ * EVM and Solana faucets respond in a few seconds, so 30s is plenty. The Mina
2991
+ * faucet sends native MINA *and* mints USDC on a chain that settles much more
2992
+ * slowly: the drip routinely succeeds server-side (the faucet logs
2993
+ * `✅ Mina faucet request completed`) but takes well over 30s to answer the
2994
+ * HTTP request, so a flat 30s budget makes the client give up on a request that
2995
+ * actually worked. Give mina a much longer budget.
2996
+ */
2997
+ declare function defaultFaucetTimeout(chain: FaucetChain): number;
2983
2998
  /**
2984
2999
  * Drip test funds to `address` on `chain` from the devnet `faucetUrl`.
2985
3000
  *
@@ -3271,7 +3286,7 @@ declare function isPrfSupported(): boolean;
3271
3286
  /**
3272
3287
  * Node-only encrypted mnemonic keystore for @toon-protocol/client.
3273
3288
  *
3274
- * Mirrors the Townhouse node wallet crypto (`packages/townhouse/src/wallet/
3289
+ * Mirrors the relay node wallet crypto (`packages/relay/src/wallet/
3275
3290
  * crypto.ts`): a BIP-39 mnemonic is encrypted at rest with scrypt (KDF) +
3276
3291
  * AES-256-GCM (authenticated encryption), serialized as JSON, and written to
3277
3292
  * disk with mode 0o600. Decryption requires the operator password; a wrong
@@ -3286,7 +3301,7 @@ declare function isPrfSupported(): boolean;
3286
3301
  */
3287
3302
  /**
3288
3303
  * Encrypted keystore file format (JSON, all binary fields base64-encoded).
3289
- * Wire-compatible with Townhouse's `EncryptedWallet`.
3304
+ * Wire-compatible with the relay node's `EncryptedWallet`.
3290
3305
  */
3291
3306
  interface EncryptedKeystore {
3292
3307
  /** scrypt salt (base64). */
@@ -3337,8 +3352,8 @@ declare function importKeystore(path: string, mnemonic: string, password: string
3337
3352
  declare function loadKeystore(path: string, password: string): string;
3338
3353
  /**
3339
3354
  * Serialize and write an encrypted keystore to disk with mode 0o600
3340
- * (owner read/write only), mirroring the Townhouse wallet file permissions.
3355
+ * (owner read/write only), mirroring the relay node wallet file permissions.
3341
3356
  */
3342
3357
  declare function writeKeystoreFile(path: string, keystore: EncryptedKeystore): void;
3343
3358
 
3344
- export { type BackupPayload, type BalanceProofParams, BtpRuntimeClient, type BtpRuntimeClientConfig, type ChainMetadata, type ChainSigner, ChannelManager, type ClaimMessage, type ClaimResolver, ConnectorError, type DiscoveredIlpPeer, type EVMClaimMessage, type EncryptedKeystore, EvmSigner, type FaucetChain, type FundWalletOptions, type FundWalletResult, type H402FetchOptions, Http402Client, type Http402ClientConfig, HttpConnectorAdmin, type HttpConnectorAdminConfig, HttpIlpClient, type HttpIlpClientConfig, type HttpIlpClientFactory, HttpRuntimeClient, type HttpRuntimeClientConfig, ILP_CLAIM_HEADER, ILP_CLAIM_WRAPPED_HEADER, ILP_PEER_ID_HEADER, type IlpTransportChoice, type InteractionResultContent, KeyManager, type KeyManagerConfig, type MinaClaimMessage, type MinaDepositReader, MinaSigner, type MinaSignerOptions, NetworkError, OnChainChannelClient, type OnChainChannelClientConfig, type ParsedFulfillHttp, type ParsedX402Challenge, type PasskeyInfo, type PetDvmProvider, type PetInteractionEventData, type PetInteractionRequestParams, type PetInteractionResultData, type PetListing, type PetListingFilterOptions, type PetListingParams, type PetPurchaseRequestParams, type ProofStatus, type PublishEventResult, type RequestBlobStorageParams, type RequestBlobStorageResult, type RetryOptions, type SelectIlpTransportOptions, type SignedBalanceProof, type SolanaChannelClientOptions, type SolanaClaimMessage, SolanaSigner, type StatValues, type ToonChannelAccept, ToonClient, type ToonClientConfig, ToonClientError, type ToonIdentity, type ToonSigners, type ToonStartResult, type UnsignedNostrEvent, ValidationError, type VaultData, applyDefaults, applyNetworkPresets, buildBackupEvent, buildBackupFilter, buildPetInteractionRequest, buildPetListingEvent, buildPetPurchaseRequest, buildSettlementInfo, buildStoreWriteEnvelope, decryptMnemonic, deriveFromNsec, deriveFullIdentity, deriveNostrKeyFromMnemonic, encryptMnemonic, filterPetDvmProviders, filterPetListings, fundWallet, generateKeystore, generateMnemonic, generateRandomIdentity, getNetworkStatus, httpEndpointToBtpUrl, importKeystore, isPrfSupported, loadKeystore, parseBackupPayload, parseFulfillHttp, parseFulfillHttpBytes, parseHttpResponse, parsePetInteractionEvent, parsePetInteractionResult, parsePetListing, parseX402Body, parseX402Challenge, proxyIlpEndpoint, readDiscoveredIlpPeer, readMinaDepositTotal, requestBlobStorage, selectIlpTransport, serializeHttpRequest, validateConfig, validateMnemonic, withRetry, writeKeystoreFile };
3359
+ export { type BackupPayload, type BalanceProofParams, BtpRuntimeClient, type BtpRuntimeClientConfig, type ChainMetadata, type ChainSigner, ChannelManager, type ClaimMessage, type ClaimResolver, ConnectorError, type DiscoveredIlpPeer, type EVMClaimMessage, type EncryptedKeystore, EvmSigner, type FaucetChain, type FundWalletOptions, type FundWalletResult, type H402FetchOptions, Http402Client, type Http402ClientConfig, HttpConnectorAdmin, type HttpConnectorAdminConfig, HttpIlpClient, type HttpIlpClientConfig, type HttpIlpClientFactory, HttpRuntimeClient, type HttpRuntimeClientConfig, ILP_CLAIM_HEADER, ILP_CLAIM_WRAPPED_HEADER, ILP_PEER_ID_HEADER, type IlpTransportChoice, type InteractionResultContent, KeyManager, type KeyManagerConfig, type MinaClaimMessage, type MinaDepositReader, MinaSigner, type MinaSignerOptions, NetworkError, OnChainChannelClient, type OnChainChannelClientConfig, type ParsedFulfillHttp, type ParsedX402Challenge, type PasskeyInfo, type PetDvmProvider, type PetInteractionEventData, type PetInteractionRequestParams, type PetInteractionResultData, type PetListing, type PetListingFilterOptions, type PetListingParams, type PetPurchaseRequestParams, type ProofStatus, type PublishEventResult, type RequestBlobStorageParams, type RequestBlobStorageResult, type RetryOptions, type SelectIlpTransportOptions, type SignedBalanceProof, type SolanaChannelClientOptions, type SolanaClaimMessage, SolanaSigner, type StatValues, type ToonChannelAccept, ToonClient, type ToonClientConfig, ToonClientError, type ToonIdentity, type ToonSigners, type ToonStartResult, type UnsignedNostrEvent, ValidationError, type VaultData, applyDefaults, applyNetworkPresets, buildBackupEvent, buildBackupFilter, buildPetInteractionRequest, buildPetListingEvent, buildPetPurchaseRequest, buildSettlementInfo, buildStoreWriteEnvelope, decryptMnemonic, defaultFaucetTimeout, deriveFromNsec, deriveFullIdentity, deriveNostrKeyFromMnemonic, encryptMnemonic, filterPetDvmProviders, filterPetListings, fundWallet, generateKeystore, generateMnemonic, generateRandomIdentity, getNetworkStatus, httpEndpointToBtpUrl, importKeystore, isPrfSupported, loadKeystore, parseBackupPayload, parseFulfillHttp, parseFulfillHttpBytes, parseHttpResponse, parsePetInteractionEvent, parsePetInteractionResult, parsePetListing, parseX402Body, parseX402Challenge, proxyIlpEndpoint, readDiscoveredIlpPeer, readMinaDepositTotal, requestBlobStorage, selectIlpTransport, serializeHttpRequest, validateConfig, validateMnemonic, withRetry, writeKeystoreFile };
package/dist/index.js CHANGED
@@ -3987,7 +3987,7 @@ var ToonClient = class {
3987
3987
  }
3988
3988
  /**
3989
3989
  * Per-chain settlement readiness for the configured `network` tier, mirroring
3990
- * the townhouse node's status. Returns `undefined` when no named `network` is
3990
+ * the relay node's status. Returns `undefined` when no named `network` is
3991
3991
  * set (or `network: 'custom'`), since there is no preset tier to report on.
3992
3992
  */
3993
3993
  getNetworkStatus() {
@@ -4305,7 +4305,7 @@ var ToonClient = class {
4305
4305
  return client.fetch(url, opts);
4306
4306
  }
4307
4307
  /**
4308
- * Sends a raw swap ILP packet (Story 12.5) to a Mill peer with an attached
4308
+ * Sends a raw swap ILP packet (Story 12.5) to a swap peer with an attached
4309
4309
  * balance-proof claim. This is a lower-level surface than `publishEvent`:
4310
4310
  * it forwards the raw `IlpSendResult` so the sender (`streamSwap()`) can
4311
4311
  * decode FULFILL metadata itself.
@@ -5414,6 +5414,9 @@ function buildPetPurchaseRequest(params) {
5414
5414
  }
5415
5415
 
5416
5416
  // src/faucet.ts
5417
+ function defaultFaucetTimeout(chain) {
5418
+ return chain === "mina" ? 12e4 : 3e4;
5419
+ }
5417
5420
  function faucetPath(chain) {
5418
5421
  switch (chain) {
5419
5422
  case "evm":
@@ -5434,7 +5437,7 @@ async function fundWallet(faucetUrl, address, chain, options = {}) {
5434
5437
  const base = faucetUrl.replace(/\/+$/, "");
5435
5438
  const url = `${base}${faucetPath(chain)}`;
5436
5439
  const fetchImpl = options.fetchImpl ?? fetch;
5437
- const timeout = options.timeout ?? 3e4;
5440
+ const timeout = options.timeout ?? defaultFaucetTimeout(chain);
5438
5441
  const controller = new AbortController();
5439
5442
  const timeoutId = setTimeout(() => controller.abort(), timeout);
5440
5443
  let response;
@@ -6557,6 +6560,7 @@ export {
6557
6560
  buildUiCoordinate,
6558
6561
  classifyIntent,
6559
6562
  decryptMnemonic2 as decryptMnemonic,
6563
+ defaultFaucetTimeout,
6560
6564
  deriveFromNsec,
6561
6565
  deriveFullIdentity,
6562
6566
  deriveNostrKeyFromMnemonic,