@scallop-io/sui-scallop-sdk 0.44.14 → 0.44.15
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/constants/common.d.ts +1 -1
- package/dist/index.js +79 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +79 -9
- package/dist/index.mjs.map +1 -1
- package/dist/models/scallopBuilder.d.ts +2 -2
- package/dist/models/scallopQuery.d.ts +12 -3
- package/dist/queries/coreQuery.d.ts +3 -3
- package/dist/queries/spoolQuery.d.ts +3 -0
- package/dist/types/query/portfolio.d.ts +2 -1
- package/package.json +1 -1
- package/src/builders/spoolBuilder.ts +2 -2
- package/src/constants/common.ts +8 -1
- package/src/constants/enum.ts +6 -0
- package/src/models/scallopAddress.ts +16 -0
- package/src/models/scallopBuilder.ts +5 -5
- package/src/queries/portfolioQuery.ts +5 -0
- package/src/queries/spoolQuery.ts +36 -0
- package/src/types/query/portfolio.ts +4 -1
package/dist/index.mjs
CHANGED
|
@@ -30,7 +30,14 @@ var SUPPORT_COLLATERALS = [
|
|
|
30
30
|
"hasui",
|
|
31
31
|
"vsui"
|
|
32
32
|
];
|
|
33
|
-
var SUPPORT_SPOOLS = [
|
|
33
|
+
var SUPPORT_SPOOLS = [
|
|
34
|
+
"ssui",
|
|
35
|
+
"susdc",
|
|
36
|
+
"susdt",
|
|
37
|
+
"safsui",
|
|
38
|
+
"shasui",
|
|
39
|
+
"svsui"
|
|
40
|
+
];
|
|
34
41
|
var SUPPORT_SPOOLS_REWARDS = ["sui"];
|
|
35
42
|
var SUPPORT_BORROW_INCENTIVE_POOLS = ["sui", "usdc", "usdt"];
|
|
36
43
|
var SUPPORT_BORROW_INCENTIVE_REWARDS = ["sui"];
|
|
@@ -104,12 +111,18 @@ var marketCoins = {
|
|
|
104
111
|
var stakeMarketCoins = {
|
|
105
112
|
ssui: "ssui",
|
|
106
113
|
susdc: "susdc",
|
|
107
|
-
susdt: "susdt"
|
|
114
|
+
susdt: "susdt",
|
|
115
|
+
safsui: "safsui",
|
|
116
|
+
shasui: "shasui",
|
|
117
|
+
svsui: "svsui"
|
|
108
118
|
};
|
|
109
119
|
var spoolRewardCoins = {
|
|
110
120
|
ssui: "sui",
|
|
111
121
|
susdc: "sui",
|
|
112
|
-
susdt: "sui"
|
|
122
|
+
susdt: "sui",
|
|
123
|
+
safsui: "sui",
|
|
124
|
+
shasui: "sui",
|
|
125
|
+
svsui: "sui"
|
|
113
126
|
};
|
|
114
127
|
var borrowIncentiveRewardCoins = {
|
|
115
128
|
sui: "sui",
|
|
@@ -337,6 +350,22 @@ var EMPTY_ADDRESSES = {
|
|
|
337
350
|
susdc: {
|
|
338
351
|
id: "",
|
|
339
352
|
rewardPoolId: ""
|
|
353
|
+
},
|
|
354
|
+
susdt: {
|
|
355
|
+
id: "",
|
|
356
|
+
rewardPoolId: ""
|
|
357
|
+
},
|
|
358
|
+
safsui: {
|
|
359
|
+
id: "",
|
|
360
|
+
rewardPoolId: ""
|
|
361
|
+
},
|
|
362
|
+
shasui: {
|
|
363
|
+
id: "",
|
|
364
|
+
rewardPoolId: ""
|
|
365
|
+
},
|
|
366
|
+
svsui: {
|
|
367
|
+
id: "",
|
|
368
|
+
rewardPoolId: ""
|
|
340
369
|
}
|
|
341
370
|
}
|
|
342
371
|
},
|
|
@@ -1943,7 +1972,10 @@ var getStakeAccounts = async (query, ownerAddress) => {
|
|
|
1943
1972
|
const stakeAccounts = {
|
|
1944
1973
|
ssui: [],
|
|
1945
1974
|
susdc: [],
|
|
1946
|
-
susdt: []
|
|
1975
|
+
susdt: [],
|
|
1976
|
+
safsui: [],
|
|
1977
|
+
shasui: [],
|
|
1978
|
+
svsui: []
|
|
1947
1979
|
};
|
|
1948
1980
|
const stakeMarketCoinTypes = Object.keys(stakeAccounts).reduce(
|
|
1949
1981
|
(types, stakeMarketCoinName) => {
|
|
@@ -2000,6 +2032,39 @@ var getStakeAccounts = async (query, ownerAddress) => {
|
|
|
2000
2032
|
points,
|
|
2001
2033
|
totalPoints
|
|
2002
2034
|
});
|
|
2035
|
+
} else if (normalizeStructTag3(type) === stakeMarketCoinTypes.safsui) {
|
|
2036
|
+
stakeAccounts.safsui.push({
|
|
2037
|
+
id,
|
|
2038
|
+
type: normalizeStructTag3(type),
|
|
2039
|
+
stakePoolId,
|
|
2040
|
+
stakeType: normalizeStructTag3(stakeType),
|
|
2041
|
+
staked,
|
|
2042
|
+
index,
|
|
2043
|
+
points,
|
|
2044
|
+
totalPoints
|
|
2045
|
+
});
|
|
2046
|
+
} else if (normalizeStructTag3(type) === stakeMarketCoinTypes.shasui) {
|
|
2047
|
+
stakeAccounts.shasui.push({
|
|
2048
|
+
id,
|
|
2049
|
+
type: normalizeStructTag3(type),
|
|
2050
|
+
stakePoolId,
|
|
2051
|
+
stakeType: normalizeStructTag3(stakeType),
|
|
2052
|
+
staked,
|
|
2053
|
+
index,
|
|
2054
|
+
points,
|
|
2055
|
+
totalPoints
|
|
2056
|
+
});
|
|
2057
|
+
} else if (normalizeStructTag3(type) === stakeMarketCoinTypes.svsui) {
|
|
2058
|
+
stakeAccounts.svsui.push({
|
|
2059
|
+
id,
|
|
2060
|
+
type: normalizeStructTag3(type),
|
|
2061
|
+
stakePoolId,
|
|
2062
|
+
stakeType: normalizeStructTag3(stakeType),
|
|
2063
|
+
staked,
|
|
2064
|
+
index,
|
|
2065
|
+
points,
|
|
2066
|
+
totalPoints
|
|
2067
|
+
});
|
|
2003
2068
|
}
|
|
2004
2069
|
}
|
|
2005
2070
|
}
|
|
@@ -2354,6 +2419,9 @@ var getLending = async (query, poolCoinName, ownerAddress, indexer = false, mark
|
|
|
2354
2419
|
);
|
|
2355
2420
|
const suppliedCoin = suppliedAmount.shiftedBy(-1 * coinDecimal);
|
|
2356
2421
|
const suppliedValue = suppliedCoin.multipliedBy(coinPrice ?? 0);
|
|
2422
|
+
const marketCoinPrice = BigNumber3(coinPrice ?? 0).multipliedBy(
|
|
2423
|
+
marketPool?.conversionRate ?? 1
|
|
2424
|
+
);
|
|
2357
2425
|
const unstakedMarketAmount = BigNumber3(marketCoinAmount);
|
|
2358
2426
|
const unstakedMarketCoin = unstakedMarketAmount.shiftedBy(-1 * coinDecimal);
|
|
2359
2427
|
const availableSupplyAmount = BigNumber3(coinAmount);
|
|
@@ -2373,6 +2441,8 @@ var getLending = async (query, poolCoinName, ownerAddress, indexer = false, mark
|
|
|
2373
2441
|
marketCoinType: query.utils.parseMarketCoinType(poolCoinName),
|
|
2374
2442
|
coinDecimal,
|
|
2375
2443
|
coinPrice: coinPrice ?? 0,
|
|
2444
|
+
conversionRate: marketPool?.conversionRate ?? 1,
|
|
2445
|
+
marketCoinPrice: marketCoinPrice.toNumber(),
|
|
2376
2446
|
supplyApr: marketPool?.supplyApr ?? 0,
|
|
2377
2447
|
supplyApy: marketPool?.supplyApy ?? 0,
|
|
2378
2448
|
rewardApr: spool?.rewardApr ?? 0,
|
|
@@ -4400,14 +4470,14 @@ var ScallopBuilder = class {
|
|
|
4400
4470
|
/**
|
|
4401
4471
|
* Request the scallop API to initialize data.
|
|
4402
4472
|
*
|
|
4403
|
-
* @param
|
|
4473
|
+
* @param force - Whether to force initialization.
|
|
4404
4474
|
*/
|
|
4405
|
-
async init(
|
|
4406
|
-
if (
|
|
4475
|
+
async init(force = false) {
|
|
4476
|
+
if (force || !this.address.getAddresses()) {
|
|
4407
4477
|
await this.address.read();
|
|
4408
4478
|
}
|
|
4409
|
-
await this.query.init(
|
|
4410
|
-
await this.utils.init(
|
|
4479
|
+
await this.query.init(force);
|
|
4480
|
+
await this.utils.init(force);
|
|
4411
4481
|
}
|
|
4412
4482
|
/**
|
|
4413
4483
|
* Create a scallop txBlock instance that enhances transaction block.
|