@scallop-io/sui-scallop-sdk 0.44.17 → 0.44.19

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 (56) hide show
  1. package/dist/builders/borrowIncentiveBuilder.d.ts +7 -0
  2. package/dist/builders/vescaBuilder.d.ts +24 -0
  3. package/dist/constants/common.d.ts +7 -4
  4. package/dist/constants/index.d.ts +1 -0
  5. package/dist/constants/vesca.d.ts +5 -0
  6. package/dist/index.js +878 -255
  7. package/dist/index.js.map +1 -1
  8. package/dist/index.mjs +867 -248
  9. package/dist/index.mjs.map +1 -1
  10. package/dist/models/scallopClient.d.ts +7 -7
  11. package/dist/models/scallopUtils.d.ts +16 -14
  12. package/dist/queries/index.d.ts +1 -0
  13. package/dist/queries/vescaQuery.d.ts +28 -0
  14. package/dist/types/address.d.ts +9 -0
  15. package/dist/types/builder/borrowIncentive.d.ts +9 -6
  16. package/dist/types/builder/index.d.ts +3 -1
  17. package/dist/types/builder/vesca.d.ts +33 -0
  18. package/dist/types/constant/enum.d.ts +1 -1
  19. package/dist/types/query/borrowIncentive.d.ts +65 -60
  20. package/dist/types/query/index.d.ts +1 -0
  21. package/dist/types/query/portfolio.d.ts +12 -6
  22. package/dist/types/query/vesca.d.ts +7 -0
  23. package/dist/types/utils.d.ts +1 -2
  24. package/dist/utils/builder.d.ts +6 -0
  25. package/dist/utils/query.d.ts +4 -10
  26. package/dist/utils/util.d.ts +7 -0
  27. package/package.json +1 -1
  28. package/src/builders/borrowIncentiveBuilder.ts +174 -25
  29. package/src/builders/index.ts +6 -2
  30. package/src/builders/vescaBuilder.ts +392 -0
  31. package/src/constants/common.ts +19 -6
  32. package/src/constants/enum.ts +9 -3
  33. package/src/constants/index.ts +1 -0
  34. package/src/constants/vesca.ts +7 -0
  35. package/src/models/scallopAddress.ts +9 -1
  36. package/src/models/scallopClient.ts +29 -20
  37. package/src/models/scallopUtils.ts +45 -0
  38. package/src/queries/borrowIncentiveQuery.ts +93 -83
  39. package/src/queries/coreQuery.ts +19 -20
  40. package/src/queries/index.ts +1 -0
  41. package/src/queries/portfolioQuery.ts +79 -41
  42. package/src/queries/spoolQuery.ts +1 -1
  43. package/src/queries/vescaQuery.ts +124 -0
  44. package/src/types/address.ts +9 -0
  45. package/src/types/builder/borrowIncentive.ts +22 -5
  46. package/src/types/builder/index.ts +4 -1
  47. package/src/types/builder/vesca.ts +73 -0
  48. package/src/types/constant/enum.ts +1 -1
  49. package/src/types/query/borrowIncentive.ts +195 -74
  50. package/src/types/query/index.ts +1 -0
  51. package/src/types/query/portfolio.ts +17 -6
  52. package/src/types/query/vesca.ts +7 -0
  53. package/src/types/utils.ts +1 -1
  54. package/src/utils/builder.ts +141 -0
  55. package/src/utils/query.ts +227 -131
  56. package/src/utils/util.ts +28 -0
@@ -264,23 +264,23 @@ export declare class ScallopClient {
264
264
  /**
265
265
  * stake obligaion.
266
266
  *
267
- * @param obligaionId - The obligation account object.
268
- * @param obligaionKeyId - The obligation key account object.
267
+ * @param obligationId - The obligation account object.
268
+ * @param obligationKeyId - The obligation key account object.
269
269
  * @param sign - Decide to directly sign the transaction or return the transaction block.
270
270
  * @param walletAddress - The wallet address of the owner.
271
271
  * @return Transaction block response or transaction block
272
272
  */
273
- stakeObligation<S extends boolean>(obligaionId: string, obligaionKeyId: string, sign?: S, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
273
+ stakeObligation<S extends boolean>(obligationId: string, obligationKeyId: string, sign?: S, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
274
274
  /**
275
275
  * unstake obligaion.
276
276
  *
277
- * @param obligaionId - The obligation account object.
278
- * @param obligaionKeyId - The obligation key account object.
277
+ * @param obligationId - The obligation account object.
278
+ * @param obligationKeyId - The obligation key account object.
279
279
  * @param sign - Decide to directly sign the transaction or return the transaction block.
280
280
  * @param walletAddress - The wallet address of the owner.
281
281
  * @return Transaction block response or transaction block
282
282
  */
283
- unstakeObligation<S extends boolean>(obligaionId: string, obligaionKeyId: string, sign?: S, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
283
+ unstakeObligation<S extends boolean>(obligationId: string, obligationKeyId: string, sign?: S, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
284
284
  /**
285
285
  * unstake market coin from the specific spool.
286
286
  *
@@ -291,7 +291,7 @@ export declare class ScallopClient {
291
291
  * @param walletAddress - The wallet address of the owner.
292
292
  * @return Transaction block response or transaction block
293
293
  */
294
- claimBorrowIncentive<S extends boolean>(coinName: SupportBorrowIncentiveCoins, obligaionId: string, obligaionKeyId: string, sign?: S, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
294
+ claimBorrowIncentive<S extends boolean>(coinName: SupportBorrowIncentiveCoins, obligationId: string, obligationKeyId: string, sign?: S, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
295
295
  /**
296
296
  * Mint and get test coin.
297
297
  *
@@ -95,7 +95,7 @@ export declare class ScallopUtils {
95
95
  * @param borrowIncentiveCoinName - Support borrow incentive coin.
96
96
  * @return Borrow incentive reward coin name.
97
97
  */
98
- getBorrowIncentiveRewardCoinName: (borrowIncentiveCoinName: SupportBorrowIncentiveCoins) => "sui";
98
+ getBorrowIncentiveRewardCoinName: (borrowIncentiveCoinName: SupportBorrowIncentiveCoins) => ("sui" | "sca")[];
99
99
  /**
100
100
  * Get coin decimal.
101
101
  *
@@ -140,19 +140,7 @@ export declare class ScallopUtils {
140
140
  * @param assetCoinNames - Specific an array of support asset coin name.
141
141
  * @return Asset coin price.
142
142
  */
143
- getCoinPrices(assetCoinNames?: SupportAssetCoins[]): Promise<{
144
- eth?: number | undefined;
145
- btc?: number | undefined;
146
- usdc?: number | undefined;
147
- usdt?: number | undefined;
148
- sui?: number | undefined;
149
- apt?: number | undefined;
150
- sol?: number | undefined;
151
- cetus?: number | undefined;
152
- afsui?: number | undefined;
153
- hasui?: number | undefined;
154
- vsui?: number | undefined;
155
- }>;
143
+ getCoinPrices(assetCoinNames?: SupportAssetCoins[]): Promise<import("../types").OptionalKeys<Record<SupportAssetCoins, number>>>;
156
144
  /**
157
145
  * Convert apr to apy.
158
146
  *
@@ -169,4 +157,18 @@ export declare class ScallopUtils {
169
157
  * @return The equivalent annual percentage rate (APR) for the given APY and compounding frequency.
170
158
  */
171
159
  parseApyToApr(apy: number, compoundFrequency?: number): number;
160
+ /**
161
+ * Give extend lock period to get unlock at in seconds timestamp.
162
+ *
163
+ * @description
164
+ * - When the user without remaining unlock period, If the extended unlock day is not specified,
165
+ * the unlock period will be increased by one day by default.
166
+ * - When the given extended day plus the user's remaining unlock period exceeds the maximum
167
+ * unlock period, the maximum unlock period is used as unlock period.
168
+ *
169
+ * @param extendLockPeriodInDay The extend lock period in day.
170
+ * @param unlockAtInSecondTimestamp The unlock timestamp from veSca object.
171
+ * @return New unlock at in seconds timestamp.
172
+ */
173
+ getUnlockAt(extendLockPeriodInDay?: number, unlockAtInSecondTimestamp?: number): number;
172
174
  }
@@ -3,3 +3,4 @@ export * from './spoolQuery';
3
3
  export * from './borrowIncentiveQuery';
4
4
  export * from './priceQuery';
5
5
  export * from './portfolioQuery';
6
+ export * from './vescaQuery';
@@ -0,0 +1,28 @@
1
+ import { Vesca } from '../types';
2
+ import type { SuiObjectData } from '@mysten/sui.js/client';
3
+ import type { ScallopQuery } from '../models';
4
+ /**
5
+ * Query all owned veSca key.
6
+ *
7
+ * @param query - The Scallop query instance.
8
+ * @param ownerAddress - The owner address.
9
+ * @return Owned veSca key.
10
+ */
11
+ export declare const getVescaKeys: (query: ScallopQuery, ownerAddress?: string) => Promise<SuiObjectData[]>;
12
+ /**
13
+ * Query all owned veSca.
14
+ *
15
+ * @param query - The Scallop query instance.
16
+ * @param ownerAddress - The owner address.
17
+ * @return Owned veScas.
18
+ */
19
+ export declare const getVeScas: (query: ScallopQuery, ownerAddress?: string) => Promise<Vesca[]>;
20
+ /**
21
+ * Get veSca data.
22
+ *
23
+ * @param query - The Scallop query instance.
24
+ * @param veScaKeyId - The vesca key id.
25
+ * @param ownerAddress - The owner address.
26
+ * @returns Vesca data.
27
+ */
28
+ export declare const getVeSca: (query: ScallopQuery, veScaKeyId?: string, ownerAddress?: string) => Promise<Vesca | undefined>;
@@ -58,9 +58,18 @@ export interface AddressesInterface {
58
58
  adminCap: string;
59
59
  object: string;
60
60
  query: string;
61
+ config: string;
61
62
  incentivePools: string;
62
63
  incentiveAccounts: string;
63
64
  };
65
+ vesca: {
66
+ id: string;
67
+ adminCap: string;
68
+ tableId: string;
69
+ table: string;
70
+ treasury: string;
71
+ config: string;
72
+ };
64
73
  }
65
74
  type AddressPathsProps<T> = T extends string ? [] : {
66
75
  [K in Extract<keyof T, string>]: [K, ...AddressPathsProps<T[K]>];
@@ -1,23 +1,26 @@
1
- import type { SuiTxBlock as SuiKitTxBlock, SuiAddressArg } from '@scallop-io/sui-kit';
1
+ import type { SuiTxBlock as SuiKitTxBlock, SuiAddressArg, SuiTxArg } from '@scallop-io/sui-kit';
2
2
  import type { TransactionResult } from '@mysten/sui.js/transactions';
3
3
  import type { ScallopBuilder } from '../../models';
4
- import type { SupportBorrowIncentiveCoins } from '../constant';
4
+ import type { SupportBorrowIncentiveCoins, SupportBorrowIncentiveRewardCoins } from '../constant';
5
5
  export type BorrowIncentiveIds = {
6
6
  borrowIncentivePkg: string;
7
7
  query: string;
8
+ config: string;
8
9
  incentivePools: string;
9
10
  incentiveAccounts: string;
10
11
  obligationAccessStore: string;
11
12
  };
12
13
  export type BorrowIncentiveNormalMethods = {
13
- stakeObligation: (obligation: SuiAddressArg, obligaionKey: SuiAddressArg) => void;
14
- unstakeObligation: (obligation: SuiAddressArg, obligaionKey: SuiAddressArg) => void;
15
- claimBorrowIncentive: (obligation: SuiAddressArg, obligaionKey: SuiAddressArg, coinName: SupportBorrowIncentiveCoins) => TransactionResult;
14
+ stakeObligation: (obligation: SuiAddressArg, obligationKey: SuiAddressArg) => void;
15
+ stakeObligationWithVesca: (obligation: SuiAddressArg, obligationKey: SuiAddressArg, veScaKey: SuiTxArg) => void;
16
+ unstakeObligation: (obligation: SuiAddressArg, obligationKey: SuiAddressArg) => void;
17
+ claimBorrowIncentive: (obligation: SuiAddressArg, obligationKey: SuiAddressArg, coinName: SupportBorrowIncentiveCoins, rewardType: SupportBorrowIncentiveRewardCoins) => TransactionResult;
16
18
  };
17
19
  export type BorrowIncentiveQuickMethods = {
18
20
  stakeObligationQuick(obligation?: SuiAddressArg, obligationKey?: SuiAddressArg): Promise<void>;
21
+ stakeObligationWithVeScaQuick(obligation?: SuiAddressArg, obligationKey?: SuiAddressArg, veScaKey?: SuiAddressArg): Promise<void>;
19
22
  unstakeObligationQuick(obligation?: SuiAddressArg, obligationKey?: SuiAddressArg): Promise<void>;
20
- claimBorrowIncentiveQuick(coinName: SupportBorrowIncentiveCoins, obligation?: SuiAddressArg, obligationKey?: SuiAddressArg): Promise<TransactionResult>;
23
+ claimBorrowIncentiveQuick(coinName: SupportBorrowIncentiveCoins, rewardType: SupportBorrowIncentiveRewardCoins, obligation?: SuiAddressArg, obligationKey?: SuiAddressArg): Promise<TransactionResult>;
21
24
  };
22
25
  export type SuiTxBlockWithBorrowIncentiveNormalMethods = SuiKitTxBlock & BorrowIncentiveNormalMethods;
23
26
  export type BorrowIncentiveTxBlock = SuiTxBlockWithBorrowIncentiveNormalMethods & BorrowIncentiveQuickMethods;
@@ -1,7 +1,9 @@
1
1
  import type { CoreTxBlock } from './core';
2
2
  import type { SpoolTxBlock } from './spool';
3
3
  import type { BorrowIncentiveTxBlock } from './borrowIncentive';
4
+ import type { VeScaTxBlock } from './vesca';
4
5
  export type * from './core';
5
6
  export type * from './spool';
6
7
  export type * from './borrowIncentive';
7
- export type ScallopTxBlock = CoreTxBlock & SpoolTxBlock & BorrowIncentiveTxBlock;
8
+ export type * from './vesca';
9
+ export type ScallopTxBlock = CoreTxBlock & SpoolTxBlock & BorrowIncentiveTxBlock & VeScaTxBlock;
@@ -0,0 +1,33 @@
1
+ import { SuiTxBlock as SuiKitTxBlock, SuiAddressArg, SuiObjectArg, SuiTxArg } from '@scallop-io/sui-kit';
2
+ import type { TransactionResult } from '@mysten/sui.js/transactions';
3
+ import { ScallopBuilder } from 'src/models';
4
+ export type VescaIds = {
5
+ pkgId: string;
6
+ table: string;
7
+ treasury: string;
8
+ config: string;
9
+ };
10
+ export type VeScaNormalMethods = {
11
+ lockSca: (scaCoin: SuiObjectArg, unlockAtInSecondTimestamp: SuiTxArg) => TransactionResult;
12
+ extendLockPeriod: (veScaKey: SuiAddressArg, newUnlockAtInSecondTimestamp: SuiTxArg) => void;
13
+ extendLockAmount: (veScaKey: SuiAddressArg, scaCoin: SuiObjectArg) => void;
14
+ renewExpiredVeSca: (veScaKey: SuiAddressArg, scaCoin: SuiObjectArg, newUnlockAtInSecondTimestamp: SuiTxArg) => void;
15
+ redeemSca: (veScaKey: SuiAddressArg) => TransactionResult;
16
+ };
17
+ export type VeScaQuickMethods = {
18
+ lockScaQuick(amountOrCoin?: SuiObjectArg | number, lockPeriodInDays?: number, autoCheck?: boolean): Promise<void>;
19
+ extendLockPeriodQuick: (lockPeriodInDays: number, veScaKey?: SuiAddressArg, autoCheck?: boolean) => Promise<void>;
20
+ extendLockAmountQuick: (scaAmount: number, veScaKey?: SuiAddressArg, autoCheck?: boolean) => Promise<void>;
21
+ renewExpiredVeScaQuick: (scaAmount: number, lockPeriodInDays: number, veScaKey?: SuiAddressArg, autoCheck?: boolean) => Promise<void>;
22
+ redeemScaQuick: (veScaKey?: SuiAddressArg) => Promise<void>;
23
+ };
24
+ export type SuiTxBlockWithVeScaNormalMethods = SuiKitTxBlock & VeScaNormalMethods;
25
+ export type VeScaTxBlock = SuiTxBlockWithVeScaNormalMethods & VeScaQuickMethods;
26
+ export type GenerateVeScaNormalMethod = (params: {
27
+ builder: ScallopBuilder;
28
+ txBlock: SuiKitTxBlock;
29
+ }) => VeScaNormalMethods;
30
+ export type GenerateVeScaQuickMethod = (params: {
31
+ builder: ScallopBuilder;
32
+ txBlock: SuiTxBlockWithVeScaNormalMethods;
33
+ }) => VeScaQuickMethods;
@@ -15,7 +15,7 @@ export type StakeRewardCoins = {
15
15
  [key in SupportStakeMarketCoins]: SupportStakeRewardCoins;
16
16
  };
17
17
  export type BorrowIncentiveRewardCoins = {
18
- [key in SupportBorrowIncentiveCoins]: SupportBorrowIncentiveRewardCoins;
18
+ [key in SupportBorrowIncentiveCoins]: SupportBorrowIncentiveRewardCoins[];
19
19
  };
20
20
  export type AssetCoinIds = {
21
21
  [key in SupportAssetCoins]: string;
@@ -1,4 +1,4 @@
1
- import type { SupportBorrowIncentiveCoins } from '../constant';
1
+ import type { SupportBorrowIncentiveCoins, SupportBorrowIncentiveRewardCoins } from '../constant';
2
2
  export interface BorrowIncentiveAccountKey {
3
3
  id: string;
4
4
  onwerId: string;
@@ -7,112 +7,117 @@ type OptionalKeys<T> = {
7
7
  [K in keyof T]?: T[K];
8
8
  };
9
9
  export type BorrowIncentivePools = OptionalKeys<Record<SupportBorrowIncentiveCoins, BorrowIncentivePool>>;
10
+ export type BorrowIncentivePoolPoints = {
11
+ symbol: string;
12
+ coinName: SupportBorrowIncentiveRewardCoins;
13
+ coinType: string;
14
+ coinDecimal: number;
15
+ coinPrice: number;
16
+ } & Required<Pick<ParsedBorrowIncentivePoolPointData, 'points' | 'distributedPoint' | 'weightedAmount'>> & CalculatedBorrowIncentivePoolPointData;
10
17
  export type BorrowIncentivePool = {
11
18
  coinName: SupportBorrowIncentiveCoins;
12
19
  symbol: string;
13
20
  coinType: string;
14
- rewardCoinType: string;
15
21
  coinDecimal: number;
16
- rewardCoinDecimal: number;
17
22
  coinPrice: number;
18
- rewardCoinPrice: number;
19
- } & Required<Pick<ParsedBorrowIncentivePoolData, 'maxPoint' | 'distributedPoint' | 'maxStake'>> & CalculatedBorrowIncentivePoolData & BorrowIncentiveRewardPool;
20
- export type OriginBorrowIncentivePoolData = {
21
- created_at: string;
22
- distributed_point: string;
23
+ points: OptionalKeys<Record<SupportBorrowIncentiveRewardCoins, BorrowIncentivePoolPoints>>;
24
+ };
25
+ export type OriginBorrowIncentivePoolPointData = {
26
+ point_type: {
27
+ name: string;
28
+ };
23
29
  distributed_point_per_period: string;
30
+ point_distribution_time: string;
31
+ distributed_point: string;
32
+ points: string;
24
33
  index: string;
34
+ base_weight: string;
35
+ weighted_amount: string;
25
36
  last_update: string;
26
- max_distributed_point: string;
27
- max_stakes: string;
28
- point_distribution_time: string;
37
+ };
38
+ export type OriginBorrowIncentivePoolData = {
29
39
  pool_type: {
30
40
  name: string;
31
41
  };
42
+ points: OriginBorrowIncentivePoolPointData[];
43
+ min_stakes: string;
44
+ max_stakes: string;
32
45
  stakes: string;
46
+ created_at: string;
47
+ };
48
+ export type ParsedBorrowIncentivePoolPointData = {
49
+ pointType: string;
50
+ distributedPointPerPeriod: number;
51
+ period: number;
52
+ distributedPoint: number;
53
+ points: number;
54
+ index: number;
55
+ baseWeight: number;
56
+ weightedAmount: number;
57
+ lastUpdate: number;
33
58
  };
34
59
  export type ParsedBorrowIncentivePoolData = {
35
60
  poolType: string;
36
- maxPoint: number;
37
- distributedPoint: number;
38
- pointPerPeriod: number;
39
- period: number;
40
- maxStake: number;
61
+ poolPoints: OptionalKeys<Record<SupportBorrowIncentiveRewardCoins, ParsedBorrowIncentivePoolPointData>>;
62
+ minStakes: number;
63
+ maxStakes: number;
41
64
  staked: number;
42
- index: number;
43
65
  createdAt: number;
44
- lastUpdate: number;
45
66
  };
46
- export type CalculatedBorrowIncentivePoolData = {
67
+ export type CalculatedBorrowIncentivePoolPointData = {
47
68
  stakedAmount: number;
48
69
  stakedCoin: number;
49
70
  stakedValue: number;
71
+ baseWeight: number;
72
+ weightedStakedAmount: number;
73
+ weightedStakedCoin: number;
74
+ weightedStakedValue: number;
50
75
  distributedPointPerSec: number;
51
76
  accumulatedPoints: number;
52
77
  currentPointIndex: number;
53
78
  currentTotalDistributedPoint: number;
54
- startDate: Date;
55
- endDate: Date;
56
- };
57
- export type BorrowIncentiveRewardPool = Required<Pick<ParsedBorrowIncentiveRewardPoolData, 'exchangeRateNumerator' | 'exchangeRateDenominator'>> & CalculatedBorrowIncentiveRewardPoolData;
58
- export type OriginBorrowIncentiveRewardPoolData = {
59
- claimed_rewards: string;
60
- exchange_rate_denominator: string;
61
- exchange_rate_numerator: string;
62
- remaining_reward: string;
63
- reward_type: {
64
- name: string;
65
- };
66
- };
67
- export type ParsedBorrowIncentiveRewardPoolData = {
68
- rewardType: string;
69
- claimedRewards: number;
70
- exchangeRateDenominator: number;
71
- exchangeRateNumerator: number;
72
- remainingRewards: number;
73
- };
74
- export type CalculatedBorrowIncentiveRewardPoolData = {
75
79
  rewardApr: number;
76
- totalRewardAmount: number;
77
- totalRewardCoin: number;
78
- totalRewardValue: number;
79
- remaindRewardAmount: number;
80
- remaindRewardCoin: number;
81
- remaindRewardValue: number;
82
- claimedRewardAmount: number;
83
- claimedRewardCoin: number;
84
- claimedRewardValue: number;
85
80
  rewardPerSec: number;
86
81
  };
87
82
  export type BorrowIncentiveAccounts = OptionalKeys<Record<SupportBorrowIncentiveCoins, ParsedBorrowIncentiveAccountData>>;
88
- export type OriginBorrowIncentiveAccountData = {
89
- amount: string;
90
- index: string;
83
+ export type OriginBorrowIncentiveAccountPoolData = {
84
+ point_type: {
85
+ name: string;
86
+ };
87
+ weighted_amount: string;
91
88
  points: string;
89
+ total_points: string;
90
+ index: string;
91
+ };
92
+ export type OriginBorrowIncentiveAccountData = {
93
+ points_list: OriginBorrowIncentiveAccountPoolData[];
92
94
  pool_type: {
93
95
  name: string;
94
96
  };
95
- total_points: string;
97
+ debt_amount: string;
96
98
  };
97
- export type ParsedBorrowIncentiveAccountData = {
98
- poolType: string;
99
- amount: number;
100
- index: number;
99
+ export type ParsedBorrowIncentiveAccountPoolData = {
100
+ pointType: string;
101
+ weightedAmount: number;
101
102
  points: number;
102
103
  totalPoints: number;
104
+ index: number;
105
+ };
106
+ export type ParsedBorrowIncentiveAccountData = {
107
+ pointList: OptionalKeys<Record<SupportBorrowIncentiveRewardCoins, ParsedBorrowIncentiveAccountPoolData>>;
108
+ poolType: string;
109
+ debtAmount: number;
103
110
  };
104
111
  /**
105
112
  * The query interface for `incentive_pools_query::incentive_pools_data` inspectTxn.
106
113
  */
107
114
  export interface BorrowIncentivePoolsQueryInterface {
108
115
  incentive_pools: OriginBorrowIncentivePoolData[];
109
- reward_pool: OriginBorrowIncentiveRewardPoolData;
110
116
  }
111
117
  /**
112
118
  * The query interface for `incentive_account_query::incentive_account_data` inspectTxn.
113
119
  */
114
120
  export interface BorrowIncentiveAccountsQueryInterface {
115
- incentive_states: OriginBorrowIncentiveAccountData[];
116
- total_points: string;
121
+ pool_records: OriginBorrowIncentiveAccountData[];
117
122
  }
118
123
  export {};
@@ -2,3 +2,4 @@ export type * from './core';
2
2
  export type * from './spool';
3
3
  export type * from './borrowIncentive';
4
4
  export type * from './portfolio';
5
+ export type * from './vesca';
@@ -1,6 +1,6 @@
1
1
  import type { MarketPool } from './core';
2
2
  import type { Spool } from './spool';
3
- import type { SupportPoolCoins, SupportCollateralCoins } from '../constant';
3
+ import type { SupportPoolCoins, SupportCollateralCoins, SupportBorrowIncentiveRewardCoins } from '../constant';
4
4
  type OptionalKeys<T> = {
5
5
  [K in keyof T]?: T[K];
6
6
  };
@@ -85,17 +85,23 @@ export type ObligationDebt = {
85
85
  availableRepayAmount: number;
86
86
  availableRepayCoin: number;
87
87
  };
88
+ export type ObligationBorrowIcentiveReward = {
89
+ coinName: SupportBorrowIncentiveRewardCoins;
90
+ coinType: string;
91
+ symbol: string;
92
+ coinDecimal: number;
93
+ coinPrice: number;
94
+ availableClaimCoin: number;
95
+ availableClaimAmount: number;
96
+ boostValue: number;
97
+ };
88
98
  export type ObligationBorrowIncentive = {
89
99
  coinName: SupportPoolCoins;
90
100
  coinType: string;
91
- rewardCoinType: string;
92
101
  symbol: string;
93
102
  coinDecimal: number;
94
- rewardCoinDecimal: number;
95
103
  coinPrice: number;
96
- rewardCoinPrice: number;
97
- availableClaimAmount: number;
98
- availableClaimCoin: number;
104
+ rewards: ObligationBorrowIcentiveReward[];
99
105
  };
100
106
  export type TotalValueLocked = {
101
107
  supplyValue: number;
@@ -0,0 +1,7 @@
1
+ export type Vesca = {
2
+ id: string;
3
+ keyId: string;
4
+ lockedScaAmount: number;
5
+ lockedScaCoin: number;
6
+ unlockAt: number;
7
+ };
@@ -1,5 +1,5 @@
1
1
  import type { SupportAssetCoins } from './constant';
2
- type OptionalKeys<T> = {
2
+ export type OptionalKeys<T> = {
3
3
  [K in keyof T]?: T[K];
4
4
  };
5
5
  export type CoinPrices = OptionalKeys<Record<SupportAssetCoins, number>>;
@@ -7,4 +7,3 @@ export type PriceMap = Map<SupportAssetCoins, {
7
7
  price: number;
8
8
  publishTime: number;
9
9
  }>;
10
- export {};
@@ -1,4 +1,5 @@
1
1
  import type { SuiTxBlock as SuiKitTxBlock } from '@scallop-io/sui-kit';
2
+ import type { SuiObjectArg } from '@scallop-io/sui-kit';
2
3
  /**
3
4
  * Check and get the sender from the transaction block.
4
5
  *
@@ -6,3 +7,8 @@ import type { SuiTxBlock as SuiKitTxBlock } from '@scallop-io/sui-kit';
6
7
  * @return Sender of transaction.
7
8
  */
8
9
  export declare const requireSender: (txBlock: SuiKitTxBlock) => string;
10
+ export declare const checkLockSca: (scaAmountOrCoin?: number | SuiObjectArg | undefined, lockPeriodInDays?: number, newUnlockAtInSecondTimestamp?: number, prevUnlockAtInSecondTimestamp?: number) => void;
11
+ export declare const checkExtendLockPeriod: (lockPeriodInDays: number, newUnlockAtInSecondTimestamp: number, prevUnlockAtInSecondTimestamp?: number) => void;
12
+ export declare const checkExtendLockAmount: (scaAmount: number, prevUnlockAtInSecondTimestamp?: number) => void;
13
+ export declare const checkRenewExpiredVeSca: (scaAmount: number, lockPeriodInDays: number, prevUnlockAtInSecondTimestamp?: number) => void;
14
+ export declare const checkVesca: (prevUnlockAtInSecondTimestamp?: number) => void;
@@ -1,6 +1,6 @@
1
1
  import BigNumber from 'bignumber.js';
2
2
  import type { ScallopUtils } from '../models';
3
- import type { OriginMarketPoolData, ParsedMarketPoolData, CalculatedMarketPoolData, OriginMarketCollateralData, ParsedMarketCollateralData, CalculatedMarketCollateralData, OriginSpoolData, ParsedSpoolData, CalculatedSpoolData, OriginSpoolRewardPoolData, ParsedSpoolRewardPoolData, CalculatedSpoolRewardPoolData, OriginBorrowIncentivePoolData, ParsedBorrowIncentivePoolData, CalculatedBorrowIncentivePoolData, OriginBorrowIncentiveRewardPoolData, ParsedBorrowIncentiveRewardPoolData, CalculatedBorrowIncentiveRewardPoolData, OriginBorrowIncentiveAccountData, ParsedBorrowIncentiveAccountData } from '../types';
3
+ import type { OriginMarketPoolData, ParsedMarketPoolData, CalculatedMarketPoolData, OriginMarketCollateralData, ParsedMarketCollateralData, CalculatedMarketCollateralData, OriginSpoolData, ParsedSpoolData, CalculatedSpoolData, OriginSpoolRewardPoolData, ParsedSpoolRewardPoolData, CalculatedSpoolRewardPoolData, OriginBorrowIncentivePoolData, ParsedBorrowIncentivePoolData, OriginBorrowIncentiveAccountData, ParsedBorrowIncentiveAccountData, OriginBorrowIncentivePoolPointData, ParsedBorrowIncentivePoolPointData, CalculatedBorrowIncentivePoolPointData, OriginBorrowIncentiveAccountPoolData, ParsedBorrowIncentiveAccountPoolData } from '../types';
4
4
  /**
5
5
  * Parse origin market pool data to a more readable format.
6
6
  *
@@ -33,6 +33,7 @@ export declare const calculateSpoolData: (parsedSpoolData: ParsedSpoolData, stak
33
33
  */
34
34
  export declare const parseOriginSpoolRewardPoolData: (originSpoolRewardPoolData: OriginSpoolRewardPoolData) => ParsedSpoolRewardPoolData;
35
35
  export declare const calculateSpoolRewardPoolData: (parsedSpoolData: ParsedSpoolData, parsedSpoolRewardPoolData: ParsedSpoolRewardPoolData, calculatedSpoolData: CalculatedSpoolData, rewardCoinPrice: number, rewardCoinDecimal: number) => CalculatedSpoolRewardPoolData;
36
+ export declare const parseOriginBorrowIncentivesPoolPointData: (originBorrowIncentivePoolPointData: OriginBorrowIncentivePoolPointData) => ParsedBorrowIncentivePoolPointData;
36
37
  /**
37
38
  * Parse origin borrow incentive pool data to a more readable format.
38
39
  *
@@ -40,15 +41,8 @@ export declare const calculateSpoolRewardPoolData: (parsedSpoolData: ParsedSpool
40
41
  * @return Parsed borrow incentive pool data
41
42
  */
42
43
  export declare const parseOriginBorrowIncentivePoolData: (originBorrowIncentivePoolData: OriginBorrowIncentivePoolData) => ParsedBorrowIncentivePoolData;
43
- export declare const calculateBorrowIncentivePoolData: (parsedBorrowIncentivePoolData: ParsedBorrowIncentivePoolData, borrowIncentiveCoinPrice: number, borrowIncentiveCoinDecimal: number) => CalculatedBorrowIncentivePoolData;
44
- /**
45
- * Parse origin borrow incentive reward pool data to a more readable format.
46
- *
47
- * @param originBorrowIncentiveRewardPoolData - Origin borrow incentive reward pool data
48
- * @return Parsed borrow incentive reward pool data
49
- */
50
- export declare const parseOriginBorrowIncentiveRewardPoolData: (originBorrowIncentiveRewardPoolData: OriginBorrowIncentiveRewardPoolData) => ParsedBorrowIncentiveRewardPoolData;
51
- export declare const calculateBorrowIncentiveRewardPoolData: (parsedBorrowIncentivePoolData: ParsedBorrowIncentivePoolData, parsedBorrowIncentiveRewardPoolData: ParsedBorrowIncentiveRewardPoolData, calculatedBorrowIncentivePoolData: CalculatedBorrowIncentivePoolData, rewardCoinPrice: number, rewardCoinDecimal: number) => CalculatedBorrowIncentiveRewardPoolData;
44
+ export declare const calculateBorrowIncentivePoolPointData: (pasredBorrowIncentinvePoolData: ParsedBorrowIncentivePoolData, parsedBorrowIncentivePoolPointData: ParsedBorrowIncentivePoolPointData, rewardCoinPrice: number, rewardCoinDecimal: number, poolCoinPrice: number, poolCoinDecimal: number) => CalculatedBorrowIncentivePoolPointData;
45
+ export declare const parseOriginBorrowIncentiveAccountPoolPointData: (originBorrowIncentiveAccountPoolPointData: OriginBorrowIncentiveAccountPoolData) => ParsedBorrowIncentiveAccountPoolData;
52
46
  /**
53
47
  * Parse origin borrow incentive account data to a more readable format.
54
48
  *
@@ -14,3 +14,10 @@ export declare const parseDataFromPythPriceFeed: (feed: PriceFeed, address: Scal
14
14
  price: number;
15
15
  publishTime: number;
16
16
  };
17
+ /**
18
+ * Find the closest unlock round timestamp (12AM) to the given unlock at timestamp in seconds.
19
+ *
20
+ * @param unlockAtInSecondTimestamp - Unlock at in seconds timestamp to find the closest round.
21
+ * @returns Closest round (12AM) in seconds timestamp.
22
+ */
23
+ export declare const findClosestUnlockRound: (unlockAtInSecondTimestamp: number) => number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scallop-io/sui-scallop-sdk",
3
- "version": "0.44.17",
3
+ "version": "0.44.19",
4
4
  "description": "Typescript sdk for interacting with Scallop contract on SUI",
5
5
  "keywords": [
6
6
  "sui",