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