@scallop-io/sui-scallop-sdk 1.3.3-alpha.1 → 1.3.3-alpha.2
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/index.js +13 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -14
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/constants/enum.ts +3 -1
- package/src/constants/testAddress.ts +2 -2
- package/src/queries/coreQuery.ts +1 -1
- package/src/queries/portfolioQuery.ts +6 -9
- package/src/queries/spoolQuery.ts +1 -1
package/package.json
CHANGED
package/src/constants/enum.ts
CHANGED
|
@@ -166,7 +166,9 @@ export const sCoinIds: types.SCoinIds = {
|
|
|
166
166
|
// ssui: '0xaafc4f740de0dd0dde642a31148fb94517087052f19afb0f7bed1dc41a50c77b::scallop_sui::SCALLOP_SUI',
|
|
167
167
|
scetus:
|
|
168
168
|
'0xea346ce428f91ab007210443efcea5f5cdbbb3aae7e9affc0ca93f9203c31f0c::scallop_cetus::SCALLOP_CETUS',
|
|
169
|
-
|
|
169
|
+
// TODO: Change this to the correct value on production release
|
|
170
|
+
ssca: '0x958428555e778e55918a59eb1c92c77f32b5c554fa3a5e56cd0815086b5072e7::scallop_sca::SCALLOP_SCA',
|
|
171
|
+
// '0x5ca17430c1d046fae9edeaa8fd76c7b4193a00d764a0ecfa9418d733ad27bc1e::scallop_sca::SCALLOP_SCA',
|
|
170
172
|
// TODO: Change this to the correct value on production release
|
|
171
173
|
swusdc:
|
|
172
174
|
'0xf5447c4305a486d8c8557559887c2c39449ddb5e748f15d33946d02a1663c158::scallop_wormhole_usdc::SCALLOP_WORMHOLE_USDC',
|
|
@@ -467,9 +467,9 @@ export const TEST_ADDRESSES: AddressesInterface = {
|
|
|
467
467
|
},
|
|
468
468
|
ssca: {
|
|
469
469
|
coinType:
|
|
470
|
-
'
|
|
470
|
+
'0x958428555e778e55918a59eb1c92c77f32b5c554fa3a5e56cd0815086b5072e7::scallop_sca::SCALLOP_SCA',
|
|
471
471
|
treasury:
|
|
472
|
-
'
|
|
472
|
+
'0x5f1c5de1df7341075d119570269b7b452af50afe8363080638f1ae29a554c038',
|
|
473
473
|
},
|
|
474
474
|
swusdc: {
|
|
475
475
|
coinType:
|
package/src/queries/coreQuery.ts
CHANGED
|
@@ -640,7 +640,7 @@ export const getMarketCollateral = async (
|
|
|
640
640
|
)
|
|
641
641
|
)
|
|
642
642
|
throw new Error(
|
|
643
|
-
`Failed to
|
|
643
|
+
`Failed to fetch riskModelDynamicFieldObject for ${riskModelDynamicFieldObjectResponse?.error?.code.toString()}: `
|
|
644
644
|
);
|
|
645
645
|
|
|
646
646
|
const riskModel: RiskModel = (
|
|
@@ -329,12 +329,8 @@ export const getObligationAccount = async (
|
|
|
329
329
|
coinAmounts?: CoinAmounts
|
|
330
330
|
) => {
|
|
331
331
|
market = market || (await query.queryMarket(indexer));
|
|
332
|
-
const
|
|
333
|
-
...new Set([
|
|
334
|
-
...Object.values(market.collaterals).map(
|
|
335
|
-
(collateral) => collateral.coinName
|
|
336
|
-
),
|
|
337
|
-
]),
|
|
332
|
+
const poolAssetCoinNames: SupportCollateralCoins[] = [
|
|
333
|
+
...new Set([...Object.values(market.pools).map((pool) => pool.coinName)]),
|
|
338
334
|
];
|
|
339
335
|
const obligationQuery = await query.queryObligation(obligationId);
|
|
340
336
|
const borrowIncentivePools = await query.getBorrowIncentivePools(
|
|
@@ -344,11 +340,12 @@ export const getObligationAccount = async (
|
|
|
344
340
|
const borrowIncentiveAccounts =
|
|
345
341
|
await query.getBorrowIncentiveAccounts(obligationId);
|
|
346
342
|
coinPrices =
|
|
347
|
-
coinPrices || (await query.utils.getCoinPrices(
|
|
343
|
+
coinPrices || (await query.utils.getCoinPrices(poolAssetCoinNames));
|
|
348
344
|
coinAmounts =
|
|
349
345
|
coinAmounts ||
|
|
350
|
-
(await query.getCoinAmounts(
|
|
346
|
+
(await query.getCoinAmounts(poolAssetCoinNames, ownerAddress));
|
|
351
347
|
|
|
348
|
+
console.log(coinPrices);
|
|
352
349
|
const collaterals: ObligationAccount['collaterals'] = {};
|
|
353
350
|
const debts: ObligationAccount['debts'] = {};
|
|
354
351
|
const borrowIncentives: ObligationAccount['borrowIncentives'] = {};
|
|
@@ -361,7 +358,7 @@ export const getObligationAccount = async (
|
|
|
361
358
|
let totalBorrowedValue = BigNumber(0);
|
|
362
359
|
let totalBorrowedValueWithWeight = BigNumber(0);
|
|
363
360
|
|
|
364
|
-
for (const assetCoinName of
|
|
361
|
+
for (const assetCoinName of poolAssetCoinNames) {
|
|
365
362
|
const collateral = obligationQuery?.collaterals.find((collateral) => {
|
|
366
363
|
const collateralCoinName =
|
|
367
364
|
query.utils.parseCoinNameFromType<SupportCollateralCoins>(
|
|
@@ -114,7 +114,7 @@ export const getSpool = async (
|
|
|
114
114
|
const coinName = query.utils.parseCoinName<SupportStakeCoins>(marketCoinName);
|
|
115
115
|
marketPool = marketPool || (await query.getMarketPool(coinName, indexer));
|
|
116
116
|
if (!marketPool) {
|
|
117
|
-
throw new Error(
|
|
117
|
+
throw new Error(`Failed to fetch marketPool for ${marketCoinName}`);
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
const poolId = query.address.get(`spool.pools.${marketCoinName}.id`);
|