@scallop-io/sui-scallop-sdk 1.3.3-alpha.2 → 1.3.4-alpha.1
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/coinGecko.d.ts +2 -0
- package/dist/constants/index.d.ts +6 -0
- package/dist/constants/poolAddress.d.ts +5 -0
- package/dist/constants/pyth.d.ts +2 -0
- package/dist/index.js +189 -40
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +182 -40
- package/dist/index.mjs.map +1 -1
- package/dist/models/scallopIndexer.d.ts +6 -0
- package/dist/models/scallopQuery.d.ts +10 -4
- package/dist/models/scallopUtils.d.ts +6 -1
- package/dist/queries/sCoinQuery.d.ts +1 -1
- package/dist/queries/spoolQuery.d.ts +1 -1
- package/dist/queries/vescaQuery.d.ts +2 -2
- package/dist/types/query/portfolio.d.ts +1 -1
- package/dist/types/query/spool.d.ts +1 -0
- package/dist/types/query/vesca.d.ts +1 -1
- package/dist/types/utils.d.ts +12 -0
- package/dist/utils/util.d.ts +2 -2
- package/package.json +1 -1
- package/src/builders/borrowIncentiveBuilder.ts +3 -2
- package/src/constants/coinGecko.ts +18 -0
- package/src/constants/index.ts +6 -0
- package/src/constants/poolAddress.ts +94 -0
- package/src/constants/pyth.ts +19 -0
- package/src/models/scallopClient.ts +3 -3
- package/src/models/scallopIndexer.ts +9 -0
- package/src/models/scallopQuery.ts +9 -0
- package/src/models/scallopUtils.ts +25 -1
- package/src/queries/coreQuery.ts +9 -8
- package/src/queries/portfolioQuery.ts +1 -0
- package/src/queries/spoolQuery.ts +1 -0
- package/src/queries/vescaQuery.ts +4 -6
- package/src/types/query/portfolio.ts +1 -0
- package/src/types/query/spool.ts +1 -0
- package/src/types/query/vesca.ts +1 -1
- package/src/types/utils.ts +13 -0
- package/src/utils/util.ts +2 -1
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
export * from './cache';
|
|
2
|
+
export * from './coinGecko';
|
|
1
3
|
export * from './common';
|
|
2
4
|
export * from './enum';
|
|
3
5
|
export * from './flashloan';
|
|
6
|
+
export * from './poolAddress';
|
|
7
|
+
export * from './pyth';
|
|
4
8
|
export * from './queryKeys';
|
|
9
|
+
export * from './testAddress';
|
|
10
|
+
export * from './tokenBucket';
|
|
5
11
|
export * from './vesca';
|
|
6
12
|
export * from './testAddress';
|
package/dist/constants/pyth.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -33,6 +33,10 @@ __export(src_exports, {
|
|
|
33
33
|
ADDRESSES_ID: () => ADDRESSES_ID,
|
|
34
34
|
API_BASE_URL: () => API_BASE_URL,
|
|
35
35
|
BORROW_FEE_PROTOCOL_ID: () => BORROW_FEE_PROTOCOL_ID,
|
|
36
|
+
COIN_GECKGO_IDS: () => COIN_GECKGO_IDS,
|
|
37
|
+
DEFAULT_CACHE_OPTIONS: () => DEFAULT_CACHE_OPTIONS,
|
|
38
|
+
DEFAULT_INTERVAL_IN_MS: () => DEFAULT_INTERVAL_IN_MS,
|
|
39
|
+
DEFAULT_TOKENS_PER_INTERVAL: () => DEFAULT_TOKENS_PER_INTERVAL,
|
|
36
40
|
FlashLoanFeeObjectMap: () => FlashLoanFeeObjectMap,
|
|
37
41
|
IS_VE_SCA_TEST: () => IS_VE_SCA_TEST,
|
|
38
42
|
MAX_LOCK_DURATION: () => MAX_LOCK_DURATION,
|
|
@@ -40,7 +44,10 @@ __export(src_exports, {
|
|
|
40
44
|
MIN_INITIAL_LOCK_AMOUNT: () => MIN_INITIAL_LOCK_AMOUNT,
|
|
41
45
|
MIN_TOP_UP_AMOUNT: () => MIN_TOP_UP_AMOUNT,
|
|
42
46
|
OLD_BORROW_INCENTIVE_PROTOCOL_ID: () => OLD_BORROW_INCENTIVE_PROTOCOL_ID,
|
|
47
|
+
POOL_ADDRESSES: () => POOL_ADDRESSES,
|
|
43
48
|
PROTOCOL_OBJECT_ID: () => PROTOCOL_OBJECT_ID,
|
|
49
|
+
PYTH_ENDPOINTS: () => PYTH_ENDPOINTS,
|
|
50
|
+
PYTH_FEED_IDS: () => PYTH_FEED_IDS,
|
|
44
51
|
SCA_COIN_TYPE: () => SCA_COIN_TYPE,
|
|
45
52
|
SDK_API_BASE_URL: () => SDK_API_BASE_URL,
|
|
46
53
|
SUPPORT_BORROW_INCENTIVE_POOLS: () => SUPPORT_BORROW_INCENTIVE_POOLS,
|
|
@@ -81,6 +88,34 @@ __export(src_exports, {
|
|
|
81
88
|
});
|
|
82
89
|
module.exports = __toCommonJS(src_exports);
|
|
83
90
|
|
|
91
|
+
// src/constants/cache.ts
|
|
92
|
+
var DEFAULT_CACHE_OPTIONS = {
|
|
93
|
+
defaultOptions: {
|
|
94
|
+
queries: {
|
|
95
|
+
staleTime: 5e3,
|
|
96
|
+
gcTime: 5e3
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
// src/constants/coinGecko.ts
|
|
102
|
+
var COIN_GECKGO_IDS = {
|
|
103
|
+
usdc: "usdc-coin",
|
|
104
|
+
sbeth: "ethereum",
|
|
105
|
+
weth: "ethereum",
|
|
106
|
+
wbtc: "bitcoin",
|
|
107
|
+
wusdc: "usdc-coin",
|
|
108
|
+
wusdt: "tether",
|
|
109
|
+
sui: "sui",
|
|
110
|
+
wapt: "aptos",
|
|
111
|
+
wsol: "solana",
|
|
112
|
+
cetus: "cetus-protocol",
|
|
113
|
+
afsui: "sui",
|
|
114
|
+
hasui: "sui",
|
|
115
|
+
vsui: "sui",
|
|
116
|
+
sca: "scallop-2"
|
|
117
|
+
};
|
|
118
|
+
|
|
84
119
|
// src/constants/common.ts
|
|
85
120
|
var API_BASE_URL = "https://sui.apis.scallop.io";
|
|
86
121
|
var SDK_API_BASE_URL = "https://sdk.api.scallop.io";
|
|
@@ -375,6 +410,88 @@ var FlashLoanFeeObjectMap = {
|
|
|
375
410
|
wsol: "0xe84bdb35b790fc7bdd1645122ac6ac0fc904531d6772c9e25904fece322c5f34"
|
|
376
411
|
};
|
|
377
412
|
|
|
413
|
+
// src/constants/poolAddress.ts
|
|
414
|
+
var POOL_ADDRESSES = {
|
|
415
|
+
usdc: {
|
|
416
|
+
lendingPoolAddress: "0xd3be98bf540f7603eeb550c0c0a19dbfc78822f25158b5fa84ebd9609def415f",
|
|
417
|
+
collateralPoolAddress: "0x8f0d529ba179c5b3d508213003eab813aaae31f78226099639b9a69d1aec17af"
|
|
418
|
+
},
|
|
419
|
+
sbeth: {
|
|
420
|
+
lendingPoolAddress: "0x5f08c4f71d56dd3342c452cc70ffc47f2f4180146d821941b0b9c04761bb42e7",
|
|
421
|
+
collateralPoolAddress: "0xce0549a1cbe952e734f56646988e6b02bbae14667889a60e24d0d03540a6119f"
|
|
422
|
+
},
|
|
423
|
+
weth: {
|
|
424
|
+
lendingPoolAddress: "0xc8fcdff48efc265740ae0b74aae3faccae9ec00034039a113f3339798035108c",
|
|
425
|
+
collateralPoolAddress: "0xad7ced91ed6e7f2b81805561eee27fa6f3e72fdae561077334c7248583db4dbf"
|
|
426
|
+
},
|
|
427
|
+
wbtc: {
|
|
428
|
+
lendingPoolAddress: "0x65cc08a5aca0a0b8d72e1993ded8d145f06dd102fd0d8f285b92934faed564ab",
|
|
429
|
+
collateralPoolAddress: "0x1aa4e5cf743cd797b4eb8bf1e614f80ae2cf556ced426cddaaf190ffcd0e59c3"
|
|
430
|
+
},
|
|
431
|
+
wusdc: {
|
|
432
|
+
lendingPoolAddress: "0x9c9077abf7a29eebce41e33addbcd6f5246a5221dd733e56ea0f00ae1b25c9e8",
|
|
433
|
+
collateralPoolAddress: "0x75aacfb7dcbf92ee0111fc1bf975b12569e4ba632e81ed7ae5ac090d40cd3acb"
|
|
434
|
+
},
|
|
435
|
+
wusdt: {
|
|
436
|
+
lendingPoolAddress: "0xfbc056f126dd35adc1f8fe985e2cedc8010e687e8e851e1c5b99fdf63cd1c879",
|
|
437
|
+
collateralPoolAddress: "0x2260cb5b24929dd20a1742f37a61ff3ce4fde5cdb023e2d3ce2e0ce2d90719e3"
|
|
438
|
+
},
|
|
439
|
+
sui: {
|
|
440
|
+
lendingPoolAddress: "0x9c9077abf7a29eebce41e33addbcd6f5246a5221dd733e56ea0f00ae1b25c9e8",
|
|
441
|
+
collateralPoolAddress: "0x75aacfb7dcbf92ee0111fc1bf975b12569e4ba632e81ed7ae5ac090d40cd3acb"
|
|
442
|
+
},
|
|
443
|
+
wapt: {
|
|
444
|
+
lendingPoolAddress: "0xca8c14a24e0c32b198eaf479a3317461e3cc339097ce88eaf296a15df8dcfdf5",
|
|
445
|
+
collateralPoolAddress: "0xde33f9ac5bb0ed34598da4e64b4983832716ced65f172fbf267bcfe859c4ad9c"
|
|
446
|
+
},
|
|
447
|
+
wsol: {
|
|
448
|
+
lendingPoolAddress: "0x985682c42984cdfb03f9ff7d8923344c2fe096b1ae4b82ea17721af19d22a21f",
|
|
449
|
+
collateralPoolAddress: "0xdc1cc2c371a043ae8e3c3fe2d013c35f1346960b7dbb4c072982c5b794ed144f"
|
|
450
|
+
},
|
|
451
|
+
cetus: {
|
|
452
|
+
lendingPoolAddress: "0xc09858f60e74a1b671635bec4e8a2c84a0ff313eb87f525fba3258e88c6b6282",
|
|
453
|
+
collateralPoolAddress: "0xe363967e29b7b9c1245d6d46d63e719de8f90b37e3358c545b55d945ea0b676a"
|
|
454
|
+
},
|
|
455
|
+
afsui: {
|
|
456
|
+
lendingPoolAddress: "0x9b942a24ce390b7f5016d34a0217057bf9487b92aa6d7cc9894271dbbe62471a",
|
|
457
|
+
collateralPoolAddress: "0xe5e56f5c0e3072760b21f9d49a5cc793f37d736c412a9065c16e1265c74e6341"
|
|
458
|
+
},
|
|
459
|
+
hasui: {
|
|
460
|
+
lendingPoolAddress: "0x7ebc607f6bdeb659fb6506cb91c5cc1d47bb365cfd5d2e637ea765346ec84ed4",
|
|
461
|
+
collateralPoolAddress: "0xad9ed40d6486e4c26cec7370dffce8dc4821eb79178250b5938a34ccafd61e6d"
|
|
462
|
+
},
|
|
463
|
+
vsui: {
|
|
464
|
+
lendingPoolAddress: "0xda9257c0731d8822e8a438ebced13415850d705b779c79958dcf2aeb21fcb43d",
|
|
465
|
+
collateralPoolAddress: "0x4435e8b8ec2a04094d863aa52deb6ab6f8f47ed8778f4d9f1b27afc4a6e85f1e"
|
|
466
|
+
},
|
|
467
|
+
sca: {
|
|
468
|
+
lendingPoolAddress: "0x6fc7d4211fc7018b6c75e7b908b88f2e0536443239804a3d32af547637bd28d7",
|
|
469
|
+
collateralPoolAddress: "0xff677a5d9e9dc8f08f0a8681ebfc7481d1c7d57bc441f2881974adcdd7b13c31"
|
|
470
|
+
}
|
|
471
|
+
};
|
|
472
|
+
|
|
473
|
+
// src/constants/pyth.ts
|
|
474
|
+
var PYTH_ENDPOINTS = {
|
|
475
|
+
testnet: ["https://hermes-beta.pyth.network"],
|
|
476
|
+
mainnet: ["https://hermes.pyth.network", "https://scallop.rpc.p2p.world"]
|
|
477
|
+
};
|
|
478
|
+
var PYTH_FEED_IDS = {
|
|
479
|
+
usdc: "eaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a",
|
|
480
|
+
sbeth: "ff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace",
|
|
481
|
+
weth: "ff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace",
|
|
482
|
+
wbtc: "e62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43",
|
|
483
|
+
wusdc: "eaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a",
|
|
484
|
+
wusdt: "2b89b9dc8fdf9f34709a5b106b472f0f39bb6ca9ce04b0fd7f2e971688e2e53b",
|
|
485
|
+
sui: "23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744",
|
|
486
|
+
wapt: "03ae4db29ed4ae33d323568895aa00337e658e348b37509f5372ae51f0af00d5",
|
|
487
|
+
wsol: "ef0d8b6fda2ceba41da15d4095d1da392a0d2f8ed0c6c7bc0f4cfac8c280b56d",
|
|
488
|
+
cetus: "e5b274b2611143df055d6e7cd8d93fe1961716bcd4dca1cad87a83bc1e78c1ef",
|
|
489
|
+
afsui: "23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744",
|
|
490
|
+
hasui: "23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744",
|
|
491
|
+
vsui: "23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744",
|
|
492
|
+
sca: "7e17f0ac105abe9214deb9944c30264f5986bf292869c6bd8e8da3ccd92d79bc"
|
|
493
|
+
};
|
|
494
|
+
|
|
378
495
|
// src/constants/queryKeys.ts
|
|
379
496
|
var queryKeys = {
|
|
380
497
|
api: {
|
|
@@ -459,13 +576,6 @@ var queryKeys = {
|
|
|
459
576
|
}
|
|
460
577
|
};
|
|
461
578
|
|
|
462
|
-
// src/constants/vesca.ts
|
|
463
|
-
var UNLOCK_ROUND_DURATION = 60 * 60 * 24;
|
|
464
|
-
var MAX_LOCK_ROUNDS = 1460;
|
|
465
|
-
var MAX_LOCK_DURATION = MAX_LOCK_ROUNDS * UNLOCK_ROUND_DURATION;
|
|
466
|
-
var MIN_INITIAL_LOCK_AMOUNT = 1e10;
|
|
467
|
-
var MIN_TOP_UP_AMOUNT = 1e9;
|
|
468
|
-
|
|
469
579
|
// src/constants/testAddress.ts
|
|
470
580
|
var TEST_ADDRESSES = {
|
|
471
581
|
core: {
|
|
@@ -890,6 +1000,17 @@ var TEST_ADDRESSES = {
|
|
|
890
1000
|
}
|
|
891
1001
|
};
|
|
892
1002
|
|
|
1003
|
+
// src/constants/tokenBucket.ts
|
|
1004
|
+
var DEFAULT_TOKENS_PER_INTERVAL = 50;
|
|
1005
|
+
var DEFAULT_INTERVAL_IN_MS = 300;
|
|
1006
|
+
|
|
1007
|
+
// src/constants/vesca.ts
|
|
1008
|
+
var UNLOCK_ROUND_DURATION = 60 * 60 * 24;
|
|
1009
|
+
var MAX_LOCK_ROUNDS = 1460;
|
|
1010
|
+
var MAX_LOCK_DURATION = MAX_LOCK_ROUNDS * UNLOCK_ROUND_DURATION;
|
|
1011
|
+
var MIN_INITIAL_LOCK_AMOUNT = 1e10;
|
|
1012
|
+
var MIN_TOP_UP_AMOUNT = 1e9;
|
|
1013
|
+
|
|
893
1014
|
// src/models/scallop.ts
|
|
894
1015
|
var import_sui_kit16 = require("@scallop-io/sui-kit");
|
|
895
1016
|
|
|
@@ -900,16 +1021,6 @@ var import_sui_kit2 = require("@scallop-io/sui-kit");
|
|
|
900
1021
|
var import_query_core = require("@tanstack/query-core");
|
|
901
1022
|
var import_sui_kit = require("@scallop-io/sui-kit");
|
|
902
1023
|
|
|
903
|
-
// src/constants/cache.ts
|
|
904
|
-
var DEFAULT_CACHE_OPTIONS = {
|
|
905
|
-
defaultOptions: {
|
|
906
|
-
queries: {
|
|
907
|
-
staleTime: 5e3,
|
|
908
|
-
gcTime: 5e3
|
|
909
|
-
}
|
|
910
|
-
}
|
|
911
|
-
};
|
|
912
|
-
|
|
913
1024
|
// src/utils/builder.ts
|
|
914
1025
|
var requireSender = (txBlock) => {
|
|
915
1026
|
const sender = txBlock.blockData.sender;
|
|
@@ -1469,10 +1580,6 @@ var findClosestUnlockRound = (unlockAtInSecondTimestamp) => {
|
|
|
1469
1580
|
return Math.floor(closestTwelveAM.getTime() / 1e3);
|
|
1470
1581
|
};
|
|
1471
1582
|
|
|
1472
|
-
// src/constants/tokenBucket.ts
|
|
1473
|
-
var DEFAULT_TOKENS_PER_INTERVAL = 50;
|
|
1474
|
-
var DEFAULT_INTERVAL_IN_MS = 300;
|
|
1475
|
-
|
|
1476
1583
|
// src/utils/tokenBucket.ts
|
|
1477
1584
|
var TokenBucket = class {
|
|
1478
1585
|
constructor(tokensPerInterval, intervalInMs) {
|
|
@@ -2959,6 +3066,9 @@ var getObligations = async ({
|
|
|
2959
3066
|
filter: {
|
|
2960
3067
|
StructType: `${protocolObjectId}::obligation::ObligationKey`
|
|
2961
3068
|
},
|
|
3069
|
+
options: {
|
|
3070
|
+
showContent: true
|
|
3071
|
+
},
|
|
2962
3072
|
cursor: nextCursor,
|
|
2963
3073
|
limit: 10
|
|
2964
3074
|
});
|
|
@@ -2972,14 +3082,14 @@ var getObligations = async ({
|
|
|
2972
3082
|
hasNextPage = false;
|
|
2973
3083
|
}
|
|
2974
3084
|
} while (hasNextPage);
|
|
2975
|
-
const
|
|
2976
|
-
const keyObjects = await address.cache.queryGetObjects(keyObjectIds);
|
|
3085
|
+
const keyObjects = keyObjectsResponse.filter((ref) => !!ref.data);
|
|
2977
3086
|
const obligations = [];
|
|
2978
3087
|
await Promise.allSettled(
|
|
2979
|
-
keyObjects.map(async (
|
|
2980
|
-
const keyId =
|
|
2981
|
-
|
|
2982
|
-
|
|
3088
|
+
keyObjects.map(async ({ data }) => {
|
|
3089
|
+
const keyId = data?.objectId;
|
|
3090
|
+
const content = data?.content;
|
|
3091
|
+
if (keyId && content && "fields" in content) {
|
|
3092
|
+
const fields = content.fields;
|
|
2983
3093
|
const obligationId = String(fields.ownership.fields.of);
|
|
2984
3094
|
const locked = await getObligationLocked(address.cache, obligationId);
|
|
2985
3095
|
obligations.push({ id: obligationId, keyId, locked });
|
|
@@ -3247,6 +3357,7 @@ var getSpool = async (query, marketCoinName, indexer = false, marketPool, coinPr
|
|
|
3247
3357
|
coinType: query.utils.parseCoinType(coinName),
|
|
3248
3358
|
marketCoinType: query.utils.parseMarketCoinType(coinName),
|
|
3249
3359
|
rewardCoinType: isMarketCoin(rewardCoinName) ? query.utils.parseMarketCoinType(rewardCoinName) : query.utils.parseCoinType(rewardCoinName),
|
|
3360
|
+
sCoinType: marketPool.sCoinType,
|
|
3250
3361
|
coinDecimal: query.utils.getCoinDecimal(coinName),
|
|
3251
3362
|
rewardCoinDecimal: query.utils.getCoinDecimal(rewardCoinName),
|
|
3252
3363
|
coinPrice: coinPrices?.[coinName] ?? 0,
|
|
@@ -3843,6 +3954,7 @@ var getLending = async (query, poolCoinName, ownerAddress, indexer = false, mark
|
|
|
3843
3954
|
symbol: query.utils.parseSymbol(poolCoinName),
|
|
3844
3955
|
coinType: query.utils.parseCoinType(poolCoinName),
|
|
3845
3956
|
marketCoinType: query.utils.parseMarketCoinType(poolCoinName),
|
|
3957
|
+
sCoinType: marketPool?.sCoinType ?? "",
|
|
3846
3958
|
coinDecimal,
|
|
3847
3959
|
coinPrice: coinPrice ?? 0,
|
|
3848
3960
|
conversionRate: marketPool?.conversionRate ?? 1,
|
|
@@ -4282,9 +4394,8 @@ var SuiObjectRefZod = import_zod3.z.object({
|
|
|
4282
4394
|
digest: import_zod3.z.string(),
|
|
4283
4395
|
version: import_zod3.z.string()
|
|
4284
4396
|
});
|
|
4285
|
-
var getVeSca = async (utils, veScaKey
|
|
4397
|
+
var getVeSca = async (utils, veScaKey) => {
|
|
4286
4398
|
const tableId = utils.address.get(`vesca.tableId`);
|
|
4287
|
-
veScaKey = veScaKey || (await getVescaKeys(utils, ownerAddress))[0];
|
|
4288
4399
|
if (!veScaKey)
|
|
4289
4400
|
return void 0;
|
|
4290
4401
|
if (typeof veScaKey === "object") {
|
|
@@ -4463,12 +4574,6 @@ var getLoyaltyProgramInformations = async (query, veScaKey) => {
|
|
|
4463
4574
|
return result;
|
|
4464
4575
|
};
|
|
4465
4576
|
|
|
4466
|
-
// src/constants/pyth.ts
|
|
4467
|
-
var PYTH_ENDPOINTS = {
|
|
4468
|
-
testnet: ["https://hermes-beta.pyth.network"],
|
|
4469
|
-
mainnet: ["https://hermes.pyth.network", "https://scallop.rpc.p2p.world"]
|
|
4470
|
-
};
|
|
4471
|
-
|
|
4472
4577
|
// src/models/scallopUtils.ts
|
|
4473
4578
|
var ScallopUtils = class {
|
|
4474
4579
|
constructor(params, instance) {
|
|
@@ -4946,6 +5051,26 @@ var ScallopUtils = class {
|
|
|
4946
5051
|
}
|
|
4947
5052
|
return findClosestUnlockRound(newUnlockAtInSecondTimestamp);
|
|
4948
5053
|
}
|
|
5054
|
+
/**
|
|
5055
|
+
* Get detailed contract address and price id information for supported pool in Scallop
|
|
5056
|
+
* @returns Supported pool informations
|
|
5057
|
+
*/
|
|
5058
|
+
getSupportedPoolAddresses() {
|
|
5059
|
+
return SUPPORT_POOLS.map((poolName) => {
|
|
5060
|
+
const sCoinName = this.parseSCoinName(poolName);
|
|
5061
|
+
return {
|
|
5062
|
+
name: this.parseSymbol(poolName),
|
|
5063
|
+
coingeckoId: COIN_GECKGO_IDS[poolName],
|
|
5064
|
+
decimal: coinDecimals[poolName],
|
|
5065
|
+
pythFeedId: PYTH_FEED_IDS[poolName],
|
|
5066
|
+
...POOL_ADDRESSES[poolName],
|
|
5067
|
+
sCoinAddress: sCoinIds[sCoinName],
|
|
5068
|
+
marketCoinAddress: this.parseMarketCoinType(poolName),
|
|
5069
|
+
coinAddress: this.parseCoinType(poolName),
|
|
5070
|
+
sCoinName: sCoinName ? this.parseSymbol(sCoinName) : void 0
|
|
5071
|
+
};
|
|
5072
|
+
});
|
|
5073
|
+
}
|
|
4949
5074
|
};
|
|
4950
5075
|
|
|
4951
5076
|
// src/models/scallopBuilder.ts
|
|
@@ -5877,13 +6002,14 @@ var generateBorrowIncentiveQuickMethod = ({ builder, txBlock }) => {
|
|
|
5877
6002
|
);
|
|
5878
6003
|
if (!obligationLocked || unstakeObligationBeforeStake) {
|
|
5879
6004
|
const bindedVeScaKey = await builder.query.getBindedVeScaKey(obligationArg);
|
|
5880
|
-
|
|
6005
|
+
const _veScaKey = bindedVeScaKey ?? veScaKey;
|
|
6006
|
+
if (!_veScaKey) {
|
|
5881
6007
|
txBlock.stakeObligation(obligationArg, obligationKeyArg);
|
|
5882
6008
|
} else {
|
|
5883
6009
|
txBlock.stakeObligationWithVesca(
|
|
5884
6010
|
obligationArg,
|
|
5885
6011
|
obligationKeyArg,
|
|
5886
|
-
|
|
6012
|
+
_veScaKey
|
|
5887
6013
|
);
|
|
5888
6014
|
}
|
|
5889
6015
|
}
|
|
@@ -6717,6 +6843,14 @@ var ScallopIndexer = class {
|
|
|
6717
6843
|
throw Error("Failed to getTotalValueLocked.");
|
|
6718
6844
|
}
|
|
6719
6845
|
}
|
|
6846
|
+
/**
|
|
6847
|
+
* Get coin price index data.
|
|
6848
|
+
*
|
|
6849
|
+
* @return price data.
|
|
6850
|
+
*/
|
|
6851
|
+
async getCoinPrice(poolCoinName) {
|
|
6852
|
+
return (await this.getMarketPool(poolCoinName))?.coinPrice ?? 0;
|
|
6853
|
+
}
|
|
6720
6854
|
};
|
|
6721
6855
|
|
|
6722
6856
|
// src/queries/sCoinQuery.ts
|
|
@@ -7344,6 +7478,14 @@ var ScallopQuery = class {
|
|
|
7344
7478
|
async isIsolatedAsset(assetCoinName) {
|
|
7345
7479
|
return isIsolatedAsset(this.utils, assetCoinName);
|
|
7346
7480
|
}
|
|
7481
|
+
/**
|
|
7482
|
+
* Get pool coin price from indexer
|
|
7483
|
+
* @param coinName
|
|
7484
|
+
* @returns price data
|
|
7485
|
+
*/
|
|
7486
|
+
async getCoinPriceByIndexer(poolName) {
|
|
7487
|
+
return this.indexer.getCoinPrice(poolName);
|
|
7488
|
+
}
|
|
7347
7489
|
};
|
|
7348
7490
|
|
|
7349
7491
|
// src/models/scallopBuilder.ts
|
|
@@ -7784,7 +7926,7 @@ var ScallopClient = class {
|
|
|
7784
7926
|
);
|
|
7785
7927
|
txBlock.transferObjects([coin], sender);
|
|
7786
7928
|
if (sign && availableStake) {
|
|
7787
|
-
await txBlock.
|
|
7929
|
+
await txBlock.stakeObligationWithVeScaQuick(obligationId, obligationKey);
|
|
7788
7930
|
}
|
|
7789
7931
|
if (sign) {
|
|
7790
7932
|
return await this.suiKit.signAndSendTxn(
|
|
@@ -7814,7 +7956,7 @@ var ScallopClient = class {
|
|
|
7814
7956
|
}
|
|
7815
7957
|
await txBlock.repayQuick(amount, poolCoinName, obligationId);
|
|
7816
7958
|
if (sign && availableStake) {
|
|
7817
|
-
await txBlock.
|
|
7959
|
+
await txBlock.stakeObligationWithVeScaQuick(obligationId, obligationKey);
|
|
7818
7960
|
}
|
|
7819
7961
|
if (sign) {
|
|
7820
7962
|
return await this.suiKit.signAndSendTxn(
|
|
@@ -7961,7 +8103,7 @@ var ScallopClient = class {
|
|
|
7961
8103
|
const txBlock = this.builder.createTxBlock();
|
|
7962
8104
|
const sender = walletAddress || this.walletAddress;
|
|
7963
8105
|
txBlock.setSender(sender);
|
|
7964
|
-
await txBlock.
|
|
8106
|
+
await txBlock.stakeObligationWithVeScaQuick(obligationId, obligationKeyId);
|
|
7965
8107
|
if (sign) {
|
|
7966
8108
|
return await this.suiKit.signAndSendTxn(
|
|
7967
8109
|
txBlock
|
|
@@ -8285,6 +8427,10 @@ var Scallop = class {
|
|
|
8285
8427
|
ADDRESSES_ID,
|
|
8286
8428
|
API_BASE_URL,
|
|
8287
8429
|
BORROW_FEE_PROTOCOL_ID,
|
|
8430
|
+
COIN_GECKGO_IDS,
|
|
8431
|
+
DEFAULT_CACHE_OPTIONS,
|
|
8432
|
+
DEFAULT_INTERVAL_IN_MS,
|
|
8433
|
+
DEFAULT_TOKENS_PER_INTERVAL,
|
|
8288
8434
|
FlashLoanFeeObjectMap,
|
|
8289
8435
|
IS_VE_SCA_TEST,
|
|
8290
8436
|
MAX_LOCK_DURATION,
|
|
@@ -8292,7 +8438,10 @@ var Scallop = class {
|
|
|
8292
8438
|
MIN_INITIAL_LOCK_AMOUNT,
|
|
8293
8439
|
MIN_TOP_UP_AMOUNT,
|
|
8294
8440
|
OLD_BORROW_INCENTIVE_PROTOCOL_ID,
|
|
8441
|
+
POOL_ADDRESSES,
|
|
8295
8442
|
PROTOCOL_OBJECT_ID,
|
|
8443
|
+
PYTH_ENDPOINTS,
|
|
8444
|
+
PYTH_FEED_IDS,
|
|
8296
8445
|
SCA_COIN_TYPE,
|
|
8297
8446
|
SDK_API_BASE_URL,
|
|
8298
8447
|
SUPPORT_BORROW_INCENTIVE_POOLS,
|