@scallop-io/sui-scallop-sdk 0.44.25 → 0.44.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builders/vescaBuilder.d.ts +3 -2
- package/dist/index.js +19 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -3
- package/dist/index.mjs.map +1 -1
- package/dist/types/builder/borrowIncentive.d.ts +10 -9
- package/dist/types/builder/vesca.d.ts +9 -9
- package/package.json +1 -1
- package/src/builders/borrowIncentiveBuilder.ts +26 -6
- package/src/builders/vescaBuilder.ts +5 -6
- package/src/types/builder/borrowIncentive.ts +20 -20
- package/src/types/builder/vesca.ts +8 -9
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SuiTxBlock as SuiKitTxBlock,
|
|
1
|
+
import type { SuiTxBlock as SuiKitTxBlock, SuiObjectArg } from '@scallop-io/sui-kit';
|
|
2
2
|
import type { TransactionResult } from '@mysten/sui.js/transactions';
|
|
3
3
|
import type { ScallopBuilder } from '../../models';
|
|
4
4
|
import type { SupportBorrowIncentiveCoins, SupportBorrowIncentiveRewardCoins } from '../constant';
|
|
@@ -11,16 +11,17 @@ export type BorrowIncentiveIds = {
|
|
|
11
11
|
obligationAccessStore: string;
|
|
12
12
|
};
|
|
13
13
|
export type BorrowIncentiveNormalMethods = {
|
|
14
|
-
stakeObligation: (obligation:
|
|
15
|
-
stakeObligationWithVesca: (obligation:
|
|
16
|
-
unstakeObligation: (obligation:
|
|
17
|
-
claimBorrowIncentive: (obligation:
|
|
14
|
+
stakeObligation: (obligation: SuiObjectArg, obligationKey: SuiObjectArg) => void;
|
|
15
|
+
stakeObligationWithVesca: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, veScaKey: SuiObjectArg) => void;
|
|
16
|
+
unstakeObligation: (obligation: SuiObjectArg, obligationKey: SuiObjectArg) => void;
|
|
17
|
+
claimBorrowIncentive: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, coinName: SupportBorrowIncentiveCoins, rewardType: SupportBorrowIncentiveRewardCoins) => TransactionResult;
|
|
18
|
+
deactivateBoost: (obligation: SuiObjectArg, veScaKey: SuiObjectArg) => void;
|
|
18
19
|
};
|
|
19
20
|
export type BorrowIncentiveQuickMethods = {
|
|
20
|
-
stakeObligationQuick(obligation?:
|
|
21
|
-
stakeObligationWithVeScaQuick(obligation?:
|
|
22
|
-
unstakeObligationQuick(obligation?:
|
|
23
|
-
claimBorrowIncentiveQuick(coinName: SupportBorrowIncentiveCoins, rewardType: SupportBorrowIncentiveRewardCoins, obligation?:
|
|
21
|
+
stakeObligationQuick(obligation?: SuiObjectArg, obligationKey?: SuiObjectArg): Promise<void>;
|
|
22
|
+
stakeObligationWithVeScaQuick(obligation?: SuiObjectArg, obligationKey?: SuiObjectArg, veScaKey?: SuiObjectArg): Promise<void>;
|
|
23
|
+
unstakeObligationQuick(obligation?: SuiObjectArg, obligationKey?: SuiObjectArg): Promise<void>;
|
|
24
|
+
claimBorrowIncentiveQuick(coinName: SupportBorrowIncentiveCoins, rewardType: SupportBorrowIncentiveRewardCoins, obligation?: SuiObjectArg, obligationKey?: SuiObjectArg): Promise<TransactionResult>;
|
|
24
25
|
};
|
|
25
26
|
export type SuiTxBlockWithBorrowIncentiveNormalMethods = SuiKitTxBlock & BorrowIncentiveNormalMethods;
|
|
26
27
|
export type BorrowIncentiveTxBlock = SuiTxBlockWithBorrowIncentiveNormalMethods & BorrowIncentiveQuickMethods;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SuiTxBlock as SuiKitTxBlock,
|
|
1
|
+
import { SuiTxBlock as SuiKitTxBlock, SuiObjectArg, SuiTxArg } from '@scallop-io/sui-kit';
|
|
2
2
|
import type { TransactionResult } from '@mysten/sui.js/transactions';
|
|
3
3
|
import { ScallopBuilder } from 'src/models';
|
|
4
4
|
export type VescaIds = {
|
|
@@ -9,17 +9,17 @@ export type VescaIds = {
|
|
|
9
9
|
};
|
|
10
10
|
export type VeScaNormalMethods = {
|
|
11
11
|
lockSca: (scaCoin: SuiObjectArg, unlockAtInSecondTimestamp: SuiTxArg) => TransactionResult;
|
|
12
|
-
extendLockPeriod: (veScaKey:
|
|
13
|
-
extendLockAmount: (veScaKey:
|
|
14
|
-
renewExpiredVeSca: (veScaKey:
|
|
15
|
-
redeemSca: (veScaKey:
|
|
12
|
+
extendLockPeriod: (veScaKey: SuiObjectArg, newUnlockAtInSecondTimestamp: SuiTxArg) => void;
|
|
13
|
+
extendLockAmount: (veScaKey: SuiObjectArg, scaCoin: SuiObjectArg) => void;
|
|
14
|
+
renewExpiredVeSca: (veScaKey: SuiObjectArg, scaCoin: SuiObjectArg, newUnlockAtInSecondTimestamp: SuiTxArg) => void;
|
|
15
|
+
redeemSca: (veScaKey: SuiObjectArg) => TransactionResult;
|
|
16
16
|
};
|
|
17
17
|
export type VeScaQuickMethods = {
|
|
18
18
|
lockScaQuick(amountOrCoin?: SuiObjectArg | number, lockPeriodInDays?: number, autoCheck?: boolean): Promise<void>;
|
|
19
|
-
extendLockPeriodQuick: (lockPeriodInDays: number, veScaKey?:
|
|
20
|
-
extendLockAmountQuick: (scaAmount: number, veScaKey?:
|
|
21
|
-
renewExpiredVeScaQuick: (scaAmount: number, lockPeriodInDays: number, veScaKey?:
|
|
22
|
-
redeemScaQuick: (veScaKey?:
|
|
19
|
+
extendLockPeriodQuick: (lockPeriodInDays: number, veScaKey?: SuiObjectArg, autoCheck?: boolean) => Promise<void>;
|
|
20
|
+
extendLockAmountQuick: (scaAmount: number, veScaKey?: SuiObjectArg, autoCheck?: boolean) => Promise<void>;
|
|
21
|
+
renewExpiredVeScaQuick: (scaAmount: number, lockPeriodInDays: number, veScaKey?: SuiObjectArg, autoCheck?: boolean) => Promise<void>;
|
|
22
|
+
redeemScaQuick: (veScaKey?: SuiObjectArg) => Promise<void>;
|
|
23
23
|
};
|
|
24
24
|
export type SuiTxBlockWithVeScaNormalMethods = SuiKitTxBlock & VeScaNormalMethods;
|
|
25
25
|
export type VeScaTxBlock = SuiTxBlockWithVeScaNormalMethods & VeScaQuickMethods;
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@ import { SuiTxBlock as SuiKitTxBlock } from '@scallop-io/sui-kit';
|
|
|
4
4
|
import { borrowIncentiveRewardCoins } from '../constants/enum';
|
|
5
5
|
import { getObligations, getObligationLocked } from '../queries';
|
|
6
6
|
import { requireSender } from '../utils';
|
|
7
|
-
import type {
|
|
7
|
+
import type { SuiObjectArg } from '@scallop-io/sui-kit';
|
|
8
8
|
import type { ScallopBuilder } from '../models';
|
|
9
9
|
import type {
|
|
10
10
|
BorrowIncentiveIds,
|
|
@@ -39,8 +39,8 @@ const requireObligationInfo = async (
|
|
|
39
39
|
...params: [
|
|
40
40
|
builder: ScallopBuilder,
|
|
41
41
|
txBlock: SuiKitTxBlock,
|
|
42
|
-
obligationId?:
|
|
43
|
-
obligationKey?:
|
|
42
|
+
obligationId?: SuiObjectArg,
|
|
43
|
+
obligationKey?: SuiObjectArg,
|
|
44
44
|
]
|
|
45
45
|
) => {
|
|
46
46
|
const [builder, txBlock, obligationId, obligationKey] = params;
|
|
@@ -61,10 +61,17 @@ const requireObligationInfo = async (
|
|
|
61
61
|
if (obligations.length === 0) {
|
|
62
62
|
throw new Error(`No obligation found for sender ${sender}`);
|
|
63
63
|
}
|
|
64
|
+
|
|
65
|
+
const selectedObligation =
|
|
66
|
+
obligations.find(
|
|
67
|
+
(obligation) =>
|
|
68
|
+
obligation.id === obligationId || obligation.keyId === obligationKey
|
|
69
|
+
) ?? obligations[0];
|
|
70
|
+
|
|
64
71
|
return {
|
|
65
|
-
obligationId:
|
|
66
|
-
obligationKey:
|
|
67
|
-
obligationLocked:
|
|
72
|
+
obligationId: selectedObligation.id,
|
|
73
|
+
obligationKey: selectedObligation.keyId,
|
|
74
|
+
obligationLocked: selectedObligation.locked,
|
|
68
75
|
};
|
|
69
76
|
};
|
|
70
77
|
|
|
@@ -220,6 +227,19 @@ const generateBorrowIncentiveNormalMethod: GenerateBorrowIncentiveNormalMethod =
|
|
|
220
227
|
[rewardType]
|
|
221
228
|
);
|
|
222
229
|
},
|
|
230
|
+
deactivateBoost: (obligation, veScaKey) => {
|
|
231
|
+
return txBlock.moveCall(
|
|
232
|
+
`${borrowIncentiveIds.borrowIncentivePkg}::user::deactivate_boost`,
|
|
233
|
+
[
|
|
234
|
+
borrowIncentiveIds.config,
|
|
235
|
+
borrowIncentiveIds.incentivePools,
|
|
236
|
+
borrowIncentiveIds.incentiveAccounts,
|
|
237
|
+
obligation,
|
|
238
|
+
veScaKey,
|
|
239
|
+
SUI_CLOCK_OBJECT_ID,
|
|
240
|
+
]
|
|
241
|
+
);
|
|
242
|
+
},
|
|
223
243
|
};
|
|
224
244
|
};
|
|
225
245
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SUI_CLOCK_OBJECT_ID,
|
|
3
|
-
SuiAddressArg,
|
|
4
3
|
SuiTxBlock,
|
|
5
4
|
TransactionBlock,
|
|
6
5
|
SuiTxBlock as SuiKitTxBlock,
|
|
@@ -46,7 +45,7 @@ export const requireVeSca = async (
|
|
|
46
45
|
...params: [
|
|
47
46
|
builder: ScallopBuilder,
|
|
48
47
|
SuiTxBlock: SuiTxBlock,
|
|
49
|
-
veScaKey?:
|
|
48
|
+
veScaKey?: SuiObjectArg,
|
|
50
49
|
]
|
|
51
50
|
) => {
|
|
52
51
|
const [builder, txBlock, veScaKey] = params;
|
|
@@ -254,7 +253,7 @@ const generateQuickVeScaMethod: GenerateVeScaQuickMethod = ({
|
|
|
254
253
|
},
|
|
255
254
|
extendLockPeriodQuick: async (
|
|
256
255
|
lockPeriodInDays: number,
|
|
257
|
-
veScaKey?:
|
|
256
|
+
veScaKey?: SuiObjectArg,
|
|
258
257
|
autoCheck = true
|
|
259
258
|
) => {
|
|
260
259
|
const veSca = await requireVeSca(builder, txBlock, veScaKey);
|
|
@@ -269,7 +268,7 @@ const generateQuickVeScaMethod: GenerateVeScaQuickMethod = ({
|
|
|
269
268
|
},
|
|
270
269
|
extendLockAmountQuick: async (
|
|
271
270
|
scaAmount: number,
|
|
272
|
-
veScaKey?:
|
|
271
|
+
veScaKey?: SuiObjectArg,
|
|
273
272
|
autoCheck = true
|
|
274
273
|
) => {
|
|
275
274
|
const sender = requireSender(txBlock);
|
|
@@ -295,7 +294,7 @@ const generateQuickVeScaMethod: GenerateVeScaQuickMethod = ({
|
|
|
295
294
|
renewExpiredVeScaQuick: async (
|
|
296
295
|
scaAmount: number,
|
|
297
296
|
lockPeriodInDays: number,
|
|
298
|
-
veScaKey?:
|
|
297
|
+
veScaKey?: SuiObjectArg,
|
|
299
298
|
autoCheck = true
|
|
300
299
|
) => {
|
|
301
300
|
const sender = requireSender(txBlock);
|
|
@@ -329,7 +328,7 @@ const generateQuickVeScaMethod: GenerateVeScaQuickMethod = ({
|
|
|
329
328
|
txBlock.transferObjects(transferObjects, sender);
|
|
330
329
|
}
|
|
331
330
|
},
|
|
332
|
-
redeemScaQuick: async (veScaKey?:
|
|
331
|
+
redeemScaQuick: async (veScaKey?: SuiObjectArg) => {
|
|
333
332
|
const sender = requireSender(txBlock);
|
|
334
333
|
const veSca = await requireVeSca(builder, txBlock, veScaKey);
|
|
335
334
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
SuiTxBlock as SuiKitTxBlock,
|
|
3
|
-
|
|
4
|
-
SuiTxArg,
|
|
3
|
+
SuiObjectArg,
|
|
5
4
|
} from '@scallop-io/sui-kit';
|
|
6
5
|
import type { TransactionResult } from '@mysten/sui.js/transactions';
|
|
7
6
|
import type { ScallopBuilder } from '../../models';
|
|
@@ -21,45 +20,46 @@ export type BorrowIncentiveIds = {
|
|
|
21
20
|
|
|
22
21
|
export type BorrowIncentiveNormalMethods = {
|
|
23
22
|
stakeObligation: (
|
|
24
|
-
obligation:
|
|
25
|
-
obligationKey:
|
|
23
|
+
obligation: SuiObjectArg,
|
|
24
|
+
obligationKey: SuiObjectArg
|
|
26
25
|
) => void;
|
|
27
26
|
stakeObligationWithVesca: (
|
|
28
|
-
obligation:
|
|
29
|
-
obligationKey:
|
|
30
|
-
veScaKey:
|
|
27
|
+
obligation: SuiObjectArg,
|
|
28
|
+
obligationKey: SuiObjectArg,
|
|
29
|
+
veScaKey: SuiObjectArg
|
|
31
30
|
) => void;
|
|
32
31
|
unstakeObligation: (
|
|
33
|
-
obligation:
|
|
34
|
-
obligationKey:
|
|
32
|
+
obligation: SuiObjectArg,
|
|
33
|
+
obligationKey: SuiObjectArg
|
|
35
34
|
) => void;
|
|
36
35
|
claimBorrowIncentive: (
|
|
37
|
-
obligation:
|
|
38
|
-
obligationKey:
|
|
36
|
+
obligation: SuiObjectArg,
|
|
37
|
+
obligationKey: SuiObjectArg,
|
|
39
38
|
coinName: SupportBorrowIncentiveCoins,
|
|
40
39
|
rewardType: SupportBorrowIncentiveRewardCoins
|
|
41
40
|
) => TransactionResult;
|
|
41
|
+
deactivateBoost: (obligation: SuiObjectArg, veScaKey: SuiObjectArg) => void;
|
|
42
42
|
};
|
|
43
43
|
|
|
44
44
|
export type BorrowIncentiveQuickMethods = {
|
|
45
45
|
stakeObligationQuick(
|
|
46
|
-
obligation?:
|
|
47
|
-
obligationKey?:
|
|
46
|
+
obligation?: SuiObjectArg,
|
|
47
|
+
obligationKey?: SuiObjectArg
|
|
48
48
|
): Promise<void>;
|
|
49
49
|
stakeObligationWithVeScaQuick(
|
|
50
|
-
obligation?:
|
|
51
|
-
obligationKey?:
|
|
52
|
-
veScaKey?:
|
|
50
|
+
obligation?: SuiObjectArg,
|
|
51
|
+
obligationKey?: SuiObjectArg,
|
|
52
|
+
veScaKey?: SuiObjectArg
|
|
53
53
|
): Promise<void>;
|
|
54
54
|
unstakeObligationQuick(
|
|
55
|
-
obligation?:
|
|
56
|
-
obligationKey?:
|
|
55
|
+
obligation?: SuiObjectArg,
|
|
56
|
+
obligationKey?: SuiObjectArg
|
|
57
57
|
): Promise<void>;
|
|
58
58
|
claimBorrowIncentiveQuick(
|
|
59
59
|
coinName: SupportBorrowIncentiveCoins,
|
|
60
60
|
rewardType: SupportBorrowIncentiveRewardCoins,
|
|
61
|
-
obligation?:
|
|
62
|
-
obligationKey?:
|
|
61
|
+
obligation?: SuiObjectArg,
|
|
62
|
+
obligationKey?: SuiObjectArg
|
|
63
63
|
): Promise<TransactionResult>;
|
|
64
64
|
};
|
|
65
65
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SuiTxBlock as SuiKitTxBlock,
|
|
3
|
-
SuiAddressArg,
|
|
4
3
|
SuiObjectArg,
|
|
5
4
|
SuiTxArg,
|
|
6
5
|
} from '@scallop-io/sui-kit';
|
|
@@ -20,16 +19,16 @@ export type VeScaNormalMethods = {
|
|
|
20
19
|
unlockAtInSecondTimestamp: SuiTxArg
|
|
21
20
|
) => TransactionResult;
|
|
22
21
|
extendLockPeriod: (
|
|
23
|
-
veScaKey:
|
|
22
|
+
veScaKey: SuiObjectArg,
|
|
24
23
|
newUnlockAtInSecondTimestamp: SuiTxArg
|
|
25
24
|
) => void;
|
|
26
|
-
extendLockAmount: (veScaKey:
|
|
25
|
+
extendLockAmount: (veScaKey: SuiObjectArg, scaCoin: SuiObjectArg) => void;
|
|
27
26
|
renewExpiredVeSca: (
|
|
28
|
-
veScaKey:
|
|
27
|
+
veScaKey: SuiObjectArg,
|
|
29
28
|
scaCoin: SuiObjectArg,
|
|
30
29
|
newUnlockAtInSecondTimestamp: SuiTxArg
|
|
31
30
|
) => void;
|
|
32
|
-
redeemSca: (veScaKey:
|
|
31
|
+
redeemSca: (veScaKey: SuiObjectArg) => TransactionResult;
|
|
33
32
|
};
|
|
34
33
|
|
|
35
34
|
export type VeScaQuickMethods = {
|
|
@@ -40,21 +39,21 @@ export type VeScaQuickMethods = {
|
|
|
40
39
|
): Promise<void>;
|
|
41
40
|
extendLockPeriodQuick: (
|
|
42
41
|
lockPeriodInDays: number,
|
|
43
|
-
veScaKey?:
|
|
42
|
+
veScaKey?: SuiObjectArg,
|
|
44
43
|
autoCheck?: boolean
|
|
45
44
|
) => Promise<void>;
|
|
46
45
|
extendLockAmountQuick: (
|
|
47
46
|
scaAmount: number,
|
|
48
|
-
veScaKey?:
|
|
47
|
+
veScaKey?: SuiObjectArg,
|
|
49
48
|
autoCheck?: boolean
|
|
50
49
|
) => Promise<void>;
|
|
51
50
|
renewExpiredVeScaQuick: (
|
|
52
51
|
scaAmount: number,
|
|
53
52
|
lockPeriodInDays: number,
|
|
54
|
-
veScaKey?:
|
|
53
|
+
veScaKey?: SuiObjectArg,
|
|
55
54
|
autoCheck?: boolean
|
|
56
55
|
) => Promise<void>;
|
|
57
|
-
redeemScaQuick: (veScaKey?:
|
|
56
|
+
redeemScaQuick: (veScaKey?: SuiObjectArg) => Promise<void>;
|
|
58
57
|
};
|
|
59
58
|
|
|
60
59
|
export type SuiTxBlockWithVeScaNormalMethods = SuiKitTxBlock &
|