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