@blockrun/clawrouter 0.12.18 → 0.12.19

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/dist/index.js CHANGED
@@ -34,12 +34,14 @@ var init_solana_balance = __esm({
34
34
  }
35
35
  async checkBalance() {
36
36
  const now = Date.now();
37
- if (this.cachedBalance !== null && now - this.cachedAt < CACHE_TTL_MS2) {
37
+ if (this.cachedBalance !== null && this.cachedBalance > 0n && now - this.cachedAt < CACHE_TTL_MS2) {
38
38
  return this.buildInfo(this.cachedBalance);
39
39
  }
40
40
  const balance = await this.fetchBalance();
41
- this.cachedBalance = balance;
42
- this.cachedAt = now;
41
+ if (balance > 0n) {
42
+ this.cachedBalance = balance;
43
+ this.cachedAt = now;
44
+ }
43
45
  return this.buildInfo(balance);
44
46
  }
45
47
  deductEstimated(amountMicros) {
@@ -3991,12 +3993,14 @@ var BalanceMonitor = class {
3991
3993
  */
3992
3994
  async checkBalance() {
3993
3995
  const now = Date.now();
3994
- if (this.cachedBalance !== null && now - this.cachedAt < CACHE_TTL_MS) {
3996
+ if (this.cachedBalance !== null && this.cachedBalance > 0n && now - this.cachedAt < CACHE_TTL_MS) {
3995
3997
  return this.buildInfo(this.cachedBalance);
3996
3998
  }
3997
3999
  const balance = await this.fetchBalance();
3998
- this.cachedBalance = balance;
3999
- this.cachedAt = now;
4000
+ if (balance > 0n) {
4001
+ this.cachedBalance = balance;
4002
+ this.cachedAt = now;
4003
+ }
4000
4004
  return this.buildInfo(balance);
4001
4005
  }
4002
4006
  /**