@toon-protocol/client-mcp 0.10.8 → 0.11.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.
@@ -11394,7 +11394,9 @@ var ToonClient = class {
11394
11394
  const tokens = this.config.preferredTokens;
11395
11395
  if (evmAddress && rpcUrls && tokens) {
11396
11396
  const chainKeys = this.config.supportedChains ?? Object.keys(rpcUrls);
11397
- const chainKey = chainKeys.find((c) => c.startsWith("evm") && rpcUrls[c] && tokens[c]);
11397
+ const usableEvm = (c) => c.startsWith("evm") && Boolean(rpcUrls[c]) && Boolean(tokens[c]);
11398
+ const settlementKeys = Object.keys(this.config.settlementAddresses ?? {});
11399
+ const chainKey = settlementKeys.find((c) => usableEvm(c)) ?? chainKeys.find(usableEvm);
11398
11400
  const rpcUrl = chainKey ? rpcUrls[chainKey] : void 0;
11399
11401
  const tokenAddress = chainKey ? tokens[chainKey] : void 0;
11400
11402
  if (chainKey && rpcUrl && tokenAddress) {
@@ -12551,7 +12553,7 @@ var ControlClient = class _ControlClient {
12551
12553
  return this.request("GET", "/channels");
12552
12554
  }
12553
12555
  balances() {
12554
- return this.request("GET", "/balances");
12556
+ return this.request("GET", "/balances", void 0, { timeoutMs: 12e3 });
12555
12557
  }
12556
12558
  depositToChannel(body) {
12557
12559
  return this.request("POST", "/channels/deposit", body);
@@ -12588,7 +12590,13 @@ var ControlClient = class _ControlClient {
12588
12590
  return this.request("DELETE", "/apex", body);
12589
12591
  }
12590
12592
  fundWallet(body = {}) {
12591
- return this.request("POST", "/fund-wallet", body);
12593
+ return this.request("POST", "/fund-wallet", body, {
12594
+ timeoutMs: 4e4
12595
+ });
12596
+ }
12597
+ fundStatus(chain2) {
12598
+ const path = chain2 ? `/fund-wallet/status?chain=${encodeURIComponent(chain2)}` : "/fund-wallet/status";
12599
+ return this.request("GET", path);
12592
12600
  }
12593
12601
  /**
12594
12602
  * Whether an HTTP method is safe to transparently retry. Idempotent reads
@@ -12599,12 +12607,12 @@ var ControlClient = class _ControlClient {
12599
12607
  static isIdempotent(method) {
12600
12608
  return method === "GET" || method === "DELETE";
12601
12609
  }
12602
- async request(method, path, body) {
12610
+ async request(method, path, body, opts) {
12603
12611
  const attempts = _ControlClient.isIdempotent(method) ? 3 : 1;
12604
12612
  let lastErr;
12605
12613
  for (let attempt = 1; attempt <= attempts; attempt++) {
12606
12614
  try {
12607
- return await this.attemptOnce(method, path, body);
12615
+ return await this.attemptOnce(method, path, body, opts?.timeoutMs);
12608
12616
  } catch (err) {
12609
12617
  lastErr = err;
12610
12618
  if (attempt < attempts && err instanceof DaemonUnreachableError) {
@@ -12616,10 +12624,10 @@ var ControlClient = class _ControlClient {
12616
12624
  }
12617
12625
  throw lastErr;
12618
12626
  }
12619
- async attemptOnce(method, path, body) {
12627
+ async attemptOnce(method, path, body, timeoutMs = this.timeoutMs) {
12620
12628
  const url = `${this.baseUrl}${path}`;
12621
12629
  const controller = new AbortController();
12622
- const timer = setTimeout(() => controller.abort(), this.timeoutMs);
12630
+ const timer = setTimeout(() => controller.abort(), timeoutMs);
12623
12631
  let res;
12624
12632
  try {
12625
12633
  res = await this.fetchImpl(url, {
@@ -12631,7 +12639,7 @@ var ControlClient = class _ControlClient {
12631
12639
  } catch (err) {
12632
12640
  if (controller.signal.aborted) {
12633
12641
  throw new ControlApiError(
12634
- `control request ${method} ${path} timed out after ${this.timeoutMs}ms`,
12642
+ `control request ${method} ${path} timed out after ${timeoutMs}ms`,
12635
12643
  504,
12636
12644
  true
12637
12645
  );
@@ -12801,4 +12809,4 @@ export {
12801
12809
  @scure/bip32/lib/esm/index.js:
12802
12810
  (*! scure-bip32 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) *)
12803
12811
  */
12804
- //# sourceMappingURL=chunk-3ZBC2HUB.js.map
12812
+ //# sourceMappingURL=chunk-CMGJ3NFT.js.map