@toon-protocol/client-mcp 0.12.0 → 0.12.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.
@@ -2058,9 +2058,24 @@ var ClientRunner = class {
2058
2058
  eventId: result.eventId ?? req.event.id,
2059
2059
  ...result.data !== void 0 ? { data: result.data } : {},
2060
2060
  channelId,
2061
- nonce: apex.client.getChannelNonce(channelId)
2061
+ nonce: apex.client.getChannelNonce(channelId),
2062
+ feePaid: fee.toString(),
2063
+ channelBalanceAfter: this.channelAvailable(apex, channelId)
2062
2064
  };
2063
2065
  }
2066
+ /**
2067
+ * Available (spendable) balance for a channel after a write — locked collateral
2068
+ * minus cumulative spent, clamped at 0. Same math as {@link getChannels}; used
2069
+ * to report a truthful post-write balance in publish/upload receipts. Returns
2070
+ * undefined if the channel isn't tracked on this apex (balance unknown).
2071
+ */
2072
+ channelAvailable(apex, channelId) {
2073
+ if (!apex.client.getTrackedChannels().includes(channelId)) return void 0;
2074
+ const cumulative = apex.client.getChannelCumulativeAmount(channelId);
2075
+ const depositTotal = apex.client.getChannelDepositTotal(channelId);
2076
+ const available = depositTotal > cumulative ? depositTotal - cumulative : 0n;
2077
+ return available.toString();
2078
+ }
2064
2079
  /**
2065
2080
  * Build, sign (with the daemon-held key), and pay-to-write an event. The
2066
2081
  * caller supplies only the event shell; the private key never leaves the
@@ -2128,7 +2143,8 @@ var ClientRunner = class {
2128
2143
  `kind:${kind} publish leg failed after upload (blob stored at ${url}): ${detail}`
2129
2144
  );
2130
2145
  }
2131
- return { ...pub, url, txId: upload.txId };
2146
+ const feePaid = (fee + BigInt(pub.feePaid)).toString();
2147
+ return { ...pub, feePaid, url, txId: upload.txId };
2132
2148
  }
2133
2149
  /**
2134
2150
  * Read media bytes off disk for an upload `filePath`. The path is resolved
@@ -2791,4 +2807,4 @@ export {
2791
2807
  PublishRejectedError,
2792
2808
  registerRoutes
2793
2809
  };
2794
- //# sourceMappingURL=chunk-74KX5LXI.js.map
2810
+ //# sourceMappingURL=chunk-HLATGATX.js.map