@scallop-io/sui-scallop-sdk 1.5.3 → 2.0.0-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.
Files changed (60) hide show
  1. package/dist/index.d.mts +451 -602
  2. package/dist/index.d.ts +451 -602
  3. package/dist/index.js +29 -60
  4. package/dist/index.mjs +6 -6
  5. package/package.json +1 -1
  6. package/src/builders/loyaltyProgramBuilder.ts +5 -3
  7. package/src/builders/oracle.ts +10 -24
  8. package/src/builders/referralBuilder.ts +5 -9
  9. package/src/builders/sCoinBuilder.ts +9 -8
  10. package/src/builders/spoolBuilder.ts +4 -6
  11. package/src/constants/common.ts +114 -126
  12. package/src/constants/index.ts +0 -5
  13. package/src/constants/pyth.ts +25 -34
  14. package/src/constants/queryKeys.ts +2 -0
  15. package/src/models/index.ts +1 -0
  16. package/src/models/scallop.ts +23 -19
  17. package/src/models/scallopAddress.ts +7 -4
  18. package/src/models/scallopBuilder.ts +36 -41
  19. package/src/models/scallopCache.ts +1 -1
  20. package/src/models/scallopClient.ts +93 -94
  21. package/src/models/scallopConstants.ts +342 -0
  22. package/src/models/scallopIndexer.ts +11 -24
  23. package/src/models/scallopQuery.ts +70 -77
  24. package/src/models/scallopUtils.ts +122 -249
  25. package/src/queries/borrowIncentiveQuery.ts +21 -56
  26. package/src/queries/borrowLimitQuery.ts +3 -6
  27. package/src/queries/coreQuery.ts +94 -112
  28. package/src/queries/flashloanFeeQuery.ts +86 -0
  29. package/src/queries/isolatedAssetQuery.ts +12 -11
  30. package/src/queries/poolAddressesQuery.ts +187 -112
  31. package/src/queries/portfolioQuery.ts +65 -67
  32. package/src/queries/priceQuery.ts +16 -22
  33. package/src/queries/sCoinQuery.ts +15 -16
  34. package/src/queries/spoolQuery.ts +49 -59
  35. package/src/queries/supplyLimitQuery.ts +2 -6
  36. package/src/queries/xOracleQuery.ts +4 -15
  37. package/src/types/address.ts +12 -18
  38. package/src/types/builder/borrowIncentive.ts +2 -3
  39. package/src/types/builder/core.ts +20 -27
  40. package/src/types/builder/index.ts +1 -2
  41. package/src/types/builder/referral.ts +4 -8
  42. package/src/types/builder/sCoin.ts +4 -8
  43. package/src/types/builder/spool.ts +7 -10
  44. package/src/types/constant/common.ts +43 -49
  45. package/src/types/constant/enum.ts +15 -27
  46. package/src/types/constant/xOracle.ts +3 -5
  47. package/src/types/model.ts +49 -28
  48. package/src/types/query/borrowIncentive.ts +7 -24
  49. package/src/types/query/core.ts +8 -18
  50. package/src/types/query/portfolio.ts +8 -17
  51. package/src/types/query/spool.ts +5 -11
  52. package/src/types/utils.ts +1 -21
  53. package/src/utils/core.ts +1 -1
  54. package/src/utils/query.ts +13 -20
  55. package/src/utils/util.ts +6 -84
  56. package/src/constants/coinGecko.ts +0 -34
  57. package/src/constants/enum.ts +0 -268
  58. package/src/constants/flashloan.ts +0 -18
  59. package/src/constants/poolAddress.ts +0 -898
  60. package/src/models/scallopPrice.ts +0 -0
@@ -1,11 +1,9 @@
1
1
  import { normalizeStructTag } from '@mysten/sui/utils';
2
- import { POOL_ADDRESSES, SUPPORT_SPOOLS } from '../constants';
3
2
  import {
4
3
  parseOriginSpoolData,
5
4
  calculateSpoolData,
6
5
  parseOriginSpoolRewardPoolData,
7
6
  calculateSpoolRewardPoolData,
8
- isMarketCoin,
9
7
  parseObjectAs,
10
8
  } from '../utils';
11
9
  import type { SuiObjectData, SuiObjectResponse } from '@mysten/sui/client';
@@ -16,8 +14,6 @@ import type {
16
14
  StakePool,
17
15
  StakeRewardPool,
18
16
  StakeAccounts,
19
- SupportStakeMarketCoins,
20
- SupportStakeCoins,
21
17
  CoinPrices,
22
18
  MarketPools,
23
19
  OriginSpoolRewardPoolData,
@@ -28,14 +24,14 @@ import { queryMultipleObjects } from './objectsQuery';
28
24
 
29
25
  const queryRequiredSpoolObjects = async (
30
26
  query: ScallopQuery,
31
- stakePoolCoinNames: SupportStakeCoins[]
27
+ stakePoolCoinNames: string[]
32
28
  ) => {
33
29
  // Prepare all tasks for querying each object type
34
30
  const tasks = stakePoolCoinNames.map((t, idx) => ({
35
31
  poolCoinName: stakePoolCoinNames[idx],
36
- spool: POOL_ADDRESSES[t]?.spool,
37
- spoolReward: POOL_ADDRESSES[t]?.spoolReward,
38
- sCoinTreasury: POOL_ADDRESSES[t]?.sCoinTreasury,
32
+ spool: query.constants.poolAddresses[t]?.spool,
33
+ spoolReward: query.constants.poolAddresses[t]?.spoolReward,
34
+ sCoinTreasury: query.constants.poolAddresses[t]?.sCoinTreasury,
39
35
  }));
40
36
 
41
37
  // Query all objects for each key in parallel
@@ -97,7 +93,7 @@ const queryRequiredSpoolObjects = async (
97
93
  return acc;
98
94
  },
99
95
  {} as Record<
100
- SupportStakeCoins,
96
+ string,
101
97
  {
102
98
  spool: SuiObjectData;
103
99
  spoolReward: SuiObjectData;
@@ -141,13 +137,13 @@ const parseSpoolObjects = ({
141
137
  */
142
138
  export const getSpools = async (
143
139
  query: ScallopQuery,
144
- stakeMarketCoinNames: SupportStakeMarketCoins[] = [...SUPPORT_SPOOLS],
140
+ stakeMarketCoinNames: string[] = [...query.constants.whitelist.spool],
145
141
  indexer: boolean = false,
146
142
  marketPools?: MarketPools,
147
143
  coinPrices?: CoinPrices
148
144
  ) => {
149
145
  const stakeCoinNames = stakeMarketCoinNames.map((stakeMarketCoinName) =>
150
- query.utils.parseCoinName<SupportStakeCoins>(stakeMarketCoinName)
146
+ query.utils.parseCoinName(stakeMarketCoinName)
151
147
  );
152
148
  marketPools =
153
149
  marketPools ??
@@ -165,12 +161,8 @@ export const getSpools = async (
165
161
  const spoolsIndexer = await query.indexer.getSpools();
166
162
  const updateSpools = (spool: Spool) => {
167
163
  if (!stakeMarketCoinNames.includes(spool.marketCoinName)) return;
168
- const coinName = query.utils.parseCoinName<SupportStakeCoins>(
169
- spool.marketCoinName
170
- );
171
- const rewardCoinName = query.utils.getSpoolRewardCoinName(
172
- spool.marketCoinName
173
- );
164
+ const coinName = query.utils.parseCoinName(spool.marketCoinName);
165
+ const rewardCoinName = query.utils.getSpoolRewardCoinName();
174
166
  spool.coinPrice = coinPrices[coinName] ?? spool.coinPrice;
175
167
  spool.marketCoinPrice =
176
168
  coinPrices[spool.marketCoinName] ?? spool.marketCoinPrice;
@@ -178,7 +170,9 @@ export const getSpools = async (
178
170
  coinPrices[rewardCoinName] ?? spool.rewardCoinPrice;
179
171
  spools[spool.marketCoinName] = spool;
180
172
  };
181
- Object.values(spoolsIndexer).forEach(updateSpools);
173
+ Object.values(spoolsIndexer)
174
+ .filter((t) => !!t)
175
+ .forEach(updateSpools);
182
176
 
183
177
  return spools;
184
178
  }
@@ -224,7 +218,7 @@ export const getSpools = async (
224
218
  */
225
219
  export const getSpool = async (
226
220
  query: ScallopQuery,
227
- marketCoinName: SupportStakeMarketCoins,
221
+ marketCoinName: string,
228
222
  indexer: boolean = false,
229
223
  coinPrices?: CoinPrices,
230
224
  requiredObjects?: {
@@ -232,14 +226,13 @@ export const getSpool = async (
232
226
  spoolReward: SuiObjectData;
233
227
  }
234
228
  ) => {
235
- const coinName = query.utils.parseCoinName<SupportStakeCoins>(marketCoinName);
229
+ const coinName = query.utils.parseCoinName<string>(marketCoinName);
236
230
  coinPrices = coinPrices || (await query.getAllCoinPrices());
237
231
 
238
232
  if (indexer) {
239
233
  const spoolIndexer = await query.indexer.getSpool(marketCoinName);
240
- const coinName =
241
- query.utils.parseCoinName<SupportStakeCoins>(marketCoinName);
242
- const rewardCoinName = query.utils.getSpoolRewardCoinName(marketCoinName);
234
+ const coinName = query.utils.parseCoinName<string>(marketCoinName);
235
+ const rewardCoinName = query.utils.getSpoolRewardCoinName();
243
236
  spoolIndexer.coinPrice = coinPrices?.[coinName] ?? spoolIndexer.coinPrice;
244
237
  spoolIndexer.marketCoinPrice =
245
238
  coinPrices?.[marketCoinName] ?? spoolIndexer.marketCoinPrice;
@@ -253,7 +246,7 @@ export const getSpool = async (
253
246
  coinName
254
247
  ];
255
248
 
256
- const rewardCoinName = query.utils.getSpoolRewardCoinName(marketCoinName);
249
+ const rewardCoinName = query.utils.getSpoolRewardCoinName();
257
250
  coinPrices = coinPrices || (await query.utils.getCoinPrices());
258
251
 
259
252
  const parsedSpoolObjects = parseSpoolObjects(requiredObjects);
@@ -286,10 +279,10 @@ export const getSpool = async (
286
279
  symbol: query.utils.parseSymbol(marketCoinName),
287
280
  coinType: query.utils.parseCoinType(coinName),
288
281
  marketCoinType: query.utils.parseMarketCoinType(coinName),
289
- rewardCoinType: isMarketCoin(rewardCoinName)
282
+ rewardCoinType: query.utils.isMarketCoin(rewardCoinName)
290
283
  ? query.utils.parseMarketCoinType(rewardCoinName)
291
284
  : query.utils.parseCoinType(rewardCoinName),
292
- sCoinType: query.utils.parseSCoinType(marketCoinName),
285
+ sCoinType: query.utils.parseSCoinType(marketCoinName) ?? '',
293
286
  coinDecimal: query.utils.getCoinDecimal(coinName),
294
287
  rewardCoinDecimal: query.utils.getCoinDecimal(rewardCoinName),
295
288
  coinPrice: coinPrices?.[coinName] ?? 0,
@@ -352,37 +345,37 @@ export const getStakeAccounts = async (
352
345
  }
353
346
  } while (hasNextPage);
354
347
 
355
- const stakeAccounts: StakeAccounts = SUPPORT_SPOOLS.reduce(
356
- (acc, stakeName) => {
357
- acc[stakeName] = [];
358
- return acc;
348
+ const stakeAccounts: StakeAccounts = [
349
+ ...utils.constants.whitelist.spool,
350
+ ].reduce((acc, stakeName) => {
351
+ acc[stakeName] = [];
352
+ return acc;
353
+ }, {} as StakeAccounts);
354
+
355
+ const stakeMarketCoinTypes: Record<string, string> = Object.keys(
356
+ stakeAccounts
357
+ ).reduce(
358
+ (types, stakeMarketCoinName) => {
359
+ const stakeCoinName = utils.parseCoinName<string>(stakeMarketCoinName);
360
+ const marketCoinType = utils.parseMarketCoinType(stakeCoinName);
361
+
362
+ types[stakeMarketCoinName as string] =
363
+ `${spoolObjectId}::spool_account::SpoolAccount<${marketCoinType}>`;
364
+ return types;
359
365
  },
360
- {} as StakeAccounts
366
+ {} as Record<string, string>
361
367
  );
362
368
 
363
- const stakeMarketCoinTypes: Record<SupportStakeMarketCoins, string> =
364
- Object.keys(stakeAccounts).reduce(
365
- (types, stakeMarketCoinName) => {
366
- const stakeCoinName =
367
- utils.parseCoinName<SupportStakeCoins>(stakeMarketCoinName);
368
- const marketCoinType = utils.parseMarketCoinType(stakeCoinName);
369
-
370
- types[stakeMarketCoinName as SupportStakeMarketCoins] =
371
- `${spoolObjectId}::spool_account::SpoolAccount<${marketCoinType}>`;
372
- return types;
373
- },
374
- {} as Record<SupportStakeMarketCoins, string>
375
- );
376
-
377
369
  // Reverse the mapping
378
- const reversedStakeMarketCoinTypes: Record<string, SupportStakeMarketCoins> =
379
- Object.entries(stakeMarketCoinTypes).reduce(
380
- (reversedTypes, [key, value]) => {
381
- reversedTypes[value] = key as SupportStakeMarketCoins;
382
- return reversedTypes;
383
- },
384
- {} as Record<string, SupportStakeMarketCoins>
385
- );
370
+ const reversedStakeMarketCoinTypes: Record<string, string> = Object.entries(
371
+ stakeMarketCoinTypes
372
+ ).reduce(
373
+ (reversedTypes, [key, value]) => {
374
+ reversedTypes[value] = key as string;
375
+ return reversedTypes;
376
+ },
377
+ {} as Record<string, string>
378
+ );
386
379
 
387
380
  for (const stakeObject of stakeObjectsResponse.map((ref) => ref.data)) {
388
381
  const id = stakeObject?.objectId;
@@ -396,10 +389,7 @@ export const getStakeAccounts = async (
396
389
  const points = Number(fields.points);
397
390
  const totalPoints = Number(fields.total_points);
398
391
 
399
- const stakeMarketCoinTypeMap: Record<
400
- SupportStakeMarketCoins,
401
- StakeAccounts[SupportStakeMarketCoins]
402
- > = {
392
+ const stakeMarketCoinTypeMap: Record<string, StakeAccounts[string]> = {
403
393
  sweth: stakeAccounts.sweth,
404
394
  ssui: stakeAccounts.ssui,
405
395
  swusdc: stakeAccounts.swusdc,
@@ -449,7 +439,7 @@ export const getStakePool = async (
449
439
  }: {
450
440
  utils: ScallopUtils;
451
441
  },
452
- marketCoinName: SupportStakeMarketCoins
442
+ marketCoinName: string
453
443
  ) => {
454
444
  const poolId = utils.address.get(`spool.pools.${marketCoinName}.id`);
455
445
  let stakePool: StakePool | undefined = undefined;
@@ -506,7 +496,7 @@ export const getStakeRewardPool = async (
506
496
  }: {
507
497
  utils: ScallopUtils;
508
498
  },
509
- marketCoinName: SupportStakeMarketCoins
499
+ marketCoinName: string
510
500
  ) => {
511
501
  const poolId = utils.address.get(
512
502
  `spool.pools.${marketCoinName}.rewardPoolId`
@@ -1,5 +1,4 @@
1
1
  import { ScallopUtils } from 'src/models';
2
- import { SupportPoolCoins } from 'src/types';
3
2
  import { z as zod } from 'zod';
4
3
 
5
4
  const supplyLimitZod = zod.object({
@@ -25,10 +24,7 @@ const supplyLimitKeyType = `0x6e641f0dca8aedab3101d047e96439178f16301bf0b57fe874
25
24
  * @param poolName
26
25
  * @returns supply limit (decimals included)
27
26
  */
28
- export const getSupplyLimit = async (
29
- utils: ScallopUtils,
30
- poolName: SupportPoolCoins
31
- ) => {
27
+ export const getSupplyLimit = async (utils: ScallopUtils, poolName: string) => {
32
28
  try {
33
29
  const poolCoinType = utils.parseCoinType(poolName).slice(2);
34
30
  const marketObject = utils.address.get('core.market');
@@ -43,7 +39,7 @@ export const getSupplyLimit = async (
43
39
  });
44
40
 
45
41
  const parsedData = supplyLimitZod.safeParse(object?.data?.content);
46
- if (!parsedData.success) return null;
42
+ if (!parsedData.success) return '0';
47
43
  return parsedData.data.fields.value;
48
44
  } catch (e: any) {
49
45
  console.error(`Error in getSupplyLimit for ${poolName}: ${e.message}`);
@@ -1,10 +1,6 @@
1
1
  import { SuiObjectResponse } from '@mysten/sui/client';
2
2
  import { ScallopAddress, ScallopUtils } from 'src/models';
3
- import {
4
- SupportAssetCoins,
5
- SupportOracleType,
6
- xOracleRuleType,
7
- } from 'src/types';
3
+ import { xOracleRuleType } from 'src/types';
8
4
 
9
5
  const PRIMARY_PRICE_UPDATE_POLICY =
10
6
  '0x56e48a141f20a3a6a6d3fc43e58b01fc63f756c08224870e7890c80ec9d2afee';
@@ -47,10 +43,6 @@ export const getPriceUpdatePolicies = async (
47
43
  };
48
44
  };
49
45
 
50
- // const PRIMARY_PRICE_UPDATE_POLICY_KEY =
51
- // '0x856d0930acc36780eda9ea47019c979ca6ad34fd36f158b181eb7350195acc00';
52
- // const SECONDARY_PRICE_UPDATE_POLICY_KEY =
53
- // '0x304d226734fa5e376423c9ff0f1d49aeb1e2572d4b617d31e11e2f69865b73ed';
54
46
  const PRIMARY_PRICE_UPDATE_POLICY_VECSET_ID =
55
47
  '0xc22c9d691ee4c780de09db91d8b487d863211ebf08720772144bcf716318826c';
56
48
  const SECONDARY_PRICE_UPDATE_POLICY_VECSET_ID =
@@ -59,7 +51,7 @@ const SECONDARY_PRICE_UPDATE_POLICY_VECSET_ID =
59
51
  export const getAssetOracles = async (
60
52
  utils: ScallopUtils,
61
53
  ruleType: xOracleRuleType
62
- ): Promise<Record<SupportAssetCoins, SupportOracleType[]> | null> => {
54
+ ): Promise<Record<string, string[]> | null> => {
63
55
  if (ruleType === 'primary' && !PRIMARY_PRICE_UPDATE_POLICY_VECSET_ID) {
64
56
  console.error('Primary price update policy vecset id is not set');
65
57
  return null;
@@ -69,17 +61,14 @@ export const getAssetOracles = async (
69
61
  return null;
70
62
  }
71
63
 
72
- const ruleTypeNameToOracleType: Record<string, SupportOracleType> = {
64
+ const ruleTypeNameToOracleType: Record<string, string> = {
73
65
  [`${utils.address.get('core.packages.pyth.object')}::rule::Rule`]: 'pyth',
74
66
  [`${utils.address.get('core.packages.supra.object')}::rule::Rule`]: 'supra',
75
67
  [`${utils.address.get('core.packages.switchboard.object')}::rule::Rule`]:
76
68
  'switchboard',
77
69
  };
78
70
 
79
- const assetPrimaryOracles = {} as Record<
80
- SupportAssetCoins,
81
- SupportOracleType[]
82
- >;
71
+ const assetPrimaryOracles = {} as Record<string, string[]>;
83
72
  let cursor = null;
84
73
  do {
85
74
  const response = await utils.cache.queryGetDynamicFields({
@@ -1,11 +1,5 @@
1
- import { SUPPORT_ORACLES } from '../constants';
2
- import type {
3
- SupportAssetCoins,
4
- SupportOracleType,
5
- SupportPackageType,
6
- SupportSCoin,
7
- SupportStakeMarketCoins,
8
- } from './constant';
1
+ const _SUPPORT_ORACLES = ['supra', 'switchboard', 'pyth'] as const;
2
+ type SupportOracleType = (typeof _SUPPORT_ORACLES)[number];
9
3
 
10
4
  export interface AddressesInterface {
11
5
  core: {
@@ -18,7 +12,7 @@ export interface AddressesInterface {
18
12
  obligationAccessStore: string;
19
13
  coins: Partial<
20
14
  Record<
21
- SupportAssetCoins,
15
+ string,
22
16
  {
23
17
  id: string;
24
18
  treasury: string;
@@ -27,11 +21,11 @@ export interface AddressesInterface {
27
21
  symbol: string;
28
22
  decimals: number;
29
23
  oracle: {
30
- [K in SupportOracleType]: K extends (typeof SUPPORT_ORACLES)[0]
24
+ [K in SupportOracleType]: K extends (typeof _SUPPORT_ORACLES)[0]
31
25
  ? string
32
- : K extends (typeof SUPPORT_ORACLES)[1]
26
+ : K extends (typeof _SUPPORT_ORACLES)[1]
33
27
  ? string
34
- : K extends (typeof SUPPORT_ORACLES)[2]
28
+ : K extends (typeof _SUPPORT_ORACLES)[2]
35
29
  ? {
36
30
  feed: string;
37
31
  feedObject: string;
@@ -42,18 +36,18 @@ export interface AddressesInterface {
42
36
  >
43
37
  >;
44
38
  oracles: {
45
- [K in SupportOracleType]: K extends (typeof SUPPORT_ORACLES)[0]
39
+ [K in SupportOracleType]: K extends (typeof _SUPPORT_ORACLES)[0]
46
40
  ? {
47
41
  registry: string;
48
42
  registryCap: string;
49
43
  holder: string;
50
44
  }
51
- : K extends (typeof SUPPORT_ORACLES)[1]
45
+ : K extends (typeof _SUPPORT_ORACLES)[1]
52
46
  ? {
53
47
  registry: string;
54
48
  registryCap: string;
55
49
  }
56
- : K extends (typeof SUPPORT_ORACLES)[2]
50
+ : K extends (typeof _SUPPORT_ORACLES)[2]
57
51
  ? {
58
52
  registry: string;
59
53
  registryCap: string;
@@ -65,7 +59,7 @@ export interface AddressesInterface {
65
59
  } & { xOracle: string; xOracleCap: string };
66
60
  packages: Partial<
67
61
  Record<
68
- SupportPackageType,
62
+ string,
69
63
  {
70
64
  id: string;
71
65
  object?: string;
@@ -81,7 +75,7 @@ export interface AddressesInterface {
81
75
  config: string;
82
76
  pools: Partial<
83
77
  Record<
84
- SupportStakeMarketCoins,
78
+ string,
85
79
  {
86
80
  id: string;
87
81
  rewardPoolId: string;
@@ -130,7 +124,7 @@ export interface AddressesInterface {
130
124
  id: string;
131
125
  coins: Partial<
132
126
  Record<
133
- SupportSCoin,
127
+ string,
134
128
  {
135
129
  coinType: string;
136
130
  symbol: string;
@@ -4,7 +4,6 @@ import type {
4
4
  } from '@scallop-io/sui-kit';
5
5
  import type { TransactionResult } from '@mysten/sui/transactions';
6
6
  import type { ScallopBuilder } from '../../models';
7
- import type { SupportBorrowIncentiveRewardCoins } from '../constant';
8
7
 
9
8
  export type BorrowIncentiveIds = {
10
9
  borrowIncentivePkg: string;
@@ -32,7 +31,7 @@ export type BorrowIncentiveNormalMethods = {
32
31
  claimBorrowIncentive: (
33
32
  obligation: SuiObjectArg,
34
33
  obligationKey: SuiObjectArg,
35
- rewardType: SupportBorrowIncentiveRewardCoins
34
+ rewardType: string
36
35
  ) => TransactionResult;
37
36
  deactivateBoost: (obligation: SuiObjectArg, veScaKey: SuiObjectArg) => void;
38
37
  };
@@ -52,7 +51,7 @@ export type BorrowIncentiveQuickMethods = {
52
51
  obligationKey?: string
53
52
  ): Promise<void>;
54
53
  claimBorrowIncentiveQuick(
55
- rewardType: SupportBorrowIncentiveRewardCoins,
54
+ rewardType: string,
56
55
  obligation?: string,
57
56
  obligationKey?: string
58
57
  ): Promise<TransactionResult>;
@@ -5,11 +5,6 @@ import type {
5
5
  } from '@scallop-io/sui-kit';
6
6
  import type { Argument, TransactionResult } from '@mysten/sui/transactions';
7
7
  import type { ScallopBuilder } from '../../models';
8
- import type {
9
- SupportCollateralCoins,
10
- SupportPoolCoins,
11
- SupportAssetCoins,
12
- } from '../constant';
13
8
  import { SuiTxBlockWithSpool } from '.';
14
9
 
15
10
  export type CoreIds = {
@@ -38,41 +33,41 @@ export type CoreNormalMethods = {
38
33
  addCollateral: (
39
34
  obligation: SuiObjectArg,
40
35
  coin: SuiObjectArg,
41
- collateralCoinName: SupportCollateralCoins
36
+ collateralCoinName: string
42
37
  // ) => Promise<void>;
43
38
  ) => void;
44
39
  takeCollateral: (
45
40
  obligation: SuiObjectArg,
46
41
  obligationKey: SuiObjectArg,
47
42
  amount: number,
48
- collateralCoinName: SupportCollateralCoins
43
+ collateralCoinName: string
49
44
  // ) => Promise<TransactionResult>;
50
45
  ) => TransactionResult;
51
46
  deposit: (
52
47
  coin: SuiObjectArg,
53
- poolCoinName: SupportPoolCoins
48
+ poolCoinName: string
54
49
  // ) => Promise<TransactionResult>;
55
50
  ) => TransactionResult;
56
51
  depositEntry: (
57
52
  coin: SuiObjectArg,
58
- poolCoinName: SupportPoolCoins
53
+ poolCoinName: string
59
54
  // ) => Promise<TransactionResult>;
60
55
  ) => TransactionResult;
61
56
  withdraw: (
62
57
  marketCoin: SuiObjectArg,
63
- poolCoinName: SupportPoolCoins
58
+ poolCoinName: string
64
59
  // ) => Promise<TransactionResult>;
65
60
  ) => TransactionResult;
66
61
  withdrawEntry: (
67
62
  marketCoin: SuiObjectArg,
68
- poolCoinName: SupportPoolCoins
63
+ poolCoinName: string
69
64
  // ) => Promise<TransactionResult>;
70
65
  ) => TransactionResult;
71
66
  borrow: (
72
67
  obligation: SuiObjectArg,
73
68
  obligationKey: SuiObjectArg,
74
69
  amount: number,
75
- poolCoinName: SupportPoolCoins
70
+ poolCoinName: string
76
71
  // ) => Promise<TransactionResult>;
77
72
  ) => TransactionResult;
78
73
  borrowWithReferral: (
@@ -80,31 +75,31 @@ export type CoreNormalMethods = {
80
75
  obligationKey: SuiObjectArg,
81
76
  borrowReferral: SuiObjectArg,
82
77
  amount: number | SuiTxArg,
83
- poolCoinName: SupportPoolCoins
78
+ poolCoinName: string
84
79
  // ) => Promise<TransactionResult>;
85
80
  ) => TransactionResult;
86
81
  borrowEntry: (
87
82
  obligation: SuiObjectArg,
88
83
  obligationKey: SuiObjectArg,
89
84
  amount: number,
90
- poolCoinName: SupportPoolCoins
85
+ poolCoinName: string
91
86
  // ) => Promise<TransactionResult>;
92
87
  ) => TransactionResult;
93
88
  repay: (
94
89
  obligation: SuiObjectArg,
95
90
  coin: SuiObjectArg,
96
- poolCoinName: SupportPoolCoins
91
+ poolCoinName: string
97
92
  // ) => Promise<void>;
98
93
  ) => void;
99
94
  borrowFlashLoan: (
100
95
  amount: number | SuiTxArg,
101
- poolCoinName: SupportPoolCoins
96
+ poolCoinName: string
102
97
  // ) => Promise<TransactionResult>;
103
98
  ) => TransactionResult;
104
99
  repayFlashLoan: (
105
100
  coin: SuiObjectArg,
106
101
  loan: SuiObjectArg,
107
- poolCoinName: SupportPoolCoins
102
+ poolCoinName: string
108
103
  // ) => Promise<void>;
109
104
  ) => void;
110
105
  };
@@ -112,45 +107,43 @@ export type CoreNormalMethods = {
112
107
  export type CoreQuickMethods = {
113
108
  addCollateralQuick: (
114
109
  amount: number,
115
- collateralCoinName: SupportCollateralCoins,
110
+ collateralCoinName: string,
116
111
  obligationId?: SuiObjectArg
117
112
  ) => Promise<void>;
118
113
  takeCollateralQuick: (
119
114
  amount: number,
120
- collateralCoinName: SupportCollateralCoins,
115
+ collateralCoinName: string,
121
116
  obligationId?: SuiObjectArg,
122
117
  obligationKey?: SuiObjectArg
123
118
  ) => Promise<TransactionResult>;
124
119
  borrowQuick: (
125
120
  amount: number,
126
- poolCoinName: SupportPoolCoins,
121
+ poolCoinName: string,
127
122
  obligationId?: SuiObjectArg,
128
123
  obligationKey?: SuiObjectArg
129
124
  ) => Promise<TransactionResult>;
130
125
  borrowWithReferralQuick: (
131
126
  amount: number,
132
- poolCoinName: SupportPoolCoins,
127
+ poolCoinName: string,
133
128
  borrowReferral: SuiObjectArg,
134
129
  obligationId?: SuiObjectArg,
135
130
  obligationKey?: SuiObjectArg
136
131
  ) => Promise<TransactionResult>;
137
132
  depositQuick: (
138
133
  amount: number,
139
- poolCoinName: SupportPoolCoins,
134
+ poolCoinName: string,
140
135
  returnSCoin?: boolean
141
136
  ) => Promise<TransactionResult>;
142
137
  withdrawQuick: (
143
138
  amount: number,
144
- poolCoinName: SupportPoolCoins
139
+ poolCoinName: string
145
140
  ) => Promise<TransactionResult>;
146
141
  repayQuick: (
147
142
  amount: number,
148
- poolCoinName: SupportPoolCoins,
143
+ poolCoinName: string,
149
144
  obligationId?: SuiObjectArg
150
145
  ) => Promise<void>;
151
- updateAssetPricesQuick: (
152
- assetCoinNames?: SupportAssetCoins[]
153
- ) => Promise<void>;
146
+ updateAssetPricesQuick: (assetCoinNames?: string[]) => Promise<void>;
154
147
  };
155
148
 
156
149
  export type SuiTxBlockWithCoreNormalMethods = SuiKitTxBlock &
@@ -5,7 +5,6 @@ import type { VeScaTxBlock } from './vesca';
5
5
  import type { ReferralTxBlock } from './referral';
6
6
  import { LoyaltyProgramTxBlock } from './loyaltyProgram';
7
7
  import { SCoinTxBlock } from './sCoin';
8
- import { SupportAssetCoins } from '../constant';
9
8
 
10
9
  export type * from './core';
11
10
  export type * from './spool';
@@ -23,7 +22,7 @@ export type SuiTxBlockWithSCoin = BaseScallopTxBlock & SCoinTxBlock;
23
22
  export type SuiTxBlockWithSpool = SuiTxBlockWithSCoin & SpoolTxBlock;
24
23
  export type ScallopTxBlock = SuiTxBlockWithSpool & CoreTxBlock;
25
24
 
26
- export type SelectCoinReturnType<T extends SupportAssetCoins> = T extends 'sui'
25
+ export type SelectCoinReturnType<T extends string> = T extends 'sui'
27
26
  ? {
28
27
  takeCoin: NestedResult;
29
28
  }
@@ -4,7 +4,6 @@ import {
4
4
  SuiTxBlock as SuiKitTxBlock,
5
5
  } from '@scallop-io/sui-kit';
6
6
  import { ScallopBuilder } from 'src/models';
7
- import { SupportPoolCoins } from '../constant';
8
7
 
9
8
  export type ReferralIds = {
10
9
  referralPgkId: string;
@@ -17,21 +16,18 @@ export type ReferralIds = {
17
16
 
18
17
  export type ReferralNormalMethods = {
19
18
  bindToReferral: (veScaKeyId: string) => void;
20
- claimReferralTicket: (poolCoinName: SupportPoolCoins) => TransactionResult;
21
- burnReferralTicket: (
22
- ticket: SuiObjectArg,
23
- poolCoinName: SupportPoolCoins
24
- ) => void;
19
+ claimReferralTicket: (poolCoinName: string) => TransactionResult;
20
+ burnReferralTicket: (ticket: SuiObjectArg, poolCoinName: string) => void;
25
21
  claimReferralRevenue: (
26
22
  veScaKey: SuiObjectArg,
27
- poolCoinName: SupportPoolCoins
23
+ poolCoinName: string
28
24
  ) => TransactionResult;
29
25
  };
30
26
 
31
27
  export type ReferralQuickMethods = {
32
28
  claimReferralRevenueQuick: (
33
29
  veScaKey: SuiObjectArg,
34
- coinNames: SupportPoolCoins[]
30
+ coinNames: string[]
35
31
  ) => Promise<void>;
36
32
  };
37
33
 
@@ -3,7 +3,6 @@ import {
3
3
  SuiTxBlock as SuiKitTxBlock,
4
4
  TransactionResult,
5
5
  } from '@scallop-io/sui-kit';
6
- import { SupportSCoin } from '../constant';
7
6
  import { ScallopBuilder } from 'src/models';
8
7
  import { BaseScallopTxBlock } from '.';
9
8
 
@@ -19,7 +18,7 @@ export type sCoinNormalMethods = {
19
18
  * @returns
20
19
  */
21
20
  mintSCoin: (
22
- marketCoinName: SupportSCoin,
21
+ marketCoinName: string,
23
22
  marketCoin: SuiObjectArg
24
23
  ) => TransactionResult;
25
24
  /**
@@ -28,19 +27,16 @@ export type sCoinNormalMethods = {
28
27
  * @param sCoin
29
28
  * @returns
30
29
  */
31
- burnSCoin: (
32
- sCoinName: SupportSCoin,
33
- sCoin: SuiObjectArg
34
- ) => TransactionResult; // returns marketCoin
30
+ burnSCoin: (sCoinName: string, sCoin: SuiObjectArg) => TransactionResult; // returns marketCoin
35
31
  };
36
32
 
37
33
  export type sCoinQuickMethods = {
38
34
  mintSCoinQuick: (
39
- marketCoinName: SupportSCoin,
35
+ marketCoinName: string,
40
36
  amount: number
41
37
  ) => Promise<TransactionResult>;
42
38
  burnSCoinQuick: (
43
- sCoinName: SupportSCoin,
39
+ sCoinName: string,
44
40
  amount: number
45
41
  ) => Promise<TransactionResult>;
46
42
  };