@toon-protocol/client 0.20.1 → 0.20.2
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/index.d.ts +17 -13
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -427,7 +427,7 @@ interface ToonClientConfig {
|
|
|
427
427
|
}>;
|
|
428
428
|
/** File path for persisting payment channel nonce/amount state across restarts */
|
|
429
429
|
channelStorePath?: string;
|
|
430
|
-
/** Nostr relay URL for peer discovery. Default: 'ws
|
|
430
|
+
/** Nostr relay URL for peer discovery. Default: 'wss://relay-ws.devnet.toonprotocol.dev' */
|
|
431
431
|
relayUrl?: string;
|
|
432
432
|
/**
|
|
433
433
|
* Known peers to bootstrap with.
|
|
@@ -3932,17 +3932,21 @@ declare function buildSettlementInfo(rawConfig: ToonClientConfig): ClientSettlem
|
|
|
3932
3932
|
/**
|
|
3933
3933
|
* Devnet faucet helper.
|
|
3934
3934
|
*
|
|
3935
|
-
* The deployed TOON devnet exposes a faucet that drips
|
|
3936
|
-
* chain address so a client can open payment channels and pay
|
|
3935
|
+
* The deployed TOON devnet exposes a faucet that drips the settlement token
|
|
3936
|
+
* (USDC) to a given chain address so a client can open payment channels and pay
|
|
3937
|
+
* for writes. This helper hits the USDC-ONLY faucet legs — it funds USDC and
|
|
3938
|
+
* assumes the wallet already holds enough native gas to transact:
|
|
3937
3939
|
*
|
|
3938
|
-
* EVM `POST {faucetUrl}/api/request`
|
|
3939
|
-
* Solana `POST {faucetUrl}/api/solana/request`
|
|
3940
|
-
* Mina `POST {faucetUrl}/api/mina/request`
|
|
3940
|
+
* EVM `POST {faucetUrl}/api/base-sepolia/request` body `{ address }` → USDC (Base Sepolia mint)
|
|
3941
|
+
* Solana `POST {faucetUrl}/api/solana/usdc-request` body `{ address }` → USDC (no SOL leg)
|
|
3942
|
+
* Mina `POST {faucetUrl}/api/mina/usdc-request` body `{ address }` → USDC (no MINA leg)
|
|
3941
3943
|
*
|
|
3942
3944
|
* Devnet edge (today): `https://faucet.devnet.toonprotocol.dev`.
|
|
3943
3945
|
*
|
|
3944
3946
|
* All three chains are live on the deployed faucet — the request shape is
|
|
3945
|
-
* identical (`{ address }`); only the path differs.
|
|
3947
|
+
* identical (`{ address }`); only the path differs. (The EVM leg mints the
|
|
3948
|
+
* ungated mock USDC on Base Sepolia and best-effort tops up gas; the Solana and
|
|
3949
|
+
* Mina legs are strictly USDC-only and expect the address to already hold gas.)
|
|
3946
3950
|
*/
|
|
3947
3951
|
/** Supported faucet chains. */
|
|
3948
3952
|
type FaucetChain = 'evm' | 'solana' | 'mina';
|
|
@@ -3969,12 +3973,12 @@ interface FundWalletOptions {
|
|
|
3969
3973
|
/**
|
|
3970
3974
|
* Default faucet request timeout (ms) for a chain.
|
|
3971
3975
|
*
|
|
3972
|
-
* EVM and Solana
|
|
3973
|
-
*
|
|
3974
|
-
*
|
|
3975
|
-
*
|
|
3976
|
-
*
|
|
3977
|
-
*
|
|
3976
|
+
* The EVM (Base Sepolia mint) and Solana USDC legs respond in a few seconds, so
|
|
3977
|
+
* 30s is plenty. The Mina USDC leg TRANSFERS the token via an o1js-proven
|
|
3978
|
+
* transaction on a chain that settles much more slowly: the drip routinely
|
|
3979
|
+
* succeeds server-side but takes well over 30s to answer the HTTP request, so a
|
|
3980
|
+
* flat 30s budget makes the client give up on a request that actually worked.
|
|
3981
|
+
* Give mina a much longer budget.
|
|
3978
3982
|
*/
|
|
3979
3983
|
declare function defaultFaucetTimeout(chain: FaucetChain): number;
|
|
3980
3984
|
/**
|
package/dist/index.js
CHANGED
|
@@ -470,7 +470,10 @@ function applyDefaults(rawConfig) {
|
|
|
470
470
|
connectorUrl,
|
|
471
471
|
// Surface the derived `POST /ilp` endpoint so HTTP mode selects HttpIlpClient.
|
|
472
472
|
...connectorHttpEndpoint ? { connectorHttpEndpoint } : {},
|
|
473
|
-
|
|
473
|
+
// Last-resort relay default. An explicit `config.relayUrl` always wins;
|
|
474
|
+
// `applyNetworkPresets` does not set a per-network relay, so this fallback
|
|
475
|
+
// points at the public devnet relay rather than a dead localhost socket.
|
|
476
|
+
relayUrl: config.relayUrl ?? "wss://relay-ws.devnet.toonprotocol.dev",
|
|
474
477
|
queryTimeout: config.queryTimeout ?? 3e4,
|
|
475
478
|
maxRetries: config.maxRetries ?? 3,
|
|
476
479
|
retryDelay: config.retryDelay ?? 1e3,
|
|
@@ -6868,11 +6871,11 @@ function defaultFaucetTimeout(chain) {
|
|
|
6868
6871
|
function faucetPath(chain) {
|
|
6869
6872
|
switch (chain) {
|
|
6870
6873
|
case "evm":
|
|
6871
|
-
return "/api/request";
|
|
6874
|
+
return "/api/base-sepolia/request";
|
|
6872
6875
|
case "solana":
|
|
6873
|
-
return "/api/solana/request";
|
|
6876
|
+
return "/api/solana/usdc-request";
|
|
6874
6877
|
case "mina":
|
|
6875
|
-
return "/api/mina/request";
|
|
6878
|
+
return "/api/mina/usdc-request";
|
|
6876
6879
|
}
|
|
6877
6880
|
}
|
|
6878
6881
|
async function fundWallet(faucetUrl, address, chain, options = {}) {
|