@toon-protocol/client-mcp 0.10.6 → 0.10.8
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 +19 -0
- package/dist/app/index.html +65 -60
- package/dist/{chunk-XYR3ACYX.js → chunk-3ZBC2HUB.js} +35 -2
- package/dist/{chunk-XYR3ACYX.js.map → chunk-3ZBC2HUB.js.map} +1 -1
- package/dist/{chunk-NDIIPZB4.js → chunk-ADBNZA5O.js} +2 -2
- package/dist/{chunk-CF4X4QPI.js → chunk-XFRMAETF.js} +2 -2
- package/dist/daemon.js +15 -3
- package/dist/daemon.js.map +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.js +3 -3
- package/dist/mcp.js +2 -2
- package/package.json +3 -3
- /package/dist/{chunk-NDIIPZB4.js.map → chunk-ADBNZA5O.js.map} +0 -0
- /package/dist/{chunk-CF4X4QPI.js.map → chunk-XFRMAETF.js.map} +0 -0
|
@@ -12498,7 +12498,7 @@ var DaemonUnreachableError = class extends Error {
|
|
|
12498
12498
|
baseUrl;
|
|
12499
12499
|
causedBy;
|
|
12500
12500
|
};
|
|
12501
|
-
var ControlClient = class {
|
|
12501
|
+
var ControlClient = class _ControlClient {
|
|
12502
12502
|
baseUrl;
|
|
12503
12503
|
timeoutMs;
|
|
12504
12504
|
fetchImpl;
|
|
@@ -12590,7 +12590,33 @@ var ControlClient = class {
|
|
|
12590
12590
|
fundWallet(body = {}) {
|
|
12591
12591
|
return this.request("POST", "/fund-wallet", body);
|
|
12592
12592
|
}
|
|
12593
|
+
/**
|
|
12594
|
+
* Whether an HTTP method is safe to transparently retry. Idempotent reads
|
|
12595
|
+
* (GET) and deletes can be replayed verbatim; a mutating POST cannot — the
|
|
12596
|
+
* daemon may have already applied it before the socket failed, so retrying
|
|
12597
|
+
* risks a double publish/fund/deposit.
|
|
12598
|
+
*/
|
|
12599
|
+
static isIdempotent(method) {
|
|
12600
|
+
return method === "GET" || method === "DELETE";
|
|
12601
|
+
}
|
|
12593
12602
|
async request(method, path, body) {
|
|
12603
|
+
const attempts = _ControlClient.isIdempotent(method) ? 3 : 1;
|
|
12604
|
+
let lastErr;
|
|
12605
|
+
for (let attempt = 1; attempt <= attempts; attempt++) {
|
|
12606
|
+
try {
|
|
12607
|
+
return await this.attemptOnce(method, path, body);
|
|
12608
|
+
} catch (err) {
|
|
12609
|
+
lastErr = err;
|
|
12610
|
+
if (attempt < attempts && err instanceof DaemonUnreachableError) {
|
|
12611
|
+
await new Promise((r) => setTimeout(r, 50 * attempt));
|
|
12612
|
+
continue;
|
|
12613
|
+
}
|
|
12614
|
+
throw err;
|
|
12615
|
+
}
|
|
12616
|
+
}
|
|
12617
|
+
throw lastErr;
|
|
12618
|
+
}
|
|
12619
|
+
async attemptOnce(method, path, body) {
|
|
12594
12620
|
const url = `${this.baseUrl}${path}`;
|
|
12595
12621
|
const controller = new AbortController();
|
|
12596
12622
|
const timer = setTimeout(() => controller.abort(), this.timeoutMs);
|
|
@@ -12603,6 +12629,13 @@ var ControlClient = class {
|
|
|
12603
12629
|
signal: controller.signal
|
|
12604
12630
|
});
|
|
12605
12631
|
} catch (err) {
|
|
12632
|
+
if (controller.signal.aborted) {
|
|
12633
|
+
throw new ControlApiError(
|
|
12634
|
+
`control request ${method} ${path} timed out after ${this.timeoutMs}ms`,
|
|
12635
|
+
504,
|
|
12636
|
+
true
|
|
12637
|
+
);
|
|
12638
|
+
}
|
|
12606
12639
|
throw new DaemonUnreachableError(this.baseUrl, err);
|
|
12607
12640
|
} finally {
|
|
12608
12641
|
clearTimeout(timer);
|
|
@@ -12768,4 +12801,4 @@ export {
|
|
|
12768
12801
|
@scure/bip32/lib/esm/index.js:
|
|
12769
12802
|
(*! scure-bip32 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) *)
|
|
12770
12803
|
*/
|
|
12771
|
-
//# sourceMappingURL=chunk-
|
|
12804
|
+
//# sourceMappingURL=chunk-3ZBC2HUB.js.map
|