@toon-protocol/client-mcp 0.34.1 → 0.34.3

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.
@@ -2,7 +2,7 @@ import { createRequire as __cr } from 'module'; const require = __cr(import.meta
2
2
  import {
3
3
  ControlApiError,
4
4
  DaemonUnreachableError
5
- } from "./chunk-ALMTQYYJ.js";
5
+ } from "./chunk-J67PL2EH.js";
6
6
 
7
7
  // src/mcp-tools.ts
8
8
  var TOOL_DEFINITIONS = [
@@ -356,4 +356,4 @@ export {
356
356
  TOOL_DEFINITIONS,
357
357
  dispatchTool
358
358
  };
359
- //# sourceMappingURL=chunk-UZT7LAGY.js.map
359
+ //# sourceMappingURL=chunk-GG5IP4ZH.js.map
@@ -481,7 +481,19 @@ function parseIlpPeerInfo(event) {
481
481
  ...swapPairs !== void 0 && { swapPairs }
482
482
  };
483
483
  }
484
- function buildIlpPeerInfoEvent(info, secretKey) {
484
+ var EXPIRATION_TAG = "expiration";
485
+ function getEventExpiration(event) {
486
+ const tag = event.tags.find((t) => t[0] === EXPIRATION_TAG);
487
+ if (!tag || tag[1] === void 0) return void 0;
488
+ const ts = Number(tag[1]);
489
+ if (!Number.isFinite(ts) || ts < 0) return void 0;
490
+ return ts;
491
+ }
492
+ function isEventExpired(event, nowSeconds = Math.floor(Date.now() / 1e3)) {
493
+ const exp = getEventExpiration(event);
494
+ return exp !== void 0 && exp <= nowSeconds;
495
+ }
496
+ function buildIlpPeerInfoEvent(info, secretKey, options = {}) {
485
497
  if (info.feePerByte !== void 0) {
486
498
  if (typeof info.feePerByte !== "string" || !/^\d+$/.test(info.feePerByte)) {
487
499
  throw new ToonError(
@@ -524,12 +536,20 @@ function buildIlpPeerInfoEvent(info, secretKey) {
524
536
  assertSwapPairForBuild(pair, index);
525
537
  });
526
538
  }
539
+ const createdAt = Math.floor(Date.now() / 1e3);
540
+ const tags = [];
541
+ if (options.ttlSeconds !== void 0 && options.ttlSeconds > 0) {
542
+ tags.push([
543
+ EXPIRATION_TAG,
544
+ String(createdAt + Math.floor(options.ttlSeconds))
545
+ ]);
546
+ }
527
547
  return finalizeEvent(
528
548
  {
529
549
  kind: ILP_PEER_INFO_KIND,
530
550
  content: JSON.stringify(effectiveInfo),
531
- tags: [],
532
- created_at: Math.floor(Date.now() / 1e3)
551
+ tags,
552
+ created_at: createdAt
533
553
  },
534
554
  secretKey
535
555
  );
@@ -10891,6 +10911,7 @@ export {
10891
10911
  decodeEventFromToon,
10892
10912
  ILP_PEER_INFO_KIND,
10893
10913
  parseIlpPeerInfo,
10914
+ isEventExpired,
10894
10915
  buildIlpPrepare,
10895
10916
  deriveFullIdentity,
10896
10917
  ToonClient,
@@ -10931,4 +10952,4 @@ export {
10931
10952
  @scure/bip32/lib/esm/index.js:
10932
10953
  (*! scure-bip32 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) *)
10933
10954
  */
10934
- //# sourceMappingURL=chunk-ALMTQYYJ.js.map
10955
+ //# sourceMappingURL=chunk-J67PL2EH.js.map