@t2000/cli 10.17.4 → 10.18.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.
@@ -11542,6 +11542,44 @@ var LimitEnforcer = class {
11542
11542
  return dailySpentToday(this.configDir);
11543
11543
  }
11544
11544
  };
11545
+ var MemoryLimitEnforcer = class extends LimitEnforcer {
11546
+ limitsMem;
11547
+ spend = { date: todayUtc(), usd: 0 };
11548
+ assert(input) {
11549
+ assertLimitConfig({
11550
+ limits: this.limitsMem,
11551
+ spentTodayUsd: this.dailySpentToday(),
11552
+ operation: input.operation,
11553
+ amountUsd: input.amountUsd,
11554
+ force: input.force
11555
+ });
11556
+ }
11557
+ record(amountUsd) {
11558
+ if (!Number.isFinite(amountUsd) || amountUsd <= 0) return;
11559
+ const today = todayUtc();
11560
+ const prior = this.spend.date === today ? this.spend.usd : 0;
11561
+ this.spend = { date: today, usd: prior + amountUsd };
11562
+ }
11563
+ getLimits() {
11564
+ return this.limitsMem;
11565
+ }
11566
+ hasLimits() {
11567
+ const l = this.limitsMem;
11568
+ return !!l && (l.perTxUsd !== void 0 || l.dailyUsd !== void 0);
11569
+ }
11570
+ setLimits(limits) {
11571
+ const merged = { ...this.limitsMem };
11572
+ if (limits.perTxUsd !== void 0) merged.perTxUsd = limits.perTxUsd;
11573
+ if (limits.dailyUsd !== void 0) merged.dailyUsd = limits.dailyUsd;
11574
+ this.limitsMem = merged;
11575
+ }
11576
+ clearLimits() {
11577
+ this.limitsMem = void 0;
11578
+ }
11579
+ dailySpentToday() {
11580
+ return this.spend.date === todayUtc() ? this.spend.usd : 0;
11581
+ }
11582
+ };
11545
11583
  var DEFAULT_CONFIG_DIR2 = join2(homedir(), ".t2000");
11546
11584
  var T2000 = class _T2000 extends import_index.default {
11547
11585
  _signer;
@@ -11564,7 +11602,7 @@ var T2000 = class _T2000 extends import_index.default {
11564
11602
  this._address = getAddress(kp);
11565
11603
  }
11566
11604
  this.client = client;
11567
- this.limits = new LimitEnforcer(configDir);
11605
+ this.limits = isSignerMode ? new MemoryLimitEnforcer() : new LimitEnforcer(configDir);
11568
11606
  }
11569
11607
  static async create(options = {}) {
11570
11608
  const { keyPath, rpcUrl } = options;
@@ -13562,4 +13600,4 @@ export {
13562
13600
  @scure/bip39/index.js:
13563
13601
  (*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) *)
13564
13602
  */
13565
- //# sourceMappingURL=chunk-F2KFMF7W.js.map
13603
+ //# sourceMappingURL=chunk-PXQ3GPIL.js.map