@t2000/sdk 0.9.7 → 0.9.8
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 +10 -1
- package/dist/adapters/index.cjs.map +1 -1
- package/dist/adapters/index.js +10 -1
- package/dist/adapters/index.js.map +1 -1
- package/dist/index.cjs +10 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +10 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -625,7 +625,8 @@ async function refreshStableOracles(tx, client, config, pools) {
|
|
|
625
625
|
config.oracle.wormholeStateId
|
|
626
626
|
);
|
|
627
627
|
await pythClient.updatePriceFeeds(tx, priceUpdateData, pythFeedIds);
|
|
628
|
-
} catch {
|
|
628
|
+
} catch (err) {
|
|
629
|
+
console.error("[t2000] Pyth oracle push failed, falling back to cached prices:", err.message ?? err);
|
|
629
630
|
}
|
|
630
631
|
}
|
|
631
632
|
for (const pool of stablePools) {
|
|
@@ -743,6 +744,10 @@ async function buildWithdrawTx(client, address, amount, options = {}) {
|
|
|
743
744
|
const effectiveAmount = Math.min(amount, Math.max(0, deposited - WITHDRAW_DUST_BUFFER));
|
|
744
745
|
if (effectiveAmount <= 0) throw new T2000Error("NO_COLLATERAL", `Nothing to withdraw for ${assetInfo.displayName} on NAVI`);
|
|
745
746
|
const rawAmount = Number(stableToRaw(effectiveAmount, assetInfo.decimals));
|
|
747
|
+
if (rawAmount <= 0) {
|
|
748
|
+
throw new T2000Error("INVALID_AMOUNT", `Withdrawal amount too small to represent (effective=${effectiveAmount}, raw=${rawAmount}, decimals=${assetInfo.decimals})`);
|
|
749
|
+
}
|
|
750
|
+
console.error(`[t2000] withdraw: asset=${asset} poolId=${pool.id} amount=${amount} deposited=${deposited} effective=${effectiveAmount} raw=${rawAmount} supplyBal=${assetState?.supplyBalance} index=${pool.currentSupplyIndex}`);
|
|
746
751
|
const tx = new Transaction();
|
|
747
752
|
tx.setSender(address);
|
|
748
753
|
await refreshStableOracles(tx, client, config, pools);
|
|
@@ -783,6 +788,10 @@ async function addWithdrawToTx(tx, client, address, amount, options = {}) {
|
|
|
783
788
|
const effectiveAmount = Math.min(amount, Math.max(0, deposited - WITHDRAW_DUST_BUFFER));
|
|
784
789
|
if (effectiveAmount <= 0) throw new T2000Error("NO_COLLATERAL", `Nothing to withdraw for ${assetInfo.displayName} on NAVI`);
|
|
785
790
|
const rawAmount = Number(stableToRaw(effectiveAmount, assetInfo.decimals));
|
|
791
|
+
if (rawAmount <= 0) {
|
|
792
|
+
throw new T2000Error("INVALID_AMOUNT", `Withdrawal amount too small to represent (effective=${effectiveAmount}, raw=${rawAmount}, decimals=${assetInfo.decimals})`);
|
|
793
|
+
}
|
|
794
|
+
console.error(`[t2000] withdraw: asset=${asset} poolId=${pool.id} amount=${amount} deposited=${deposited} effective=${effectiveAmount} raw=${rawAmount} supplyBal=${assetState?.supplyBalance} index=${pool.currentSupplyIndex}`);
|
|
786
795
|
await refreshStableOracles(tx, client, config, pools);
|
|
787
796
|
const [balance] = tx.moveCall({
|
|
788
797
|
target: `${config.package}::incentive_v3::withdraw_v2`,
|