@toon-protocol/client-mcp 0.12.0 → 0.12.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/app/index.html +132 -92
- package/dist/{chunk-W6T6ZK7U.js → chunk-AYIP46A2.js} +45 -3
- package/dist/chunk-AYIP46A2.js.map +1 -0
- package/dist/{chunk-74KX5LXI.js → chunk-EAPVMGLZ.js} +37 -4
- package/dist/chunk-EAPVMGLZ.js.map +1 -0
- package/dist/{chunk-LN64MLWP.js → chunk-XVGREVEL.js} +186 -19
- package/dist/chunk-XVGREVEL.js.map +1 -0
- package/dist/daemon.js +2 -2
- package/dist/index.d.ts +36 -0
- package/dist/index.js +3 -3
- package/dist/mcp.js +16 -7
- package/dist/mcp.js.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-74KX5LXI.js.map +0 -1
- package/dist/chunk-LN64MLWP.js.map +0 -1
- package/dist/chunk-W6T6ZK7U.js.map +0 -1
|
@@ -6561,6 +6561,29 @@ var ValidationError = class extends ToonClientError {
|
|
|
6561
6561
|
this.name = "ValidationError";
|
|
6562
6562
|
}
|
|
6563
6563
|
};
|
|
6564
|
+
var ChannelFundingError = class extends ToonClientError {
|
|
6565
|
+
retryable = true;
|
|
6566
|
+
constructor(message, cause) {
|
|
6567
|
+
super(message, "CHANNEL_FUNDING", cause);
|
|
6568
|
+
this.name = "ChannelFundingError";
|
|
6569
|
+
}
|
|
6570
|
+
};
|
|
6571
|
+
var INSUFFICIENT_GAS_MARKERS = [
|
|
6572
|
+
"exceeds the balance of the account",
|
|
6573
|
+
"insufficient funds for gas",
|
|
6574
|
+
"insufficient funds for intrinsic transaction cost",
|
|
6575
|
+
"insufficient funds for transfer"
|
|
6576
|
+
];
|
|
6577
|
+
function isInsufficientGasError(err) {
|
|
6578
|
+
const parts = [];
|
|
6579
|
+
let cur = err;
|
|
6580
|
+
for (let i = 0; i < 10 && cur != null; i++) {
|
|
6581
|
+
parts.push(cur instanceof Error ? cur.message : String(cur));
|
|
6582
|
+
cur = cur instanceof Error ? cur.cause : void 0;
|
|
6583
|
+
}
|
|
6584
|
+
const text = parts.join(" | ").toLowerCase();
|
|
6585
|
+
return INSUFFICIENT_GAS_MARKERS.some((m) => text.includes(m));
|
|
6586
|
+
}
|
|
6564
6587
|
function generateMnemonic2() {
|
|
6565
6588
|
return generateMnemonic(wordlist, 128);
|
|
6566
6589
|
}
|
|
@@ -9195,14 +9218,33 @@ var OnChainChannelClient = class {
|
|
|
9195
9218
|
};
|
|
9196
9219
|
}
|
|
9197
9220
|
/**
|
|
9198
|
-
* Opens an EVM payment channel on-chain
|
|
9221
|
+
* Opens an EVM payment channel on-chain, remapping the one-time
|
|
9222
|
+
* insufficient-native-gas revert into an actionable {@link ChannelFundingError}
|
|
9223
|
+
* so callers surface "fund the wallet" instead of the raw viem
|
|
9224
|
+
* "...exceeds the balance of the account" string (toon-meta#65). Only the gas
|
|
9225
|
+
* case is remapped; every other error propagates unchanged.
|
|
9226
|
+
*/
|
|
9227
|
+
async openEvmChannel(params) {
|
|
9228
|
+
try {
|
|
9229
|
+
return await this.openEvmChannelUnchecked(params);
|
|
9230
|
+
} catch (err) {
|
|
9231
|
+
if (!isInsufficientGasError(err)) throw err;
|
|
9232
|
+
const chainFamily = params.chain.split(":")[0] || params.chain;
|
|
9233
|
+
throw new ChannelFundingError(
|
|
9234
|
+
`Settlement wallet ${this.evmSigner.address} has no gas on ${chainFamily} to open a payment channel. Run toon_fund_wallet (or fund the wallet) and retry.`,
|
|
9235
|
+
err instanceof Error ? err : void 0
|
|
9236
|
+
);
|
|
9237
|
+
}
|
|
9238
|
+
}
|
|
9239
|
+
/**
|
|
9240
|
+
* Raw EVM channel-open (no gas-error remapping — see {@link openEvmChannel}).
|
|
9199
9241
|
*
|
|
9200
9242
|
* 1. Approve token spend if needed
|
|
9201
9243
|
* 2. Call TokenNetwork.openChannel()
|
|
9202
9244
|
* 3. Extract channelId from ChannelOpened event
|
|
9203
9245
|
* 4. Deposit initial funds if specified
|
|
9204
9246
|
*/
|
|
9205
|
-
async
|
|
9247
|
+
async openEvmChannelUnchecked(params) {
|
|
9206
9248
|
const {
|
|
9207
9249
|
chain: chain2,
|
|
9208
9250
|
tokenNetwork,
|
|
@@ -12864,4 +12906,4 @@ export {
|
|
|
12864
12906
|
@scure/bip32/lib/esm/index.js:
|
|
12865
12907
|
(*! scure-bip32 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) *)
|
|
12866
12908
|
*/
|
|
12867
|
-
//# sourceMappingURL=chunk-
|
|
12909
|
+
//# sourceMappingURL=chunk-AYIP46A2.js.map
|