@scallop-io/sui-scallop-sdk 2.0.13-merge-split-ve-sca-alpha.5 → 2.1.0

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 (55) hide show
  1. package/dist/index.d.mts +622 -697
  2. package/dist/index.d.ts +622 -697
  3. package/dist/index.js +32 -33
  4. package/dist/index.mjs +10 -10
  5. package/package.json +8 -18
  6. package/src/builders/borrowIncentiveBuilder.ts +9 -21
  7. package/src/builders/coreBuilder.ts +2 -2
  8. package/src/builders/index.ts +2 -2
  9. package/src/builders/oracles/index.ts +2 -3
  10. package/src/builders/oracles/pyth.ts +2 -2
  11. package/src/builders/spoolBuilder.ts +2 -2
  12. package/src/builders/vescaBuilder.ts +14 -132
  13. package/src/constants/queryKeys.ts +29 -54
  14. package/src/constants/testAddress.ts +6 -12
  15. package/src/index.ts +11 -1
  16. package/src/models/index.ts +11 -9
  17. package/src/models/interface.ts +36 -0
  18. package/src/models/scallop.ts +38 -133
  19. package/src/models/scallopAddress.ts +127 -142
  20. package/src/models/scallopAxios.ts +185 -0
  21. package/src/models/scallopBuilder.ts +45 -75
  22. package/src/models/scallopClient.ts +124 -154
  23. package/src/models/scallopConstants.ts +248 -323
  24. package/src/models/scallopIndexer.ts +54 -98
  25. package/src/models/scallopQuery.ts +145 -190
  26. package/src/models/scallopQueryClient.ts +29 -0
  27. package/src/models/scallopSuiKit.ts +432 -0
  28. package/src/models/scallopUtils.ts +260 -164
  29. package/src/queries/borrowIncentiveQuery.ts +28 -16
  30. package/src/queries/borrowLimitQuery.ts +1 -1
  31. package/src/queries/coreQuery.ts +148 -107
  32. package/src/queries/flashloanFeeQuery.ts +12 -6
  33. package/src/queries/index.ts +0 -1
  34. package/src/queries/isolatedAssetQuery.ts +3 -3
  35. package/src/queries/loyaltyProgramQuery.ts +10 -8
  36. package/src/queries/ownerQuery.ts +32 -0
  37. package/src/queries/portfolioQuery.ts +4 -5
  38. package/src/queries/priceQuery.ts +14 -8
  39. package/src/queries/referralQuery.ts +9 -3
  40. package/src/queries/sCoinQuery.ts +4 -4
  41. package/src/queries/spoolQuery.ts +11 -11
  42. package/src/queries/supplyLimitQuery.ts +1 -1
  43. package/src/queries/switchboardQuery.ts +1 -1
  44. package/src/queries/vescaQuery.ts +31 -27
  45. package/src/queries/xOracleQuery.ts +13 -8
  46. package/src/types/address.ts +0 -3
  47. package/src/types/builder/core.ts +1 -1
  48. package/src/types/builder/vesca.ts +10 -20
  49. package/src/types/constant/queryKeys.ts +48 -0
  50. package/src/types/index.ts +0 -1
  51. package/src/utils/builder.ts +1 -1
  52. package/src/utils/util.ts +1 -33
  53. package/src/models/scallopCache.ts +0 -428
  54. package/src/queries/objectsQuery.ts +0 -18
  55. package/src/types/model.ts +0 -117
@@ -1,26 +1,30 @@
1
- import { normalizeSuiAddress } from '@mysten/sui/utils';
2
- import { SuiKit } from '@scallop-io/sui-kit';
3
- import { ScallopAddress } from './scallopAddress';
4
- import { ScallopUtils } from './scallopUtils';
5
- import { ScallopBuilder } from './scallopBuilder';
6
- import { ScallopQuery } from './scallopQuery';
1
+ import ScallopBuilder, { ScallopBuilderParams } from './scallopBuilder';
7
2
  import type { SuiTransactionBlockResponse } from '@mysten/sui/client';
8
3
  import type {
4
+ Transaction,
9
5
  TransactionObjectArgument,
10
6
  TransactionResult,
11
7
  } from '@mysten/sui/transactions';
12
- import { ScallopCache } from './scallopCache';
13
8
  import { requireSender } from 'src/utils';
14
- import type { SuiObjectArg } from '@scallop-io/sui-kit';
15
- import type {
16
- ScallopClientFnReturnType,
17
- ScallopClientParams,
18
- ScallopTxBlock,
19
- ScallopClientVeScaReturnType,
20
- ScallopClientInstanceParams,
21
- } from 'src/types';
22
- import { newSuiKit } from './suiKit';
23
- import { ScallopConstants } from './scallopConstants';
9
+ import type { NetworkType, SuiObjectArg } from '@scallop-io/sui-kit';
10
+ import type { ScallopTxBlock } from '../types';
11
+ import { ScallopClientInterface } from './interface';
12
+
13
+ export type ScallopClientParams = {
14
+ networkType?: NetworkType;
15
+ builder?: ScallopBuilder;
16
+ } & ScallopBuilderParams;
17
+
18
+ type ScallopClientFnReturnType<T extends boolean> = T extends true
19
+ ? SuiTransactionBlockResponse
20
+ : Transaction;
21
+
22
+ type ScallopClientVeScaReturnType<T extends boolean> = T extends true
23
+ ? SuiTransactionBlockResponse
24
+ : {
25
+ tx: Transaction;
26
+ scaCoin: TransactionResult;
27
+ };
24
28
 
25
29
  /**
26
30
  * @description
@@ -34,65 +38,37 @@ import { ScallopConstants } from './scallopConstants';
34
38
  * await scallopClient.<client async functions>();
35
39
  * ```
36
40
  */
37
- export class ScallopClient {
38
- public readonly params: ScallopClientParams;
39
-
40
- public suiKit: SuiKit;
41
- public address: ScallopAddress;
42
- public constants: ScallopConstants;
43
- public builder: ScallopBuilder;
44
- public query: ScallopQuery;
45
- public utils: ScallopUtils;
46
- public cache: ScallopCache;
47
- public walletAddress: string;
48
-
49
- public constructor(
50
- params: ScallopClientParams,
51
- instance?: ScallopClientInstanceParams
52
- ) {
53
- this.params = params;
54
- this.suiKit =
55
- instance?.suiKit ?? instance?.builder?.suiKit ?? newSuiKit(params);
56
- this.walletAddress = normalizeSuiAddress(
57
- params?.walletAddress ?? this.suiKit.currentAddress()
58
- );
41
+ class ScallopClient implements ScallopClientInterface {
42
+ public readonly builder: ScallopBuilder;
43
+ public networkType: NetworkType;
59
44
 
60
- this.cache =
61
- instance?.builder?.cache ??
62
- instance?.cache ??
63
- new ScallopCache(this.params, {
64
- suiKit: this.suiKit,
65
- });
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, {
76
- address: this.address,
77
- });
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, {
88
- utils: this.utils,
89
- });
90
-
91
- this.builder =
92
- instance?.builder ??
93
- new ScallopBuilder(this.params, {
94
- query: this.query,
95
- });
45
+ public constructor(params: ScallopClientParams) {
46
+ this.builder = params.builder ?? new ScallopBuilder(params);
47
+ this.networkType = params.networkType ?? 'mainnet';
48
+ }
49
+
50
+ get query() {
51
+ return this.builder.query;
52
+ }
53
+
54
+ get utils() {
55
+ return this.query.utils;
56
+ }
57
+
58
+ get constants() {
59
+ return this.utils.constants;
60
+ }
61
+
62
+ get walletAddress() {
63
+ return this.utils.walletAddress;
64
+ }
65
+
66
+ get scallopSuiKit() {
67
+ return this.utils.scallopSuiKit;
68
+ }
69
+
70
+ get address() {
71
+ return this.builder.address;
96
72
  }
97
73
 
98
74
  /**
@@ -100,14 +76,8 @@ export class ScallopClient {
100
76
  *
101
77
  * @param force - Whether to force initialization.
102
78
  */
103
- public async init(force: boolean = false) {
104
- if (force || !this.constants.isInitialized) {
105
- await this.constants.init();
106
- }
107
-
79
+ async init(force: boolean = false) {
108
80
  await this.builder.init(force);
109
- await this.query.init(force);
110
- await this.utils.init(force);
111
81
  }
112
82
 
113
83
  /* ==================== Query Method ==================== */
@@ -120,7 +90,7 @@ export class ScallopClient {
120
90
  *
121
91
  * @return Market data.
122
92
  */
123
- public async queryMarket() {
93
+ async queryMarket() {
124
94
  return await this.query.queryMarket();
125
95
  }
126
96
 
@@ -133,7 +103,7 @@ export class ScallopClient {
133
103
  * @param ownerAddress - The owner address.
134
104
  * @return Obligations data.
135
105
  */
136
- public async getObligations(ownerAddress?: string) {
106
+ async getObligations(ownerAddress?: string) {
137
107
  const owner = ownerAddress ?? this.walletAddress;
138
108
  return await this.query.getObligations(owner);
139
109
  }
@@ -147,7 +117,7 @@ export class ScallopClient {
147
117
  * @param obligationId - The obligation id.
148
118
  * @return Obligation data.
149
119
  */
150
- public async queryObligation(obligationId: string) {
120
+ async queryObligation(obligationId: string) {
151
121
  return await this.query.queryObligation(obligationId);
152
122
  }
153
123
 
@@ -214,17 +184,17 @@ export class ScallopClient {
214
184
  * @param sign - Decide to directly sign the transaction or return the transaction block.
215
185
  * @return Transaction block response or transaction block.
216
186
  */
217
- public async openObligation(): Promise<SuiTransactionBlockResponse>;
218
- public async openObligation<S extends boolean>(
187
+ async openObligation(): Promise<SuiTransactionBlockResponse>;
188
+ async openObligation<S extends boolean>(
219
189
  sign?: S
220
190
  ): Promise<ScallopClientFnReturnType<S>>;
221
- public async openObligation<S extends boolean>(
191
+ async openObligation<S extends boolean>(
222
192
  sign: S = true as S
223
193
  ): Promise<ScallopClientFnReturnType<S>> {
224
194
  const txBlock = this.builder.createTxBlock();
225
195
  txBlock.openObligationEntry();
226
196
  if (sign) {
227
- return (await this.suiKit.signAndSendTxn(
197
+ return (await this.scallopSuiKit.signAndSendTxn(
228
198
  txBlock
229
199
  )) as ScallopClientFnReturnType<S>;
230
200
  } else {
@@ -242,18 +212,18 @@ export class ScallopClient {
242
212
  * @param walletAddress - The wallet address of the owner.
243
213
  * @return Transaction block response or transaction block.
244
214
  */
245
- public async depositCollateral(
215
+ async depositCollateral(
246
216
  collateralCoinName: string,
247
217
  amount: number
248
218
  ): Promise<SuiTransactionBlockResponse>;
249
- public async depositCollateral<S extends boolean>(
219
+ async depositCollateral<S extends boolean>(
250
220
  collateralCoinName: string,
251
221
  amount: number,
252
222
  sign?: S,
253
223
  obligationId?: string,
254
224
  walletAddress?: string
255
225
  ): Promise<ScallopClientFnReturnType<S>>;
256
- public async depositCollateral<S extends boolean>(
226
+ async depositCollateral<S extends boolean>(
257
227
  collateralCoinName: string,
258
228
  amount: number,
259
229
  sign: S = true as S,
@@ -280,7 +250,7 @@ export class ScallopClient {
280
250
  }
281
251
 
282
252
  if (sign) {
283
- return (await this.suiKit.signAndSendTxn(
253
+ return (await this.scallopSuiKit.signAndSendTxn(
284
254
  txBlock
285
255
  )) as ScallopClientFnReturnType<S>;
286
256
  } else {
@@ -299,7 +269,7 @@ export class ScallopClient {
299
269
  * @param walletAddress - The wallet address of the owner.
300
270
  * @return Transaction block response or transaction block.
301
271
  */
302
- public async withdrawCollateral<S extends boolean>(
272
+ async withdrawCollateral<S extends boolean>(
303
273
  collateralCoinName: string,
304
274
  amount: number,
305
275
  sign: S = true as S,
@@ -320,7 +290,7 @@ export class ScallopClient {
320
290
  txBlock.transferObjects([collateralCoin], sender);
321
291
 
322
292
  if (sign) {
323
- return (await this.suiKit.signAndSendTxn(
293
+ return (await this.scallopSuiKit.signAndSendTxn(
324
294
  txBlock
325
295
  )) as ScallopClientFnReturnType<S>;
326
296
  } else {
@@ -337,17 +307,17 @@ export class ScallopClient {
337
307
  * @param walletAddress - The wallet address of the owner.
338
308
  * @return Transaction block response or transaction block.
339
309
  */
340
- public async deposit(
310
+ async deposit(
341
311
  poolCoinName: string,
342
312
  amount: number
343
313
  ): Promise<SuiTransactionBlockResponse>;
344
- public async deposit<S extends boolean>(
314
+ async deposit<S extends boolean>(
345
315
  poolCoinName: string,
346
316
  amount: number,
347
317
  sign?: S,
348
318
  walletAddress?: string
349
319
  ): Promise<ScallopClientFnReturnType<S>>;
350
- public async deposit<S extends boolean>(
320
+ async deposit<S extends boolean>(
351
321
  poolCoinName: string,
352
322
  amount: number,
353
323
  sign: S = true as S,
@@ -361,7 +331,7 @@ export class ScallopClient {
361
331
  txBlock.transferObjects([sCoin], sender);
362
332
 
363
333
  if (sign) {
364
- return (await this.suiKit.signAndSendTxn(
334
+ return (await this.scallopSuiKit.signAndSendTxn(
365
335
  txBlock
366
336
  )) as ScallopClientFnReturnType<S>;
367
337
  } else {
@@ -379,18 +349,18 @@ export class ScallopClient {
379
349
  * @param walletAddress - The wallet address of the owner.
380
350
  * @return Transaction block response or transaction block.
381
351
  */
382
- public async depositAndStake(
352
+ async depositAndStake(
383
353
  stakeCoinName: string,
384
354
  amount: number
385
355
  ): Promise<SuiTransactionBlockResponse>;
386
- public async depositAndStake<S extends boolean>(
356
+ async depositAndStake<S extends boolean>(
387
357
  stakeCoinName: string,
388
358
  amount: number,
389
359
  sign?: S,
390
360
  stakeAccountId?: string,
391
361
  walletAddress?: string
392
362
  ): Promise<ScallopClientFnReturnType<S>>;
393
- public async depositAndStake<S extends boolean>(
363
+ async depositAndStake<S extends boolean>(
394
364
  stakeCoinName: string,
395
365
  amount: number,
396
366
  sign: S = true as S,
@@ -421,7 +391,7 @@ export class ScallopClient {
421
391
  }
422
392
 
423
393
  if (sign) {
424
- return (await this.suiKit.signAndSendTxn(
394
+ return (await this.scallopSuiKit.signAndSendTxn(
425
395
  txBlock
426
396
  )) as ScallopClientFnReturnType<S>;
427
397
  } else {
@@ -438,17 +408,17 @@ export class ScallopClient {
438
408
  * @param walletAddress - The wallet address of the owner.
439
409
  * @return Transaction block response or transaction block.
440
410
  */
441
- public async withdraw(
411
+ async withdraw(
442
412
  poolCoinName: string,
443
413
  amount: number
444
414
  ): Promise<SuiTransactionBlockResponse>;
445
- public async withdraw<S extends boolean>(
415
+ async withdraw<S extends boolean>(
446
416
  poolCoinName: string,
447
417
  amount: number,
448
418
  sign?: S,
449
419
  walletAddress?: string
450
420
  ): Promise<ScallopClientFnReturnType<S>>;
451
- public async withdraw<S extends boolean>(
421
+ async withdraw<S extends boolean>(
452
422
  poolCoinName: string,
453
423
  amount: number,
454
424
  sign: S = true as S,
@@ -462,7 +432,7 @@ export class ScallopClient {
462
432
  txBlock.transferObjects([coin], sender);
463
433
 
464
434
  if (sign) {
465
- return (await this.suiKit.signAndSendTxn(
435
+ return (await this.scallopSuiKit.signAndSendTxn(
466
436
  txBlock
467
437
  )) as ScallopClientFnReturnType<S>;
468
438
  } else {
@@ -481,7 +451,7 @@ export class ScallopClient {
481
451
  * @param walletAddress - The wallet address of the owner.
482
452
  * @return Transaction block response or transaction block.
483
453
  */
484
- public async borrow<S extends boolean>(
454
+ async borrow<S extends boolean>(
485
455
  poolCoinName: string,
486
456
  amount: number,
487
457
  sign: S = true as S,
@@ -509,7 +479,7 @@ export class ScallopClient {
509
479
  }
510
480
 
511
481
  if (sign) {
512
- return (await this.suiKit.signAndSendTxn(
482
+ return (await this.scallopSuiKit.signAndSendTxn(
513
483
  txBlock
514
484
  )) as ScallopClientFnReturnType<S>;
515
485
  } else {
@@ -527,7 +497,7 @@ export class ScallopClient {
527
497
  * @param walletAddress - The wallet address of the owner.
528
498
  * @return Transaction block response or transaction block.
529
499
  */
530
- public async repay<S extends boolean>(
500
+ async repay<S extends boolean>(
531
501
  poolCoinName: string,
532
502
  amount: number,
533
503
  sign: S = true as S,
@@ -549,7 +519,7 @@ export class ScallopClient {
549
519
  }
550
520
 
551
521
  if (sign) {
552
- return (await this.suiKit.signAndSendTxn(
522
+ return (await this.scallopSuiKit.signAndSendTxn(
553
523
  txBlock
554
524
  )) as ScallopClientFnReturnType<S>;
555
525
  } else {
@@ -566,7 +536,7 @@ export class ScallopClient {
566
536
  * @param sign - Decide to directly sign the transaction or return the transaction block.
567
537
  * @return Transaction block response or transaction block.
568
538
  */
569
- public async flashLoan(
539
+ async flashLoan(
570
540
  poolCoinName: string,
571
541
  amount: number,
572
542
  callback: (
@@ -574,7 +544,7 @@ export class ScallopClient {
574
544
  coin: TransactionObjectArgument | string
575
545
  ) => SuiObjectArg
576
546
  ): Promise<SuiTransactionBlockResponse>;
577
- public async flashLoan<S extends boolean>(
547
+ async flashLoan<S extends boolean>(
578
548
  poolCoinName: string,
579
549
  amount: number,
580
550
  callback: (
@@ -584,7 +554,7 @@ export class ScallopClient {
584
554
  sign?: S,
585
555
  walletAddress?: string
586
556
  ): Promise<ScallopClientFnReturnType<S>>;
587
- public async flashLoan<S extends boolean>(
557
+ async flashLoan<S extends boolean>(
588
558
  poolCoinName: string,
589
559
  amount: number,
590
560
  callback: (
@@ -601,7 +571,7 @@ export class ScallopClient {
601
571
  txBlock.repayFlashLoan(await callback(txBlock, coin), loan, poolCoinName);
602
572
 
603
573
  if (sign) {
604
- return (await this.suiKit.signAndSendTxn(
574
+ return (await this.scallopSuiKit.signAndSendTxn(
605
575
  txBlock
606
576
  )) as ScallopClientFnReturnType<S>;
607
577
  } else {
@@ -618,15 +588,15 @@ export class ScallopClient {
618
588
  * @param walletAddress - The wallet address of the owner.
619
589
  * @return Transaction block response or transaction block.
620
590
  */
621
- public async createStakeAccount(
591
+ async createStakeAccount(
622
592
  marketCoinName: string
623
593
  ): Promise<SuiTransactionBlockResponse>;
624
- public async createStakeAccount<S extends boolean>(
594
+ async createStakeAccount<S extends boolean>(
625
595
  marketCoinName: string,
626
596
  sign?: S,
627
597
  walletAddress?: string
628
598
  ): Promise<ScallopClientFnReturnType<S>>;
629
- public async createStakeAccount<S extends boolean>(
599
+ async createStakeAccount<S extends boolean>(
630
600
  marketCoinName: string,
631
601
  sign: S = true as S,
632
602
  walletAddress?: string
@@ -639,7 +609,7 @@ export class ScallopClient {
639
609
  txBlock.transferObjects([stakeAccount], sender);
640
610
 
641
611
  if (sign) {
642
- return (await this.suiKit.signAndSendTxn(
612
+ return (await this.scallopSuiKit.signAndSendTxn(
643
613
  txBlock
644
614
  )) as ScallopClientFnReturnType<S>;
645
615
  } else {
@@ -657,18 +627,18 @@ export class ScallopClient {
657
627
  * @param walletAddress - The wallet address of the owner.
658
628
  * @return Transaction block response or transaction block.
659
629
  */
660
- public async stake(
630
+ async stake(
661
631
  stakeMarketCoinName: string,
662
632
  amount: number
663
633
  ): Promise<SuiTransactionBlockResponse>;
664
- public async stake<S extends boolean>(
634
+ async stake<S extends boolean>(
665
635
  stakeMarketCoinName: string,
666
636
  amount: number,
667
637
  sign?: S,
668
638
  stakeAccountId?: string,
669
639
  walletAddress?: string
670
640
  ): Promise<ScallopClientFnReturnType<S>>;
671
- public async stake<S extends boolean>(
641
+ async stake<S extends boolean>(
672
642
  stakeMarketCoinName: string,
673
643
  amount: number,
674
644
  sign: S = true as S,
@@ -691,7 +661,7 @@ export class ScallopClient {
691
661
  }
692
662
 
693
663
  if (sign) {
694
- return (await this.suiKit.signAndSendTxn(
664
+ return (await this.scallopSuiKit.signAndSendTxn(
695
665
  txBlock
696
666
  )) as ScallopClientFnReturnType<S>;
697
667
  } else {
@@ -709,18 +679,18 @@ export class ScallopClient {
709
679
  * @param walletAddress - The wallet address of the owner.
710
680
  * @return Transaction block response or transaction block.
711
681
  */
712
- public async unstake(
682
+ async unstake(
713
683
  stakeMarketCoinName: string,
714
684
  amount: number
715
685
  ): Promise<SuiTransactionBlockResponse>;
716
- public async unstake<S extends boolean>(
686
+ async unstake<S extends boolean>(
717
687
  stakeMarketCoinName: string,
718
688
  amount: number,
719
689
  sign?: S,
720
690
  stakeAccountId?: string,
721
691
  walletAddress?: string
722
692
  ): Promise<ScallopClientFnReturnType<S>>;
723
- public async unstake<S extends boolean>(
693
+ async unstake<S extends boolean>(
724
694
  stakeMarketCoinName: string,
725
695
  amount: number,
726
696
  sign: S = true as S,
@@ -754,7 +724,7 @@ export class ScallopClient {
754
724
  txBlock.transferObjects([sCoin], sender);
755
725
 
756
726
  if (sign) {
757
- return (await this.suiKit.signAndSendTxn(
727
+ return (await this.scallopSuiKit.signAndSendTxn(
758
728
  txBlock
759
729
  )) as ScallopClientFnReturnType<S>;
760
730
  } else {
@@ -772,18 +742,18 @@ export class ScallopClient {
772
742
  * @param walletAddress - The wallet address of the owner.
773
743
  * @return Transaction block response or transaction block.
774
744
  */
775
- public async unstakeAndWithdraw(
745
+ async unstakeAndWithdraw(
776
746
  stakeMarketCoinName: string,
777
747
  amount: number
778
748
  ): Promise<SuiTransactionBlockResponse>;
779
- public async unstakeAndWithdraw<S extends boolean>(
749
+ async unstakeAndWithdraw<S extends boolean>(
780
750
  stakeMarketCoinName: string,
781
751
  amount: number,
782
752
  sign?: S,
783
753
  stakeAccountId?: string,
784
754
  walletAddress?: string
785
755
  ): Promise<ScallopClientFnReturnType<S>>;
786
- public async unstakeAndWithdraw<S extends boolean>(
756
+ async unstakeAndWithdraw<S extends boolean>(
787
757
  stakeMarketCoinName: string,
788
758
  amount: number,
789
759
  sign: S = true as S,
@@ -817,7 +787,7 @@ export class ScallopClient {
817
787
  }
818
788
 
819
789
  if (sign) {
820
- return (await this.suiKit.signAndSendTxn(
790
+ return (await this.scallopSuiKit.signAndSendTxn(
821
791
  txBlock
822
792
  )) as ScallopClientFnReturnType<S>;
823
793
  } else {
@@ -835,16 +805,16 @@ export class ScallopClient {
835
805
  * @param walletAddress - The wallet address of the owner.
836
806
  * @return Transaction block response or transaction block.
837
807
  */
838
- public async claim(
808
+ async claim(
839
809
  stakeMarketCoinName: string
840
810
  ): Promise<SuiTransactionBlockResponse>;
841
- public async claim<S extends boolean>(
811
+ async claim<S extends boolean>(
842
812
  stakeMarketCoinName: string,
843
813
  sign?: S,
844
814
  stakeAccountId?: string,
845
815
  walletAddress?: string
846
816
  ): Promise<ScallopClientFnReturnType<S>>;
847
- public async claim<S extends boolean>(
817
+ async claim<S extends boolean>(
848
818
  stakeMarketCoinName: string,
849
819
  sign: S = true as S,
850
820
  stakeAccountId?: string,
@@ -861,7 +831,7 @@ export class ScallopClient {
861
831
  txBlock.transferObjects(rewardCoins, sender);
862
832
 
863
833
  if (sign) {
864
- return (await this.suiKit.signAndSendTxn(
834
+ return (await this.scallopSuiKit.signAndSendTxn(
865
835
  txBlock
866
836
  )) as ScallopClientFnReturnType<S>;
867
837
  } else {
@@ -880,7 +850,7 @@ export class ScallopClient {
880
850
  * @param walletAddress - The wallet address of the owner.
881
851
  * @return Transaction block response or transaction block
882
852
  */
883
- public async stakeObligation<S extends boolean>(
853
+ async stakeObligation<S extends boolean>(
884
854
  obligationId: string,
885
855
  obligationKeyId: string,
886
856
  sign: S = true as S,
@@ -893,7 +863,7 @@ export class ScallopClient {
893
863
  await txBlock.stakeObligationWithVeScaQuick(obligationId, obligationKeyId);
894
864
 
895
865
  if (sign) {
896
- return (await this.suiKit.signAndSendTxn(
866
+ return (await this.scallopSuiKit.signAndSendTxn(
897
867
  txBlock
898
868
  )) as ScallopClientFnReturnType<S>;
899
869
  } else {
@@ -910,7 +880,7 @@ export class ScallopClient {
910
880
  * @param walletAddress - The wallet address of the owner.
911
881
  * @return Transaction block response or transaction block
912
882
  */
913
- public async unstakeObligation<S extends boolean>(
883
+ async unstakeObligation<S extends boolean>(
914
884
  obligationId: string,
915
885
  obligationKeyId: string,
916
886
  sign: S = true as S,
@@ -923,7 +893,7 @@ export class ScallopClient {
923
893
  await txBlock.unstakeObligationQuick(obligationId, obligationKeyId);
924
894
 
925
895
  if (sign) {
926
- return (await this.suiKit.signAndSendTxn(
896
+ return (await this.scallopSuiKit.signAndSendTxn(
927
897
  txBlock
928
898
  )) as ScallopClientFnReturnType<S>;
929
899
  } else {
@@ -941,7 +911,7 @@ export class ScallopClient {
941
911
  * @param walletAddress - The wallet address of the owner.
942
912
  * @return Transaction block response or transaction block
943
913
  */
944
- public async claimBorrowIncentive<S extends boolean>(
914
+ async claimBorrowIncentive<S extends boolean>(
945
915
  obligationId: string,
946
916
  obligationKeyId: string,
947
917
  sign: S = true as S,
@@ -986,7 +956,7 @@ export class ScallopClient {
986
956
  );
987
957
 
988
958
  if (sign) {
989
- return (await this.suiKit.signAndSendTxn(
959
+ return (await this.scallopSuiKit.signAndSendTxn(
990
960
  txBlock
991
961
  )) as ScallopClientFnReturnType<S>;
992
962
  } else {
@@ -999,7 +969,7 @@ export class ScallopClient {
999
969
  * Function to migrate all market coin in user wallet into sCoin
1000
970
  * @returns Transaction response
1001
971
  */
1002
- public async migrateAllMarketCoin<S extends boolean>(
972
+ async migrateAllMarketCoin<S extends boolean>(
1003
973
  includeStakePool: boolean = true,
1004
974
  sign: S = true as S,
1005
975
  walletAddress?: string
@@ -1078,7 +1048,7 @@ export class ScallopClient {
1078
1048
  }
1079
1049
 
1080
1050
  if (sign) {
1081
- return (await this.suiKit.signAndSendTxn(
1051
+ return (await this.scallopSuiKit.signAndSendTxn(
1082
1052
  txBlock
1083
1053
  )) as ScallopClientFnReturnType<S>;
1084
1054
  } else {
@@ -1090,12 +1060,12 @@ export class ScallopClient {
1090
1060
  /**
1091
1061
  * Claim unlocked SCA from all veSCA accounts.
1092
1062
  */
1093
- public async claimAllUnlockedSca(): Promise<SuiTransactionBlockResponse>;
1094
- public async claimAllUnlockedSca<S extends boolean>(
1063
+ async claimAllUnlockedSca(): Promise<SuiTransactionBlockResponse>;
1064
+ async claimAllUnlockedSca<S extends boolean>(
1095
1065
  sign?: S,
1096
1066
  walletAddress?: string
1097
1067
  ): Promise<ScallopClientVeScaReturnType<S>>;
1098
- public async claimAllUnlockedSca<S extends boolean>(
1068
+ async claimAllUnlockedSca<S extends boolean>(
1099
1069
  sign: S = true as S,
1100
1070
  walletAddress?: string
1101
1071
  ): Promise<ScallopClientVeScaReturnType<S>> {
@@ -1136,7 +1106,7 @@ export class ScallopClient {
1136
1106
  await this.utils.mergeSimilarCoins(tx, scaCoins[0], 'sca', sender);
1137
1107
 
1138
1108
  if (sign) {
1139
- return (await this.suiKit.signAndSendTxn(
1109
+ return (await this.scallopSuiKit.signAndSendTxn(
1140
1110
  tx
1141
1111
  )) as ScallopClientVeScaReturnType<S>;
1142
1112
  } else {
@@ -1161,25 +1131,23 @@ export class ScallopClient {
1161
1131
  * @param sign - Decide to directly sign the transaction or return the transaction block.
1162
1132
  * @return Transaction block response or transaction block.
1163
1133
  */
1164
- public async mintTestCoin(
1134
+ async mintTestCoin(
1165
1135
  assetCoinName: Exclude<string, 'sui'>,
1166
1136
  amount: number
1167
1137
  ): Promise<SuiTransactionBlockResponse>;
1168
- public async mintTestCoin<S extends boolean>(
1138
+ async mintTestCoin<S extends boolean>(
1169
1139
  assetCoinName: Exclude<string, 'sui'>,
1170
1140
  amount: number,
1171
1141
  sign?: S,
1172
1142
  receiveAddress?: string
1173
1143
  ): Promise<ScallopClientFnReturnType<S>>;
1174
- public async mintTestCoin<S extends boolean>(
1144
+ async mintTestCoin<S extends boolean>(
1175
1145
  assetCoinName: Exclude<string, 'sui'>,
1176
1146
  amount: number,
1177
1147
  sign: S = true as S,
1178
1148
  receiveAddress?: string
1179
1149
  ): Promise<ScallopClientFnReturnType<S>> {
1180
- const isTestnet = this.params.networkType
1181
- ? this.params.networkType === 'testnet'
1182
- : false;
1150
+ const isTestnet = this.networkType === 'testnet';
1183
1151
 
1184
1152
  if (!isTestnet) {
1185
1153
  throw new Error('Only be used on the test network.');
@@ -1194,7 +1162,7 @@ export class ScallopClient {
1194
1162
  txBlock.transferObjects([coin], recipient);
1195
1163
 
1196
1164
  if (sign) {
1197
- return (await this.suiKit.signAndSendTxn(
1165
+ return (await this.scallopSuiKit.signAndSendTxn(
1198
1166
  txBlock
1199
1167
  )) as ScallopClientFnReturnType<S>;
1200
1168
  } else {
@@ -1202,3 +1170,5 @@ export class ScallopClient {
1202
1170
  }
1203
1171
  }
1204
1172
  }
1173
+
1174
+ export default ScallopClient;