@t2000/sdk 0.18.35 → 0.18.36

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.cjs CHANGED
@@ -57991,6 +57991,13 @@ To sell investment: t2000 invest sell ${params.amount} ${fromAsset}`,
57991
57991
  throw new T2000Error("ASSET_NOT_SUPPORTED", `${params.asset} is not available for investment`);
57992
57992
  }
57993
57993
  const bal = await queryBalance(this.client, this._address);
57994
+ const totalFunds = bal.available + bal.savings;
57995
+ if (params.usdAmount > totalFunds * 1.05) {
57996
+ throw new T2000Error(
57997
+ "INSUFFICIENT_BALANCE",
57998
+ `Insufficient funds. You have $${totalFunds.toFixed(2)} total (checking: $${bal.available.toFixed(2)}, savings: $${bal.savings.toFixed(2)}) but need $${params.usdAmount.toFixed(2)}.`
57999
+ );
58000
+ }
57994
58001
  if (bal.available < params.usdAmount) {
57995
58002
  await this._autoFundFromSavings(params.usdAmount - bal.available);
57996
58003
  }
@@ -58436,6 +58443,13 @@ To sell investment: t2000 invest sell ${params.amount} ${fromAsset}`,
58436
58443
  }
58437
58444
  this.enforcer.check({ operation: "invest", amount: params.usdAmount });
58438
58445
  const bal = await queryBalance(this.client, this._address);
58446
+ const totalFunds = bal.available + bal.savings;
58447
+ if (params.usdAmount > totalFunds * 1.05) {
58448
+ throw new T2000Error(
58449
+ "INSUFFICIENT_BALANCE",
58450
+ `Insufficient funds. You have $${totalFunds.toFixed(2)} total (checking: $${bal.available.toFixed(2)}, savings: $${bal.savings.toFixed(2)}) but need $${params.usdAmount.toFixed(2)}.`
58451
+ );
58452
+ }
58439
58453
  if (bal.available < params.usdAmount && !params.dryRun) {
58440
58454
  await this._autoFundFromSavings(params.usdAmount - bal.available);
58441
58455
  }