@toon-protocol/client-mcp 0.3.0 → 0.4.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.
- package/README.md +4 -0
- package/dist/app/index.html +44 -42
- package/dist/{chunk-QFHCXJ2V.js → chunk-HDAH6TAT.js} +38 -2
- package/dist/chunk-HDAH6TAT.js.map +1 -0
- package/dist/{chunk-XV52IHVR.js → chunk-MAQ3UZPR.js} +78 -10
- package/dist/chunk-MAQ3UZPR.js.map +1 -0
- package/dist/{chunk-CQ2QIZ6Z.js → chunk-WGR4UZ34.js} +67 -1
- package/dist/chunk-WGR4UZ34.js.map +1 -0
- package/dist/daemon.js +2 -2
- package/dist/index.d.ts +37 -1
- package/dist/index.js +3 -3
- package/dist/mcp.js +2 -2
- package/package.json +3 -3
- package/dist/chunk-CQ2QIZ6Z.js.map +0 -1
- package/dist/chunk-QFHCXJ2V.js.map +0 -1
- package/dist/chunk-XV52IHVR.js.map +0 -1
|
@@ -9,11 +9,12 @@ import {
|
|
|
9
9
|
defaultConfigPath,
|
|
10
10
|
deriveFullIdentity,
|
|
11
11
|
encodeEventToToon,
|
|
12
|
+
fundWallet,
|
|
12
13
|
generateKeystore,
|
|
13
14
|
isEventExpired,
|
|
14
15
|
parseIlpPeerInfo,
|
|
15
16
|
readConfigFile
|
|
16
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-WGR4UZ34.js";
|
|
17
18
|
import {
|
|
18
19
|
__require
|
|
19
20
|
} from "./chunk-F22GNSF6.js";
|
|
@@ -1885,6 +1886,7 @@ var ClientRunner = class {
|
|
|
1885
1886
|
bootstrapping: apex?.bootstrapping ?? false,
|
|
1886
1887
|
ready: apex?.ready ?? false,
|
|
1887
1888
|
settlementChain: this.config.chain,
|
|
1889
|
+
feePerEvent: (apex?.feePerEvent ?? this.config.feePerEvent).toString(),
|
|
1888
1890
|
identity: {
|
|
1889
1891
|
nostrPubkey: safe(() => client?.getPublicKey()) ?? "",
|
|
1890
1892
|
evmAddress: safe(() => client?.getEvmAddress()),
|
|
@@ -1905,6 +1907,33 @@ var ClientRunner = class {
|
|
|
1905
1907
|
...apex?.lastError ? { lastError: apex.lastError } : {}
|
|
1906
1908
|
};
|
|
1907
1909
|
}
|
|
1910
|
+
/**
|
|
1911
|
+
* Drip devnet test funds to a wallet from the configured faucet. Defaults the
|
|
1912
|
+
* chain to the active settlement chain and the address to this client's own
|
|
1913
|
+
* address on that chain, so a no-arg call funds the caller's own wallet
|
|
1914
|
+
* (the typical "fund me before I open a channel" flow). The daemon holds the
|
|
1915
|
+
* faucet URL + the keys, so the MCP caller never needs either.
|
|
1916
|
+
*/
|
|
1917
|
+
async fundWallet(req = {}) {
|
|
1918
|
+
const faucetUrl = this.config.faucetUrl;
|
|
1919
|
+
if (!faucetUrl) {
|
|
1920
|
+
throw new InvalidPayloadError(
|
|
1921
|
+
"no faucet configured \u2014 set faucetUrl in the daemon config (or the TOON_CLIENT_FAUCET_URL env var) to fund wallets."
|
|
1922
|
+
);
|
|
1923
|
+
}
|
|
1924
|
+
const chain = req.chain ?? this.config.chain;
|
|
1925
|
+
const client = this.defaultApex()?.client;
|
|
1926
|
+
const address = req.address ?? safe(
|
|
1927
|
+
() => chain === "evm" ? client?.getEvmAddress() : chain === "solana" ? client?.getSolanaAddress() : client?.getMinaAddress()
|
|
1928
|
+
);
|
|
1929
|
+
if (!address) {
|
|
1930
|
+
throw new InvalidPayloadError(
|
|
1931
|
+
`no ${chain} address available to fund \u2014 pass an explicit address (this client has no ${chain} key configured).`
|
|
1932
|
+
);
|
|
1933
|
+
}
|
|
1934
|
+
const { response } = await fundWallet(faucetUrl, address, chain);
|
|
1935
|
+
return { chain, address, faucetUrl, response };
|
|
1936
|
+
}
|
|
1908
1937
|
/** Full registry of relay + apex targets with per-target status. */
|
|
1909
1938
|
getTargets() {
|
|
1910
1939
|
const relays = [...this.relays.entries()].map(
|
|
@@ -2382,6 +2411,13 @@ function registerRoutes(app, runner) {
|
|
|
2382
2411
|
}
|
|
2383
2412
|
}
|
|
2384
2413
|
);
|
|
2414
|
+
app.post("/fund-wallet", async (req, reply) => {
|
|
2415
|
+
try {
|
|
2416
|
+
return await runner.fundWallet(req.body ?? {});
|
|
2417
|
+
} catch (err) {
|
|
2418
|
+
return mapError(reply, err);
|
|
2419
|
+
}
|
|
2420
|
+
});
|
|
2385
2421
|
app.get("/targets", async () => runner.getTargets());
|
|
2386
2422
|
app.post("/relays", async (req, reply) => {
|
|
2387
2423
|
const url = req.body?.relayUrl;
|
|
@@ -2489,4 +2525,4 @@ export {
|
|
|
2489
2525
|
PublishRejectedError,
|
|
2490
2526
|
registerRoutes
|
|
2491
2527
|
};
|
|
2492
|
-
//# sourceMappingURL=chunk-
|
|
2528
|
+
//# sourceMappingURL=chunk-HDAH6TAT.js.map
|