@scallop-io/sui-scallop-sdk 1.4.2-rc.5 → 1.4.3-rc.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.
@@ -89,8 +89,8 @@ const generateNormalVeScaMethod: GenerateVeScaNormalMethod = ({
89
89
  };
90
90
 
91
91
  return {
92
- lockSca: async (scaCoin, unlockAtInSecondTimestamp) => {
93
- return await builder.moveCall(
92
+ lockSca: (scaCoin, unlockAtInSecondTimestamp) => {
93
+ return builder.moveCall(
94
94
  txBlock,
95
95
  `${veScaIds.pkgId}::ve_sca::mint_ve_sca_key`,
96
96
  [
@@ -104,8 +104,8 @@ const generateNormalVeScaMethod: GenerateVeScaNormalMethod = ({
104
104
  []
105
105
  );
106
106
  },
107
- extendLockPeriod: async (veScaKey, newUnlockAtInSecondTimestamp) => {
108
- await builder.moveCall(
107
+ extendLockPeriod: (veScaKey, newUnlockAtInSecondTimestamp) => {
108
+ builder.moveCall(
109
109
  txBlock,
110
110
  `${veScaIds.pkgId}::ve_sca::extend_lock_period`,
111
111
  [
@@ -119,8 +119,8 @@ const generateNormalVeScaMethod: GenerateVeScaNormalMethod = ({
119
119
  []
120
120
  );
121
121
  },
122
- extendLockAmount: async (veScaKey, scaCoin) => {
123
- await builder.moveCall(
122
+ extendLockAmount: (veScaKey, scaCoin) => {
123
+ builder.moveCall(
124
124
  txBlock,
125
125
  `${veScaIds.pkgId}::ve_sca::lock_more_sca`,
126
126
  [
@@ -134,12 +134,8 @@ const generateNormalVeScaMethod: GenerateVeScaNormalMethod = ({
134
134
  []
135
135
  );
136
136
  },
137
- renewExpiredVeSca: async (
138
- veScaKey,
139
- scaCoin,
140
- newUnlockAtInSecondTimestamp
141
- ) => {
142
- await builder.moveCall(
137
+ renewExpiredVeSca: (veScaKey, scaCoin, newUnlockAtInSecondTimestamp) => {
138
+ builder.moveCall(
143
139
  txBlock,
144
140
  `${veScaIds.pkgId}::ve_sca::renew_expired_ve_sca`,
145
141
  [
@@ -154,8 +150,8 @@ const generateNormalVeScaMethod: GenerateVeScaNormalMethod = ({
154
150
  []
155
151
  );
156
152
  },
157
- redeemSca: async (veScaKey) => {
158
- return await builder.moveCall(
153
+ redeemSca: (veScaKey) => {
154
+ return builder.moveCall(
159
155
  txBlock,
160
156
  `${veScaIds.pkgId}::ve_sca::redeem`,
161
157
  [
@@ -168,8 +164,8 @@ const generateNormalVeScaMethod: GenerateVeScaNormalMethod = ({
168
164
  []
169
165
  );
170
166
  },
171
- mintEmptyVeSca: async () => {
172
- return await builder.moveCall(
167
+ mintEmptyVeSca: () => {
168
+ return builder.moveCall(
173
169
  txBlock,
174
170
  `${veScaIds.pkgId}::ve_sca::mint_ve_sca_placeholder_key`,
175
171
  [veScaIds.config, veScaIds.table],
@@ -232,7 +232,7 @@ export class ScallopClient {
232
232
  sign: S = true as S
233
233
  ): Promise<ScallopClientFnReturnType<S>> {
234
234
  const txBlock = this.builder.createTxBlock();
235
- await txBlock.openObligationEntry();
235
+ txBlock.openObligationEntry();
236
236
  if (sign) {
237
237
  return (await this.suiKit.signAndSendTxn(
238
238
  txBlock
@@ -283,10 +283,9 @@ export class ScallopClient {
283
283
  specificObligationId
284
284
  );
285
285
  } else {
286
- const [obligation, obligationKey, hotPotato] =
287
- await txBlock.openObligation();
286
+ const [obligation, obligationKey, hotPotato] = txBlock.openObligation();
288
287
  await txBlock.addCollateralQuick(amount, collateralCoinName, obligation);
289
- await txBlock.returnObligation(obligation, hotPotato);
288
+ txBlock.returnObligation(obligation, hotPotato);
290
289
  txBlock.transferObjects([obligationKey], sender);
291
290
  }
292
291
 
@@ -426,7 +425,7 @@ export class ScallopClient {
426
425
  targetStakeAccount
427
426
  );
428
427
  } else {
429
- const account = await txBlock.createStakeAccount(stakeMarketCoinName);
428
+ const account = txBlock.createStakeAccount(stakeMarketCoinName);
430
429
  await txBlock.stakeQuick(marketCoin, stakeMarketCoinName, account);
431
430
  txBlock.transferObjects([account], sender);
432
431
  }
@@ -612,12 +611,8 @@ export class ScallopClient {
612
611
  const txBlock = this.builder.createTxBlock();
613
612
  const sender = walletAddress ?? this.walletAddress;
614
613
  txBlock.setSender(sender);
615
- const [coin, loan] = await txBlock.borrowFlashLoan(amount, poolCoinName);
616
- await txBlock.repayFlashLoan(
617
- await callback(txBlock, coin),
618
- loan,
619
- poolCoinName
620
- );
614
+ const [coin, loan] = txBlock.borrowFlashLoan(amount, poolCoinName);
615
+ txBlock.repayFlashLoan(await callback(txBlock, coin), loan, poolCoinName);
621
616
 
622
617
  if (sign) {
623
618
  return (await this.suiKit.signAndSendTxn(
@@ -654,7 +649,7 @@ export class ScallopClient {
654
649
  const sender = walletAddress ?? this.walletAddress;
655
650
  txBlock.setSender(sender);
656
651
 
657
- const stakeAccount = await txBlock.createStakeAccount(marketCoinName);
652
+ const stakeAccount = txBlock.createStakeAccount(marketCoinName);
658
653
  txBlock.transferObjects([stakeAccount], sender);
659
654
 
660
655
  if (sign) {
@@ -704,7 +699,7 @@ export class ScallopClient {
704
699
  if (targetStakeAccount) {
705
700
  await txBlock.stakeQuick(amount, stakeMarketCoinName, targetStakeAccount);
706
701
  } else {
707
- const account = await txBlock.createStakeAccount(stakeMarketCoinName);
702
+ const account = txBlock.createStakeAccount(stakeMarketCoinName);
708
703
  await txBlock.stakeQuick(amount, stakeMarketCoinName, account);
709
704
  txBlock.transferObjects([account], sender);
710
705
  }
@@ -819,7 +814,7 @@ export class ScallopClient {
819
814
  this.utils.parseCoinName<SupportStakeCoins>(stakeMarketCoinName);
820
815
 
821
816
  if (stakeMarketCoin) {
822
- const coin = await txBlock.withdraw(stakeMarketCoin, stakeCoinName);
817
+ const coin = txBlock.withdraw(stakeMarketCoin, stakeCoinName);
823
818
  await this.utils.mergeSimilarCoins(
824
819
  txBlock,
825
820
  coin,
@@ -1053,7 +1048,7 @@ export class ScallopClient {
1053
1048
  // if market coin found, mint sCoin
1054
1049
  if (toDestroyMarketCoin) {
1055
1050
  // mint new sCoin
1056
- const sCoin = await txBlock.mintSCoin(
1051
+ const sCoin = txBlock.mintSCoin(
1057
1052
  sCoinName as SupportSCoin,
1058
1053
  toDestroyMarketCoin
1059
1054
  );
@@ -19,25 +19,22 @@ export type BorrowIncentiveNormalMethods = {
19
19
  stakeObligation: (
20
20
  obligation: SuiObjectArg,
21
21
  obligationKey: SuiObjectArg
22
- ) => Promise<void>;
22
+ ) => void;
23
23
  stakeObligationWithVesca: (
24
24
  obligation: SuiObjectArg,
25
25
  obligationKey: SuiObjectArg,
26
26
  veScaKey: SuiObjectArg
27
- ) => Promise<void>;
27
+ ) => void;
28
28
  unstakeObligation: (
29
29
  obligation: SuiObjectArg,
30
30
  obligationKey: SuiObjectArg
31
- ) => Promise<void>;
31
+ ) => void;
32
32
  claimBorrowIncentive: (
33
33
  obligation: SuiObjectArg,
34
34
  obligationKey: SuiObjectArg,
35
35
  rewardType: SupportBorrowIncentiveRewardCoins
36
- ) => Promise<TransactionResult>;
37
- deactivateBoost: (
38
- obligation: SuiObjectArg,
39
- veScaKey: SuiObjectArg
40
- ) => Promise<void>;
36
+ ) => TransactionResult;
37
+ deactivateBoost: (obligation: SuiObjectArg, veScaKey: SuiObjectArg) => void;
41
38
  };
42
39
 
43
40
  export type BorrowIncentiveQuickMethods = {
@@ -26,74 +26,87 @@ type ObligationKey = NestedResult;
26
26
  type ObligationHotPotato = NestedResult;
27
27
 
28
28
  export type CoreNormalMethods = {
29
- openObligation: () => Promise<
30
- [Obligation, ObligationKey, ObligationHotPotato]
31
- >;
29
+ // openObligation: () => Promise<
30
+ openObligation: () => [Obligation, ObligationKey, ObligationHotPotato];
32
31
  returnObligation: (
33
32
  obligation: SuiObjectArg,
34
33
  obligationHotPotato: SuiObjectArg
35
- ) => Promise<void>;
36
- openObligationEntry: () => Promise<void>;
34
+ // ) => Promise<void>;
35
+ ) => void;
36
+ // openObligationEntry: () => Promise<void>;
37
+ openObligationEntry: () => void;
37
38
  addCollateral: (
38
39
  obligation: SuiObjectArg,
39
40
  coin: SuiObjectArg,
40
41
  collateralCoinName: SupportCollateralCoins
41
- ) => Promise<void>;
42
+ // ) => Promise<void>;
43
+ ) => void;
42
44
  takeCollateral: (
43
45
  obligation: SuiObjectArg,
44
46
  obligationKey: SuiObjectArg,
45
47
  amount: number,
46
48
  collateralCoinName: SupportCollateralCoins
47
- ) => Promise<TransactionResult>;
49
+ // ) => Promise<TransactionResult>;
50
+ ) => TransactionResult;
48
51
  deposit: (
49
52
  coin: SuiObjectArg,
50
53
  poolCoinName: SupportPoolCoins
51
- ) => Promise<TransactionResult>;
54
+ // ) => Promise<TransactionResult>;
55
+ ) => TransactionResult;
52
56
  depositEntry: (
53
57
  coin: SuiObjectArg,
54
58
  poolCoinName: SupportPoolCoins
55
- ) => Promise<TransactionResult>;
59
+ // ) => Promise<TransactionResult>;
60
+ ) => TransactionResult;
56
61
  withdraw: (
57
62
  marketCoin: SuiObjectArg,
58
63
  poolCoinName: SupportPoolCoins
59
- ) => Promise<TransactionResult>;
64
+ // ) => Promise<TransactionResult>;
65
+ ) => TransactionResult;
60
66
  withdrawEntry: (
61
67
  marketCoin: SuiObjectArg,
62
68
  poolCoinName: SupportPoolCoins
63
- ) => Promise<TransactionResult>;
69
+ // ) => Promise<TransactionResult>;
70
+ ) => TransactionResult;
64
71
  borrow: (
65
72
  obligation: SuiObjectArg,
66
73
  obligationKey: SuiObjectArg,
67
74
  amount: number,
68
75
  poolCoinName: SupportPoolCoins
69
- ) => Promise<TransactionResult>;
76
+ // ) => Promise<TransactionResult>;
77
+ ) => TransactionResult;
70
78
  borrowWithReferral: (
71
79
  obligation: SuiObjectArg,
72
80
  obligationKey: SuiObjectArg,
73
81
  borrowReferral: SuiObjectArg,
74
82
  amount: number | SuiTxArg,
75
83
  poolCoinName: SupportPoolCoins
76
- ) => Promise<TransactionResult>;
84
+ // ) => Promise<TransactionResult>;
85
+ ) => TransactionResult;
77
86
  borrowEntry: (
78
87
  obligation: SuiObjectArg,
79
88
  obligationKey: SuiObjectArg,
80
89
  amount: number,
81
90
  poolCoinName: SupportPoolCoins
82
- ) => Promise<TransactionResult>;
91
+ // ) => Promise<TransactionResult>;
92
+ ) => TransactionResult;
83
93
  repay: (
84
94
  obligation: SuiObjectArg,
85
95
  coin: SuiObjectArg,
86
96
  poolCoinName: SupportPoolCoins
87
- ) => Promise<void>;
97
+ // ) => Promise<void>;
98
+ ) => void;
88
99
  borrowFlashLoan: (
89
100
  amount: number | SuiTxArg,
90
101
  poolCoinName: SupportPoolCoins
91
- ) => Promise<TransactionResult>;
102
+ // ) => Promise<TransactionResult>;
103
+ ) => TransactionResult;
92
104
  repayFlashLoan: (
93
105
  coin: SuiObjectArg,
94
106
  loan: SuiObjectArg,
95
107
  poolCoinName: SupportPoolCoins
96
- ) => Promise<void>;
108
+ // ) => Promise<void>;
109
+ ) => void;
97
110
  };
98
111
 
99
112
  export type CoreQuickMethods = {
@@ -12,7 +12,7 @@ export type LoyaltyProgramIds = {
12
12
  };
13
13
 
14
14
  export type LoyaltyProgramNormalMethods = {
15
- claimLoyaltyRevenue: (veScaKey: SuiObjectArg) => Promise<TransactionResult>;
15
+ claimLoyaltyRevenue: (veScaKey: SuiObjectArg) => TransactionResult;
16
16
  };
17
17
 
18
18
  export type LoyaltyProgramQuickMethods = {
@@ -16,18 +16,16 @@ export type ReferralIds = {
16
16
  };
17
17
 
18
18
  export type ReferralNormalMethods = {
19
- bindToReferral: (veScaKeyId: string) => Promise<void>;
20
- claimReferralTicket: (
21
- poolCoinName: SupportPoolCoins
22
- ) => Promise<TransactionResult>;
19
+ bindToReferral: (veScaKeyId: string) => void;
20
+ claimReferralTicket: (poolCoinName: SupportPoolCoins) => TransactionResult;
23
21
  burnReferralTicket: (
24
22
  ticket: SuiObjectArg,
25
23
  poolCoinName: SupportPoolCoins
26
- ) => Promise<void>;
24
+ ) => void;
27
25
  claimReferralRevenue: (
28
26
  veScaKey: SuiObjectArg,
29
27
  poolCoinName: SupportPoolCoins
30
- ) => Promise<TransactionResult>;
28
+ ) => TransactionResult;
31
29
  };
32
30
 
33
31
  export type ReferralQuickMethods = {
@@ -21,7 +21,7 @@ export type sCoinNormalMethods = {
21
21
  mintSCoin: (
22
22
  marketCoinName: SupportSCoin,
23
23
  marketCoin: SuiObjectArg
24
- ) => Promise<TransactionResult>;
24
+ ) => TransactionResult;
25
25
  /**
26
26
  * Burn sCoin and return marketCoin
27
27
  * @param sCoinName
@@ -31,7 +31,7 @@ export type sCoinNormalMethods = {
31
31
  burnSCoin: (
32
32
  sCoinName: SupportSCoin,
33
33
  sCoin: SuiObjectArg
34
- ) => Promise<TransactionResult>; // returns marketCoin
34
+ ) => TransactionResult; // returns marketCoin
35
35
  };
36
36
 
37
37
  export type sCoinQuickMethods = {
@@ -15,21 +15,21 @@ export type SpoolIds = {
15
15
  export type SpoolNormalMethods = {
16
16
  createStakeAccount: (
17
17
  stakeMarketCoinName: SupportStakeMarketCoins
18
- ) => Promise<TransactionResult>;
18
+ ) => TransactionResult;
19
19
  stake: (
20
20
  stakeAccount: SuiAddressArg,
21
21
  coin: SuiObjectArg,
22
22
  stakeMarketCoinName: SupportStakeMarketCoins
23
- ) => Promise<void>;
23
+ ) => void;
24
24
  unstake: (
25
25
  stakeAccount: SuiAddressArg,
26
26
  amount: number,
27
27
  stakeMarketCoinName: SupportStakeMarketCoins
28
- ) => Promise<TransactionResult>;
28
+ ) => TransactionResult;
29
29
  claim: (
30
30
  stakeAccount: SuiAddressArg,
31
31
  stakeMarketCoinName: SupportStakeMarketCoins
32
- ) => Promise<TransactionResult>;
32
+ ) => TransactionResult;
33
33
  };
34
34
 
35
35
  export type SpoolQuickMethods = {
@@ -13,22 +13,19 @@ export type VeScaNormalMethods = {
13
13
  lockSca: (
14
14
  scaCoin: SuiObjectArg,
15
15
  unlockAtInSecondTimestamp: number
16
- ) => Promise<TransactionResult>;
16
+ ) => TransactionResult;
17
17
  extendLockPeriod: (
18
18
  veScaKey: SuiObjectArg,
19
19
  newUnlockAtInSecondTimestamp: number
20
- ) => Promise<void>;
21
- extendLockAmount: (
22
- veScaKey: SuiObjectArg,
23
- scaCoin: SuiObjectArg
24
- ) => Promise<void>;
20
+ ) => void;
21
+ extendLockAmount: (veScaKey: SuiObjectArg, scaCoin: SuiObjectArg) => void;
25
22
  renewExpiredVeSca: (
26
23
  veScaKey: SuiObjectArg,
27
24
  scaCoin: SuiObjectArg,
28
25
  newUnlockAtInSecondTimestamp: number
29
- ) => Promise<void>;
30
- redeemSca: (veScaKey: SuiObjectArg) => Promise<TransactionResult>;
31
- mintEmptyVeSca: () => Promise<TransactionResult>;
26
+ ) => void;
27
+ redeemSca: (veScaKey: SuiObjectArg) => TransactionResult;
28
+ mintEmptyVeSca: () => TransactionResult;
32
29
  };
33
30
 
34
31
  export type RedeemScaQuickReturnType<T extends boolean> = T extends true