@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.
- package/dist/adapters/index.cjs +6 -4
- package/dist/adapters/index.cjs.map +1 -1
- package/dist/adapters/index.js +6 -4
- package/dist/adapters/index.js.map +1 -1
- package/dist/index.cjs +11 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +11 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/adapters/index.cjs
CHANGED
|
@@ -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
|
|
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
|
-
|
|
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`,
|