@t2000/sdk 0.9.7 → 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 +12 -1
- package/dist/adapters/index.cjs.map +1 -1
- package/dist/adapters/index.js +12 -1
- package/dist/adapters/index.js.map +1 -1
- package/dist/index.cjs +17 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/adapters/index.js
CHANGED
|
@@ -374,7 +374,8 @@ async function refreshStableOracles(tx, client, config, pools) {
|
|
|
374
374
|
config.oracle.wormholeStateId
|
|
375
375
|
);
|
|
376
376
|
await pythClient.updatePriceFeeds(tx, priceUpdateData, pythFeedIds);
|
|
377
|
-
} catch {
|
|
377
|
+
} catch (err) {
|
|
378
|
+
console.error("[t2000] Pyth oracle push failed, falling back to cached prices:", err.message ?? err);
|
|
378
379
|
}
|
|
379
380
|
}
|
|
380
381
|
for (const pool of stablePools) {
|
|
@@ -492,6 +493,9 @@ async function buildWithdrawTx(client, address, amount, options = {}) {
|
|
|
492
493
|
const effectiveAmount = Math.min(amount, Math.max(0, deposited - WITHDRAW_DUST_BUFFER));
|
|
493
494
|
if (effectiveAmount <= 0) throw new T2000Error("NO_COLLATERAL", `Nothing to withdraw for ${assetInfo.displayName} on NAVI`);
|
|
494
495
|
const rawAmount = Number(stableToRaw(effectiveAmount, assetInfo.decimals));
|
|
496
|
+
if (rawAmount <= 0) {
|
|
497
|
+
throw new T2000Error("INVALID_AMOUNT", `Withdrawal amount rounds to zero \u2014 balance is dust`);
|
|
498
|
+
}
|
|
495
499
|
const tx = new Transaction();
|
|
496
500
|
tx.setSender(address);
|
|
497
501
|
await refreshStableOracles(tx, client, config, pools);
|
|
@@ -532,6 +536,13 @@ async function addWithdrawToTx(tx, client, address, amount, options = {}) {
|
|
|
532
536
|
const effectiveAmount = Math.min(amount, Math.max(0, deposited - WITHDRAW_DUST_BUFFER));
|
|
533
537
|
if (effectiveAmount <= 0) throw new T2000Error("NO_COLLATERAL", `Nothing to withdraw for ${assetInfo.displayName} on NAVI`);
|
|
534
538
|
const rawAmount = Number(stableToRaw(effectiveAmount, assetInfo.decimals));
|
|
539
|
+
if (rawAmount <= 0) {
|
|
540
|
+
const [coin2] = tx.moveCall({
|
|
541
|
+
target: "0x2::coin::zero",
|
|
542
|
+
typeArguments: [pool.suiCoinType]
|
|
543
|
+
});
|
|
544
|
+
return { coin: coin2, effectiveAmount: 0 };
|
|
545
|
+
}
|
|
535
546
|
await refreshStableOracles(tx, client, config, pools);
|
|
536
547
|
const [balance] = tx.moveCall({
|
|
537
548
|
target: `${config.package}::incentive_v3::withdraw_v2`,
|