@scallop-io/sui-scallop-sdk 1.5.3 → 2.0.0-alpha.10

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 (66) hide show
  1. package/dist/index.d.mts +509 -602
  2. package/dist/index.d.ts +509 -602
  3. package/dist/index.js +28 -59
  4. package/dist/index.mjs +7 -7
  5. package/package.json +1 -1
  6. package/src/builders/coreBuilder.ts +33 -33
  7. package/src/builders/loyaltyProgramBuilder.ts +5 -3
  8. package/src/builders/{oracle.ts → oracles/index.ts} +48 -60
  9. package/src/builders/oracles/pyth.ts +44 -0
  10. package/src/builders/oracles/switchboard.ts +270 -0
  11. package/src/builders/referralBuilder.ts +5 -9
  12. package/src/builders/sCoinBuilder.ts +9 -8
  13. package/src/builders/spoolBuilder.ts +4 -6
  14. package/src/constants/common.ts +114 -126
  15. package/src/constants/index.ts +0 -5
  16. package/src/constants/pyth.ts +25 -34
  17. package/src/constants/queryKeys.ts +2 -0
  18. package/src/constants/testAddress.ts +36 -487
  19. package/src/models/index.ts +1 -0
  20. package/src/models/scallop.ts +23 -19
  21. package/src/models/scallopAddress.ts +17 -5
  22. package/src/models/scallopBuilder.ts +36 -41
  23. package/src/models/scallopCache.ts +3 -3
  24. package/src/models/scallopClient.ts +93 -98
  25. package/src/models/scallopConstants.ts +399 -0
  26. package/src/models/scallopIndexer.ts +11 -24
  27. package/src/models/scallopQuery.ts +76 -79
  28. package/src/models/scallopUtils.ts +126 -250
  29. package/src/queries/borrowIncentiveQuery.ts +25 -58
  30. package/src/queries/borrowLimitQuery.ts +3 -6
  31. package/src/queries/coreQuery.ts +98 -114
  32. package/src/queries/flashloanFeeQuery.ts +86 -0
  33. package/src/queries/index.ts +1 -0
  34. package/src/queries/isolatedAssetQuery.ts +12 -11
  35. package/src/queries/poolAddressesQuery.ts +211 -117
  36. package/src/queries/portfolioQuery.ts +60 -70
  37. package/src/queries/priceQuery.ts +16 -22
  38. package/src/queries/sCoinQuery.ts +15 -16
  39. package/src/queries/spoolQuery.ts +49 -59
  40. package/src/queries/supplyLimitQuery.ts +2 -6
  41. package/src/queries/switchboardQuery.ts +64 -0
  42. package/src/queries/xOracleQuery.ts +29 -32
  43. package/src/types/address.ts +21 -19
  44. package/src/types/builder/borrowIncentive.ts +2 -3
  45. package/src/types/builder/core.ts +20 -27
  46. package/src/types/builder/index.ts +1 -2
  47. package/src/types/builder/referral.ts +4 -8
  48. package/src/types/builder/sCoin.ts +4 -8
  49. package/src/types/builder/spool.ts +7 -10
  50. package/src/types/constant/common.ts +44 -49
  51. package/src/types/constant/enum.ts +15 -27
  52. package/src/types/constant/xOracle.ts +3 -2
  53. package/src/types/model.ts +49 -28
  54. package/src/types/query/borrowIncentive.ts +7 -24
  55. package/src/types/query/core.ts +8 -18
  56. package/src/types/query/portfolio.ts +9 -17
  57. package/src/types/query/spool.ts +5 -11
  58. package/src/types/utils.ts +1 -21
  59. package/src/utils/core.ts +1 -1
  60. package/src/utils/query.ts +15 -23
  61. package/src/utils/util.ts +6 -84
  62. package/src/constants/coinGecko.ts +0 -34
  63. package/src/constants/enum.ts +0 -268
  64. package/src/constants/flashloan.ts +0 -18
  65. package/src/constants/poolAddress.ts +0 -898
  66. package/src/models/scallopPrice.ts +0 -0
@@ -1,11 +1,5 @@
1
1
  import { normalizeSuiAddress } from '@mysten/sui/utils';
2
2
  import { SuiKit } from '@scallop-io/sui-kit';
3
- import {
4
- ADDRESS_ID,
5
- SUPPORT_BORROW_INCENTIVE_POOLS,
6
- SUPPORT_SCOIN,
7
- SUPPORT_SPOOLS,
8
- } from '../constants';
9
3
  import { ScallopAddress } from './scallopAddress';
10
4
  import { ScallopUtils } from './scallopUtils';
11
5
  import { ScallopBuilder } from './scallopBuilder';
@@ -21,17 +15,12 @@ import type { SuiObjectArg } from '@scallop-io/sui-kit';
21
15
  import type {
22
16
  ScallopClientFnReturnType,
23
17
  ScallopClientParams,
24
- SupportPoolCoins,
25
- SupportCollateralCoins,
26
- SupportAssetCoins,
27
- SupportStakeCoins,
28
- SupportStakeMarketCoins,
29
18
  ScallopTxBlock,
30
- SupportSCoin,
31
19
  ScallopClientVeScaReturnType,
32
20
  ScallopClientInstanceParams,
33
21
  } from '../types';
34
22
  import { newSuiKit } from './suiKit';
23
+ import { ScallopConstants } from './scallopConstants';
35
24
 
36
25
  /**
37
26
  * @description
@@ -50,6 +39,7 @@ export class ScallopClient {
50
39
 
51
40
  public suiKit: SuiKit;
52
41
  public address: ScallopAddress;
42
+ public constants: ScallopConstants;
53
43
  public builder: ScallopBuilder;
54
44
  public query: ScallopQuery;
55
45
  public utils: ScallopUtils;
@@ -57,7 +47,7 @@ export class ScallopClient {
57
47
  public walletAddress: string;
58
48
 
59
49
  public constructor(
60
- params: ScallopClientParams = {},
50
+ params: ScallopClientParams,
61
51
  instance?: ScallopClientInstanceParams
62
52
  ) {
63
53
  this.params = params;
@@ -67,36 +57,42 @@ export class ScallopClient {
67
57
  params?.walletAddress ?? this.suiKit.currentAddress()
68
58
  );
69
59
 
70
- if (instance?.builder) {
71
- this.builder = instance.builder;
72
- this.query = this.builder.query;
73
- this.utils = this.query.utils;
74
- this.address = this.utils.address;
75
- this.cache = this.address.cache;
76
- } else {
77
- this.cache = new ScallopCache(this.params, {
60
+ this.cache =
61
+ instance?.builder?.cache ??
62
+ instance?.cache ??
63
+ new ScallopCache(this.params, {
78
64
  suiKit: this.suiKit,
79
65
  });
80
- this.address = new ScallopAddress(
81
- {
82
- id: params?.addressId ?? ADDRESS_ID,
83
- network: params?.networkType,
84
- forceInterface: params?.forceAddressesInterface,
85
- },
86
- {
87
- cache: this.cache,
88
- }
89
- );
90
- this.utils = new ScallopUtils(this.params, {
66
+
67
+ this.address =
68
+ instance?.builder?.address ??
69
+ new ScallopAddress(this.params, {
70
+ cache: this.cache,
71
+ });
72
+
73
+ this.constants =
74
+ instance?.builder?.constants ??
75
+ new ScallopConstants(this.params, {
91
76
  address: this.address,
92
77
  });
93
- this.query = new ScallopQuery(this.params, {
78
+
79
+ this.utils =
80
+ instance?.builder?.utils ??
81
+ new ScallopUtils(this.params, {
82
+ constants: this.constants,
83
+ });
84
+
85
+ this.query =
86
+ instance?.builder?.query ??
87
+ new ScallopQuery(this.params, {
94
88
  utils: this.utils,
95
89
  });
96
- this.builder = new ScallopBuilder(this.params, {
90
+
91
+ this.builder =
92
+ instance?.builder ??
93
+ new ScallopBuilder(this.params, {
97
94
  query: this.query,
98
95
  });
99
- }
100
96
  }
101
97
 
102
98
  /**
@@ -105,13 +101,13 @@ export class ScallopClient {
105
101
  * @param force - Whether to force initialization.
106
102
  */
107
103
  public async init(force: boolean = false) {
108
- if (force || !this.address.getAddresses()) {
109
- await this.address.read();
104
+ if (force || !this.constants.isInitialized) {
105
+ await this.constants.init();
110
106
  }
111
107
 
112
- await this.builder.init(force, this.address);
113
- await this.query.init(force, this.address);
114
- await this.utils.init(force, this.address);
108
+ await this.builder.init(force);
109
+ await this.query.init(force);
110
+ await this.utils.init(force);
115
111
  }
116
112
 
117
113
  /* ==================== Query Method ==================== */
@@ -179,10 +175,7 @@ export class ScallopClient {
179
175
  * @param ownerAddress - The owner address.
180
176
  * @return Stake accounts data.
181
177
  */
182
- async getStakeAccounts(
183
- stakeMarketCoinName: SupportStakeMarketCoins,
184
- ownerAddress?: string
185
- ) {
178
+ async getStakeAccounts(stakeMarketCoinName: string, ownerAddress?: string) {
186
179
  const owner = ownerAddress ?? this.walletAddress;
187
180
  return await this.query.getStakeAccounts(stakeMarketCoinName, owner);
188
181
  }
@@ -196,7 +189,7 @@ export class ScallopClient {
196
189
  * @param stakeMarketCoinName - Support stake market coin.
197
190
  * @return Stake pool data.
198
191
  */
199
- async getStakePool(stakeMarketCoinName: SupportStakeMarketCoins) {
192
+ async getStakePool(stakeMarketCoinName: string) {
200
193
  return await this.query.getStakePool(stakeMarketCoinName);
201
194
  }
202
195
 
@@ -209,7 +202,7 @@ export class ScallopClient {
209
202
  * @param stakeMarketCoinName - Support stake market coin.
210
203
  * @return Reward pool data.
211
204
  */
212
- async getStakeRewardPool(stakeMarketCoinName: SupportStakeMarketCoins) {
205
+ async getStakeRewardPool(stakeMarketCoinName: string) {
213
206
  return await this.query.getStakeRewardPool(stakeMarketCoinName);
214
207
  }
215
208
 
@@ -250,18 +243,18 @@ export class ScallopClient {
250
243
  * @return Transaction block response or transaction block.
251
244
  */
252
245
  public async depositCollateral(
253
- collateralCoinName: SupportCollateralCoins,
246
+ collateralCoinName: string,
254
247
  amount: number
255
248
  ): Promise<SuiTransactionBlockResponse>;
256
249
  public async depositCollateral<S extends boolean>(
257
- collateralCoinName: SupportCollateralCoins,
250
+ collateralCoinName: string,
258
251
  amount: number,
259
252
  sign?: S,
260
253
  obligationId?: string,
261
254
  walletAddress?: string
262
255
  ): Promise<ScallopClientFnReturnType<S>>;
263
256
  public async depositCollateral<S extends boolean>(
264
- collateralCoinName: SupportCollateralCoins,
257
+ collateralCoinName: string,
265
258
  amount: number,
266
259
  sign: S = true as S,
267
260
  obligationId?: string,
@@ -307,7 +300,7 @@ export class ScallopClient {
307
300
  * @return Transaction block response or transaction block.
308
301
  */
309
302
  public async withdrawCollateral<S extends boolean>(
310
- collateralCoinName: SupportCollateralCoins,
303
+ collateralCoinName: string,
311
304
  amount: number,
312
305
  sign: S = true as S,
313
306
  obligationId: string,
@@ -345,17 +338,17 @@ export class ScallopClient {
345
338
  * @return Transaction block response or transaction block.
346
339
  */
347
340
  public async deposit(
348
- poolCoinName: SupportPoolCoins,
341
+ poolCoinName: string,
349
342
  amount: number
350
343
  ): Promise<SuiTransactionBlockResponse>;
351
344
  public async deposit<S extends boolean>(
352
- poolCoinName: SupportPoolCoins,
345
+ poolCoinName: string,
353
346
  amount: number,
354
347
  sign?: S,
355
348
  walletAddress?: string
356
349
  ): Promise<ScallopClientFnReturnType<S>>;
357
350
  public async deposit<S extends boolean>(
358
- poolCoinName: SupportPoolCoins,
351
+ poolCoinName: string,
359
352
  amount: number,
360
353
  sign: S = true as S,
361
354
  walletAddress?: string
@@ -387,18 +380,18 @@ export class ScallopClient {
387
380
  * @return Transaction block response or transaction block.
388
381
  */
389
382
  public async depositAndStake(
390
- stakeCoinName: SupportStakeCoins,
383
+ stakeCoinName: string,
391
384
  amount: number
392
385
  ): Promise<SuiTransactionBlockResponse>;
393
386
  public async depositAndStake<S extends boolean>(
394
- stakeCoinName: SupportStakeCoins,
387
+ stakeCoinName: string,
395
388
  amount: number,
396
389
  sign?: S,
397
390
  stakeAccountId?: string,
398
391
  walletAddress?: string
399
392
  ): Promise<ScallopClientFnReturnType<S>>;
400
393
  public async depositAndStake<S extends boolean>(
401
- stakeCoinName: SupportStakeCoins,
394
+ stakeCoinName: string,
402
395
  amount: number,
403
396
  sign: S = true as S,
404
397
  stakeAccountId?: string,
@@ -409,7 +402,7 @@ export class ScallopClient {
409
402
  txBlock.setSender(sender);
410
403
 
411
404
  const stakeMarketCoinName =
412
- this.utils.parseMarketCoinName<SupportStakeMarketCoins>(stakeCoinName);
405
+ this.utils.parseMarketCoinName<string>(stakeCoinName);
413
406
  const stakeAccounts =
414
407
  await this.query.getStakeAccounts(stakeMarketCoinName);
415
408
  const targetStakeAccount = stakeAccountId ?? stakeAccounts[0]?.id;
@@ -446,17 +439,17 @@ export class ScallopClient {
446
439
  * @return Transaction block response or transaction block.
447
440
  */
448
441
  public async withdraw(
449
- poolCoinName: SupportPoolCoins,
442
+ poolCoinName: string,
450
443
  amount: number
451
444
  ): Promise<SuiTransactionBlockResponse>;
452
445
  public async withdraw<S extends boolean>(
453
- poolCoinName: SupportPoolCoins,
446
+ poolCoinName: string,
454
447
  amount: number,
455
448
  sign?: S,
456
449
  walletAddress?: string
457
450
  ): Promise<ScallopClientFnReturnType<S>>;
458
451
  public async withdraw<S extends boolean>(
459
- poolCoinName: SupportPoolCoins,
452
+ poolCoinName: string,
460
453
  amount: number,
461
454
  sign: S = true as S,
462
455
  walletAddress?: string
@@ -489,7 +482,7 @@ export class ScallopClient {
489
482
  * @return Transaction block response or transaction block.
490
483
  */
491
484
  public async borrow<S extends boolean>(
492
- poolCoinName: SupportPoolCoins,
485
+ poolCoinName: string,
493
486
  amount: number,
494
487
  sign: S = true as S,
495
488
  obligationId: string,
@@ -500,9 +493,7 @@ export class ScallopClient {
500
493
  const sender = walletAddress ?? this.walletAddress;
501
494
  txBlock.setSender(sender);
502
495
 
503
- const availableStake = (
504
- SUPPORT_BORROW_INCENTIVE_POOLS as readonly SupportPoolCoins[]
505
- ).includes(poolCoinName);
496
+ const availableStake = this.constants.whitelist.lending.has(poolCoinName);
506
497
  if (sign && availableStake) {
507
498
  await txBlock.unstakeObligationQuick(obligationId, obligationKey);
508
499
  }
@@ -537,7 +528,7 @@ export class ScallopClient {
537
528
  * @return Transaction block response or transaction block.
538
529
  */
539
530
  public async repay<S extends boolean>(
540
- poolCoinName: SupportPoolCoins,
531
+ poolCoinName: string,
541
532
  amount: number,
542
533
  sign: S = true as S,
543
534
  obligationId: string,
@@ -548,9 +539,7 @@ export class ScallopClient {
548
539
  const sender = walletAddress ?? this.walletAddress;
549
540
  txBlock.setSender(sender);
550
541
 
551
- const availableStake = (
552
- SUPPORT_BORROW_INCENTIVE_POOLS as readonly SupportPoolCoins[]
553
- ).includes(poolCoinName);
542
+ const availableStake = this.constants.whitelist.lending.has(poolCoinName);
554
543
  if (sign && availableStake) {
555
544
  await txBlock.unstakeObligationQuick(obligationId, obligationKey);
556
545
  }
@@ -578,7 +567,7 @@ export class ScallopClient {
578
567
  * @return Transaction block response or transaction block.
579
568
  */
580
569
  public async flashLoan(
581
- poolCoinName: SupportPoolCoins,
570
+ poolCoinName: string,
582
571
  amount: number,
583
572
  callback: (
584
573
  txBlock: ScallopTxBlock,
@@ -586,7 +575,7 @@ export class ScallopClient {
586
575
  ) => SuiObjectArg
587
576
  ): Promise<SuiTransactionBlockResponse>;
588
577
  public async flashLoan<S extends boolean>(
589
- poolCoinName: SupportPoolCoins,
578
+ poolCoinName: string,
590
579
  amount: number,
591
580
  callback: (
592
581
  txBlock: ScallopTxBlock,
@@ -596,7 +585,7 @@ export class ScallopClient {
596
585
  walletAddress?: string
597
586
  ): Promise<ScallopClientFnReturnType<S>>;
598
587
  public async flashLoan<S extends boolean>(
599
- poolCoinName: SupportPoolCoins,
588
+ poolCoinName: string,
600
589
  amount: number,
601
590
  callback: (
602
591
  txBlock: ScallopTxBlock,
@@ -630,15 +619,15 @@ export class ScallopClient {
630
619
  * @return Transaction block response or transaction block.
631
620
  */
632
621
  public async createStakeAccount(
633
- marketCoinName: SupportStakeMarketCoins
622
+ marketCoinName: string
634
623
  ): Promise<SuiTransactionBlockResponse>;
635
624
  public async createStakeAccount<S extends boolean>(
636
- marketCoinName: SupportStakeMarketCoins,
625
+ marketCoinName: string,
637
626
  sign?: S,
638
627
  walletAddress?: string
639
628
  ): Promise<ScallopClientFnReturnType<S>>;
640
629
  public async createStakeAccount<S extends boolean>(
641
- marketCoinName: SupportStakeMarketCoins,
630
+ marketCoinName: string,
642
631
  sign: S = true as S,
643
632
  walletAddress?: string
644
633
  ): Promise<ScallopClientFnReturnType<S>> {
@@ -669,18 +658,18 @@ export class ScallopClient {
669
658
  * @return Transaction block response or transaction block.
670
659
  */
671
660
  public async stake(
672
- stakeMarketCoinName: SupportStakeMarketCoins,
661
+ stakeMarketCoinName: string,
673
662
  amount: number
674
663
  ): Promise<SuiTransactionBlockResponse>;
675
664
  public async stake<S extends boolean>(
676
- stakeMarketCoinName: SupportStakeMarketCoins,
665
+ stakeMarketCoinName: string,
677
666
  amount: number,
678
667
  sign?: S,
679
668
  stakeAccountId?: string,
680
669
  walletAddress?: string
681
670
  ): Promise<ScallopClientFnReturnType<S>>;
682
671
  public async stake<S extends boolean>(
683
- stakeMarketCoinName: SupportStakeMarketCoins,
672
+ stakeMarketCoinName: string,
684
673
  amount: number,
685
674
  sign: S = true as S,
686
675
  stakeAccountId?: string,
@@ -721,18 +710,18 @@ export class ScallopClient {
721
710
  * @return Transaction block response or transaction block.
722
711
  */
723
712
  public async unstake(
724
- stakeMarketCoinName: SupportStakeMarketCoins,
713
+ stakeMarketCoinName: string,
725
714
  amount: number
726
715
  ): Promise<SuiTransactionBlockResponse>;
727
716
  public async unstake<S extends boolean>(
728
- stakeMarketCoinName: SupportStakeMarketCoins,
717
+ stakeMarketCoinName: string,
729
718
  amount: number,
730
719
  sign?: S,
731
720
  stakeAccountId?: string,
732
721
  walletAddress?: string
733
722
  ): Promise<ScallopClientFnReturnType<S>>;
734
723
  public async unstake<S extends boolean>(
735
- stakeMarketCoinName: SupportStakeMarketCoins,
724
+ stakeMarketCoinName: string,
736
725
  amount: number,
737
726
  sign: S = true as S,
738
727
  stakeAccountId?: string,
@@ -749,11 +738,15 @@ export class ScallopClient {
749
738
  );
750
739
 
751
740
  if (sCoin) {
741
+ const sCoinType = this.utils.parseSCoinType(stakeMarketCoinName);
742
+ if (!sCoinType)
743
+ throw new Error(`Invalid sCoin type: ${stakeMarketCoinName}`);
744
+
752
745
  // merge to existing sCoins if exist
753
746
  await this.utils.mergeSimilarCoins(
754
747
  txBlock,
755
748
  sCoin,
756
- this.utils.parseSCoinType(stakeMarketCoinName),
749
+ sCoinType,
757
750
  requireSender(txBlock)
758
751
  );
759
752
  }
@@ -780,18 +773,18 @@ export class ScallopClient {
780
773
  * @return Transaction block response or transaction block.
781
774
  */
782
775
  public async unstakeAndWithdraw(
783
- stakeMarketCoinName: SupportStakeMarketCoins,
776
+ stakeMarketCoinName: string,
784
777
  amount: number
785
778
  ): Promise<SuiTransactionBlockResponse>;
786
779
  public async unstakeAndWithdraw<S extends boolean>(
787
- stakeMarketCoinName: SupportStakeMarketCoins,
780
+ stakeMarketCoinName: string,
788
781
  amount: number,
789
782
  sign?: S,
790
783
  stakeAccountId?: string,
791
784
  walletAddress?: string
792
785
  ): Promise<ScallopClientFnReturnType<S>>;
793
786
  public async unstakeAndWithdraw<S extends boolean>(
794
- stakeMarketCoinName: SupportStakeMarketCoins,
787
+ stakeMarketCoinName: string,
795
788
  amount: number,
796
789
  sign: S = true as S,
797
790
  stakeAccountId?: string,
@@ -807,8 +800,7 @@ export class ScallopClient {
807
800
  stakeAccountId,
808
801
  false
809
802
  );
810
- const stakeCoinName =
811
- this.utils.parseCoinName<SupportStakeCoins>(stakeMarketCoinName);
803
+ const stakeCoinName = this.utils.parseCoinName(stakeMarketCoinName);
812
804
 
813
805
  if (stakeMarketCoin) {
814
806
  const coin = txBlock.withdraw(stakeMarketCoin, stakeCoinName);
@@ -844,16 +836,16 @@ export class ScallopClient {
844
836
  * @return Transaction block response or transaction block.
845
837
  */
846
838
  public async claim(
847
- stakeMarketCoinName: SupportStakeMarketCoins
839
+ stakeMarketCoinName: string
848
840
  ): Promise<SuiTransactionBlockResponse>;
849
841
  public async claim<S extends boolean>(
850
- stakeMarketCoinName: SupportStakeMarketCoins,
842
+ stakeMarketCoinName: string,
851
843
  sign?: S,
852
844
  stakeAccountId?: string,
853
845
  walletAddress?: string
854
846
  ): Promise<ScallopClientFnReturnType<S>>;
855
847
  public async claim<S extends boolean>(
856
- stakeMarketCoinName: SupportStakeMarketCoins,
848
+ stakeMarketCoinName: string,
857
849
  sign: S = true as S,
858
850
  stakeAccountId?: string,
859
851
  walletAddress?: string
@@ -964,6 +956,7 @@ export class ScallopClient {
964
956
  await this.query.getObligationAccount(obligationId);
965
957
  if (!obligationAccount) throw new Error('Obligation not found');
966
958
  const rewardCoinNames = Object.values(obligationAccount.borrowIncentives)
959
+ .filter((t): t is NonNullable<typeof t> => !!t)
967
960
  .flatMap(({ rewards }) =>
968
961
  rewards.filter(({ availableClaimAmount }) => availableClaimAmount > 0)
969
962
  )
@@ -1015,7 +1008,7 @@ export class ScallopClient {
1015
1008
 
1016
1009
  const toTransfer: SuiObjectArg[] = [];
1017
1010
  await Promise.all(
1018
- SUPPORT_SCOIN.map(async (sCoinName) => {
1011
+ [...this.constants.whitelist.scoin].map(async (sCoinName) => {
1019
1012
  /**
1020
1013
  * First check marketCoin inside mini wallet
1021
1014
  * Then check stakedMarketCoin inside spool
@@ -1027,7 +1020,7 @@ export class ScallopClient {
1027
1020
  try {
1028
1021
  const marketCoins = await this.utils.selectCoins(
1029
1022
  Number.MAX_SAFE_INTEGER,
1030
- this.utils.parseMarketCoinType(sCoinName as SupportSCoin),
1023
+ this.utils.parseMarketCoinType(sCoinName as string),
1031
1024
  this.walletAddress
1032
1025
  ); // throw error no coins found
1033
1026
 
@@ -1046,26 +1039,28 @@ export class ScallopClient {
1046
1039
  if (toDestroyMarketCoin) {
1047
1040
  // mint new sCoin
1048
1041
  const sCoin = txBlock.mintSCoin(
1049
- sCoinName as SupportSCoin,
1042
+ sCoinName as string,
1050
1043
  toDestroyMarketCoin
1051
1044
  );
1052
1045
 
1046
+ const sCoinType = this.utils.parseSCoinType(sCoinName as string);
1047
+ if (!sCoinType) throw new Error('Invalid sCoin type');
1053
1048
  // Merge with existing sCoin
1054
1049
  await this.utils.mergeSimilarCoins(
1055
1050
  txBlock,
1056
1051
  sCoin,
1057
- this.utils.parseSCoinType(sCoinName as SupportSCoin),
1052
+ sCoinType,
1058
1053
  requireSender(txBlock)
1059
1054
  );
1060
1055
  sCoins.push(sCoin);
1061
1056
  }
1062
1057
  if (includeStakePool) {
1063
1058
  // check for staked market coin in spool
1064
- if (SUPPORT_SPOOLS.includes(sCoinName as SupportStakeMarketCoins)) {
1059
+ if (this.constants.whitelist.spool.has(sCoinName as string)) {
1065
1060
  try {
1066
1061
  const sCoin = await txBlock.unstakeQuick(
1067
1062
  Number.MAX_SAFE_INTEGER,
1068
- sCoinName as SupportStakeMarketCoins
1063
+ sCoinName as string
1069
1064
  );
1070
1065
  if (sCoin) {
1071
1066
  sCoins.push(sCoin);
@@ -1178,17 +1173,17 @@ export class ScallopClient {
1178
1173
  * @return Transaction block response or transaction block.
1179
1174
  */
1180
1175
  public async mintTestCoin(
1181
- assetCoinName: Exclude<SupportAssetCoins, 'sui'>,
1176
+ assetCoinName: Exclude<string, 'sui'>,
1182
1177
  amount: number
1183
1178
  ): Promise<SuiTransactionBlockResponse>;
1184
1179
  public async mintTestCoin<S extends boolean>(
1185
- assetCoinName: Exclude<SupportAssetCoins, 'sui'>,
1180
+ assetCoinName: Exclude<string, 'sui'>,
1186
1181
  amount: number,
1187
1182
  sign?: S,
1188
1183
  receiveAddress?: string
1189
1184
  ): Promise<ScallopClientFnReturnType<S>>;
1190
1185
  public async mintTestCoin<S extends boolean>(
1191
- assetCoinName: Exclude<SupportAssetCoins, 'sui'>,
1186
+ assetCoinName: Exclude<string, 'sui'>,
1192
1187
  amount: number,
1193
1188
  sign: S = true as S,
1194
1189
  receiveAddress?: string