@scallop-io/sui-scallop-sdk 0.44.1 → 0.44.3
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/borrowIncentiveBuilder.d.ts +12 -0
- package/dist/constants/common.d.ts +5 -3
- package/dist/constants/enum.d.ts +4 -2
- package/dist/index.js +843 -228
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +803 -192
- package/dist/index.mjs.map +1 -1
- package/dist/models/scallopClient.d.ts +33 -2
- package/dist/models/scallopQuery.d.ts +36 -10
- package/dist/models/scallopUtils.d.ts +12 -4
- package/dist/queries/borrowIncentiveQuery.d.ts +24 -0
- package/dist/queries/coreQuery.d.ts +12 -0
- package/dist/queries/index.d.ts +1 -0
- package/dist/queries/portfolioQuery.d.ts +1 -0
- package/dist/queries/spoolQuery.d.ts +13 -5
- package/dist/types/address.d.ts +10 -2
- package/dist/types/builder/borrowIncentive.d.ts +31 -0
- package/dist/types/builder/index.d.ts +3 -1
- package/dist/types/constant/common.d.ts +5 -3
- package/dist/types/constant/enum.d.ts +9 -3
- package/dist/types/query/borrowIncentive.d.ts +118 -0
- package/dist/types/query/core.d.ts +1 -0
- package/dist/types/query/index.d.ts +1 -0
- package/dist/types/query/spool.d.ts +12 -13
- package/dist/utils/builder.d.ts +8 -0
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/query.d.ts +33 -10
- package/dist/utils/util.d.ts +15 -1
- package/package.json +12 -12
- package/src/builders/borrowIncentiveBuilder.ts +257 -0
- package/src/builders/coreBuilder.ts +1 -14
- package/src/builders/index.ts +9 -2
- package/src/builders/spoolBuilder.ts +3 -16
- package/src/constants/common.ts +6 -1
- package/src/constants/enum.ts +18 -2
- package/src/models/scallopAddress.ts +47 -0
- package/src/models/scallopClient.ts +104 -2
- package/src/models/scallopQuery.ts +48 -14
- package/src/models/scallopUtils.ts +53 -15
- package/src/queries/borrowIncentiveQuery.ts +166 -0
- package/src/queries/coreQuery.ts +57 -15
- package/src/queries/index.ts +1 -0
- package/src/queries/spoolQuery.ts +78 -62
- package/src/types/address.ts +10 -2
- package/src/types/builder/borrowIncentive.ts +67 -0
- package/src/types/builder/index.ts +5 -1
- package/src/types/builder/spool.ts +0 -1
- package/src/types/constant/common.ts +10 -3
- package/src/types/constant/enum.ts +13 -3
- package/src/types/query/borrowIncentive.ts +150 -0
- package/src/types/query/core.ts +1 -1
- package/src/types/query/index.ts +1 -0
- package/src/types/query/spool.ts +28 -18
- package/src/utils/builder.ts +15 -0
- package/src/utils/index.ts +1 -1
- package/src/utils/query.ts +277 -70
- package/src/utils/util.ts +59 -9
- package/dist/utils/oracle.d.ts +0 -14
- package/src/utils/oracle.ts +0 -36
|
@@ -6,7 +6,7 @@ import { ScallopQuery } from './scallopQuery';
|
|
|
6
6
|
import type { SuiTransactionBlockResponse } from '@mysten/sui.js/client';
|
|
7
7
|
import type { TransactionObjectArgument } from '@mysten/sui.js/transactions';
|
|
8
8
|
import type { SuiObjectArg } from '@scallop-io/sui-kit';
|
|
9
|
-
import type { ScallopClientFnReturnType, ScallopInstanceParams, ScallopClientParams, SupportPoolCoins, SupportCollateralCoins, SupportAssetCoins, SupportStakeCoins, SupportStakeMarketCoins, ScallopTxBlock } from '../types';
|
|
9
|
+
import type { ScallopClientFnReturnType, ScallopInstanceParams, ScallopClientParams, SupportPoolCoins, SupportCollateralCoins, SupportAssetCoins, SupportStakeCoins, SupportStakeMarketCoins, SupportBorrowIncentiveCoins, ScallopTxBlock } from '../types';
|
|
10
10
|
/**
|
|
11
11
|
* @description
|
|
12
12
|
* It provides contract interaction operations for general users.
|
|
@@ -103,7 +103,7 @@ export declare class ScallopClient {
|
|
|
103
103
|
* @param stakeMarketCoinName - Support stake market coin.
|
|
104
104
|
* @return Reward pool data.
|
|
105
105
|
*/
|
|
106
|
-
|
|
106
|
+
getStakeRewardPool(stakeMarketCoinName: SupportStakeMarketCoins): Promise<import("../types").StakeRewardPool | undefined>;
|
|
107
107
|
/**
|
|
108
108
|
* Open obligation.
|
|
109
109
|
*
|
|
@@ -261,6 +261,37 @@ export declare class ScallopClient {
|
|
|
261
261
|
*/
|
|
262
262
|
claim(stakeMarketCoinName: SupportStakeMarketCoins): Promise<SuiTransactionBlockResponse>;
|
|
263
263
|
claim<S extends boolean>(stakeMarketCoinName: SupportStakeMarketCoins, sign?: S, stakeAccountId?: string, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
|
|
264
|
+
/**
|
|
265
|
+
* stake obligaion.
|
|
266
|
+
*
|
|
267
|
+
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
268
|
+
* @param obligaionId - The obligation account object.
|
|
269
|
+
* @param obligaionKeyId - The obligation key account object.
|
|
270
|
+
* @param walletAddress - The wallet address of the owner.
|
|
271
|
+
* @return Transaction block response or transaction block
|
|
272
|
+
*/
|
|
273
|
+
stakeObligation<S extends boolean>(coinName: SupportBorrowIncentiveCoins, obligaionId: string, obligaionKeyId: string, sign?: S, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
|
|
274
|
+
/**
|
|
275
|
+
* unstake obligaion.
|
|
276
|
+
*
|
|
277
|
+
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
278
|
+
* @param obligaionId - The obligation account object.
|
|
279
|
+
* @param obligaionKeyId - The obligation key account object.
|
|
280
|
+
* @param walletAddress - The wallet address of the owner.
|
|
281
|
+
* @return Transaction block response or transaction block
|
|
282
|
+
*/
|
|
283
|
+
unstakeObligation<S extends boolean>(coinName: SupportBorrowIncentiveCoins, obligaionId: string, obligaionKeyId: string, sign?: S, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
|
|
284
|
+
/**
|
|
285
|
+
* unstake market coin from the specific spool.
|
|
286
|
+
*
|
|
287
|
+
* @param marketCoinName - Types of mak coin.
|
|
288
|
+
* @param amount - The amount of coins would deposit.
|
|
289
|
+
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
290
|
+
* @param accountId - The stake account object.
|
|
291
|
+
* @param walletAddress - The wallet address of the owner.
|
|
292
|
+
* @return Transaction block response or transaction block
|
|
293
|
+
*/
|
|
294
|
+
claimBorrowIncentive<S extends boolean>(coinName: SupportBorrowIncentiveCoins, obligaionId: string, obligaionKeyId: string, sign?: S, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
|
|
264
295
|
/**
|
|
265
296
|
* Mint and get test coin.
|
|
266
297
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SuiKit } from '@scallop-io/sui-kit';
|
|
2
|
-
import { ScallopQueryParams, ScallopInstanceParams, SupportStakeMarketCoins, SupportAssetCoins, SupportPoolCoins, SupportCollateralCoins, SupportMarketCoins } from '../types';
|
|
2
|
+
import { ScallopQueryParams, ScallopInstanceParams, SupportStakeMarketCoins, SupportAssetCoins, SupportPoolCoins, SupportCollateralCoins, SupportMarketCoins, SupportBorrowIncentiveCoins } from '../types';
|
|
3
3
|
import { ScallopAddress } from './scallopAddress';
|
|
4
4
|
import { ScallopUtils } from './scallopUtils';
|
|
5
5
|
/**
|
|
@@ -53,6 +53,7 @@ export declare class ScallopQuery {
|
|
|
53
53
|
cetus?: import("../types").MarketPool | undefined;
|
|
54
54
|
afsui?: import("../types").MarketPool | undefined;
|
|
55
55
|
hasui?: import("../types").MarketPool | undefined;
|
|
56
|
+
vsui?: import("../types").MarketPool | undefined;
|
|
56
57
|
}>;
|
|
57
58
|
/**
|
|
58
59
|
* Get market pool
|
|
@@ -82,6 +83,7 @@ export declare class ScallopQuery {
|
|
|
82
83
|
cetus?: import("../types").MarketCollateral | undefined;
|
|
83
84
|
afsui?: import("../types").MarketCollateral | undefined;
|
|
84
85
|
hasui?: import("../types").MarketCollateral | undefined;
|
|
86
|
+
vsui?: import("../types").MarketCollateral | undefined;
|
|
85
87
|
}>;
|
|
86
88
|
/**
|
|
87
89
|
* Get market collateral
|
|
@@ -122,6 +124,7 @@ export declare class ScallopQuery {
|
|
|
122
124
|
cetus?: number | undefined;
|
|
123
125
|
afsui?: number | undefined;
|
|
124
126
|
hasui?: number | undefined;
|
|
127
|
+
vsui?: number | undefined;
|
|
125
128
|
}>;
|
|
126
129
|
/**
|
|
127
130
|
* Get asset coin amount.
|
|
@@ -149,6 +152,7 @@ export declare class ScallopQuery {
|
|
|
149
152
|
scetus?: number | undefined;
|
|
150
153
|
safsui?: number | undefined;
|
|
151
154
|
shasui?: number | undefined;
|
|
155
|
+
svsui?: number | undefined;
|
|
152
156
|
}>;
|
|
153
157
|
/**
|
|
154
158
|
* Get market coin amount.
|
|
@@ -225,31 +229,52 @@ export declare class ScallopQuery {
|
|
|
225
229
|
*/
|
|
226
230
|
getStakePool(stakeMarketCoinName: SupportStakeMarketCoins): Promise<import("../types").StakePool | undefined>;
|
|
227
231
|
/**
|
|
228
|
-
* Get reward pools data.
|
|
232
|
+
* Get stake reward pools data.
|
|
229
233
|
*
|
|
230
234
|
* @description
|
|
231
235
|
* For backward compatible, it is recommended to use `getSpools` method
|
|
232
236
|
* to get all spools data.
|
|
233
237
|
*
|
|
234
238
|
* @param stakeMarketCoinNames - Specific an array of stake market coin name.
|
|
235
|
-
* @return
|
|
239
|
+
* @return Stake reward pools data.
|
|
236
240
|
*/
|
|
237
|
-
|
|
238
|
-
ssui?: import("../types").
|
|
239
|
-
susdc?: import("../types").
|
|
240
|
-
susdt?: import("../types").
|
|
241
|
+
getStakeRewardPools(stakeMarketCoinNames?: SupportStakeMarketCoins[]): Promise<{
|
|
242
|
+
ssui?: import("../types").StakeRewardPool | undefined;
|
|
243
|
+
susdc?: import("../types").StakeRewardPool | undefined;
|
|
244
|
+
susdt?: import("../types").StakeRewardPool | undefined;
|
|
241
245
|
}>;
|
|
242
246
|
/**
|
|
243
|
-
* Get reward pool data.
|
|
247
|
+
* Get stake reward pool data.
|
|
244
248
|
*
|
|
245
249
|
* @description
|
|
246
250
|
* For backward compatible, it is recommended to use `getSpool` method
|
|
247
251
|
* to get spool data.
|
|
248
252
|
*
|
|
249
253
|
* @param marketCoinName - Specific support stake market coin name.
|
|
250
|
-
* @return
|
|
254
|
+
* @return Stake reward pool data.
|
|
251
255
|
*/
|
|
252
|
-
|
|
256
|
+
getStakeRewardPool(stakeMarketCoinName: SupportStakeMarketCoins): Promise<import("../types").StakeRewardPool | undefined>;
|
|
257
|
+
/**
|
|
258
|
+
* Get borrow incentive pools data.
|
|
259
|
+
*
|
|
260
|
+
* @param coinNames - Specific an array of support borrow incentive coin name.
|
|
261
|
+
* @return Borrow incentive pools data.
|
|
262
|
+
*/
|
|
263
|
+
getBorrowIncentivePools(coinNames?: SupportBorrowIncentiveCoins[]): Promise<{
|
|
264
|
+
usdc?: import("../types").BorrowIncentivePool | undefined;
|
|
265
|
+
sui?: import("../types").BorrowIncentivePool | undefined;
|
|
266
|
+
}>;
|
|
267
|
+
/**
|
|
268
|
+
* Get borrow incentive accounts data.
|
|
269
|
+
*
|
|
270
|
+
* @param coinNames - Specific support borrow incentive coin name.
|
|
271
|
+
* @param ownerAddress - The owner address.
|
|
272
|
+
* @return Borrow incentive accounts data.
|
|
273
|
+
*/
|
|
274
|
+
getBorrowIncentiveAccounts(obligationId: string, coinNames?: SupportBorrowIncentiveCoins[]): Promise<{
|
|
275
|
+
usdc?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
|
|
276
|
+
sui?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
|
|
277
|
+
}>;
|
|
253
278
|
/**
|
|
254
279
|
* Get user lending and spool infomation for specific pools.
|
|
255
280
|
*
|
|
@@ -268,6 +293,7 @@ export declare class ScallopQuery {
|
|
|
268
293
|
cetus?: import("../types").Lending | undefined;
|
|
269
294
|
afsui?: import("../types").Lending | undefined;
|
|
270
295
|
hasui?: import("../types").Lending | undefined;
|
|
296
|
+
vsui?: import("../types").Lending | undefined;
|
|
271
297
|
}>;
|
|
272
298
|
/**
|
|
273
299
|
* Get user lending and spool information for specific pool.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SuiAddressArg } from '@scallop-io/sui-kit';
|
|
2
|
-
import type { ScallopUtilsParams, ScallopInstanceParams, SupportCoins, SupportAssetCoins, SupportMarketCoins, SupportStakeMarketCoins, CoinWrappedType } from '../types';
|
|
2
|
+
import type { ScallopUtilsParams, ScallopInstanceParams, SupportCoins, SupportAssetCoins, SupportMarketCoins, SupportStakeMarketCoins, SupportBorrowIncentiveCoins, CoinWrappedType } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* @description
|
|
5
5
|
* Integrates some helper functions frequently used in interactions with the Scallop contract.
|
|
@@ -81,12 +81,19 @@ export declare class ScallopUtils {
|
|
|
81
81
|
*/
|
|
82
82
|
parseMarketCoinName<T extends SupportMarketCoins>(coinName: SupportCoins): T;
|
|
83
83
|
/**
|
|
84
|
-
* Get reward type of
|
|
84
|
+
* Get reward type of spool.
|
|
85
85
|
*
|
|
86
86
|
* @param stakeMarketCoinName - Support stake market coin.
|
|
87
|
-
* @return
|
|
87
|
+
* @return Spool reward coin name.
|
|
88
88
|
*/
|
|
89
|
-
|
|
89
|
+
getSpoolRewardCoinName: (stakeMarketCoinName: SupportStakeMarketCoins) => "sui";
|
|
90
|
+
/**
|
|
91
|
+
* Get reward type of borrow incentive pool.
|
|
92
|
+
*
|
|
93
|
+
* @param borrowIncentiveCoinName - Support borrow incentive coin.
|
|
94
|
+
* @return Borrow incentive reward coin name.
|
|
95
|
+
*/
|
|
96
|
+
getBorrowIncentiveRewardCoinName: (borrowIncentiveCoinName: SupportBorrowIncentiveCoins) => "sui";
|
|
90
97
|
/**
|
|
91
98
|
* Get coin decimal.
|
|
92
99
|
*
|
|
@@ -142,6 +149,7 @@ export declare class ScallopUtils {
|
|
|
142
149
|
cetus?: number | undefined;
|
|
143
150
|
afsui?: number | undefined;
|
|
144
151
|
hasui?: number | undefined;
|
|
152
|
+
vsui?: number | undefined;
|
|
145
153
|
}>;
|
|
146
154
|
/**
|
|
147
155
|
* Convert apr to apy.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ScallopQuery } from '../models';
|
|
2
|
+
import type { SupportBorrowIncentiveCoins } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Query borrow incentive pools data.
|
|
5
|
+
*
|
|
6
|
+
* @param query - The Scallop query instance.
|
|
7
|
+
* @param borrowIncentiveCoinNames - Specific an array of support borrow incentive coin name.
|
|
8
|
+
* @return Borrow incentive pools data.
|
|
9
|
+
*/
|
|
10
|
+
export declare const queryBorrowIncentivePools: (query: ScallopQuery, borrowIncentiveCoinNames?: SupportBorrowIncentiveCoins[]) => Promise<{
|
|
11
|
+
usdc?: import("../types").BorrowIncentivePool | undefined;
|
|
12
|
+
sui?: import("../types").BorrowIncentivePool | undefined;
|
|
13
|
+
}>;
|
|
14
|
+
/**
|
|
15
|
+
* Query borrow incentive accounts data.
|
|
16
|
+
*
|
|
17
|
+
* @param query - The Scallop query instance.
|
|
18
|
+
* @param borrowIncentiveCoinNames - Specific an array of support borrow incentive coin name.
|
|
19
|
+
* @return Borrow incentive accounts data.
|
|
20
|
+
*/
|
|
21
|
+
export declare const queryBorrowIncentiveAccounts: (query: ScallopQuery, obligationId: string, borrowIncentiveCoinNames?: SupportBorrowIncentiveCoins[]) => Promise<{
|
|
22
|
+
usdc?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
|
|
23
|
+
sui?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
|
|
24
|
+
}>;
|
|
@@ -35,6 +35,7 @@ export declare const getMarketPools: (query: ScallopQuery, poolCoinNames?: Suppo
|
|
|
35
35
|
cetus?: MarketPool | undefined;
|
|
36
36
|
afsui?: MarketPool | undefined;
|
|
37
37
|
hasui?: MarketPool | undefined;
|
|
38
|
+
vsui?: MarketPool | undefined;
|
|
38
39
|
}>;
|
|
39
40
|
/**
|
|
40
41
|
* Get market pool data.
|
|
@@ -68,6 +69,7 @@ export declare const getMarketCollaterals: (query: ScallopQuery, collateralCoinN
|
|
|
68
69
|
cetus?: MarketCollateral | undefined;
|
|
69
70
|
afsui?: MarketCollateral | undefined;
|
|
70
71
|
hasui?: MarketCollateral | undefined;
|
|
72
|
+
vsui?: MarketCollateral | undefined;
|
|
71
73
|
}>;
|
|
72
74
|
/**
|
|
73
75
|
* Get market collateral data.
|
|
@@ -87,6 +89,14 @@ export declare const getMarketCollateral: (query: ScallopQuery, collateralCoinNa
|
|
|
87
89
|
* @return Owned obligations.
|
|
88
90
|
*/
|
|
89
91
|
export declare const getObligations: (query: ScallopQuery, ownerAddress?: string) => Promise<Obligation[]>;
|
|
92
|
+
/**
|
|
93
|
+
* Query obligation locked status.
|
|
94
|
+
*
|
|
95
|
+
* @param query - The Scallop query instance.
|
|
96
|
+
* @param obligationId - The obligation id.
|
|
97
|
+
* @return Obligation locked status.
|
|
98
|
+
*/
|
|
99
|
+
export declare const getObligationLocked: (query: ScallopQuery, obligationId: string) => Promise<boolean>;
|
|
90
100
|
/**
|
|
91
101
|
* Query obligation data.
|
|
92
102
|
*
|
|
@@ -117,6 +127,7 @@ export declare const getCoinAmounts: (query: ScallopQuery, assetCoinNames?: Supp
|
|
|
117
127
|
cetus?: number | undefined;
|
|
118
128
|
afsui?: number | undefined;
|
|
119
129
|
hasui?: number | undefined;
|
|
130
|
+
vsui?: number | undefined;
|
|
120
131
|
}>;
|
|
121
132
|
/**
|
|
122
133
|
* Query owned coin amount.
|
|
@@ -146,6 +157,7 @@ export declare const getMarketCoinAmounts: (query: ScallopQuery, marketCoinNames
|
|
|
146
157
|
scetus?: number | undefined;
|
|
147
158
|
safsui?: number | undefined;
|
|
148
159
|
shasui?: number | undefined;
|
|
160
|
+
svsui?: number | undefined;
|
|
149
161
|
}>;
|
|
150
162
|
/**
|
|
151
163
|
* Query owned market coin (sCoin) amount.
|
package/dist/queries/index.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export declare const getLendings: (query: ScallopQuery, poolCoinNames?: SupportP
|
|
|
19
19
|
cetus?: Lending | undefined;
|
|
20
20
|
afsui?: Lending | undefined;
|
|
21
21
|
hasui?: Lending | undefined;
|
|
22
|
+
vsui?: Lending | undefined;
|
|
22
23
|
}>;
|
|
23
24
|
/**
|
|
24
25
|
* Get user lending infomation for specific pool.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ScallopQuery } from '../models';
|
|
2
|
-
import type { MarketPool, Spool, StakePool,
|
|
2
|
+
import type { MarketPool, Spool, StakePool, StakeRewardPool, StakeAccounts, SupportStakeMarketCoins } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* Get spools data.
|
|
5
5
|
*
|
|
@@ -20,7 +20,7 @@ export declare const getSpools: (query: ScallopQuery, stakeMarketCoinNames?: Sup
|
|
|
20
20
|
* @param marketPool - The market pool data.
|
|
21
21
|
* @return Spool data.
|
|
22
22
|
*/
|
|
23
|
-
export declare const getSpool: (query: ScallopQuery,
|
|
23
|
+
export declare const getSpool: (query: ScallopQuery, marketCoinName: SupportStakeMarketCoins, marketPool?: MarketPool) => Promise<Spool | undefined>;
|
|
24
24
|
/**
|
|
25
25
|
* Get all stake accounts of the owner.
|
|
26
26
|
*
|
|
@@ -32,16 +32,24 @@ export declare const getStakeAccounts: (query: ScallopQuery, ownerAddress?: stri
|
|
|
32
32
|
/**
|
|
33
33
|
* Get stake pool data.
|
|
34
34
|
*
|
|
35
|
+
* @description
|
|
36
|
+
* For backward compatible, it is recommended to use `getSpool` method
|
|
37
|
+
* to get stake pool info in spool data.
|
|
38
|
+
*
|
|
35
39
|
* @param query - The Scallop query instance.
|
|
36
40
|
* @param marketCoinName - Specific support stake market coin name.
|
|
37
41
|
* @return Stake pool data.
|
|
38
42
|
*/
|
|
39
43
|
export declare const getStakePool: (query: ScallopQuery, marketCoinName: SupportStakeMarketCoins) => Promise<StakePool | undefined>;
|
|
40
44
|
/**
|
|
41
|
-
* Get reward pool of the owner.
|
|
45
|
+
* Get stake reward pool of the owner.
|
|
46
|
+
*
|
|
47
|
+
* @description
|
|
48
|
+
* For backward compatible, it is recommended to use `getSpool` method
|
|
49
|
+
* to get reward info in spool data.
|
|
42
50
|
*
|
|
43
51
|
* @param query - The Scallop query instance.
|
|
44
52
|
* @param marketCoinName - Specific support stake market coin name.
|
|
45
|
-
* @return
|
|
53
|
+
* @return Stake reward pool.
|
|
46
54
|
*/
|
|
47
|
-
export declare const
|
|
55
|
+
export declare const getStakeRewardPool: (query: ScallopQuery, marketCoinName: SupportStakeMarketCoins) => Promise<StakeRewardPool | undefined>;
|
package/dist/types/address.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SUPPORT_ORACLES } from '../constants';
|
|
2
|
-
import type {
|
|
2
|
+
import type { SupportAssetCoins, SupportOracleType, SupportPackageType, SupportStakeMarketCoins } from './constant';
|
|
3
3
|
export interface AddressesInterface {
|
|
4
4
|
core: {
|
|
5
5
|
version: string;
|
|
@@ -7,7 +7,8 @@ export interface AddressesInterface {
|
|
|
7
7
|
market: string;
|
|
8
8
|
adminCap: string;
|
|
9
9
|
coinDecimalsRegistry: string;
|
|
10
|
-
|
|
10
|
+
obligationAccessStore: string;
|
|
11
|
+
coins: Partial<Record<SupportAssetCoins, {
|
|
11
12
|
id: string;
|
|
12
13
|
treasury: string;
|
|
13
14
|
metaData: string;
|
|
@@ -50,6 +51,13 @@ export interface AddressesInterface {
|
|
|
50
51
|
rewardPoolId: string;
|
|
51
52
|
}>>;
|
|
52
53
|
};
|
|
54
|
+
borrowIncentive: {
|
|
55
|
+
id: string;
|
|
56
|
+
adminCap: string;
|
|
57
|
+
query: string;
|
|
58
|
+
incentivePools: string;
|
|
59
|
+
incentiveAccounts: string;
|
|
60
|
+
};
|
|
53
61
|
}
|
|
54
62
|
type AddressPathsProps<T> = T extends string ? [] : {
|
|
55
63
|
[K in Extract<keyof T, string>]: [K, ...AddressPathsProps<T[K]>];
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { SuiTxBlock as SuiKitTxBlock, SuiAddressArg } from '@scallop-io/sui-kit';
|
|
2
|
+
import type { TransactionResult } from '@mysten/sui.js/transactions';
|
|
3
|
+
import type { ScallopBuilder } from '../../models';
|
|
4
|
+
import type { SupportBorrowIncentiveCoins } from '../constant';
|
|
5
|
+
export type BorrowIncentiveIds = {
|
|
6
|
+
borrowIncentivePkg: string;
|
|
7
|
+
query: string;
|
|
8
|
+
incentivePools: string;
|
|
9
|
+
incentiveAccounts: string;
|
|
10
|
+
obligationAccessStore: string;
|
|
11
|
+
};
|
|
12
|
+
export type BorrowIncentiveNormalMethods = {
|
|
13
|
+
stakeObligation: (obligation: SuiAddressArg, obligaionKey: SuiAddressArg, coinName: SupportBorrowIncentiveCoins) => void;
|
|
14
|
+
unstakeObligation: (obligation: SuiAddressArg, obligaionKey: SuiAddressArg, coinName: SupportBorrowIncentiveCoins) => void;
|
|
15
|
+
claimBorrowIncentive: (obligation: SuiAddressArg, obligaionKey: SuiAddressArg, coinName: SupportBorrowIncentiveCoins) => TransactionResult;
|
|
16
|
+
};
|
|
17
|
+
export type BorrowIncentiveQuickMethods = {
|
|
18
|
+
stakeObligationQuick(coinName: SupportBorrowIncentiveCoins, obligation?: SuiAddressArg, obligationKey?: SuiAddressArg): Promise<void>;
|
|
19
|
+
unstakeObligationQuick(coinName: SupportBorrowIncentiveCoins, obligation?: SuiAddressArg, obligationKey?: SuiAddressArg): Promise<void>;
|
|
20
|
+
claimBorrowIncentiveQuick(coinName: SupportBorrowIncentiveCoins, obligation?: SuiAddressArg, obligationKey?: SuiAddressArg): Promise<TransactionResult>;
|
|
21
|
+
};
|
|
22
|
+
export type SuiTxBlockWithBorrowIncentiveNormalMethods = SuiKitTxBlock & BorrowIncentiveNormalMethods;
|
|
23
|
+
export type BorrowIncentiveTxBlock = SuiTxBlockWithBorrowIncentiveNormalMethods & BorrowIncentiveQuickMethods;
|
|
24
|
+
export type GenerateBorrowIncentiveNormalMethod = (params: {
|
|
25
|
+
builder: ScallopBuilder;
|
|
26
|
+
txBlock: SuiKitTxBlock;
|
|
27
|
+
}) => BorrowIncentiveNormalMethods;
|
|
28
|
+
export type GenerateBorrowIncentiveQuickMethod = (params: {
|
|
29
|
+
builder: ScallopBuilder;
|
|
30
|
+
txBlock: SuiTxBlockWithBorrowIncentiveNormalMethods;
|
|
31
|
+
}) => BorrowIncentiveQuickMethods;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { CoreTxBlock } from './core';
|
|
2
2
|
import type { SpoolTxBlock } from './spool';
|
|
3
|
+
import type { BorrowIncentiveTxBlock } from './borrowIncentive';
|
|
3
4
|
export type * from './core';
|
|
4
5
|
export type * from './spool';
|
|
5
|
-
export type
|
|
6
|
+
export type * from './borrowIncentive';
|
|
7
|
+
export type ScallopTxBlock = CoreTxBlock & SpoolTxBlock & BorrowIncentiveTxBlock;
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { SUPPORT_POOLS, SUPPORT_COLLATERALS, SUPPORT_ORACLES, SUPPORT_PACKAGES, SUPPORT_SPOOLS,
|
|
1
|
+
import { SUPPORT_POOLS, SUPPORT_COLLATERALS, SUPPORT_ORACLES, SUPPORT_PACKAGES, SUPPORT_SPOOLS, SUPPORT_SPOOLS_REWARDS, SUPPORT_BORROW_INCENTIVE_POOLS, SUPPORT_BORROW_INCENTIVE_REWARDS } from '../../constants';
|
|
2
2
|
type ParseMarketCoins<T extends string> = `s${T}`;
|
|
3
3
|
type ParseCoins<T extends string> = T extends `s${infer R}` ? R : never;
|
|
4
4
|
export type SupportCoins = SupportAssetCoins | SupportMarketCoins | SupportStakeMarketCoins;
|
|
5
|
-
export type SupportAssetCoins = SupportPoolCoins | SupportCollateralCoins |
|
|
5
|
+
export type SupportAssetCoins = SupportPoolCoins | SupportCollateralCoins | SupportStakeRewardCoins | SupportBorrowIncentiveRewardCoins;
|
|
6
6
|
export type SupportPoolCoins = (typeof SUPPORT_POOLS)[number];
|
|
7
7
|
export type SupportCollateralCoins = (typeof SUPPORT_COLLATERALS)[number];
|
|
8
8
|
export type SupportMarketCoins = ParseMarketCoins<SupportPoolCoins> | SupportStakeMarketCoins;
|
|
9
9
|
export type SupportStakeMarketCoins = (typeof SUPPORT_SPOOLS)[number];
|
|
10
10
|
export type SupportStakeCoins = Extract<SupportPoolCoins, ParseCoins<SupportStakeMarketCoins>>;
|
|
11
|
-
export type
|
|
11
|
+
export type SupportStakeRewardCoins = (typeof SUPPORT_SPOOLS_REWARDS)[number];
|
|
12
|
+
export type SupportBorrowIncentiveCoins = (typeof SUPPORT_BORROW_INCENTIVE_POOLS)[number];
|
|
13
|
+
export type SupportBorrowIncentiveRewardCoins = (typeof SUPPORT_BORROW_INCENTIVE_REWARDS)[number];
|
|
12
14
|
export type SupportOracleType = (typeof SUPPORT_ORACLES)[number];
|
|
13
15
|
export type SupportPackageType = (typeof SUPPORT_PACKAGES)[number];
|
|
14
16
|
export type SupportCoinDecimals = Record<SupportCoins, number>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SupportCoins, SupportAssetCoins, SupportMarketCoins, SupportStakeMarketCoins,
|
|
1
|
+
import { SupportCoins, SupportAssetCoins, SupportMarketCoins, SupportStakeMarketCoins, SupportStakeRewardCoins, SupportBorrowIncentiveCoins, SupportBorrowIncentiveRewardCoins } from './common';
|
|
2
2
|
export type Coins = {
|
|
3
3
|
[K in SupportCoins]: K;
|
|
4
4
|
};
|
|
@@ -11,8 +11,11 @@ export type MarketCoins = {
|
|
|
11
11
|
export type StakeMarketCoins = {
|
|
12
12
|
[K in SupportStakeMarketCoins]: K;
|
|
13
13
|
};
|
|
14
|
-
export type
|
|
15
|
-
[key in SupportStakeMarketCoins]:
|
|
14
|
+
export type StakeRewardCoins = {
|
|
15
|
+
[key in SupportStakeMarketCoins]: SupportStakeRewardCoins;
|
|
16
|
+
};
|
|
17
|
+
export type BorrowIncentiveRewardCoins = {
|
|
18
|
+
[key in SupportBorrowIncentiveCoins]: SupportBorrowIncentiveRewardCoins;
|
|
16
19
|
};
|
|
17
20
|
export type AssetCoinIds = {
|
|
18
21
|
[key in SupportAssetCoins]: string;
|
|
@@ -21,4 +24,7 @@ type PickFromUnion<T, K extends string> = K extends T ? K : never;
|
|
|
21
24
|
export type WormholeCoinIds = {
|
|
22
25
|
[key in PickFromUnion<SupportAssetCoins, 'eth' | 'btc' | 'usdc' | 'usdt' | 'apt' | 'sol'>]: string;
|
|
23
26
|
};
|
|
27
|
+
export type VoloCoinIds = {
|
|
28
|
+
[key in PickFromUnion<SupportAssetCoins, 'vsui'>]: string;
|
|
29
|
+
};
|
|
24
30
|
export {};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import type { SupportBorrowIncentiveCoins } from '../constant';
|
|
2
|
+
export interface BorrowIncentiveAccountKey {
|
|
3
|
+
id: string;
|
|
4
|
+
onwerId: string;
|
|
5
|
+
}
|
|
6
|
+
type OptionalKeys<T> = {
|
|
7
|
+
[K in keyof T]?: T[K];
|
|
8
|
+
};
|
|
9
|
+
export type BorrowIncentivePools = OptionalKeys<Record<SupportBorrowIncentiveCoins, BorrowIncentivePool>>;
|
|
10
|
+
export type BorrowIncentivePool = {
|
|
11
|
+
coinName: SupportBorrowIncentiveCoins;
|
|
12
|
+
symbol: string;
|
|
13
|
+
coinType: string;
|
|
14
|
+
rewardCoinType: string;
|
|
15
|
+
coinDecimal: number;
|
|
16
|
+
rewardCoinDecimal: number;
|
|
17
|
+
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
|
+
distributed_point_per_period: string;
|
|
24
|
+
index: string;
|
|
25
|
+
last_update: string;
|
|
26
|
+
max_distributed_point: string;
|
|
27
|
+
max_stakes: string;
|
|
28
|
+
point_distribution_time: string;
|
|
29
|
+
pool_type: {
|
|
30
|
+
name: string;
|
|
31
|
+
};
|
|
32
|
+
stakes: string;
|
|
33
|
+
};
|
|
34
|
+
export type ParsedBorrowIncentivePoolData = {
|
|
35
|
+
poolType: string;
|
|
36
|
+
maxPoint: number;
|
|
37
|
+
distributedPoint: number;
|
|
38
|
+
pointPerPeriod: number;
|
|
39
|
+
period: number;
|
|
40
|
+
maxStake: number;
|
|
41
|
+
staked: number;
|
|
42
|
+
index: number;
|
|
43
|
+
createdAt: number;
|
|
44
|
+
lastUpdate: number;
|
|
45
|
+
};
|
|
46
|
+
export type CalculatedBorrowIncentivePoolData = {
|
|
47
|
+
stakedAmount: number;
|
|
48
|
+
stakedCoin: number;
|
|
49
|
+
stakedValue: number;
|
|
50
|
+
distributedPointPerSec: number;
|
|
51
|
+
accumulatedPoints: number;
|
|
52
|
+
currentPointIndex: number;
|
|
53
|
+
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
|
+
exchangeRateNumerator: number;
|
|
71
|
+
exchangeRateDenominator: number;
|
|
72
|
+
remainingRewards: number;
|
|
73
|
+
};
|
|
74
|
+
export type CalculatedBorrowIncentiveRewardPoolData = {
|
|
75
|
+
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
|
+
rewardPerSec: number;
|
|
86
|
+
};
|
|
87
|
+
export type BorrowIncentiveAccounts = OptionalKeys<Record<SupportBorrowIncentiveCoins, ParsedBorrowIncentiveAccountData>>;
|
|
88
|
+
export type OriginBorrowIncentiveAccountData = {
|
|
89
|
+
amount: string;
|
|
90
|
+
index: string;
|
|
91
|
+
points: string;
|
|
92
|
+
pool_type: {
|
|
93
|
+
name: string;
|
|
94
|
+
};
|
|
95
|
+
total_points: string;
|
|
96
|
+
};
|
|
97
|
+
export type ParsedBorrowIncentiveAccountData = {
|
|
98
|
+
poolType: string;
|
|
99
|
+
amount: number;
|
|
100
|
+
index: number;
|
|
101
|
+
points: number;
|
|
102
|
+
totalPoints: number;
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* The query interface for `incentive_pools_query::incentive_pools_data` inspectTxn.
|
|
106
|
+
*/
|
|
107
|
+
export interface BorrowIncentivePoolsQueryInterface {
|
|
108
|
+
incentive_pools: OriginBorrowIncentivePoolData[];
|
|
109
|
+
reward_pool: OriginBorrowIncentiveRewardPoolData;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* The query interface for `incentive_account_query::incentive_account_data` inspectTxn.
|
|
113
|
+
*/
|
|
114
|
+
export interface BorrowIncentiveAccountsQueryInterface {
|
|
115
|
+
incentive_states: OriginBorrowIncentiveAccountData[];
|
|
116
|
+
total_points: string;
|
|
117
|
+
}
|
|
118
|
+
export {};
|