@scallop-io/sui-scallop-sdk 1.4.7 → 1.4.9
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 -6
- package/dist/constants/enum.d.ts +2 -2
- package/dist/constants/poolAddress.d.ts +1 -1
- package/dist/index.js +135 -70
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +135 -70
- package/dist/index.mjs.map +1 -1
- package/dist/models/scallopQuery.d.ts +55 -41
- package/dist/models/scallopUtils.d.ts +2 -2
- package/dist/queries/borrowIncentiveQuery.d.ts +2 -0
- package/dist/queries/coreQuery.d.ts +1 -0
- package/dist/queries/poolAddressesQuery.d.ts +2 -2
- package/dist/queries/portfolioQuery.d.ts +46 -39
- package/dist/queries/priceQuery.d.ts +2 -0
- package/dist/queries/sCoinQuery.d.ts +1 -1
- package/package.json +1 -1
- package/src/constants/coinGecko.ts +1 -0
- package/src/constants/common.ts +4 -1
- package/src/constants/enum.ts +38 -20
- package/src/constants/poolAddress.ts +47 -18
- package/src/constants/pyth.ts +1 -0
- package/src/constants/testAddress.ts +3 -0
- package/src/models/scallop.ts +1 -0
- package/src/models/scallopCache.ts +1 -1
- package/src/models/scallopQuery.ts +8 -1
- package/src/queries/poolAddressesQuery.ts +7 -6
- package/src/queries/portfolioQuery.ts +54 -29
package/dist/index.mjs
CHANGED
|
@@ -12,6 +12,7 @@ var DEFAULT_CACHE_OPTIONS = {
|
|
|
12
12
|
var COIN_GECKGO_IDS = {
|
|
13
13
|
usdc: "usdc",
|
|
14
14
|
sbeth: "ethereum",
|
|
15
|
+
sbusdt: "tether",
|
|
15
16
|
weth: "ethereum",
|
|
16
17
|
wbtc: "bitcoin",
|
|
17
18
|
wusdc: "usdc",
|
|
@@ -44,6 +45,8 @@ var SUPPORT_POOLS = [
|
|
|
44
45
|
// native USDC
|
|
45
46
|
"sbeth",
|
|
46
47
|
// sui bridge ETH
|
|
48
|
+
"sbusdt",
|
|
49
|
+
// sui bridge USDT
|
|
47
50
|
"weth",
|
|
48
51
|
"wbtc",
|
|
49
52
|
"wusdc",
|
|
@@ -65,6 +68,8 @@ var SUPPORT_COLLATERALS = [
|
|
|
65
68
|
// native USDC
|
|
66
69
|
"sbeth",
|
|
67
70
|
// sui bridge ETH
|
|
71
|
+
"sbusdt",
|
|
72
|
+
// sui bridge USDT
|
|
68
73
|
"weth",
|
|
69
74
|
"wbtc",
|
|
70
75
|
"wusdc",
|
|
@@ -93,6 +98,7 @@ var SUPPORT_SPOOLS = [
|
|
|
93
98
|
var SUPPORT_SCOIN = [
|
|
94
99
|
"susdc",
|
|
95
100
|
"ssbeth",
|
|
101
|
+
"ssbusdt",
|
|
96
102
|
"ssui",
|
|
97
103
|
"swusdc",
|
|
98
104
|
"swusdt",
|
|
@@ -108,7 +114,7 @@ var SUPPORT_SCOIN = [
|
|
|
108
114
|
"sfud",
|
|
109
115
|
"sfdusd"
|
|
110
116
|
];
|
|
111
|
-
var SUPPORT_SUI_BRIDGE = ["sbeth"];
|
|
117
|
+
var SUPPORT_SUI_BRIDGE = ["sbeth", "sbusdt"];
|
|
112
118
|
var SUPPORT_WORMHOLE = [
|
|
113
119
|
"wusdc",
|
|
114
120
|
"wusdt",
|
|
@@ -143,6 +149,7 @@ var SUPPORT_PACKAGES = [
|
|
|
143
149
|
var coinDecimals = {
|
|
144
150
|
usdc: 6,
|
|
145
151
|
sbeth: 8,
|
|
152
|
+
sbusdt: 6,
|
|
146
153
|
weth: 8,
|
|
147
154
|
wbtc: 8,
|
|
148
155
|
wusdc: 6,
|
|
@@ -161,6 +168,7 @@ var coinDecimals = {
|
|
|
161
168
|
susdc: 6,
|
|
162
169
|
sweth: 8,
|
|
163
170
|
ssbeth: 8,
|
|
171
|
+
ssbusdt: 6,
|
|
164
172
|
swbtc: 8,
|
|
165
173
|
swusdc: 6,
|
|
166
174
|
swusdt: 6,
|
|
@@ -179,6 +187,7 @@ var coinDecimals = {
|
|
|
179
187
|
var assetCoins = {
|
|
180
188
|
usdc: "usdc",
|
|
181
189
|
sbeth: "sbeth",
|
|
190
|
+
sbusdt: "sbusdt",
|
|
182
191
|
weth: "weth",
|
|
183
192
|
wbtc: "wbtc",
|
|
184
193
|
wusdc: "wusdc",
|
|
@@ -198,6 +207,7 @@ var assetCoins = {
|
|
|
198
207
|
var marketCoins = {
|
|
199
208
|
susdc: "susdc",
|
|
200
209
|
ssbeth: "ssbeth",
|
|
210
|
+
ssbusdt: "ssbusdt",
|
|
201
211
|
sweth: "sweth",
|
|
202
212
|
swbtc: "swbtc",
|
|
203
213
|
swusdc: "swusdc",
|
|
@@ -217,6 +227,7 @@ var marketCoins = {
|
|
|
217
227
|
var sCoins = {
|
|
218
228
|
susdc: "susdc",
|
|
219
229
|
ssbeth: "ssbeth",
|
|
230
|
+
ssbusdt: "ssbusdt",
|
|
220
231
|
sweth: "sweth",
|
|
221
232
|
swusdc: "swusdc",
|
|
222
233
|
swusdt: "swusdt",
|
|
@@ -255,27 +266,33 @@ var spoolRewardCoins = {
|
|
|
255
266
|
susdc: "sui"
|
|
256
267
|
};
|
|
257
268
|
var suiBridgeCoins = {
|
|
258
|
-
sbeth: "sbeth"
|
|
269
|
+
sbeth: "sbeth",
|
|
270
|
+
sbusdt: "sbusdt"
|
|
259
271
|
};
|
|
260
272
|
var coinIds = {
|
|
261
|
-
usdc: "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7",
|
|
262
273
|
sui: "0x0000000000000000000000000000000000000000000000000000000000000002",
|
|
263
|
-
|
|
274
|
+
cetus: "0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b",
|
|
275
|
+
sca: IS_VE_SCA_TEST ? "0x6cd813061a3adf3602b76545f076205f0c8e7ec1d3b1eab9a1da7992c18c0524" : "0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6",
|
|
276
|
+
// Wormhole assets
|
|
264
277
|
weth: "0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5",
|
|
265
278
|
wbtc: "0x027792d9fed7f9844eb4839566001bb6f6cb4804f66aa2da6fe1ee242d896881",
|
|
266
|
-
wusdc: "0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf",
|
|
267
|
-
wusdt: "0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c",
|
|
268
279
|
wapt: "0x3a5143bb1196e3bcdfab6203d1683ae29edd26294fc8bfeafe4aaa9d2704df37",
|
|
269
280
|
wsol: "0xb7844e289a8410e50fb3ca48d69eb9cf29e27d223ef90353fe1bd8e27ff8f3f8",
|
|
270
|
-
|
|
281
|
+
// Sui LST
|
|
271
282
|
afsui: "0xf325ce1300e8dac124071d3152c5c5ee6174914f8bc2161e88329cf579246efc",
|
|
272
283
|
hasui: "0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d",
|
|
273
284
|
vsui: "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55",
|
|
274
|
-
|
|
285
|
+
// stable coins
|
|
286
|
+
usdc: "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7",
|
|
287
|
+
wusdc: "0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf",
|
|
288
|
+
wusdt: "0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c",
|
|
275
289
|
fdusd: "0xf16e6b723f242ec745dfd7634ad072c42d5c1d9ac9d62a39c381303eaa57693a",
|
|
276
290
|
// isolated assets
|
|
277
291
|
deep: "0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270",
|
|
278
|
-
fud: "0x76cb819b01abed502bee8a702b4c2d547532c12f25001c9dea795a5e631c26f1"
|
|
292
|
+
fud: "0x76cb819b01abed502bee8a702b4c2d547532c12f25001c9dea795a5e631c26f1",
|
|
293
|
+
// Sui bridge assets
|
|
294
|
+
sbeth: "0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29",
|
|
295
|
+
sbusdt: "0x375f70cf2ae4c00bf37117d0c85a2c71545e6ee05c4a5c7d282cd66a4504b068"
|
|
279
296
|
};
|
|
280
297
|
var wormholeCoinIds = {
|
|
281
298
|
weth: "0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5",
|
|
@@ -289,22 +306,28 @@ var voloCoinIds = {
|
|
|
289
306
|
vsui: "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55"
|
|
290
307
|
};
|
|
291
308
|
var sCoinIds = {
|
|
292
|
-
susdc: "0x854950aa624b1df59fe64e630b2ba7c550642e9342267a33061d59fb31582da5::scallop_usdc::SCALLOP_USDC",
|
|
293
|
-
ssbeth: "0xb14f82d8506d139eacef109688d1b71e7236bcce9b2c0ad526abcd6aa5be7de0::scallop_sb_eth::SCALLOP_SB_ETH",
|
|
294
309
|
ssui: "0xaafc4f740de0dd0dde642a31148fb94517087052f19afb0f7bed1dc41a50c77b::scallop_sui::SCALLOP_SUI",
|
|
295
|
-
swusdc: "0xad4d71551d31092230db1fd482008ea42867dbf27b286e9c70a79d2a6191d58d::scallop_wormhole_usdc::SCALLOP_WORMHOLE_USDC",
|
|
296
|
-
swusdt: "0xe6e5a012ec20a49a3d1d57bd2b67140b96cd4d3400b9d79e541f7bdbab661f95::scallop_wormhole_usdt::SCALLOP_WORMHOLE_USDT",
|
|
297
310
|
ssca: "0x5ca17430c1d046fae9edeaa8fd76c7b4193a00d764a0ecfa9418d733ad27bc1e::scallop_sca::SCALLOP_SCA",
|
|
298
311
|
scetus: "0xea346ce428f91ab007210443efcea5f5cdbbb3aae7e9affc0ca93f9203c31f0c::scallop_cetus::SCALLOP_CETUS",
|
|
312
|
+
// Wormhole assets
|
|
299
313
|
sweth: "0x67540ceb850d418679e69f1fb6b2093d6df78a2a699ffc733f7646096d552e9b::scallop_wormhole_eth::SCALLOP_WORMHOLE_ETH",
|
|
314
|
+
swsol: "0x1392650f2eca9e3f6ffae3ff89e42a3590d7102b80e2b430f674730bc30d3259::scallop_wormhole_sol::SCALLOP_WORMHOLE_SOL",
|
|
315
|
+
swbtc: "0x2cf76a9cf5d3337961d1154283234f94da2dcff18544dfe5cbdef65f319591b5::scallop_wormhole_btc::SCALLOP_WORMHOLE_BTC",
|
|
316
|
+
// Sui LST
|
|
300
317
|
safsui: "0x00671b1fa2a124f5be8bdae8b91ee711462c5d9e31bda232e70fd9607b523c88::scallop_af_sui::SCALLOP_AF_SUI",
|
|
301
318
|
shasui: "0x9a2376943f7d22f88087c259c5889925f332ca4347e669dc37d54c2bf651af3c::scallop_ha_sui::SCALLOP_HA_SUI",
|
|
302
319
|
svsui: "0xe1a1cc6bcf0001a015eab84bcc6713393ce20535f55b8b6f35c142e057a25fbe::scallop_v_sui::SCALLOP_V_SUI",
|
|
303
|
-
|
|
304
|
-
|
|
320
|
+
// stable coins
|
|
321
|
+
susdc: "0x854950aa624b1df59fe64e630b2ba7c550642e9342267a33061d59fb31582da5::scallop_usdc::SCALLOP_USDC",
|
|
322
|
+
swusdc: "0xad4d71551d31092230db1fd482008ea42867dbf27b286e9c70a79d2a6191d58d::scallop_wormhole_usdc::SCALLOP_WORMHOLE_USDC",
|
|
323
|
+
swusdt: "0xe6e5a012ec20a49a3d1d57bd2b67140b96cd4d3400b9d79e541f7bdbab661f95::scallop_wormhole_usdt::SCALLOP_WORMHOLE_USDT",
|
|
305
324
|
sfdusd: "0x6711551c1e7652a270d9fbf0eee25d99594c157cde3cb5fbb49035eb59b1b001::scallop_fdusd::SCALLOP_FDUSD",
|
|
325
|
+
// isolated assets
|
|
306
326
|
sdeep: "0xeb7a05a3224837c5e5503575aed0be73c091d1ce5e43aa3c3e716e0ae614608f::scallop_deep::SCALLOP_DEEP",
|
|
307
|
-
sfud: "0xe56d5167f427cbe597da9e8150ef5c337839aaf46891d62468dcf80bdd8e10d1::scallop_fud::SCALLOP_FUD"
|
|
327
|
+
sfud: "0xe56d5167f427cbe597da9e8150ef5c337839aaf46891d62468dcf80bdd8e10d1::scallop_fud::SCALLOP_FUD",
|
|
328
|
+
// Sui bridge assets
|
|
329
|
+
ssbeth: "0xb14f82d8506d139eacef109688d1b71e7236bcce9b2c0ad526abcd6aa5be7de0::scallop_sb_eth::SCALLOP_SB_ETH",
|
|
330
|
+
ssbusdt: "0xb1d7df34829d1513b73ba17cb7ad90c88d1e104bb65ab8f62f13e0cc103783d3::scallop_sb_usdt::SCALLOP_SB_USDT"
|
|
308
331
|
};
|
|
309
332
|
var sCoinTypeToName = Object.entries(sCoinIds).reduce(
|
|
310
333
|
(acc, [coinName, coinType]) => {
|
|
@@ -353,9 +376,26 @@ var POOL_ADDRESSES = {
|
|
|
353
376
|
spoolReward: "0x85ed6ed72ea97c35dbf0cdc7ed6fbc48d8ec15de9b17c74bf4512df8a6d7f166",
|
|
354
377
|
sCoinTreasury: "0xbe6b63021f3d82e0e7e977cdd718ed7c019cf2eba374b7b546220402452f938e",
|
|
355
378
|
sCoinType: "0x854950aa624b1df59fe64e630b2ba7c550642e9342267a33061d59fb31582da5::scallop_usdc::SCALLOP_USDC",
|
|
356
|
-
|
|
379
|
+
coinMetadataId: "0x69b7a7c3c200439c1b5f3b19d7d495d5966d5f08de66c69276152f8db3992ec6",
|
|
357
380
|
coinType: "dba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC"
|
|
358
381
|
},
|
|
382
|
+
sbusdt: {
|
|
383
|
+
lendingPoolAddress: "0x958ca02058a7dd8b00e26ed6988f45d7c2834ae2a47ee4c4a8fdedea155f18ca",
|
|
384
|
+
collateralPoolAddress: "0x63c861f97192ceab2dabb1e74649ae87a9e36c33aaedcc43e40a811d3a39e653",
|
|
385
|
+
borrowDynamic: "0xf1ef9a19881ed6ddeb88f361c83f37c592ec5b9c64fe715383f63ccc094be205",
|
|
386
|
+
interestModel: "0x62c46e4667c4fa69a29030ecbc0f661c61365d02adc3810b08b11cfd8f42ca1c",
|
|
387
|
+
riskModel: "0x59d5f3dbcd14a0aab6ee6e2879803e10b0a752119d19c4ac0bd389d71dc8c2bf",
|
|
388
|
+
borrowFeeKey: "0xa418990ad042e97cca61830476483933b9e026970fc33451072b2627ccb31da2",
|
|
389
|
+
supplyLimitKey: "0x93641bfb62ea40760f0c15911b4ec0eb866f8725e36b0ca9a786775d93629139",
|
|
390
|
+
borrowLimitKey: "0x953a9b8d5353abb38db21a2cbbc5c54f8f23348895acb26cbe2c0ab61b54635d",
|
|
391
|
+
isolatedAssetKey: void 0,
|
|
392
|
+
spool: void 0,
|
|
393
|
+
spoolReward: void 0,
|
|
394
|
+
sCoinTreasury: "0x58bdf6a9752e3a60144d0b70e8608d630dfd971513e2b2bfa7282f5eaa7d04d8",
|
|
395
|
+
sCoinType: "0xb1d7df34829d1513b73ba17cb7ad90c88d1e104bb65ab8f62f13e0cc103783d3::scallop_sb_usdt::SCALLOP_SB_USDT",
|
|
396
|
+
coinMetadataId: "0xda61b33ac61ed4c084bbda65a2229459ed4eb2185729e70498538f0688bec3cc",
|
|
397
|
+
coinType: "0x375f70cf2ae4c00bf37117d0c85a2c71545e6ee05c4a5c7d282cd66a4504b068::usdt::USDT"
|
|
398
|
+
},
|
|
359
399
|
sbeth: {
|
|
360
400
|
lendingPoolAddress: "0xaa34c938e0394e5186c7dc626ad69be96af2194b23fdc6ac1c63090e399f5ba4",
|
|
361
401
|
collateralPoolAddress: "0xce0549a1cbe952e734f56646988e6b02bbae14667889a60e24d0d03540a6119f",
|
|
@@ -370,7 +410,7 @@ var POOL_ADDRESSES = {
|
|
|
370
410
|
spoolReward: void 0,
|
|
371
411
|
sCoinTreasury: "0xfd0f02def6358a1f266acfa1493d4707ee8387460d434fb667d63d755ff907ed",
|
|
372
412
|
sCoinType: "0xb14f82d8506d139eacef109688d1b71e7236bcce9b2c0ad526abcd6aa5be7de0::scallop_sb_eth::SCALLOP_SB_ETH",
|
|
373
|
-
|
|
413
|
+
coinMetadataId: "0x89b04ba87f8832d4d76e17a1c9dce72eb3e64d372cf02012b8d2de5384faeef0",
|
|
374
414
|
coinType: "d0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29::eth::ETH"
|
|
375
415
|
},
|
|
376
416
|
weth: {
|
|
@@ -387,7 +427,7 @@ var POOL_ADDRESSES = {
|
|
|
387
427
|
spoolReward: "0x957de68a18d87817de8309b30c1ec269a4d87ae513abbeed86b5619cb9ce1077",
|
|
388
428
|
sCoinTreasury: "0x4b7f5da0e306c9d52490a0c1d4091e653d6b89778b9b4f23c877e534e4d9cd21",
|
|
389
429
|
sCoinType: "0x67540ceb850d418679e69f1fb6b2093d6df78a2a699ffc733f7646096d552e9b::scallop_wormhole_eth::SCALLOP_WORMHOLE_ETH",
|
|
390
|
-
|
|
430
|
+
coinMetadataId: "0x8900e4ceede3363bef086d6b50ca89d816d0e90bf6bc46efefe1f8455e08f50f",
|
|
391
431
|
coinType: "af8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5::coin::COIN"
|
|
392
432
|
},
|
|
393
433
|
wbtc: {
|
|
@@ -404,7 +444,7 @@ var POOL_ADDRESSES = {
|
|
|
404
444
|
spoolReward: void 0,
|
|
405
445
|
sCoinTreasury: "0xe2883934ea42c99bc998bbe0f01dd6d27aa0e27a56455707b1b34e6a41c20baa",
|
|
406
446
|
sCoinType: "0x2cf76a9cf5d3337961d1154283234f94da2dcff18544dfe5cbdef65f319591b5::scallop_wormhole_btc::SCALLOP_WORMHOLE_BTC",
|
|
407
|
-
|
|
447
|
+
coinMetadataId: "0x5d3c6e60eeff8a05b693b481539e7847dfe33013e7070cdcb387f5c0cac05dfd",
|
|
408
448
|
coinType: "027792d9fed7f9844eb4839566001bb6f6cb4804f66aa2da6fe1ee242d896881::coin::COIN"
|
|
409
449
|
},
|
|
410
450
|
wusdc: {
|
|
@@ -421,7 +461,7 @@ var POOL_ADDRESSES = {
|
|
|
421
461
|
spoolReward: "0xf4268cc9b9413b9bfe09e8966b8de650494c9e5784bf0930759cfef4904daff8",
|
|
422
462
|
sCoinTreasury: "0x50c5cfcbcca3aaacab0984e4d7ad9a6ad034265bebb440f0d1cd688ec20b2548",
|
|
423
463
|
sCoinType: "0xad4d71551d31092230db1fd482008ea42867dbf27b286e9c70a79d2a6191d58d::scallop_wormhole_usdc::SCALLOP_WORMHOLE_USDC",
|
|
424
|
-
|
|
464
|
+
coinMetadataId: "0x4fbf84f3029bd0c0b77164b587963be957f853eccf834a67bb9ecba6ec80f189",
|
|
425
465
|
coinType: "5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN"
|
|
426
466
|
},
|
|
427
467
|
wusdt: {
|
|
@@ -438,7 +478,7 @@ var POOL_ADDRESSES = {
|
|
|
438
478
|
spoolReward: "0x2c9f934d67a5baa586ceec2cc24163a2f049a6af3d5ba36b84d8ac40f25c4080",
|
|
439
479
|
sCoinTreasury: "0x1f02e2fed702b477732d4ad6044aaed04f2e8e586a169153694861a901379df0",
|
|
440
480
|
sCoinType: "0xe6e5a012ec20a49a3d1d57bd2b67140b96cd4d3400b9d79e541f7bdbab661f95::scallop_wormhole_usdt::SCALLOP_WORMHOLE_USDT",
|
|
441
|
-
|
|
481
|
+
coinMetadataId: "0xfb0e3eb97dd158a5ae979dddfa24348063843c5b20eb8381dd5fa7c93699e45c",
|
|
442
482
|
coinType: "c060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c::coin::COIN"
|
|
443
483
|
},
|
|
444
484
|
sui: {
|
|
@@ -455,7 +495,7 @@ var POOL_ADDRESSES = {
|
|
|
455
495
|
spoolReward: "0x162250ef72393a4ad3d46294c4e1bdfcb03f04c869d390e7efbfc995353a7ee9",
|
|
456
496
|
sCoinTreasury: "0x5c1678c8261ac9eec024d4d630006a9f55c80dc0b1aa38a003fcb1d425818c6b",
|
|
457
497
|
sCoinType: "0xaafc4f740de0dd0dde642a31148fb94517087052f19afb0f7bed1dc41a50c77b::scallop_sui::SCALLOP_SUI",
|
|
458
|
-
|
|
498
|
+
coinMetadataId: "0x9258181f5ceac8dbffb7030890243caed69a9599d2886d957a9cb7656af3bdb3",
|
|
459
499
|
coinType: "0000000000000000000000000000000000000000000000000000000000000002::sui::SUI"
|
|
460
500
|
},
|
|
461
501
|
wapt: {
|
|
@@ -472,7 +512,7 @@ var POOL_ADDRESSES = {
|
|
|
472
512
|
spoolReward: void 0,
|
|
473
513
|
sCoinTreasury: void 0,
|
|
474
514
|
sCoinType: void 0,
|
|
475
|
-
|
|
515
|
+
coinMetadataId: "0xc969c5251f372c0f34c32759f1d315cf1ea0ee5e4454b52aea08778eacfdd0a8",
|
|
476
516
|
coinType: "3a5143bb1196e3bcdfab6203d1683ae29edd26294fc8bfeafe4aaa9d2704df37::coin::COIN"
|
|
477
517
|
},
|
|
478
518
|
cetus: {
|
|
@@ -489,7 +529,7 @@ var POOL_ADDRESSES = {
|
|
|
489
529
|
spoolReward: "0x6835c1224126a45086fc6406adc249e3f30df18d779ca4f4e570e38716a17f3f",
|
|
490
530
|
sCoinTreasury: "0xa283c63488773c916cb3d6c64109536160d5eb496caddc721eb39aad2977d735",
|
|
491
531
|
sCoinType: "0xea346ce428f91ab007210443efcea5f5cdbbb3aae7e9affc0ca93f9203c31f0c::scallop_cetus::SCALLOP_CETUS",
|
|
492
|
-
|
|
532
|
+
coinMetadataId: "0x4c0dce55eff2db5419bbd2d239d1aa22b4a400c01bbb648b058a9883989025da",
|
|
493
533
|
coinType: "06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b::cetus::CETUS"
|
|
494
534
|
},
|
|
495
535
|
wsol: {
|
|
@@ -506,7 +546,7 @@ var POOL_ADDRESSES = {
|
|
|
506
546
|
spoolReward: void 0,
|
|
507
547
|
sCoinTreasury: "0x760fd66f5be869af4382fa32b812b3c67f0eca1bb1ed7a5578b21d56e1848819",
|
|
508
548
|
sCoinType: "0x1392650f2eca9e3f6ffae3ff89e42a3590d7102b80e2b430f674730bc30d3259::scallop_wormhole_sol::SCALLOP_WORMHOLE_SOL",
|
|
509
|
-
|
|
549
|
+
coinMetadataId: "0x4d2c39082b4477e3e79dc4562d939147ab90c42fc5f3e4acf03b94383cd69b6e",
|
|
510
550
|
coinType: "b7844e289a8410e50fb3ca48d69eb9cf29e27d223ef90353fe1bd8e27ff8f3f8::coin::COIN"
|
|
511
551
|
},
|
|
512
552
|
afsui: {
|
|
@@ -523,7 +563,7 @@ var POOL_ADDRESSES = {
|
|
|
523
563
|
spoolReward: "0x89255a2f86ed7fbfef35ab8b7be48cc7667015975be2685dd9a55a9a64baf76e",
|
|
524
564
|
sCoinTreasury: "0x55f4dfe9e40bc4cc11c70fcb1f3daefa2bdc330567c58d4f0792fbd9f9175a62",
|
|
525
565
|
sCoinType: "0x00671b1fa2a124f5be8bdae8b91ee711462c5d9e31bda232e70fd9607b523c88::scallop_af_sui::SCALLOP_AF_SUI",
|
|
526
|
-
|
|
566
|
+
coinMetadataId: "0x2f9217f533e51334873a39b8026a4aa6919497b47f49d0986a4f1aec66f8a34d",
|
|
527
567
|
coinType: "f325ce1300e8dac124071d3152c5c5ee6174914f8bc2161e88329cf579246efc::afsui::AFSUI"
|
|
528
568
|
},
|
|
529
569
|
hasui: {
|
|
@@ -540,7 +580,7 @@ var POOL_ADDRESSES = {
|
|
|
540
580
|
spoolReward: "0x6f3563644d3e2ef13176dbf9d865bd93479df60ccbe07b7e66db57f6309f5a66",
|
|
541
581
|
sCoinTreasury: "0x404ccc1404d74a90eb6f9c9d4b6cda6d417fb03189f80d9070a35e5dab1df0f5",
|
|
542
582
|
sCoinType: "0x9a2376943f7d22f88087c259c5889925f332ca4347e669dc37d54c2bf651af3c::scallop_ha_sui::SCALLOP_HA_SUI",
|
|
543
|
-
|
|
583
|
+
coinMetadataId: "0x2c5f33af93f6511df699aaaa5822d823aac6ed99d4a0de2a4a50b3afa0172e24",
|
|
544
584
|
coinType: "bde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d::hasui::HASUI"
|
|
545
585
|
},
|
|
546
586
|
vsui: {
|
|
@@ -557,7 +597,7 @@ var POOL_ADDRESSES = {
|
|
|
557
597
|
spoolReward: "0xbca914adce058ad0902c7f3cfcd698392a475f00dcfdc3f76001d0370b98777a",
|
|
558
598
|
sCoinTreasury: "0xc06688ee1af25abc286ffb1d18ce273d1d5907cd1064c25f4e8ca61ea989c1d1",
|
|
559
599
|
sCoinType: "0xe1a1cc6bcf0001a015eab84bcc6713393ce20535f55b8b6f35c142e057a25fbe::scallop_v_sui::SCALLOP_V_SUI",
|
|
560
|
-
|
|
600
|
+
coinMetadataId: "0xabd84a23467b33854ab25cf862006fd97479f8f6f53e50fe732c43a274d939bd",
|
|
561
601
|
coinType: "549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT"
|
|
562
602
|
},
|
|
563
603
|
sca: {
|
|
@@ -574,7 +614,7 @@ var POOL_ADDRESSES = {
|
|
|
574
614
|
spoolReward: void 0,
|
|
575
615
|
sCoinTreasury: "0xe04bfc95e00252bd654ee13c08edef9ac5e4b6ae4074e8390db39e9a0109c529",
|
|
576
616
|
sCoinType: "0x5ca17430c1d046fae9edeaa8fd76c7b4193a00d764a0ecfa9418d733ad27bc1e::scallop_sca::SCALLOP_SCA",
|
|
577
|
-
|
|
617
|
+
coinMetadataId: "0x5d26a1e9a55c88147ac870bfa31b729d7f49f8804b8b3adfdf3582d301cca844",
|
|
578
618
|
coinType: "7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6::sca::SCA"
|
|
579
619
|
},
|
|
580
620
|
fud: {
|
|
@@ -591,7 +631,7 @@ var POOL_ADDRESSES = {
|
|
|
591
631
|
spoolReward: void 0,
|
|
592
632
|
sCoinTreasury: "0xf25212f11d182decff7a86165699a73e3d5787aced203ca539f43cfbc10db867",
|
|
593
633
|
sCoinType: "0xe56d5167f427cbe597da9e8150ef5c337839aaf46891d62468dcf80bdd8e10d1::scallop_fud::SCALLOP_FUD",
|
|
594
|
-
|
|
634
|
+
coinMetadataId: "0x01087411ef48aaac1eb6e24803213e3a60a03b147dac930e5e341f17a85e524e",
|
|
595
635
|
coinType: "76cb819b01abed502bee8a702b4c2d547532c12f25001c9dea795a5e631c26f1::fud::FUD"
|
|
596
636
|
},
|
|
597
637
|
deep: {
|
|
@@ -608,7 +648,7 @@ var POOL_ADDRESSES = {
|
|
|
608
648
|
spoolReward: void 0,
|
|
609
649
|
sCoinTreasury: "0xc63838fabe37b25ad897392d89876d920f5e0c6a406bf3abcb84753d2829bc88",
|
|
610
650
|
sCoinType: "0xeb7a05a3224837c5e5503575aed0be73c091d1ce5e43aa3c3e716e0ae614608f::scallop_deep::SCALLOP_DEEP",
|
|
611
|
-
|
|
651
|
+
coinMetadataId: "0x6e60b051a08fa836f5a7acd7c464c8d9825bc29c44657fe170fe9b8e1e4770c0",
|
|
612
652
|
coinType: "deeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP"
|
|
613
653
|
},
|
|
614
654
|
fdusd: {
|
|
@@ -625,7 +665,7 @@ var POOL_ADDRESSES = {
|
|
|
625
665
|
spoolReward: void 0,
|
|
626
666
|
sCoinTreasury: "0xdad9bc6293e694f67a5274ea51b596e0bdabfafc585ae6d7e82888e65f1a03e0",
|
|
627
667
|
sCoinType: "0x6711551c1e7652a270d9fbf0eee25d99594c157cde3cb5fbb49035eb59b1b001::scallop_fdusd::SCALLOP_FDUSD",
|
|
628
|
-
|
|
668
|
+
coinMetadataId: "0xdebee5265a67c186ed87fe93303d33dfe1de53e3b4fd7d9329c2852860acd3e7",
|
|
629
669
|
coinType: "f16e6b723f242ec745dfd7634ad072c42d5c1d9ac9d62a39c381303eaa57693a::fdusd::FDUSD"
|
|
630
670
|
}
|
|
631
671
|
};
|
|
@@ -638,6 +678,7 @@ var PYTH_ENDPOINTS = {
|
|
|
638
678
|
var PYTH_FEED_IDS = {
|
|
639
679
|
usdc: "eaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a",
|
|
640
680
|
sbeth: "ff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace",
|
|
681
|
+
sbusdt: "2b89b9dc8fdf9f34709a5b106b472f0f39bb6ca9ce04b0fd7f2e971688e2e53b",
|
|
641
682
|
weth: "ff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace",
|
|
642
683
|
wbtc: "e62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43",
|
|
643
684
|
wusdc: "eaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a",
|
|
@@ -960,6 +1001,9 @@ var TEST_ADDRESSES = {
|
|
|
960
1001
|
}
|
|
961
1002
|
}
|
|
962
1003
|
},
|
|
1004
|
+
// @TODO: add test address
|
|
1005
|
+
// @ts-ignore
|
|
1006
|
+
sbusdt: {},
|
|
963
1007
|
fdusd: {
|
|
964
1008
|
id: "0xf16e6b723f242ec745dfd7634ad072c42d5c1d9ac9d62a39c381303eaa57693a",
|
|
965
1009
|
metaData: "0xdebee5265a67c186ed87fe93303d33dfe1de53e3b4fd7d9329c2852860acd3e7",
|
|
@@ -4047,14 +4091,14 @@ var getLoyaltyProgramInformations = async (query, veScaKey) => {
|
|
|
4047
4091
|
// src/queries/portfolioQuery.ts
|
|
4048
4092
|
import BigNumber5 from "bignumber.js";
|
|
4049
4093
|
import { normalizeStructTag as normalizeStructTag5, SUI_TYPE_ARG } from "@scallop-io/sui-kit";
|
|
4050
|
-
var getLendings = async (query, poolCoinNames = [...SUPPORT_POOLS], ownerAddress, marketPools, indexer = false) => {
|
|
4094
|
+
var getLendings = async (query, poolCoinNames = [...SUPPORT_POOLS], ownerAddress, marketPools, coinPrices, indexer = false) => {
|
|
4051
4095
|
const marketCoinNames = poolCoinNames.map(
|
|
4052
4096
|
(poolCoinName) => query.utils.parseMarketCoinName(poolCoinName)
|
|
4053
4097
|
);
|
|
4054
4098
|
const stakeMarketCoinNames = marketCoinNames.filter(
|
|
4055
4099
|
(marketCoinName) => SUPPORT_SPOOLS.includes(marketCoinName)
|
|
4056
4100
|
);
|
|
4057
|
-
|
|
4101
|
+
coinPrices = coinPrices ?? await query.utils.getCoinPrices();
|
|
4058
4102
|
marketPools = marketPools ?? (await query.getMarketPools(poolCoinNames, {
|
|
4059
4103
|
indexer,
|
|
4060
4104
|
coinPrices
|
|
@@ -4225,9 +4269,9 @@ var getLending = async (query, poolCoinName, ownerAddress, indexer = false, mark
|
|
|
4225
4269
|
};
|
|
4226
4270
|
return lending;
|
|
4227
4271
|
};
|
|
4228
|
-
var getObligationAccounts = async (query, ownerAddress, market, indexer = false) => {
|
|
4272
|
+
var getObligationAccounts = async (query, ownerAddress, market, coinPrices, indexer = false) => {
|
|
4229
4273
|
market = market ?? await query.getMarketPools(void 0, { indexer });
|
|
4230
|
-
|
|
4274
|
+
coinPrices = coinPrices ?? await query.getAllCoinPrices({
|
|
4231
4275
|
marketPools: market.pools
|
|
4232
4276
|
});
|
|
4233
4277
|
const [coinAmounts, obligations] = await Promise.all([
|
|
@@ -4587,19 +4631,24 @@ var getTotalValueLocked = async (query, indexer = false) => {
|
|
|
4587
4631
|
return tvl;
|
|
4588
4632
|
};
|
|
4589
4633
|
var getUserPortfolio = async (query, walletAddress, indexer = false) => {
|
|
4590
|
-
const
|
|
4591
|
-
const
|
|
4634
|
+
const coinPrices = await query.utils.getCoinPrices();
|
|
4635
|
+
const market = await query.getMarketPools(void 0, { indexer, coinPrices });
|
|
4636
|
+
const [lendings, obligationAccounts, borrowIncentivePools, veScas] = await Promise.all([
|
|
4592
4637
|
query.getLendings(void 0, walletAddress, {
|
|
4593
4638
|
indexer,
|
|
4594
|
-
marketPools: market.pools
|
|
4639
|
+
marketPools: market.pools,
|
|
4640
|
+
coinPrices
|
|
4595
4641
|
}),
|
|
4596
4642
|
query.getObligationAccounts(walletAddress, {
|
|
4597
4643
|
indexer,
|
|
4598
|
-
market
|
|
4644
|
+
market,
|
|
4645
|
+
coinPrices
|
|
4599
4646
|
}),
|
|
4600
4647
|
query.getBorrowIncentivePools(void 0, {
|
|
4601
|
-
marketPools: market.pools
|
|
4602
|
-
|
|
4648
|
+
marketPools: market.pools,
|
|
4649
|
+
coinPrices
|
|
4650
|
+
}),
|
|
4651
|
+
query.getVeScas({ walletAddress, excludeEmpty: true })
|
|
4603
4652
|
]);
|
|
4604
4653
|
const parsedLendings = Object.values(lendings).filter((t) => t.availableWithdrawCoin > 0).map((lending) => ({
|
|
4605
4654
|
suppliedCoin: lending.availableWithdrawCoin,
|
|
@@ -4686,28 +4735,39 @@ var getUserPortfolio = async (query, walletAddress, indexer = false) => {
|
|
|
4686
4735
|
},
|
|
4687
4736
|
{}
|
|
4688
4737
|
);
|
|
4738
|
+
const parsedVeScas = veScas.map(
|
|
4739
|
+
({ keyId, lockedScaCoin, currentVeScaBalance, unlockAt }) => ({
|
|
4740
|
+
veScaKey: keyId,
|
|
4741
|
+
coinPrice: coinPrices.sca ?? 0,
|
|
4742
|
+
lockedScaInCoin: lockedScaCoin,
|
|
4743
|
+
lockedScaInUsd: lockedScaCoin * (coinPrices.sca ?? 0),
|
|
4744
|
+
currentVeScaBalance,
|
|
4745
|
+
remainingLockPeriodInDays: unlockAt - Date.now() > 0 ? (unlockAt - Date.now()) / 864e5 : 0,
|
|
4746
|
+
unlockAt
|
|
4747
|
+
})
|
|
4748
|
+
);
|
|
4689
4749
|
return {
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4750
|
+
totalSupplyValue: parsedLendings.reduce((acc, curr) => {
|
|
4751
|
+
acc += curr.suppliedValue;
|
|
4752
|
+
return acc;
|
|
4753
|
+
}, 0),
|
|
4754
|
+
...parsedObligationAccounts.reduce(
|
|
4755
|
+
(acc, curr) => {
|
|
4756
|
+
acc.totalDebtValue += curr.totalDebtsInUsd;
|
|
4757
|
+
acc.totalCollateralValue += curr.totalCollateralInUsd;
|
|
4693
4758
|
return acc;
|
|
4694
|
-
},
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
totalCollateralValue: 0
|
|
4707
|
-
}
|
|
4708
|
-
),
|
|
4709
|
-
obligations: parsedObligationAccounts
|
|
4710
|
-
},
|
|
4759
|
+
},
|
|
4760
|
+
{
|
|
4761
|
+
totalDebtValue: 0,
|
|
4762
|
+
totalCollateralValue: 0
|
|
4763
|
+
}
|
|
4764
|
+
),
|
|
4765
|
+
totalLockedScaValue: parsedVeScas.reduce((acc, curr) => {
|
|
4766
|
+
acc += curr.lockedScaInUsd;
|
|
4767
|
+
return acc;
|
|
4768
|
+
}, 0),
|
|
4769
|
+
lendings: parsedLendings,
|
|
4770
|
+
borrowings: parsedObligationAccounts,
|
|
4711
4771
|
pendingRewards: {
|
|
4712
4772
|
lendings: Object.entries(pendingLendingRewards).reduce(
|
|
4713
4773
|
(acc, [key, value]) => {
|
|
@@ -4731,7 +4791,8 @@ var getUserPortfolio = async (query, walletAddress, indexer = false) => {
|
|
|
4731
4791
|
},
|
|
4732
4792
|
[]
|
|
4733
4793
|
)
|
|
4734
|
-
}
|
|
4794
|
+
},
|
|
4795
|
+
veScas: parsedVeScas
|
|
4735
4796
|
};
|
|
4736
4797
|
};
|
|
4737
4798
|
|
|
@@ -5514,7 +5575,8 @@ var getAllAddresses = async (query) => {
|
|
|
5514
5575
|
value
|
|
5515
5576
|
}
|
|
5516
5577
|
}))?.data?.objectId;
|
|
5517
|
-
} catch (
|
|
5578
|
+
} catch (e) {
|
|
5579
|
+
console.error(e.message);
|
|
5518
5580
|
return void 0;
|
|
5519
5581
|
}
|
|
5520
5582
|
};
|
|
@@ -5554,7 +5616,7 @@ var getAllAddresses = async (query) => {
|
|
|
5554
5616
|
// @ts-ignore
|
|
5555
5617
|
`scoin.coins.s${coinName}.treasury`
|
|
5556
5618
|
);
|
|
5557
|
-
const
|
|
5619
|
+
const coinMetadataId = query.address.get(
|
|
5558
5620
|
`core.coins.${coinName}.metaData`
|
|
5559
5621
|
);
|
|
5560
5622
|
results[coinName] = {
|
|
@@ -5571,10 +5633,10 @@ var getAllAddresses = async (query) => {
|
|
|
5571
5633
|
spoolReward: rewardPool,
|
|
5572
5634
|
sCoinTreasury,
|
|
5573
5635
|
sCoinType,
|
|
5574
|
-
|
|
5575
|
-
coinType
|
|
5636
|
+
coinMetadataId,
|
|
5637
|
+
coinType: `0x${coinType}`
|
|
5576
5638
|
};
|
|
5577
|
-
await new Promise((resolve) => setTimeout(resolve,
|
|
5639
|
+
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
5578
5640
|
})
|
|
5579
5641
|
);
|
|
5580
5642
|
return results;
|
|
@@ -8264,6 +8326,7 @@ var ScallopQuery = class {
|
|
|
8264
8326
|
poolCoinNames,
|
|
8265
8327
|
ownerAddress,
|
|
8266
8328
|
args?.marketPools,
|
|
8329
|
+
args?.coinPrices,
|
|
8267
8330
|
args?.indexer
|
|
8268
8331
|
);
|
|
8269
8332
|
}
|
|
@@ -8293,6 +8356,7 @@ var ScallopQuery = class {
|
|
|
8293
8356
|
this,
|
|
8294
8357
|
ownerAddress,
|
|
8295
8358
|
args?.market,
|
|
8359
|
+
args?.coinPrices,
|
|
8296
8360
|
args?.indexer
|
|
8297
8361
|
);
|
|
8298
8362
|
}
|
|
@@ -9434,7 +9498,8 @@ var Scallop = class {
|
|
|
9434
9498
|
...params
|
|
9435
9499
|
},
|
|
9436
9500
|
{
|
|
9437
|
-
address: this.address
|
|
9501
|
+
address: this.address,
|
|
9502
|
+
suiKit: this.suiKit
|
|
9438
9503
|
}
|
|
9439
9504
|
);
|
|
9440
9505
|
return scallopUtils;
|