@scallop-io/sui-scallop-sdk 0.47.3 → 0.47.5
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 +6 -4
- package/dist/constants/enum.d.ts +1 -0
- package/dist/index.js +134 -123
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +131 -123
- package/dist/index.mjs.map +1 -1
- package/dist/models/scallopQuery.d.ts +11 -3
- package/dist/models/scallopUtils.d.ts +4 -2
- package/dist/queries/borrowIncentiveQuery.d.ts +2 -0
- package/dist/queries/coreQuery.d.ts +2 -0
- package/dist/queries/portfolioQuery.d.ts +1 -0
- package/dist/queries/sCoinQuery.d.ts +1 -1
- package/dist/queries/vescaQuery.d.ts +1 -1
- package/dist/types/constant/common.d.ts +3 -1
- package/dist/types/constant/enum.d.ts +7 -1
- package/dist/utils/util.d.ts +3 -1
- package/package.json +1 -1
- package/src/constants/common.ts +15 -1
- package/src/constants/enum.ts +13 -0
- package/src/models/scallopClient.ts +3 -1
- package/src/models/scallopQuery.ts +8 -2
- package/src/models/scallopUtils.ts +52 -22
- package/src/queries/coreQuery.ts +0 -1
- package/src/queries/spoolQuery.ts +40 -103
- package/src/queries/vescaQuery.ts +8 -2
- package/src/types/constant/common.ts +4 -0
- package/src/types/constant/enum.ts +9 -0
- package/src/utils/util.ts +25 -3
|
@@ -7,12 +7,14 @@ export declare const PROTOCOL_OBJECT_ID: "0xc9f859f98ca352a11b97a038c4b4162bee43
|
|
|
7
7
|
export declare const BORROW_FEE_PROTOCOL_ID: "0xc9f859f98ca352a11b97a038c4b4162bee437b8df8caa047990fe9cb03d4f778" | "0xc38f849e81cfe46d4e4320f508ea7dda42934a329d5a6571bb4c3cb6ea63f5da";
|
|
8
8
|
export declare const SCA_COIN_TYPE: "0x6cd813061a3adf3602b76545f076205f0c8e7ec1d3b1eab9a1da7992c18c0524::sca::SCA" | "0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6::sca::SCA";
|
|
9
9
|
export declare const OLD_BORROW_INCENTIVE_PROTOCOL_ID: "0xc63072e7f5f4983a2efaf5bdba1480d5e7d74d57948e1c7cc436f8e22cbeb410";
|
|
10
|
-
export declare const SUPPORT_POOLS: readonly ["usdc", "weth", "wbtc", "wusdc", "wusdt", "sui", "wapt", "wsol", "cetus", "afsui", "hasui", "vsui", "sca"];
|
|
11
|
-
export declare const SUPPORT_COLLATERALS: readonly ["usdc", "weth", "wbtc", "wusdc", "wusdt", "sui", "wapt", "wsol", "cetus", "afsui", "hasui", "vsui", "sca"];
|
|
10
|
+
export declare const SUPPORT_POOLS: readonly ["usdc", "sbeth", "weth", "wbtc", "wusdc", "wusdt", "sui", "wapt", "wsol", "cetus", "afsui", "hasui", "vsui", "sca"];
|
|
11
|
+
export declare const SUPPORT_COLLATERALS: readonly ["usdc", "sbeth", "weth", "wbtc", "wusdc", "wusdt", "sui", "wapt", "wsol", "cetus", "afsui", "hasui", "vsui", "sca"];
|
|
12
12
|
export declare const SUPPORT_SPOOLS: readonly ["susdc", "sweth", "ssui", "swusdc", "swusdt", "scetus", "safsui", "shasui", "svsui"];
|
|
13
|
-
export declare const SUPPORT_SCOIN: readonly ["susdc", "ssui", "swusdc", "swusdt", "safsui", "shasui", "svsui", "sweth", "ssca", "scetus", "swsol", "swbtc"];
|
|
13
|
+
export declare const SUPPORT_SCOIN: readonly ["susdc", "ssbeth", "ssui", "swusdc", "swusdt", "safsui", "shasui", "svsui", "sweth", "ssca", "scetus", "swsol", "swbtc"];
|
|
14
|
+
export declare const SUPPORT_SUI_BRIDGE: readonly ["sbeth"];
|
|
15
|
+
export declare const SUPPORT_WORMHOLE: readonly ["wusdc", "wusdt", "weth", "wbtc", "wapt", "wsol"];
|
|
14
16
|
export declare const SUPPORT_SPOOLS_REWARDS: readonly ["sui"];
|
|
15
|
-
export declare const SUPPORT_BORROW_INCENTIVE_POOLS: readonly ["sui", "wusdc", "wusdt", "afsui", "hasui", "vsui", "weth", "sca", "usdc"];
|
|
17
|
+
export declare const SUPPORT_BORROW_INCENTIVE_POOLS: readonly ["sui", "wusdc", "wusdt", "afsui", "hasui", "vsui", "weth", "sbeth", "sca", "usdc"];
|
|
16
18
|
export declare const SUPPORT_BORROW_INCENTIVE_REWARDS: readonly ["sui", "sca"];
|
|
17
19
|
export declare const SUPPORT_ORACLES: readonly ["supra", "switchboard", "pyth"];
|
|
18
20
|
export declare const SUPPORT_PACKAGES: readonly ["coinDecimalsRegistry", "math", "whitelist", "x", "protocol", "protocolWhitelist", "query", "supra", "pyth", "switchboard", "xOracle", "testCoin"];
|
package/dist/constants/enum.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export declare const marketCoins: types.MarketCoins;
|
|
|
5
5
|
export declare const sCoins: types.SCoins;
|
|
6
6
|
export declare const stakeMarketCoins: types.StakeMarketCoins;
|
|
7
7
|
export declare const spoolRewardCoins: types.StakeRewardCoins;
|
|
8
|
+
export declare const suiBridgeCoins: types.SuiBridgeCoins;
|
|
8
9
|
export declare const borrowIncentiveRewardCoins: types.BorrowIncentiveRewardCoins;
|
|
9
10
|
export declare const coinIds: types.AssetCoinIds;
|
|
10
11
|
export declare const wormholeCoinIds: types.WormholeCoinIds;
|
package/dist/index.js
CHANGED
|
@@ -52,6 +52,8 @@ __export(src_exports, {
|
|
|
52
52
|
SUPPORT_SCOIN: () => SUPPORT_SCOIN,
|
|
53
53
|
SUPPORT_SPOOLS: () => SUPPORT_SPOOLS,
|
|
54
54
|
SUPPORT_SPOOLS_REWARDS: () => SUPPORT_SPOOLS_REWARDS,
|
|
55
|
+
SUPPORT_SUI_BRIDGE: () => SUPPORT_SUI_BRIDGE,
|
|
56
|
+
SUPPORT_WORMHOLE: () => SUPPORT_WORMHOLE,
|
|
55
57
|
Scallop: () => Scallop,
|
|
56
58
|
ScallopAddress: () => ScallopAddress,
|
|
57
59
|
ScallopBuilder: () => ScallopBuilder,
|
|
@@ -71,6 +73,7 @@ __export(src_exports, {
|
|
|
71
73
|
sCoins: () => sCoins,
|
|
72
74
|
spoolRewardCoins: () => spoolRewardCoins,
|
|
73
75
|
stakeMarketCoins: () => stakeMarketCoins,
|
|
76
|
+
suiBridgeCoins: () => suiBridgeCoins,
|
|
74
77
|
voloCoinIds: () => voloCoinIds,
|
|
75
78
|
wormholeCoinIds: () => wormholeCoinIds
|
|
76
79
|
});
|
|
@@ -89,6 +92,8 @@ var OLD_BORROW_INCENTIVE_PROTOCOL_ID = "0xc63072e7f5f4983a2efaf5bdba1480d5e7d74d
|
|
|
89
92
|
var SUPPORT_POOLS = [
|
|
90
93
|
"usdc",
|
|
91
94
|
// native USDC
|
|
95
|
+
"sbeth",
|
|
96
|
+
// native ETH
|
|
92
97
|
"weth",
|
|
93
98
|
"wbtc",
|
|
94
99
|
"wusdc",
|
|
@@ -104,6 +109,9 @@ var SUPPORT_POOLS = [
|
|
|
104
109
|
];
|
|
105
110
|
var SUPPORT_COLLATERALS = [
|
|
106
111
|
"usdc",
|
|
112
|
+
// native USDC
|
|
113
|
+
"sbeth",
|
|
114
|
+
// native ETH
|
|
107
115
|
"weth",
|
|
108
116
|
"wbtc",
|
|
109
117
|
"wusdc",
|
|
@@ -130,6 +138,7 @@ var SUPPORT_SPOOLS = [
|
|
|
130
138
|
];
|
|
131
139
|
var SUPPORT_SCOIN = [
|
|
132
140
|
"susdc",
|
|
141
|
+
"ssbeth",
|
|
133
142
|
"ssui",
|
|
134
143
|
"swusdc",
|
|
135
144
|
"swusdt",
|
|
@@ -142,6 +151,15 @@ var SUPPORT_SCOIN = [
|
|
|
142
151
|
"swsol",
|
|
143
152
|
"swbtc"
|
|
144
153
|
];
|
|
154
|
+
var SUPPORT_SUI_BRIDGE = ["sbeth"];
|
|
155
|
+
var SUPPORT_WORMHOLE = [
|
|
156
|
+
"wusdc",
|
|
157
|
+
"wusdt",
|
|
158
|
+
"weth",
|
|
159
|
+
"wbtc",
|
|
160
|
+
"wapt",
|
|
161
|
+
"wsol"
|
|
162
|
+
];
|
|
145
163
|
var SUPPORT_SPOOLS_REWARDS = ["sui"];
|
|
146
164
|
var SUPPORT_BORROW_INCENTIVE_POOLS = [
|
|
147
165
|
"sui",
|
|
@@ -151,6 +169,7 @@ var SUPPORT_BORROW_INCENTIVE_POOLS = [
|
|
|
151
169
|
"hasui",
|
|
152
170
|
"vsui",
|
|
153
171
|
"weth",
|
|
172
|
+
"sbeth",
|
|
154
173
|
"sca",
|
|
155
174
|
"usdc"
|
|
156
175
|
];
|
|
@@ -174,6 +193,7 @@ var SUPPORT_PACKAGES = [
|
|
|
174
193
|
// src/constants/enum.ts
|
|
175
194
|
var coinDecimals = {
|
|
176
195
|
usdc: 6,
|
|
196
|
+
sbeth: 8,
|
|
177
197
|
weth: 8,
|
|
178
198
|
wbtc: 8,
|
|
179
199
|
wusdc: 6,
|
|
@@ -188,6 +208,7 @@ var coinDecimals = {
|
|
|
188
208
|
sca: 9,
|
|
189
209
|
susdc: 6,
|
|
190
210
|
sweth: 8,
|
|
211
|
+
ssbeth: 8,
|
|
191
212
|
swbtc: 8,
|
|
192
213
|
swusdc: 6,
|
|
193
214
|
swusdt: 6,
|
|
@@ -202,6 +223,7 @@ var coinDecimals = {
|
|
|
202
223
|
};
|
|
203
224
|
var assetCoins = {
|
|
204
225
|
usdc: "usdc",
|
|
226
|
+
sbeth: "sbeth",
|
|
205
227
|
weth: "weth",
|
|
206
228
|
wbtc: "wbtc",
|
|
207
229
|
wusdc: "wusdc",
|
|
@@ -217,6 +239,7 @@ var assetCoins = {
|
|
|
217
239
|
};
|
|
218
240
|
var marketCoins = {
|
|
219
241
|
susdc: "susdc",
|
|
242
|
+
ssbeth: "ssbeth",
|
|
220
243
|
sweth: "sweth",
|
|
221
244
|
swbtc: "swbtc",
|
|
222
245
|
swusdc: "swusdc",
|
|
@@ -232,6 +255,7 @@ var marketCoins = {
|
|
|
232
255
|
};
|
|
233
256
|
var sCoins = {
|
|
234
257
|
susdc: "susdc",
|
|
258
|
+
ssbeth: "ssbeth",
|
|
235
259
|
sweth: "sweth",
|
|
236
260
|
swusdc: "swusdc",
|
|
237
261
|
swusdt: "swusdt",
|
|
@@ -266,6 +290,9 @@ var spoolRewardCoins = {
|
|
|
266
290
|
svsui: "sui",
|
|
267
291
|
susdc: "sui"
|
|
268
292
|
};
|
|
293
|
+
var suiBridgeCoins = {
|
|
294
|
+
sbeth: "sbeth"
|
|
295
|
+
};
|
|
269
296
|
var borrowIncentiveRewardCoins = {
|
|
270
297
|
usdc: ["sui", "sca"],
|
|
271
298
|
sui: ["sui", "sca"],
|
|
@@ -275,11 +302,13 @@ var borrowIncentiveRewardCoins = {
|
|
|
275
302
|
afsui: ["sui"],
|
|
276
303
|
hasui: ["sui"],
|
|
277
304
|
vsui: ["sui"],
|
|
278
|
-
weth: ["sui"]
|
|
305
|
+
weth: ["sui"],
|
|
306
|
+
sbeth: ["sui"]
|
|
279
307
|
};
|
|
280
308
|
var coinIds = {
|
|
281
309
|
usdc: "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7",
|
|
282
310
|
sui: "0x0000000000000000000000000000000000000000000000000000000000000002",
|
|
311
|
+
sbeth: "0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29",
|
|
283
312
|
weth: "0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5",
|
|
284
313
|
wbtc: "0x027792d9fed7f9844eb4839566001bb6f6cb4804f66aa2da6fe1ee242d896881",
|
|
285
314
|
wusdc: "0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf",
|
|
@@ -305,6 +334,7 @@ var voloCoinIds = {
|
|
|
305
334
|
};
|
|
306
335
|
var sCoinIds = {
|
|
307
336
|
susdc: "0x854950aa624b1df59fe64e630b2ba7c550642e9342267a33061d59fb31582da5::scallop_usdc::SCALLOP_USDC",
|
|
337
|
+
ssbeth: "0xb14f82d8506d139eacef109688d1b71e7236bcce9b2c0ad526abcd6aa5be7de0::scallop_sb_eth::SCALLOP_SB_ETH",
|
|
308
338
|
ssui: "0xaafc4f740de0dd0dde642a31148fb94517087052f19afb0f7bed1dc41a50c77b::scallop_sui::SCALLOP_SUI",
|
|
309
339
|
scetus: "0xea346ce428f91ab007210443efcea5f5cdbbb3aae7e9affc0ca93f9203c31f0c::scallop_cetus::SCALLOP_CETUS",
|
|
310
340
|
ssca: "0x5ca17430c1d046fae9edeaa8fd76c7b4193a00d764a0ecfa9418d733ad27bc1e::scallop_sca::SCALLOP_SCA",
|
|
@@ -861,11 +891,23 @@ var isMarketCoin = (coinName) => {
|
|
|
861
891
|
const assetCoinName = coinName.slice(1).toLowerCase();
|
|
862
892
|
return coinName.charAt(0).toLowerCase() === "s" && COIN_SET.includes(assetCoinName);
|
|
863
893
|
};
|
|
894
|
+
var isSuiBridgeAsset = (coinName) => {
|
|
895
|
+
return SUPPORT_SUI_BRIDGE.includes(coinName);
|
|
896
|
+
};
|
|
897
|
+
var isWormholeAsset = (coinName) => {
|
|
898
|
+
return SUPPORT_WORMHOLE.includes(coinName);
|
|
899
|
+
};
|
|
864
900
|
var parseAssetSymbol = (coinName) => {
|
|
865
|
-
|
|
866
|
-
if (isWormhole) {
|
|
901
|
+
if (isWormholeAsset(coinName)) {
|
|
867
902
|
return `w${coinName.slice(1).toUpperCase()}`;
|
|
868
903
|
}
|
|
904
|
+
if (isSuiBridgeAsset(coinName)) {
|
|
905
|
+
return `sb${coinName.slice(2).toUpperCase()}`;
|
|
906
|
+
}
|
|
907
|
+
if (isMarketCoin(coinName)) {
|
|
908
|
+
const assetCoinName = coinName.slice(1).toLowerCase();
|
|
909
|
+
return coinName.slice(0, 1).toLowerCase() + parseAssetSymbol(assetCoinName);
|
|
910
|
+
}
|
|
869
911
|
switch (coinName) {
|
|
870
912
|
case "afsui":
|
|
871
913
|
return "afSUI";
|
|
@@ -3109,18 +3151,13 @@ var getStakeAccounts = async ({
|
|
|
3109
3151
|
hasNextPage = false;
|
|
3110
3152
|
}
|
|
3111
3153
|
} while (hasNextPage);
|
|
3112
|
-
const stakeAccounts =
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
safsui: [],
|
|
3120
|
-
shasui: [],
|
|
3121
|
-
svsui: []
|
|
3122
|
-
// ssca: [],
|
|
3123
|
-
};
|
|
3154
|
+
const stakeAccounts = SUPPORT_SPOOLS.reduce(
|
|
3155
|
+
(acc, stakeName) => {
|
|
3156
|
+
acc[stakeName] = [];
|
|
3157
|
+
return acc;
|
|
3158
|
+
},
|
|
3159
|
+
{}
|
|
3160
|
+
);
|
|
3124
3161
|
const stakeMarketCoinTypes = Object.keys(stakeAccounts).reduce(
|
|
3125
3162
|
(types, stakeMarketCoinName) => {
|
|
3126
3163
|
const stakeCoinName = utils.parseCoinName(stakeMarketCoinName);
|
|
@@ -3130,6 +3167,13 @@ var getStakeAccounts = async ({
|
|
|
3130
3167
|
},
|
|
3131
3168
|
{}
|
|
3132
3169
|
);
|
|
3170
|
+
const reversedStakeMarketCoinTypes = Object.entries(stakeMarketCoinTypes).reduce(
|
|
3171
|
+
(reversedTypes, [key, value]) => {
|
|
3172
|
+
reversedTypes[value] = key;
|
|
3173
|
+
return reversedTypes;
|
|
3174
|
+
},
|
|
3175
|
+
{}
|
|
3176
|
+
);
|
|
3133
3177
|
const stakeObjectIds = stakeObjectsResponse.map((ref) => ref?.data?.objectId).filter((id) => id !== void 0);
|
|
3134
3178
|
const stakeObjects = await utils.cache.queryGetObjects(stakeObjectIds, {
|
|
3135
3179
|
showContent: true,
|
|
@@ -3146,98 +3190,23 @@ var getStakeAccounts = async ({
|
|
|
3146
3190
|
const index = Number(fields.index);
|
|
3147
3191
|
const points = Number(fields.points);
|
|
3148
3192
|
const totalPoints = Number(fields.total_points);
|
|
3149
|
-
|
|
3150
|
-
stakeAccounts.sweth
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
stakePoolId,
|
|
3165
|
-
stakeType: (0, import_utils5.normalizeStructTag)(stakeType),
|
|
3166
|
-
staked,
|
|
3167
|
-
index,
|
|
3168
|
-
points,
|
|
3169
|
-
totalPoints
|
|
3170
|
-
});
|
|
3171
|
-
} else if ((0, import_utils5.normalizeStructTag)(type) === stakeMarketCoinTypes.swusdc) {
|
|
3172
|
-
stakeAccounts.swusdc.push({
|
|
3173
|
-
id,
|
|
3174
|
-
type: (0, import_utils5.normalizeStructTag)(type),
|
|
3175
|
-
stakePoolId,
|
|
3176
|
-
stakeType: (0, import_utils5.normalizeStructTag)(stakeType),
|
|
3177
|
-
staked,
|
|
3178
|
-
index,
|
|
3179
|
-
points,
|
|
3180
|
-
totalPoints
|
|
3181
|
-
});
|
|
3182
|
-
} else if ((0, import_utils5.normalizeStructTag)(type) === stakeMarketCoinTypes.swusdt) {
|
|
3183
|
-
stakeAccounts.swusdt.push({
|
|
3184
|
-
id,
|
|
3185
|
-
type: (0, import_utils5.normalizeStructTag)(type),
|
|
3186
|
-
stakePoolId,
|
|
3187
|
-
stakeType: (0, import_utils5.normalizeStructTag)(stakeType),
|
|
3188
|
-
staked,
|
|
3189
|
-
index,
|
|
3190
|
-
points,
|
|
3191
|
-
totalPoints
|
|
3192
|
-
});
|
|
3193
|
-
} else if ((0, import_utils5.normalizeStructTag)(type) === stakeMarketCoinTypes.scetus) {
|
|
3194
|
-
stakeAccounts.scetus.push({
|
|
3195
|
-
id,
|
|
3196
|
-
type: (0, import_utils5.normalizeStructTag)(type),
|
|
3197
|
-
stakePoolId,
|
|
3198
|
-
stakeType: (0, import_utils5.normalizeStructTag)(stakeType),
|
|
3199
|
-
staked,
|
|
3200
|
-
index,
|
|
3201
|
-
points,
|
|
3202
|
-
totalPoints
|
|
3203
|
-
});
|
|
3204
|
-
} else if ((0, import_utils5.normalizeStructTag)(type) === stakeMarketCoinTypes.safsui) {
|
|
3205
|
-
stakeAccounts.safsui.push({
|
|
3206
|
-
id,
|
|
3207
|
-
type: (0, import_utils5.normalizeStructTag)(type),
|
|
3208
|
-
stakePoolId,
|
|
3209
|
-
stakeType: (0, import_utils5.normalizeStructTag)(stakeType),
|
|
3210
|
-
staked,
|
|
3211
|
-
index,
|
|
3212
|
-
points,
|
|
3213
|
-
totalPoints
|
|
3214
|
-
});
|
|
3215
|
-
} else if ((0, import_utils5.normalizeStructTag)(type) === stakeMarketCoinTypes.shasui) {
|
|
3216
|
-
stakeAccounts.shasui.push({
|
|
3217
|
-
id,
|
|
3218
|
-
type: (0, import_utils5.normalizeStructTag)(type),
|
|
3219
|
-
stakePoolId,
|
|
3220
|
-
stakeType: (0, import_utils5.normalizeStructTag)(stakeType),
|
|
3221
|
-
staked,
|
|
3222
|
-
index,
|
|
3223
|
-
points,
|
|
3224
|
-
totalPoints
|
|
3225
|
-
});
|
|
3226
|
-
} else if ((0, import_utils5.normalizeStructTag)(type) === stakeMarketCoinTypes.svsui) {
|
|
3227
|
-
stakeAccounts.svsui.push({
|
|
3228
|
-
id,
|
|
3229
|
-
type: (0, import_utils5.normalizeStructTag)(type),
|
|
3230
|
-
stakePoolId,
|
|
3231
|
-
stakeType: (0, import_utils5.normalizeStructTag)(stakeType),
|
|
3232
|
-
staked,
|
|
3233
|
-
index,
|
|
3234
|
-
points,
|
|
3235
|
-
totalPoints
|
|
3236
|
-
});
|
|
3237
|
-
} else if ((0, import_utils5.normalizeStructTag)(type) === stakeMarketCoinTypes.susdc) {
|
|
3238
|
-
stakeAccounts.susdc.push({
|
|
3193
|
+
const stakeMarketCoinTypeMap = {
|
|
3194
|
+
sweth: stakeAccounts.sweth,
|
|
3195
|
+
ssui: stakeAccounts.ssui,
|
|
3196
|
+
swusdc: stakeAccounts.swusdc,
|
|
3197
|
+
swusdt: stakeAccounts.swusdt,
|
|
3198
|
+
scetus: stakeAccounts.scetus,
|
|
3199
|
+
safsui: stakeAccounts.safsui,
|
|
3200
|
+
shasui: stakeAccounts.shasui,
|
|
3201
|
+
svsui: stakeAccounts.svsui,
|
|
3202
|
+
susdc: stakeAccounts.susdc
|
|
3203
|
+
};
|
|
3204
|
+
const normalizedType = (0, import_utils5.normalizeStructTag)(type);
|
|
3205
|
+
const stakeAccountArray = stakeMarketCoinTypeMap[reversedStakeMarketCoinTypes[normalizedType]];
|
|
3206
|
+
if (stakeAccountArray) {
|
|
3207
|
+
stakeAccountArray.push({
|
|
3239
3208
|
id,
|
|
3240
|
-
type:
|
|
3209
|
+
type: normalizedType,
|
|
3241
3210
|
stakePoolId,
|
|
3242
3211
|
stakeType: (0, import_utils5.normalizeStructTag)(stakeType),
|
|
3243
3212
|
staked,
|
|
@@ -4155,7 +4124,7 @@ var getVescaKeys = async (utils, ownerAddress) => {
|
|
|
4155
4124
|
};
|
|
4156
4125
|
var getVeScas = async ({
|
|
4157
4126
|
utils
|
|
4158
|
-
}, ownerAddress) => {
|
|
4127
|
+
}, ownerAddress, excludeEmpty) => {
|
|
4159
4128
|
const keyObjectDatas = await getVescaKeys(utils, ownerAddress);
|
|
4160
4129
|
const veScas = Array(keyObjectDatas.length).fill(null);
|
|
4161
4130
|
const tasks = keyObjectDatas.map(async (veScaKey, idx) => {
|
|
@@ -4165,7 +4134,11 @@ var getVeScas = async ({
|
|
|
4165
4134
|
}
|
|
4166
4135
|
});
|
|
4167
4136
|
await Promise.allSettled(tasks);
|
|
4168
|
-
|
|
4137
|
+
const result = veScas.filter(Boolean).sort((a, b) => b.currentVeScaBalance - a.currentVeScaBalance);
|
|
4138
|
+
if (excludeEmpty) {
|
|
4139
|
+
return result.filter((v) => v.lockedScaAmount !== "0");
|
|
4140
|
+
}
|
|
4141
|
+
return result;
|
|
4169
4142
|
};
|
|
4170
4143
|
var SuiObjectRefZod = import_zod2.z.object({
|
|
4171
4144
|
objectId: import_zod2.z.string(),
|
|
@@ -4408,6 +4381,13 @@ var ScallopUtils = class {
|
|
|
4408
4381
|
}
|
|
4409
4382
|
this.isTestnet = params.networkType ? params.networkType === "testnet" : false;
|
|
4410
4383
|
}
|
|
4384
|
+
// -------------- TYPE GUARDS --------------
|
|
4385
|
+
isSuiBridgeAsset(coinName) {
|
|
4386
|
+
return isSuiBridgeAsset(coinName);
|
|
4387
|
+
}
|
|
4388
|
+
isWormholeAsset(coinName) {
|
|
4389
|
+
return isWormholeAsset(coinName);
|
|
4390
|
+
}
|
|
4411
4391
|
/**
|
|
4412
4392
|
* Request the scallop API to initialize data.
|
|
4413
4393
|
*
|
|
@@ -4428,12 +4408,7 @@ var ScallopUtils = class {
|
|
|
4428
4408
|
* @return Symbol string.
|
|
4429
4409
|
*/
|
|
4430
4410
|
parseSymbol(coinName) {
|
|
4431
|
-
|
|
4432
|
-
const assetCoinName = coinName.slice(1).toLowerCase();
|
|
4433
|
-
return coinName.slice(0, 1).toLowerCase() + parseAssetSymbol(assetCoinName);
|
|
4434
|
-
} else {
|
|
4435
|
-
return parseAssetSymbol(coinName);
|
|
4436
|
-
}
|
|
4411
|
+
return parseAssetSymbol(coinName);
|
|
4437
4412
|
}
|
|
4438
4413
|
/**
|
|
4439
4414
|
* Convert coin name to coin type.
|
|
@@ -4465,10 +4440,21 @@ var ScallopUtils = class {
|
|
|
4465
4440
|
const voloPackageIds = [
|
|
4466
4441
|
this.address.get("core.coins.vsui.id") ?? voloCoinIds.vsui
|
|
4467
4442
|
];
|
|
4443
|
+
const suiBridgePackageIds = Object.values(
|
|
4444
|
+
suiBridgeCoins
|
|
4445
|
+
).reduce((curr, coinName2) => {
|
|
4446
|
+
curr.push(
|
|
4447
|
+
this.address.get(`core.coins.${coinName2}.id`) ?? coinIds[coinName2]
|
|
4448
|
+
);
|
|
4449
|
+
return curr;
|
|
4450
|
+
}, []);
|
|
4468
4451
|
if (wormHolePackageIds.includes(coinPackageId)) {
|
|
4469
4452
|
return `${coinPackageId}::coin::COIN`;
|
|
4470
4453
|
} else if (voloPackageIds.includes(coinPackageId)) {
|
|
4471
4454
|
return `${coinPackageId}::cert::CERT`;
|
|
4455
|
+
} else if (suiBridgePackageIds.includes(coinPackageId)) {
|
|
4456
|
+
const typeCoinName = coinName.slice(2);
|
|
4457
|
+
return `${coinPackageId}::${typeCoinName}::${typeCoinName.toUpperCase()}`;
|
|
4472
4458
|
} else {
|
|
4473
4459
|
return `${coinPackageId}::${coinName}::${coinName.toUpperCase()}`;
|
|
4474
4460
|
}
|
|
@@ -4544,11 +4530,20 @@ var ScallopUtils = class {
|
|
|
4544
4530
|
const voloCoinTypeMap = {
|
|
4545
4531
|
[`${this.address.get("core.coins.vsui.id") ?? voloCoinIds.vsui}::cert::CERT`]: "vsui"
|
|
4546
4532
|
};
|
|
4547
|
-
const
|
|
4533
|
+
const suiBridgeTypeMap = Object.values(
|
|
4534
|
+
suiBridgeCoins
|
|
4535
|
+
).reduce(
|
|
4536
|
+
(curr, coinName) => {
|
|
4537
|
+
curr[this.parseCoinType(coinName)] = coinName;
|
|
4538
|
+
return curr;
|
|
4539
|
+
},
|
|
4540
|
+
{}
|
|
4541
|
+
);
|
|
4542
|
+
const assetCoinName = wormHoleCoinTypeMap[coinType] || voloCoinTypeMap[coinType] || suiBridgeTypeMap[coinType] || coinType.split("::")[2].toLowerCase();
|
|
4548
4543
|
return isMarketCoinType ? this.parseMarketCoinName(assetCoinName) : assetCoinName;
|
|
4549
4544
|
}
|
|
4550
4545
|
/**
|
|
4551
|
-
* Convert
|
|
4546
|
+
* Convert market coin name to coin name.
|
|
4552
4547
|
*
|
|
4553
4548
|
* @param marketCoinName - Specific support market coin name.
|
|
4554
4549
|
* @return Coin Name.
|
|
@@ -4579,10 +4574,18 @@ var ScallopUtils = class {
|
|
|
4579
4574
|
* return Coin wrapped type.
|
|
4580
4575
|
*/
|
|
4581
4576
|
getCoinWrappedType(assetCoinName) {
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4577
|
+
if (this.isSuiBridgeAsset(assetCoinName)) {
|
|
4578
|
+
return {
|
|
4579
|
+
from: "Sui Bridge",
|
|
4580
|
+
type: "Asset from Sui Bridge"
|
|
4581
|
+
};
|
|
4582
|
+
} else if (this.isWormholeAsset(assetCoinName)) {
|
|
4583
|
+
return {
|
|
4584
|
+
from: "Wormhole",
|
|
4585
|
+
type: "Portal from Ethereum"
|
|
4586
|
+
};
|
|
4587
|
+
}
|
|
4588
|
+
return void 0;
|
|
4586
4589
|
}
|
|
4587
4590
|
/**
|
|
4588
4591
|
* Select coin id that add up to the given amount as transaction arguments.
|
|
@@ -7045,8 +7048,11 @@ var ScallopQuery = class {
|
|
|
7045
7048
|
* @param walletAddress
|
|
7046
7049
|
* @returns array of veSca
|
|
7047
7050
|
*/
|
|
7048
|
-
async getVeScas(
|
|
7049
|
-
|
|
7051
|
+
async getVeScas({
|
|
7052
|
+
walletAddress = this.walletAddress,
|
|
7053
|
+
excludeEmpty = false
|
|
7054
|
+
} = {}) {
|
|
7055
|
+
return await getVeScas(this, walletAddress, excludeEmpty);
|
|
7050
7056
|
}
|
|
7051
7057
|
/**
|
|
7052
7058
|
* Get total vesca treasury with movecall
|
|
@@ -7894,7 +7900,9 @@ var ScallopClient = class {
|
|
|
7894
7900
|
}
|
|
7895
7901
|
}
|
|
7896
7902
|
async claimAllUnlockedSca(sign = true) {
|
|
7897
|
-
const veScaKeys = (await this.query.getVeScas(
|
|
7903
|
+
const veScaKeys = (await this.query.getVeScas({
|
|
7904
|
+
walletAddress: this.walletAddress
|
|
7905
|
+
}) ?? []).map(({ keyObject }) => keyObject);
|
|
7898
7906
|
if (veScaKeys.length === 0) {
|
|
7899
7907
|
throw new Error("No veSCA found in the wallet");
|
|
7900
7908
|
}
|
|
@@ -8093,6 +8101,8 @@ var Scallop = class {
|
|
|
8093
8101
|
SUPPORT_SCOIN,
|
|
8094
8102
|
SUPPORT_SPOOLS,
|
|
8095
8103
|
SUPPORT_SPOOLS_REWARDS,
|
|
8104
|
+
SUPPORT_SUI_BRIDGE,
|
|
8105
|
+
SUPPORT_WORMHOLE,
|
|
8096
8106
|
Scallop,
|
|
8097
8107
|
ScallopAddress,
|
|
8098
8108
|
ScallopBuilder,
|
|
@@ -8112,6 +8122,7 @@ var Scallop = class {
|
|
|
8112
8122
|
sCoins,
|
|
8113
8123
|
spoolRewardCoins,
|
|
8114
8124
|
stakeMarketCoins,
|
|
8125
|
+
suiBridgeCoins,
|
|
8115
8126
|
voloCoinIds,
|
|
8116
8127
|
wormholeCoinIds
|
|
8117
8128
|
});
|