@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/adapters/index.cjs
CHANGED
|
@@ -376,7 +376,8 @@ async function refreshStableOracles(tx, client, config, pools) {
|
|
|
376
376
|
config.oracle.wormholeStateId
|
|
377
377
|
);
|
|
378
378
|
await pythClient.updatePriceFeeds(tx, priceUpdateData, pythFeedIds);
|
|
379
|
-
} catch {
|
|
379
|
+
} catch (err) {
|
|
380
|
+
console.error("[t2000] Pyth oracle push failed, falling back to cached prices:", err.message ?? err);
|
|
380
381
|
}
|
|
381
382
|
}
|
|
382
383
|
for (const pool of stablePools) {
|
|
@@ -494,6 +495,10 @@ async function buildWithdrawTx(client, address, amount, options = {}) {
|
|
|
494
495
|
const effectiveAmount = Math.min(amount, Math.max(0, deposited - WITHDRAW_DUST_BUFFER));
|
|
495
496
|
if (effectiveAmount <= 0) throw new T2000Error("NO_COLLATERAL", `Nothing to withdraw for ${assetInfo.displayName} on NAVI`);
|
|
496
497
|
const rawAmount = Number(stableToRaw(effectiveAmount, assetInfo.decimals));
|
|
498
|
+
if (rawAmount <= 0) {
|
|
499
|
+
throw new T2000Error("INVALID_AMOUNT", `Withdrawal amount too small to represent (effective=${effectiveAmount}, raw=${rawAmount}, decimals=${assetInfo.decimals})`);
|
|
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}`);
|
|
497
502
|
const tx = new transactions.Transaction();
|
|
498
503
|
tx.setSender(address);
|
|
499
504
|
await refreshStableOracles(tx, client, config, pools);
|
|
@@ -534,6 +539,10 @@ async function addWithdrawToTx(tx, client, address, amount, options = {}) {
|
|
|
534
539
|
const effectiveAmount = Math.min(amount, Math.max(0, deposited - WITHDRAW_DUST_BUFFER));
|
|
535
540
|
if (effectiveAmount <= 0) throw new T2000Error("NO_COLLATERAL", `Nothing to withdraw for ${assetInfo.displayName} on NAVI`);
|
|
536
541
|
const rawAmount = Number(stableToRaw(effectiveAmount, assetInfo.decimals));
|
|
542
|
+
if (rawAmount <= 0) {
|
|
543
|
+
throw new T2000Error("INVALID_AMOUNT", `Withdrawal amount too small to represent (effective=${effectiveAmount}, raw=${rawAmount}, decimals=${assetInfo.decimals})`);
|
|
544
|
+
}
|
|
545
|
+
console.error(`[t2000] withdraw: asset=${asset} poolId=${pool.id} amount=${amount} deposited=${deposited} effective=${effectiveAmount} raw=${rawAmount} supplyBal=${assetState?.supplyBalance} index=${pool.currentSupplyIndex}`);
|
|
537
546
|
await refreshStableOracles(tx, client, config, pools);
|
|
538
547
|
const [balance] = tx.moveCall({
|
|
539
548
|
target: `${config.package}::incentive_v3::withdraw_v2`,
|