@t2000/sdk 0.9.8 → 0.9.9

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.
@@ -496,9 +496,8 @@ async function buildWithdrawTx(client, address, amount, options = {}) {
496
496
  if (effectiveAmount <= 0) throw new T2000Error("NO_COLLATERAL", `Nothing to withdraw for ${assetInfo.displayName} on NAVI`);
497
497
  const rawAmount = Number(stableToRaw(effectiveAmount, assetInfo.decimals));
498
498
  if (rawAmount <= 0) {
499
- throw new T2000Error("INVALID_AMOUNT", `Withdrawal amount too small to represent (effective=${effectiveAmount}, raw=${rawAmount}, decimals=${assetInfo.decimals})`);
499
+ throw new T2000Error("INVALID_AMOUNT", `Withdrawal amount rounds to zero \u2014 balance is dust`);
500
500
  }
501
- console.error(`[t2000] withdraw: asset=${asset} poolId=${pool.id} amount=${amount} deposited=${deposited} effective=${effectiveAmount} raw=${rawAmount} supplyBal=${assetState?.supplyBalance} index=${pool.currentSupplyIndex}`);
502
501
  const tx = new transactions.Transaction();
503
502
  tx.setSender(address);
504
503
  await refreshStableOracles(tx, client, config, pools);
@@ -540,9 +539,12 @@ async function addWithdrawToTx(tx, client, address, amount, options = {}) {
540
539
  if (effectiveAmount <= 0) throw new T2000Error("NO_COLLATERAL", `Nothing to withdraw for ${assetInfo.displayName} on NAVI`);
541
540
  const rawAmount = Number(stableToRaw(effectiveAmount, assetInfo.decimals));
542
541
  if (rawAmount <= 0) {
543
- throw new T2000Error("INVALID_AMOUNT", `Withdrawal amount too small to represent (effective=${effectiveAmount}, raw=${rawAmount}, decimals=${assetInfo.decimals})`);
542
+ const [coin2] = tx.moveCall({
543
+ target: "0x2::coin::zero",
544
+ typeArguments: [pool.suiCoinType]
545
+ });
546
+ return { coin: coin2, effectiveAmount: 0 };
544
547
  }
545
- console.error(`[t2000] withdraw: asset=${asset} poolId=${pool.id} amount=${amount} deposited=${deposited} effective=${effectiveAmount} raw=${rawAmount} supplyBal=${assetState?.supplyBalance} index=${pool.currentSupplyIndex}`);
546
548
  await refreshStableOracles(tx, client, config, pools);
547
549
  const [balance] = tx.moveCall({
548
550
  target: `${config.package}::incentive_v3::withdraw_v2`,