@t2000/sdk 0.18.27 → 0.18.28

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
@@ -57358,14 +57358,6 @@ To access invested funds: t2000 invest sell ${params.amount} ${asset}`,
57358
57358
  }
57359
57359
  }
57360
57360
  this.emitBalanceChange("USDC", finalAmount, "withdraw", gasResult.digest);
57361
- for (let attempt = 0; attempt < 5; attempt++) {
57362
- try {
57363
- const bal = await queryBalance(this.client, this._address);
57364
- if ((bal.stables.USDC ?? 0) > 0.5) break;
57365
- } catch {
57366
- }
57367
- await new Promise((r) => setTimeout(r, 2e3));
57368
- }
57369
57361
  return {
57370
57362
  success: true,
57371
57363
  tx: gasResult.digest,
@@ -57486,14 +57478,6 @@ To access invested funds: t2000 invest sell ${params.amount} ${asset}`,
57486
57478
  if (totalUsdcReceived <= 0) {
57487
57479
  throw new T2000Error("NO_COLLATERAL", "No savings to withdraw across any protocol");
57488
57480
  }
57489
- for (let attempt = 0; attempt < 5; attempt++) {
57490
- try {
57491
- const bal = await queryBalance(this.client, this._address);
57492
- if ((bal.stables.USDC ?? 0) > 0.5) break;
57493
- } catch {
57494
- }
57495
- await new Promise((r) => setTimeout(r, 2e3));
57496
- }
57497
57481
  return {
57498
57482
  success: true,
57499
57483
  tx: gasResult.digest,
@@ -58963,7 +58947,7 @@ To sell investment: t2000 invest sell ${params.amount} ${fromAsset}`,
58963
58947
  const earningAssets = new Set(
58964
58948
  this.portfolio.getPositions().filter((p) => p.earning).map((p) => p.asset)
58965
58949
  );
58966
- let savePositions = allPositions.flatMap(
58950
+ const savePositions = allPositions.flatMap(
58967
58951
  (p) => p.positions.supplies.filter((s) => s.amount > 0.01).filter((s) => !earningAssets.has(s.asset)).filter((s) => !(s.asset in INVESTMENT_ASSETS)).map((s) => ({
58968
58952
  protocolId: p.protocolId,
58969
58953
  protocol: p.protocol,
@@ -58973,22 +58957,7 @@ To sell investment: t2000 invest sell ${params.amount} ${fromAsset}`,
58973
58957
  }))
58974
58958
  );
58975
58959
  if (savePositions.length === 0) {
58976
- for (let retry = 0; retry < 2 && savePositions.length === 0; retry++) {
58977
- await new Promise((r) => setTimeout(r, 3e3));
58978
- const freshPositions = await this.registry.allPositions(this._address);
58979
- savePositions = freshPositions.flatMap(
58980
- (p) => p.positions.supplies.filter((s) => s.amount > 0.01).filter((s) => !earningAssets.has(s.asset)).filter((s) => !(s.asset in INVESTMENT_ASSETS)).map((s) => ({
58981
- protocolId: p.protocolId,
58982
- protocol: p.protocol,
58983
- asset: s.asset,
58984
- amount: s.amount,
58985
- apy: s.apy
58986
- }))
58987
- );
58988
- }
58989
- if (savePositions.length === 0) {
58990
- throw new T2000Error("NO_COLLATERAL", "No savings positions to rebalance. Use `t2000 save <amount>` first.");
58991
- }
58960
+ throw new T2000Error("NO_COLLATERAL", "No savings positions to rebalance. Use `t2000 save <amount>` first.");
58992
58961
  }
58993
58962
  const borrowPositions = allPositions.flatMap(
58994
58963
  (p) => p.positions.borrows.filter((b2) => b2.amount > 0.01)
@@ -59217,17 +59186,6 @@ To sell investment: t2000 invest sell ${params.amount} ${fromAsset}`,
59217
59186
  txDigests.push(depositResult.digest);
59218
59187
  totalGasCost += depositResult.gasCostSui;
59219
59188
  }
59220
- for (let attempt = 0; attempt < 5; attempt++) {
59221
- try {
59222
- const positions = await this.positions();
59223
- const newPos = positions.positions.find(
59224
- (p) => p.type === "save" && p.asset === bestRate.asset && p.amount > 0.01
59225
- );
59226
- if (newPos) break;
59227
- } catch {
59228
- }
59229
- await new Promise((r) => setTimeout(r, 2e3));
59230
- }
59231
59189
  return {
59232
59190
  executed: true,
59233
59191
  steps,