@scallop-io/sui-scallop-sdk 0.44.2 → 0.44.4
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 +3 -1
- package/dist/constants/enum.d.ts +3 -2
- package/dist/index.js +815 -228
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +776 -192
- package/dist/index.mjs.map +1 -1
- package/dist/models/scallopClient.d.ts +33 -2
- package/dist/models/scallopQuery.d.ts +31 -10
- package/dist/models/scallopUtils.d.ts +11 -4
- package/dist/queries/borrowIncentiveQuery.d.ts +24 -0
- package/dist/queries/coreQuery.d.ts +8 -0
- package/dist/queries/index.d.ts +1 -0
- package/dist/queries/spoolQuery.d.ts +13 -5
- package/dist/types/address.d.ts +8 -0
- 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 +6 -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/portfolio.d.ts +13 -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 +13 -0
- package/package.json +1 -1
- 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 +4 -1
- package/src/constants/enum.ts +8 -2
- package/src/models/scallopAddress.ts +8 -0
- package/src/models/scallopClient.ts +104 -2
- package/src/models/scallopQuery.ts +48 -14
- package/src/models/scallopUtils.ts +21 -5
- package/src/queries/borrowIncentiveQuery.ts +167 -0
- package/src/queries/coreQuery.ts +58 -15
- package/src/queries/index.ts +1 -0
- package/src/queries/portfolioQuery.ts +59 -5
- package/src/queries/spoolQuery.ts +87 -71
- package/src/types/address.ts +8 -0
- 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 +9 -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/portfolio.ts +16 -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 +279 -72
- package/src/utils/util.ts +36 -2
- 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
|
/**
|
|
@@ -229,31 +229,52 @@ export declare class ScallopQuery {
|
|
|
229
229
|
*/
|
|
230
230
|
getStakePool(stakeMarketCoinName: SupportStakeMarketCoins): Promise<import("../types").StakePool | undefined>;
|
|
231
231
|
/**
|
|
232
|
-
* Get reward pools data.
|
|
232
|
+
* Get stake reward pools data.
|
|
233
233
|
*
|
|
234
234
|
* @description
|
|
235
235
|
* For backward compatible, it is recommended to use `getSpools` method
|
|
236
236
|
* to get all spools data.
|
|
237
237
|
*
|
|
238
238
|
* @param stakeMarketCoinNames - Specific an array of stake market coin name.
|
|
239
|
-
* @return
|
|
239
|
+
* @return Stake reward pools data.
|
|
240
240
|
*/
|
|
241
|
-
|
|
242
|
-
ssui?: import("../types").
|
|
243
|
-
susdc?: import("../types").
|
|
244
|
-
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;
|
|
245
245
|
}>;
|
|
246
246
|
/**
|
|
247
|
-
* Get reward pool data.
|
|
247
|
+
* Get stake reward pool data.
|
|
248
248
|
*
|
|
249
249
|
* @description
|
|
250
250
|
* For backward compatible, it is recommended to use `getSpool` method
|
|
251
251
|
* to get spool data.
|
|
252
252
|
*
|
|
253
253
|
* @param marketCoinName - Specific support stake market coin name.
|
|
254
|
-
* @return
|
|
254
|
+
* @return Stake reward pool data.
|
|
255
255
|
*/
|
|
256
|
-
|
|
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
|
+
}>;
|
|
257
278
|
/**
|
|
258
279
|
* Get user lending and spool infomation for specific pools.
|
|
259
280
|
*
|
|
@@ -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
|
*
|
|
@@ -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
|
+
}>;
|
|
@@ -89,6 +89,14 @@ export declare const getMarketCollateral: (query: ScallopQuery, collateralCoinNa
|
|
|
89
89
|
* @return Owned obligations.
|
|
90
90
|
*/
|
|
91
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>;
|
|
92
100
|
/**
|
|
93
101
|
* Query obligation data.
|
|
94
102
|
*
|
package/dist/queries/index.d.ts
CHANGED
|
@@ -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
|
@@ -7,6 +7,7 @@ export interface AddressesInterface {
|
|
|
7
7
|
market: string;
|
|
8
8
|
adminCap: string;
|
|
9
9
|
coinDecimalsRegistry: string;
|
|
10
|
+
obligationAccessStore: string;
|
|
10
11
|
coins: Partial<Record<SupportAssetCoins, {
|
|
11
12
|
id: string;
|
|
12
13
|
treasury: 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;
|
|
@@ -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 {};
|
|
@@ -48,6 +48,7 @@ export type ObligationAccount = {
|
|
|
48
48
|
totalBorrowedPools: number;
|
|
49
49
|
collaterals: OptionalKeys<Record<SupportCollateralCoins, ObligationCollateral>>;
|
|
50
50
|
debts: OptionalKeys<Record<SupportPoolCoins, ObligationDebt>>;
|
|
51
|
+
borrowIncentives: OptionalKeys<Record<SupportPoolCoins, ObligationBorrowIncentive>>;
|
|
51
52
|
};
|
|
52
53
|
export type ObligationCollateral = {
|
|
53
54
|
coinName: SupportCollateralCoins;
|
|
@@ -81,6 +82,18 @@ export type ObligationDebt = {
|
|
|
81
82
|
availableRepayAmount: number;
|
|
82
83
|
availableRepayCoin: number;
|
|
83
84
|
};
|
|
85
|
+
export type ObligationBorrowIncentive = {
|
|
86
|
+
coinName: SupportPoolCoins;
|
|
87
|
+
coinType: string;
|
|
88
|
+
rewardCoinType: string;
|
|
89
|
+
symbol: string;
|
|
90
|
+
coinDecimal: number;
|
|
91
|
+
rewardCoinDecimal: number;
|
|
92
|
+
coinPrice: number;
|
|
93
|
+
rewardCoinPrice: number;
|
|
94
|
+
availableClaimAmount: number;
|
|
95
|
+
availableClaimCoin: number;
|
|
96
|
+
};
|
|
84
97
|
export type TotalValueLocked = {
|
|
85
98
|
supplyValue: number;
|
|
86
99
|
borrowValue: number;
|
|
@@ -2,9 +2,6 @@ import type { SupportStakeMarketCoins } from '../constant';
|
|
|
2
2
|
type OptionalKeys<T> = {
|
|
3
3
|
[K in keyof T]?: T[K];
|
|
4
4
|
};
|
|
5
|
-
export type StakePools = OptionalKeys<Record<SupportStakeMarketCoins, StakePool>>;
|
|
6
|
-
export type RewardPools = OptionalKeys<Record<SupportStakeMarketCoins, RewardPool>>;
|
|
7
|
-
export type StakeAccounts = Record<SupportStakeMarketCoins, StakeAccount[]>;
|
|
8
5
|
export type Spools = OptionalKeys<Record<SupportStakeMarketCoins, Spool>>;
|
|
9
6
|
export type Spool = {
|
|
10
7
|
marketCoinName: SupportStakeMarketCoins;
|
|
@@ -17,8 +14,8 @@ export type Spool = {
|
|
|
17
14
|
coinPrice: number;
|
|
18
15
|
marketCoinPrice: number;
|
|
19
16
|
rewardCoinPrice: number;
|
|
20
|
-
} &
|
|
21
|
-
export type
|
|
17
|
+
} & Required<Pick<ParsedSpoolData, 'maxPoint' | 'distributedPoint' | 'maxStake'>> & CalculatedSpoolData & SpoolRewardPool;
|
|
18
|
+
export type OriginSpoolData = {
|
|
22
19
|
stakeType: {
|
|
23
20
|
fields: {
|
|
24
21
|
name: string;
|
|
@@ -34,7 +31,7 @@ export type OriginStakePoolData = {
|
|
|
34
31
|
createdAt: string;
|
|
35
32
|
lastUpdate: string;
|
|
36
33
|
};
|
|
37
|
-
export type
|
|
34
|
+
export type ParsedSpoolData = {
|
|
38
35
|
stakeType: string;
|
|
39
36
|
maxPoint: number;
|
|
40
37
|
distributedPoint: number;
|
|
@@ -46,7 +43,7 @@ export type ParsedStakePoolData = {
|
|
|
46
43
|
createdAt: number;
|
|
47
44
|
lastUpdate: number;
|
|
48
45
|
};
|
|
49
|
-
export type
|
|
46
|
+
export type CalculatedSpoolData = {
|
|
50
47
|
stakedAmount: number;
|
|
51
48
|
stakedCoin: number;
|
|
52
49
|
stakedValue: number;
|
|
@@ -57,21 +54,22 @@ export type CalculatedStakePoolData = {
|
|
|
57
54
|
startDate: Date;
|
|
58
55
|
endDate: Date;
|
|
59
56
|
};
|
|
60
|
-
export type
|
|
57
|
+
export type SpoolRewardPool = Required<Pick<ParsedSpoolRewardPoolData, 'exchangeRateNumerator' | 'exchangeRateDenominator'>> & CalculatedSpoolRewardPoolData;
|
|
58
|
+
export type OriginSpoolRewardPoolData = {
|
|
61
59
|
claimed_rewards: string;
|
|
62
60
|
exchange_rate_denominator: string;
|
|
63
61
|
exchange_rate_numerator: string;
|
|
64
62
|
rewards: string;
|
|
65
63
|
spool_id: string;
|
|
66
64
|
};
|
|
67
|
-
export type
|
|
65
|
+
export type ParsedSpoolRewardPoolData = {
|
|
68
66
|
claimedRewards: number;
|
|
69
67
|
exchangeRateNumerator: number;
|
|
70
68
|
exchangeRateDenominator: number;
|
|
71
69
|
rewards: number;
|
|
72
70
|
spoolId: string;
|
|
73
71
|
};
|
|
74
|
-
export type
|
|
72
|
+
export type CalculatedSpoolRewardPoolData = {
|
|
75
73
|
rewardApr: number;
|
|
76
74
|
totalRewardAmount: number;
|
|
77
75
|
totalRewardCoin: number;
|
|
@@ -83,9 +81,10 @@ export type CalculatedRewardPoolData = {
|
|
|
83
81
|
claimedRewardCoin: number;
|
|
84
82
|
claimedRewardValue: number;
|
|
85
83
|
rewardPerSec: number;
|
|
86
|
-
exchangeRateNumerator: number;
|
|
87
|
-
exchangeRateDenominator: number;
|
|
88
84
|
};
|
|
85
|
+
export type StakePools = OptionalKeys<Record<SupportStakeMarketCoins, StakePool>>;
|
|
86
|
+
export type StakeRewardPools = OptionalKeys<Record<SupportStakeMarketCoins, StakeRewardPool>>;
|
|
87
|
+
export type StakeAccounts = Record<SupportStakeMarketCoins, StakeAccount[]>;
|
|
89
88
|
export interface StakeAccount {
|
|
90
89
|
id: string;
|
|
91
90
|
type: string;
|
|
@@ -110,7 +109,7 @@ export interface StakePool {
|
|
|
110
109
|
createdAt: number;
|
|
111
110
|
lastUpdate: number;
|
|
112
111
|
}
|
|
113
|
-
export interface
|
|
112
|
+
export interface StakeRewardPool {
|
|
114
113
|
id: string;
|
|
115
114
|
type: string;
|
|
116
115
|
stakePoolId: string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SuiTxBlock as SuiKitTxBlock } from '@scallop-io/sui-kit';
|
|
2
|
+
/**
|
|
3
|
+
* Check and get the sender from the transaction block.
|
|
4
|
+
*
|
|
5
|
+
* @param txBlock - TxBlock created by SuiKit.
|
|
6
|
+
* @return Sender of transaction.
|
|
7
|
+
*/
|
|
8
|
+
export declare const requireSender: (txBlock: SuiKitTxBlock) => string;
|
package/dist/utils/index.d.ts
CHANGED