@t2000/sdk 0.18.4 → 0.18.5
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 -2
- package/dist/adapters/index.cjs.map +1 -1
- package/dist/adapters/index.js +10 -2
- package/dist/adapters/index.js.map +1 -1
- package/dist/index.cjs +19 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +19 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/adapters/index.js
CHANGED
|
@@ -822,11 +822,19 @@ async function getRates(client) {
|
|
|
822
822
|
}
|
|
823
823
|
async function getPositions(client, addressOrKeypair) {
|
|
824
824
|
const address = typeof addressOrKeypair === "string" ? addressOrKeypair : addressOrKeypair.getPublicKey().toSuiAddress();
|
|
825
|
-
const [states,
|
|
825
|
+
const [states, cachedPools] = await Promise.all([getUserState(client, address), getPools()]);
|
|
826
|
+
let pools = cachedPools;
|
|
827
|
+
const unmatchedIds = states.filter((s) => !pools.find((p) => p.id === s.assetId)).map((s) => s.assetId);
|
|
828
|
+
if (unmatchedIds.length > 0) {
|
|
829
|
+
pools = await getPools(true);
|
|
830
|
+
}
|
|
826
831
|
const positions = [];
|
|
827
832
|
for (const state of states) {
|
|
828
833
|
const pool = pools.find((p) => p.id === state.assetId);
|
|
829
|
-
if (!pool)
|
|
834
|
+
if (!pool) {
|
|
835
|
+
console.warn(`[NAVI] No pool found for assetId=${state.assetId} (supply=${state.supplyBalance}, borrow=${state.borrowBalance}) \u2014 funds may be invisible`);
|
|
836
|
+
continue;
|
|
837
|
+
}
|
|
830
838
|
const symbol = resolvePoolSymbol(pool);
|
|
831
839
|
const supplyBal = compoundBalance(state.supplyBalance, pool.currentSupplyIndex, pool);
|
|
832
840
|
const borrowBal = compoundBalance(state.borrowBalance, pool.currentBorrowIndex, pool);
|