@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/dist/index.mjs
CHANGED
|
@@ -258,7 +258,9 @@ var sCoinIds = {
|
|
|
258
258
|
ssui: "0xf569919046f19a0c40b519ecfbb6ca0319698cd5908716c29b62ef56541f298b::scallop_sui::SCALLOP_SUI",
|
|
259
259
|
// ssui: '0xaafc4f740de0dd0dde642a31148fb94517087052f19afb0f7bed1dc41a50c77b::scallop_sui::SCALLOP_SUI',
|
|
260
260
|
scetus: "0xea346ce428f91ab007210443efcea5f5cdbbb3aae7e9affc0ca93f9203c31f0c::scallop_cetus::SCALLOP_CETUS",
|
|
261
|
-
|
|
261
|
+
// TODO: Change this to the correct value on production release
|
|
262
|
+
ssca: "0x958428555e778e55918a59eb1c92c77f32b5c554fa3a5e56cd0815086b5072e7::scallop_sca::SCALLOP_SCA",
|
|
263
|
+
// '0x5ca17430c1d046fae9edeaa8fd76c7b4193a00d764a0ecfa9418d733ad27bc1e::scallop_sca::SCALLOP_SCA',
|
|
262
264
|
// TODO: Change this to the correct value on production release
|
|
263
265
|
swusdc: "0xf5447c4305a486d8c8557559887c2c39449ddb5e748f15d33946d02a1663c158::scallop_wormhole_usdc::SCALLOP_WORMHOLE_USDC",
|
|
264
266
|
// '0xad4d71551d31092230db1fd482008ea42867dbf27b286e9c70a79d2a6191d58d::scallop_wormhole_usdc::SCALLOP_WORMHOLE_USDC',
|
|
@@ -770,8 +772,8 @@ var TEST_ADDRESSES = {
|
|
|
770
772
|
treasury: "0xd786f4b2d26278cc7911a3445b1b085eab60f269ef9dbb6b87e803d52f155003"
|
|
771
773
|
},
|
|
772
774
|
ssca: {
|
|
773
|
-
coinType: "
|
|
774
|
-
treasury: "
|
|
775
|
+
coinType: "0x958428555e778e55918a59eb1c92c77f32b5c554fa3a5e56cd0815086b5072e7::scallop_sca::SCALLOP_SCA",
|
|
776
|
+
treasury: "0x5f1c5de1df7341075d119570269b7b452af50afe8363080638f1ae29a554c038"
|
|
775
777
|
},
|
|
776
778
|
swusdc: {
|
|
777
779
|
coinType: "0xf5447c4305a486d8c8557559887c2c39449ddb5e748f15d33946d02a1663c158::scallop_wormhole_usdc::SCALLOP_WORMHOLE_USDC",
|
|
@@ -2813,7 +2815,7 @@ var getMarketCollateral = async (query, collateralCoinName, indexer = false, mar
|
|
|
2813
2815
|
const riskModelDynamicFieldObject = riskModelDynamicFieldObjectResponse?.data;
|
|
2814
2816
|
if (!(riskModelDynamicFieldObject && riskModelDynamicFieldObject.content && "fields" in riskModelDynamicFieldObject.content))
|
|
2815
2817
|
throw new Error(
|
|
2816
|
-
`Failed to
|
|
2818
|
+
`Failed to fetch riskModelDynamicFieldObject for ${riskModelDynamicFieldObjectResponse?.error?.code.toString()}: `
|
|
2817
2819
|
);
|
|
2818
2820
|
const riskModel = riskModelDynamicFieldObject.content.fields.value.fields;
|
|
2819
2821
|
const collateralStatParentId = fields.collateral_stats.fields.table.fields.id.id;
|
|
@@ -3090,7 +3092,7 @@ var getSpool = async (query, marketCoinName, indexer = false, marketPool, coinPr
|
|
|
3090
3092
|
const coinName = query.utils.parseCoinName(marketCoinName);
|
|
3091
3093
|
marketPool = marketPool || await query.getMarketPool(coinName, indexer);
|
|
3092
3094
|
if (!marketPool) {
|
|
3093
|
-
throw new Error(
|
|
3095
|
+
throw new Error(`Failed to fetch marketPool for ${marketCoinName}`);
|
|
3094
3096
|
}
|
|
3095
3097
|
const poolId = query.address.get(`spool.pools.${marketCoinName}.id`);
|
|
3096
3098
|
const rewardPoolId = query.address.get(
|
|
@@ -3818,12 +3820,8 @@ var getObligationAccounts = async (query, ownerAddress, indexer = false) => {
|
|
|
3818
3820
|
};
|
|
3819
3821
|
var getObligationAccount = async (query, obligationId, ownerAddress, indexer = false, market, coinPrices, coinAmounts) => {
|
|
3820
3822
|
market = market || await query.queryMarket(indexer);
|
|
3821
|
-
const
|
|
3822
|
-
.../* @__PURE__ */ new Set([
|
|
3823
|
-
...Object.values(market.collaterals).map(
|
|
3824
|
-
(collateral) => collateral.coinName
|
|
3825
|
-
)
|
|
3826
|
-
])
|
|
3823
|
+
const poolAssetCoinNames = [
|
|
3824
|
+
.../* @__PURE__ */ new Set([...Object.values(market.pools).map((pool) => pool.coinName)])
|
|
3827
3825
|
];
|
|
3828
3826
|
const obligationQuery = await query.queryObligation(obligationId);
|
|
3829
3827
|
const borrowIncentivePools = await query.getBorrowIncentivePools(
|
|
@@ -3831,8 +3829,9 @@ var getObligationAccount = async (query, obligationId, ownerAddress, indexer = f
|
|
|
3831
3829
|
indexer
|
|
3832
3830
|
);
|
|
3833
3831
|
const borrowIncentiveAccounts = await query.getBorrowIncentiveAccounts(obligationId);
|
|
3834
|
-
coinPrices = coinPrices || await query.utils.getCoinPrices(
|
|
3835
|
-
coinAmounts = coinAmounts || await query.getCoinAmounts(
|
|
3832
|
+
coinPrices = coinPrices || await query.utils.getCoinPrices(poolAssetCoinNames);
|
|
3833
|
+
coinAmounts = coinAmounts || await query.getCoinAmounts(poolAssetCoinNames, ownerAddress);
|
|
3834
|
+
console.log(coinPrices);
|
|
3836
3835
|
const collaterals = {};
|
|
3837
3836
|
const debts = {};
|
|
3838
3837
|
const borrowIncentives = {};
|
|
@@ -3844,7 +3843,7 @@ var getObligationAccount = async (query, obligationId, ownerAddress, indexer = f
|
|
|
3844
3843
|
let totalRewardedPools = 0;
|
|
3845
3844
|
let totalBorrowedValue = BigNumber4(0);
|
|
3846
3845
|
let totalBorrowedValueWithWeight = BigNumber4(0);
|
|
3847
|
-
for (const assetCoinName of
|
|
3846
|
+
for (const assetCoinName of poolAssetCoinNames) {
|
|
3848
3847
|
const collateral = obligationQuery?.collaterals.find((collateral2) => {
|
|
3849
3848
|
const collateralCoinName = query.utils.parseCoinNameFromType(
|
|
3850
3849
|
collateral2.type.name
|