@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.js
CHANGED
|
@@ -341,7 +341,9 @@ var sCoinIds = {
|
|
|
341
341
|
ssui: "0xf569919046f19a0c40b519ecfbb6ca0319698cd5908716c29b62ef56541f298b::scallop_sui::SCALLOP_SUI",
|
|
342
342
|
// ssui: '0xaafc4f740de0dd0dde642a31148fb94517087052f19afb0f7bed1dc41a50c77b::scallop_sui::SCALLOP_SUI',
|
|
343
343
|
scetus: "0xea346ce428f91ab007210443efcea5f5cdbbb3aae7e9affc0ca93f9203c31f0c::scallop_cetus::SCALLOP_CETUS",
|
|
344
|
-
|
|
344
|
+
// TODO: Change this to the correct value on production release
|
|
345
|
+
ssca: "0x958428555e778e55918a59eb1c92c77f32b5c554fa3a5e56cd0815086b5072e7::scallop_sca::SCALLOP_SCA",
|
|
346
|
+
// '0x5ca17430c1d046fae9edeaa8fd76c7b4193a00d764a0ecfa9418d733ad27bc1e::scallop_sca::SCALLOP_SCA',
|
|
345
347
|
// TODO: Change this to the correct value on production release
|
|
346
348
|
swusdc: "0xf5447c4305a486d8c8557559887c2c39449ddb5e748f15d33946d02a1663c158::scallop_wormhole_usdc::SCALLOP_WORMHOLE_USDC",
|
|
347
349
|
// '0xad4d71551d31092230db1fd482008ea42867dbf27b286e9c70a79d2a6191d58d::scallop_wormhole_usdc::SCALLOP_WORMHOLE_USDC',
|
|
@@ -853,8 +855,8 @@ var TEST_ADDRESSES = {
|
|
|
853
855
|
treasury: "0xd786f4b2d26278cc7911a3445b1b085eab60f269ef9dbb6b87e803d52f155003"
|
|
854
856
|
},
|
|
855
857
|
ssca: {
|
|
856
|
-
coinType: "
|
|
857
|
-
treasury: "
|
|
858
|
+
coinType: "0x958428555e778e55918a59eb1c92c77f32b5c554fa3a5e56cd0815086b5072e7::scallop_sca::SCALLOP_SCA",
|
|
859
|
+
treasury: "0x5f1c5de1df7341075d119570269b7b452af50afe8363080638f1ae29a554c038"
|
|
858
860
|
},
|
|
859
861
|
swusdc: {
|
|
860
862
|
coinType: "0xf5447c4305a486d8c8557559887c2c39449ddb5e748f15d33946d02a1663c158::scallop_wormhole_usdc::SCALLOP_WORMHOLE_USDC",
|
|
@@ -2893,7 +2895,7 @@ var getMarketCollateral = async (query, collateralCoinName, indexer = false, mar
|
|
|
2893
2895
|
const riskModelDynamicFieldObject = riskModelDynamicFieldObjectResponse?.data;
|
|
2894
2896
|
if (!(riskModelDynamicFieldObject && riskModelDynamicFieldObject.content && "fields" in riskModelDynamicFieldObject.content))
|
|
2895
2897
|
throw new Error(
|
|
2896
|
-
`Failed to
|
|
2898
|
+
`Failed to fetch riskModelDynamicFieldObject for ${riskModelDynamicFieldObjectResponse?.error?.code.toString()}: `
|
|
2897
2899
|
);
|
|
2898
2900
|
const riskModel = riskModelDynamicFieldObject.content.fields.value.fields;
|
|
2899
2901
|
const collateralStatParentId = fields.collateral_stats.fields.table.fields.id.id;
|
|
@@ -3170,7 +3172,7 @@ var getSpool = async (query, marketCoinName, indexer = false, marketPool, coinPr
|
|
|
3170
3172
|
const coinName = query.utils.parseCoinName(marketCoinName);
|
|
3171
3173
|
marketPool = marketPool || await query.getMarketPool(coinName, indexer);
|
|
3172
3174
|
if (!marketPool) {
|
|
3173
|
-
throw new Error(
|
|
3175
|
+
throw new Error(`Failed to fetch marketPool for ${marketCoinName}`);
|
|
3174
3176
|
}
|
|
3175
3177
|
const poolId = query.address.get(`spool.pools.${marketCoinName}.id`);
|
|
3176
3178
|
const rewardPoolId = query.address.get(
|
|
@@ -3898,12 +3900,8 @@ var getObligationAccounts = async (query, ownerAddress, indexer = false) => {
|
|
|
3898
3900
|
};
|
|
3899
3901
|
var getObligationAccount = async (query, obligationId, ownerAddress, indexer = false, market, coinPrices, coinAmounts) => {
|
|
3900
3902
|
market = market || await query.queryMarket(indexer);
|
|
3901
|
-
const
|
|
3902
|
-
.../* @__PURE__ */ new Set([
|
|
3903
|
-
...Object.values(market.collaterals).map(
|
|
3904
|
-
(collateral) => collateral.coinName
|
|
3905
|
-
)
|
|
3906
|
-
])
|
|
3903
|
+
const poolAssetCoinNames = [
|
|
3904
|
+
.../* @__PURE__ */ new Set([...Object.values(market.pools).map((pool) => pool.coinName)])
|
|
3907
3905
|
];
|
|
3908
3906
|
const obligationQuery = await query.queryObligation(obligationId);
|
|
3909
3907
|
const borrowIncentivePools = await query.getBorrowIncentivePools(
|
|
@@ -3911,8 +3909,9 @@ var getObligationAccount = async (query, obligationId, ownerAddress, indexer = f
|
|
|
3911
3909
|
indexer
|
|
3912
3910
|
);
|
|
3913
3911
|
const borrowIncentiveAccounts = await query.getBorrowIncentiveAccounts(obligationId);
|
|
3914
|
-
coinPrices = coinPrices || await query.utils.getCoinPrices(
|
|
3915
|
-
coinAmounts = coinAmounts || await query.getCoinAmounts(
|
|
3912
|
+
coinPrices = coinPrices || await query.utils.getCoinPrices(poolAssetCoinNames);
|
|
3913
|
+
coinAmounts = coinAmounts || await query.getCoinAmounts(poolAssetCoinNames, ownerAddress);
|
|
3914
|
+
console.log(coinPrices);
|
|
3916
3915
|
const collaterals = {};
|
|
3917
3916
|
const debts = {};
|
|
3918
3917
|
const borrowIncentives = {};
|
|
@@ -3924,7 +3923,7 @@ var getObligationAccount = async (query, obligationId, ownerAddress, indexer = f
|
|
|
3924
3923
|
let totalRewardedPools = 0;
|
|
3925
3924
|
let totalBorrowedValue = (0, import_bignumber4.default)(0);
|
|
3926
3925
|
let totalBorrowedValueWithWeight = (0, import_bignumber4.default)(0);
|
|
3927
|
-
for (const assetCoinName of
|
|
3926
|
+
for (const assetCoinName of poolAssetCoinNames) {
|
|
3928
3927
|
const collateral = obligationQuery?.collaterals.find((collateral2) => {
|
|
3929
3928
|
const collateralCoinName = query.utils.parseCoinNameFromType(
|
|
3930
3929
|
collateral2.type.name
|