@toon-protocol/client-mcp 0.8.3 → 0.9.1

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.
@@ -15,7 +15,7 @@ import {
15
15
  isEventExpired,
16
16
  parseIlpPeerInfo,
17
17
  readConfigFile
18
- } from "./chunk-ZVFLRFXS.js";
18
+ } from "./chunk-WAE4H47W.js";
19
19
  import {
20
20
  __require
21
21
  } from "./chunk-F22GNSF6.js";
@@ -2163,6 +2163,19 @@ var ClientRunner = class {
2163
2163
  const balances = await apex.client.getBalances();
2164
2164
  return { balances };
2165
2165
  }
2166
+ /**
2167
+ * Deposit additional collateral into an open channel. Routes to the apex whose
2168
+ * client tracks the channel (each apex client opens/tracks its own channels);
2169
+ * the client signs its own on-chain tx.
2170
+ */
2171
+ async depositToChannel(req) {
2172
+ for (const apex of this.apexes.values()) {
2173
+ if (apex.client.getTrackedChannels().includes(req.channelId)) {
2174
+ return apex.client.depositToChannel(req.channelId, req.amount);
2175
+ }
2176
+ }
2177
+ throw new Error(`Channel "${req.channelId}" is not tracked by any apex.`);
2178
+ }
2166
2179
  /** Swap source→target asset against a swap peer via the selected apex. */
2167
2180
  async swap(req) {
2168
2181
  const apex = this.selectApex(req.btpUrl);
@@ -2429,6 +2442,13 @@ function registerRoutes(app, runner) {
2429
2442
  });
2430
2443
  app.get("/channels", async () => runner.getChannels());
2431
2444
  app.get("/balances", async () => runner.getBalances());
2445
+ app.post("/channels/deposit", async (req, reply) => {
2446
+ try {
2447
+ return await runner.depositToChannel(req.body);
2448
+ } catch (err) {
2449
+ return mapError(reply, err);
2450
+ }
2451
+ });
2432
2452
  app.post("/swap", async (req, reply) => {
2433
2453
  const body = req.body;
2434
2454
  if (!body || !body.destination || body.amount === void 0 || !body.swapPubkey || !body.pair || !body.chainRecipient) {
@@ -2572,4 +2592,4 @@ export {
2572
2592
  PublishRejectedError,
2573
2593
  registerRoutes
2574
2594
  };
2575
- //# sourceMappingURL=chunk-XJI66XFQ.js.map
2595
+ //# sourceMappingURL=chunk-2GQXKV2O.js.map