@scallop-io/sui-scallop-sdk 1.5.3 → 2.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +446 -599
- package/dist/index.d.ts +446 -599
- package/dist/index.js +29 -60
- package/dist/index.mjs +6 -6
- package/package.json +1 -1
- package/src/builders/loyaltyProgramBuilder.ts +5 -3
- package/src/builders/oracle.ts +10 -24
- package/src/builders/referralBuilder.ts +5 -9
- package/src/builders/sCoinBuilder.ts +9 -8
- package/src/builders/spoolBuilder.ts +4 -6
- package/src/constants/common.ts +114 -126
- package/src/constants/index.ts +0 -5
- package/src/constants/pyth.ts +25 -34
- package/src/constants/queryKeys.ts +2 -0
- package/src/models/index.ts +1 -0
- package/src/models/scallop.ts +23 -19
- package/src/models/scallopAddress.ts +7 -4
- package/src/models/scallopBuilder.ts +32 -35
- package/src/models/scallopCache.ts +1 -1
- package/src/models/scallopClient.ts +87 -89
- package/src/models/scallopConstants.ts +341 -0
- package/src/models/scallopIndexer.ts +11 -24
- package/src/models/scallopQuery.ts +65 -70
- package/src/models/scallopUtils.ts +114 -244
- package/src/queries/borrowIncentiveQuery.ts +21 -56
- package/src/queries/borrowLimitQuery.ts +3 -6
- package/src/queries/coreQuery.ts +94 -112
- package/src/queries/flashloanFeeQuery.ts +86 -0
- package/src/queries/isolatedAssetQuery.ts +12 -11
- package/src/queries/poolAddressesQuery.ts +187 -112
- package/src/queries/portfolioQuery.ts +65 -67
- package/src/queries/priceQuery.ts +16 -22
- package/src/queries/sCoinQuery.ts +15 -16
- package/src/queries/spoolQuery.ts +49 -59
- package/src/queries/supplyLimitQuery.ts +2 -6
- package/src/queries/xOracleQuery.ts +4 -15
- package/src/types/address.ts +12 -18
- package/src/types/builder/borrowIncentive.ts +2 -3
- package/src/types/builder/core.ts +20 -27
- package/src/types/builder/index.ts +1 -2
- package/src/types/builder/referral.ts +4 -8
- package/src/types/builder/sCoin.ts +4 -8
- package/src/types/builder/spool.ts +7 -10
- package/src/types/constant/common.ts +43 -49
- package/src/types/constant/enum.ts +15 -27
- package/src/types/constant/xOracle.ts +3 -5
- package/src/types/model.ts +47 -28
- package/src/types/query/borrowIncentive.ts +7 -24
- package/src/types/query/core.ts +8 -18
- package/src/types/query/portfolio.ts +8 -17
- package/src/types/query/spool.ts +5 -11
- package/src/types/utils.ts +1 -21
- package/src/utils/core.ts +1 -1
- package/src/utils/query.ts +13 -20
- package/src/utils/util.ts +6 -84
- package/src/constants/coinGecko.ts +0 -34
- package/src/constants/enum.ts +0 -268
- package/src/constants/flashloan.ts +0 -18
- package/src/constants/poolAddress.ts +0 -898
|
@@ -5,11 +5,6 @@ import type {
|
|
|
5
5
|
} from '@scallop-io/sui-kit';
|
|
6
6
|
import type { Argument, TransactionResult } from '@mysten/sui/transactions';
|
|
7
7
|
import type { ScallopBuilder } from '../../models';
|
|
8
|
-
import type {
|
|
9
|
-
SupportCollateralCoins,
|
|
10
|
-
SupportPoolCoins,
|
|
11
|
-
SupportAssetCoins,
|
|
12
|
-
} from '../constant';
|
|
13
8
|
import { SuiTxBlockWithSpool } from '.';
|
|
14
9
|
|
|
15
10
|
export type CoreIds = {
|
|
@@ -38,41 +33,41 @@ export type CoreNormalMethods = {
|
|
|
38
33
|
addCollateral: (
|
|
39
34
|
obligation: SuiObjectArg,
|
|
40
35
|
coin: SuiObjectArg,
|
|
41
|
-
collateralCoinName:
|
|
36
|
+
collateralCoinName: string
|
|
42
37
|
// ) => Promise<void>;
|
|
43
38
|
) => void;
|
|
44
39
|
takeCollateral: (
|
|
45
40
|
obligation: SuiObjectArg,
|
|
46
41
|
obligationKey: SuiObjectArg,
|
|
47
42
|
amount: number,
|
|
48
|
-
collateralCoinName:
|
|
43
|
+
collateralCoinName: string
|
|
49
44
|
// ) => Promise<TransactionResult>;
|
|
50
45
|
) => TransactionResult;
|
|
51
46
|
deposit: (
|
|
52
47
|
coin: SuiObjectArg,
|
|
53
|
-
poolCoinName:
|
|
48
|
+
poolCoinName: string
|
|
54
49
|
// ) => Promise<TransactionResult>;
|
|
55
50
|
) => TransactionResult;
|
|
56
51
|
depositEntry: (
|
|
57
52
|
coin: SuiObjectArg,
|
|
58
|
-
poolCoinName:
|
|
53
|
+
poolCoinName: string
|
|
59
54
|
// ) => Promise<TransactionResult>;
|
|
60
55
|
) => TransactionResult;
|
|
61
56
|
withdraw: (
|
|
62
57
|
marketCoin: SuiObjectArg,
|
|
63
|
-
poolCoinName:
|
|
58
|
+
poolCoinName: string
|
|
64
59
|
// ) => Promise<TransactionResult>;
|
|
65
60
|
) => TransactionResult;
|
|
66
61
|
withdrawEntry: (
|
|
67
62
|
marketCoin: SuiObjectArg,
|
|
68
|
-
poolCoinName:
|
|
63
|
+
poolCoinName: string
|
|
69
64
|
// ) => Promise<TransactionResult>;
|
|
70
65
|
) => TransactionResult;
|
|
71
66
|
borrow: (
|
|
72
67
|
obligation: SuiObjectArg,
|
|
73
68
|
obligationKey: SuiObjectArg,
|
|
74
69
|
amount: number,
|
|
75
|
-
poolCoinName:
|
|
70
|
+
poolCoinName: string
|
|
76
71
|
// ) => Promise<TransactionResult>;
|
|
77
72
|
) => TransactionResult;
|
|
78
73
|
borrowWithReferral: (
|
|
@@ -80,31 +75,31 @@ export type CoreNormalMethods = {
|
|
|
80
75
|
obligationKey: SuiObjectArg,
|
|
81
76
|
borrowReferral: SuiObjectArg,
|
|
82
77
|
amount: number | SuiTxArg,
|
|
83
|
-
poolCoinName:
|
|
78
|
+
poolCoinName: string
|
|
84
79
|
// ) => Promise<TransactionResult>;
|
|
85
80
|
) => TransactionResult;
|
|
86
81
|
borrowEntry: (
|
|
87
82
|
obligation: SuiObjectArg,
|
|
88
83
|
obligationKey: SuiObjectArg,
|
|
89
84
|
amount: number,
|
|
90
|
-
poolCoinName:
|
|
85
|
+
poolCoinName: string
|
|
91
86
|
// ) => Promise<TransactionResult>;
|
|
92
87
|
) => TransactionResult;
|
|
93
88
|
repay: (
|
|
94
89
|
obligation: SuiObjectArg,
|
|
95
90
|
coin: SuiObjectArg,
|
|
96
|
-
poolCoinName:
|
|
91
|
+
poolCoinName: string
|
|
97
92
|
// ) => Promise<void>;
|
|
98
93
|
) => void;
|
|
99
94
|
borrowFlashLoan: (
|
|
100
95
|
amount: number | SuiTxArg,
|
|
101
|
-
poolCoinName:
|
|
96
|
+
poolCoinName: string
|
|
102
97
|
// ) => Promise<TransactionResult>;
|
|
103
98
|
) => TransactionResult;
|
|
104
99
|
repayFlashLoan: (
|
|
105
100
|
coin: SuiObjectArg,
|
|
106
101
|
loan: SuiObjectArg,
|
|
107
|
-
poolCoinName:
|
|
102
|
+
poolCoinName: string
|
|
108
103
|
// ) => Promise<void>;
|
|
109
104
|
) => void;
|
|
110
105
|
};
|
|
@@ -112,45 +107,43 @@ export type CoreNormalMethods = {
|
|
|
112
107
|
export type CoreQuickMethods = {
|
|
113
108
|
addCollateralQuick: (
|
|
114
109
|
amount: number,
|
|
115
|
-
collateralCoinName:
|
|
110
|
+
collateralCoinName: string,
|
|
116
111
|
obligationId?: SuiObjectArg
|
|
117
112
|
) => Promise<void>;
|
|
118
113
|
takeCollateralQuick: (
|
|
119
114
|
amount: number,
|
|
120
|
-
collateralCoinName:
|
|
115
|
+
collateralCoinName: string,
|
|
121
116
|
obligationId?: SuiObjectArg,
|
|
122
117
|
obligationKey?: SuiObjectArg
|
|
123
118
|
) => Promise<TransactionResult>;
|
|
124
119
|
borrowQuick: (
|
|
125
120
|
amount: number,
|
|
126
|
-
poolCoinName:
|
|
121
|
+
poolCoinName: string,
|
|
127
122
|
obligationId?: SuiObjectArg,
|
|
128
123
|
obligationKey?: SuiObjectArg
|
|
129
124
|
) => Promise<TransactionResult>;
|
|
130
125
|
borrowWithReferralQuick: (
|
|
131
126
|
amount: number,
|
|
132
|
-
poolCoinName:
|
|
127
|
+
poolCoinName: string,
|
|
133
128
|
borrowReferral: SuiObjectArg,
|
|
134
129
|
obligationId?: SuiObjectArg,
|
|
135
130
|
obligationKey?: SuiObjectArg
|
|
136
131
|
) => Promise<TransactionResult>;
|
|
137
132
|
depositQuick: (
|
|
138
133
|
amount: number,
|
|
139
|
-
poolCoinName:
|
|
134
|
+
poolCoinName: string,
|
|
140
135
|
returnSCoin?: boolean
|
|
141
136
|
) => Promise<TransactionResult>;
|
|
142
137
|
withdrawQuick: (
|
|
143
138
|
amount: number,
|
|
144
|
-
poolCoinName:
|
|
139
|
+
poolCoinName: string
|
|
145
140
|
) => Promise<TransactionResult>;
|
|
146
141
|
repayQuick: (
|
|
147
142
|
amount: number,
|
|
148
|
-
poolCoinName:
|
|
143
|
+
poolCoinName: string,
|
|
149
144
|
obligationId?: SuiObjectArg
|
|
150
145
|
) => Promise<void>;
|
|
151
|
-
updateAssetPricesQuick: (
|
|
152
|
-
assetCoinNames?: SupportAssetCoins[]
|
|
153
|
-
) => Promise<void>;
|
|
146
|
+
updateAssetPricesQuick: (assetCoinNames?: string[]) => Promise<void>;
|
|
154
147
|
};
|
|
155
148
|
|
|
156
149
|
export type SuiTxBlockWithCoreNormalMethods = SuiKitTxBlock &
|
|
@@ -5,7 +5,6 @@ import type { VeScaTxBlock } from './vesca';
|
|
|
5
5
|
import type { ReferralTxBlock } from './referral';
|
|
6
6
|
import { LoyaltyProgramTxBlock } from './loyaltyProgram';
|
|
7
7
|
import { SCoinTxBlock } from './sCoin';
|
|
8
|
-
import { SupportAssetCoins } from '../constant';
|
|
9
8
|
|
|
10
9
|
export type * from './core';
|
|
11
10
|
export type * from './spool';
|
|
@@ -23,7 +22,7 @@ export type SuiTxBlockWithSCoin = BaseScallopTxBlock & SCoinTxBlock;
|
|
|
23
22
|
export type SuiTxBlockWithSpool = SuiTxBlockWithSCoin & SpoolTxBlock;
|
|
24
23
|
export type ScallopTxBlock = SuiTxBlockWithSpool & CoreTxBlock;
|
|
25
24
|
|
|
26
|
-
export type SelectCoinReturnType<T extends
|
|
25
|
+
export type SelectCoinReturnType<T extends string> = T extends 'sui'
|
|
27
26
|
? {
|
|
28
27
|
takeCoin: NestedResult;
|
|
29
28
|
}
|
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
SuiTxBlock as SuiKitTxBlock,
|
|
5
5
|
} from '@scallop-io/sui-kit';
|
|
6
6
|
import { ScallopBuilder } from 'src/models';
|
|
7
|
-
import { SupportPoolCoins } from '../constant';
|
|
8
7
|
|
|
9
8
|
export type ReferralIds = {
|
|
10
9
|
referralPgkId: string;
|
|
@@ -17,21 +16,18 @@ export type ReferralIds = {
|
|
|
17
16
|
|
|
18
17
|
export type ReferralNormalMethods = {
|
|
19
18
|
bindToReferral: (veScaKeyId: string) => void;
|
|
20
|
-
claimReferralTicket: (poolCoinName:
|
|
21
|
-
burnReferralTicket: (
|
|
22
|
-
ticket: SuiObjectArg,
|
|
23
|
-
poolCoinName: SupportPoolCoins
|
|
24
|
-
) => void;
|
|
19
|
+
claimReferralTicket: (poolCoinName: string) => TransactionResult;
|
|
20
|
+
burnReferralTicket: (ticket: SuiObjectArg, poolCoinName: string) => void;
|
|
25
21
|
claimReferralRevenue: (
|
|
26
22
|
veScaKey: SuiObjectArg,
|
|
27
|
-
poolCoinName:
|
|
23
|
+
poolCoinName: string
|
|
28
24
|
) => TransactionResult;
|
|
29
25
|
};
|
|
30
26
|
|
|
31
27
|
export type ReferralQuickMethods = {
|
|
32
28
|
claimReferralRevenueQuick: (
|
|
33
29
|
veScaKey: SuiObjectArg,
|
|
34
|
-
coinNames:
|
|
30
|
+
coinNames: string[]
|
|
35
31
|
) => Promise<void>;
|
|
36
32
|
};
|
|
37
33
|
|
|
@@ -3,7 +3,6 @@ import {
|
|
|
3
3
|
SuiTxBlock as SuiKitTxBlock,
|
|
4
4
|
TransactionResult,
|
|
5
5
|
} from '@scallop-io/sui-kit';
|
|
6
|
-
import { SupportSCoin } from '../constant';
|
|
7
6
|
import { ScallopBuilder } from 'src/models';
|
|
8
7
|
import { BaseScallopTxBlock } from '.';
|
|
9
8
|
|
|
@@ -19,7 +18,7 @@ export type sCoinNormalMethods = {
|
|
|
19
18
|
* @returns
|
|
20
19
|
*/
|
|
21
20
|
mintSCoin: (
|
|
22
|
-
marketCoinName:
|
|
21
|
+
marketCoinName: string,
|
|
23
22
|
marketCoin: SuiObjectArg
|
|
24
23
|
) => TransactionResult;
|
|
25
24
|
/**
|
|
@@ -28,19 +27,16 @@ export type sCoinNormalMethods = {
|
|
|
28
27
|
* @param sCoin
|
|
29
28
|
* @returns
|
|
30
29
|
*/
|
|
31
|
-
burnSCoin: (
|
|
32
|
-
sCoinName: SupportSCoin,
|
|
33
|
-
sCoin: SuiObjectArg
|
|
34
|
-
) => TransactionResult; // returns marketCoin
|
|
30
|
+
burnSCoin: (sCoinName: string, sCoin: SuiObjectArg) => TransactionResult; // returns marketCoin
|
|
35
31
|
};
|
|
36
32
|
|
|
37
33
|
export type sCoinQuickMethods = {
|
|
38
34
|
mintSCoinQuick: (
|
|
39
|
-
marketCoinName:
|
|
35
|
+
marketCoinName: string,
|
|
40
36
|
amount: number
|
|
41
37
|
) => Promise<TransactionResult>;
|
|
42
38
|
burnSCoinQuick: (
|
|
43
|
-
sCoinName:
|
|
39
|
+
sCoinName: string,
|
|
44
40
|
amount: number
|
|
45
41
|
) => Promise<TransactionResult>;
|
|
46
42
|
};
|
|
@@ -5,7 +5,6 @@ import type {
|
|
|
5
5
|
} from '@scallop-io/sui-kit';
|
|
6
6
|
import type { TransactionResult } from '@mysten/sui/transactions';
|
|
7
7
|
import type { ScallopBuilder } from '../../models';
|
|
8
|
-
import type { SupportStakeMarketCoins } from '../constant';
|
|
9
8
|
import { SuiTxBlockWithSCoin } from '.';
|
|
10
9
|
|
|
11
10
|
export type SpoolIds = {
|
|
@@ -13,39 +12,37 @@ export type SpoolIds = {
|
|
|
13
12
|
};
|
|
14
13
|
|
|
15
14
|
export type SpoolNormalMethods = {
|
|
16
|
-
createStakeAccount: (
|
|
17
|
-
stakeMarketCoinName: SupportStakeMarketCoins
|
|
18
|
-
) => TransactionResult;
|
|
15
|
+
createStakeAccount: (stakeMarketCoinName: string) => TransactionResult;
|
|
19
16
|
stake: (
|
|
20
17
|
stakeAccount: SuiAddressArg,
|
|
21
18
|
coin: SuiObjectArg,
|
|
22
|
-
stakeMarketCoinName:
|
|
19
|
+
stakeMarketCoinName: string
|
|
23
20
|
) => void;
|
|
24
21
|
unstake: (
|
|
25
22
|
stakeAccount: SuiAddressArg,
|
|
26
23
|
amount: number,
|
|
27
|
-
stakeMarketCoinName:
|
|
24
|
+
stakeMarketCoinName: string
|
|
28
25
|
) => TransactionResult;
|
|
29
26
|
claim: (
|
|
30
27
|
stakeAccount: SuiAddressArg,
|
|
31
|
-
stakeMarketCoinName:
|
|
28
|
+
stakeMarketCoinName: string
|
|
32
29
|
) => TransactionResult;
|
|
33
30
|
};
|
|
34
31
|
|
|
35
32
|
export type SpoolQuickMethods = {
|
|
36
33
|
stakeQuick(
|
|
37
34
|
amountOrMarketCoin: SuiObjectArg | number,
|
|
38
|
-
stakeMarketCoinName:
|
|
35
|
+
stakeMarketCoinName: string,
|
|
39
36
|
stakeAccountId?: SuiAddressArg
|
|
40
37
|
): Promise<void>;
|
|
41
38
|
unstakeQuick(
|
|
42
39
|
amount: number,
|
|
43
|
-
stakeMarketCoinName:
|
|
40
|
+
stakeMarketCoinName: string,
|
|
44
41
|
stakeAccountId?: SuiAddressArg,
|
|
45
42
|
returnSCoin?: boolean
|
|
46
43
|
): Promise<TransactionResult | undefined>;
|
|
47
44
|
claimQuick(
|
|
48
|
-
stakeMarketCoinName:
|
|
45
|
+
stakeMarketCoinName: string,
|
|
49
46
|
stakeAccountId?: SuiAddressArg
|
|
50
47
|
): Promise<TransactionResult[]>;
|
|
51
48
|
};
|
|
@@ -1,53 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
export type PoolAddress = {
|
|
2
|
+
coinName: string;
|
|
3
|
+
symbol: string;
|
|
4
|
+
coinType: string;
|
|
5
|
+
coinMetadataId: string;
|
|
6
|
+
decimals: number;
|
|
7
|
+
// optional keys
|
|
8
|
+
pythFeed?: string;
|
|
9
|
+
pythFeedObjectId?: string;
|
|
10
|
+
lendingPoolAddress?: string;
|
|
11
|
+
borrowDynamic?: string;
|
|
12
|
+
interestModel?: string;
|
|
13
|
+
borrowFeeKey?: string;
|
|
14
|
+
flashloanFeeObject?: string;
|
|
15
|
+
coinGeckoId?: string;
|
|
16
|
+
collateralPoolAddress?: string; // not all pool has collateral
|
|
17
|
+
riskModel?: string;
|
|
18
|
+
supplyLimitKey?: string;
|
|
19
|
+
borrowLimitKey?: string;
|
|
20
|
+
sCoinType?: string;
|
|
21
|
+
sCoinName?: string;
|
|
22
|
+
sCoinSymbol?: string;
|
|
23
|
+
sCoinMetadataId?: string;
|
|
24
|
+
sCoinTreasury?: string;
|
|
25
|
+
isolatedAssetKey?: string;
|
|
26
|
+
spool?: string;
|
|
27
|
+
spoolReward?: string;
|
|
28
|
+
spoolName?: string;
|
|
29
|
+
};
|
|
14
30
|
|
|
15
|
-
type
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
export type SupportMarketCoins =
|
|
30
|
-
| ParseMarketCoins<SupportPoolCoins>
|
|
31
|
-
| SupportStakeMarketCoins;
|
|
32
|
-
export type SupportStakeMarketCoins = (typeof SUPPORT_SPOOLS)[number];
|
|
33
|
-
export type SupportSuiBridgeCoins = (typeof SUPPORT_SUI_BRIDGE)[number];
|
|
34
|
-
export type SupportWormholeCoins = (typeof SUPPORT_WORMHOLE)[number];
|
|
35
|
-
export type SupportStakeCoins = Extract<
|
|
36
|
-
SupportPoolCoins,
|
|
37
|
-
ParseCoins<SupportStakeMarketCoins>
|
|
38
|
-
>;
|
|
39
|
-
export type SupportStakeRewardCoins = (typeof SUPPORT_SPOOLS_REWARDS)[number];
|
|
40
|
-
export type SupportBorrowIncentiveCoins =
|
|
41
|
-
(typeof SUPPORT_BORROW_INCENTIVE_POOLS)[number];
|
|
42
|
-
export type SupportBorrowIncentiveRewardCoins =
|
|
43
|
-
(typeof SUPPORT_BORROW_INCENTIVE_REWARDS)[number];
|
|
44
|
-
export type SupportSCoin = (typeof SUPPORT_SCOIN)[number];
|
|
45
|
-
|
|
46
|
-
export type SupportOracleType = (typeof SUPPORT_ORACLES)[number];
|
|
47
|
-
|
|
48
|
-
export type SupportPackageType = (typeof SUPPORT_PACKAGES)[number];
|
|
49
|
-
|
|
50
|
-
export type SupportCoinDecimals = Record<SupportCoins, number>;
|
|
31
|
+
export type Whitelist = {
|
|
32
|
+
lending: Set<string>;
|
|
33
|
+
borrowing: Set<string>;
|
|
34
|
+
collateral: Set<string>;
|
|
35
|
+
packages: Set<string>;
|
|
36
|
+
spool: Set<string>;
|
|
37
|
+
scoin: Set<string>;
|
|
38
|
+
suiBridge: Set<string>;
|
|
39
|
+
wormhole: Set<string>;
|
|
40
|
+
oracles: Set<string>;
|
|
41
|
+
borrowIncentiveRewards: Set<string>;
|
|
42
|
+
pythEndpoints: Set<string>;
|
|
43
|
+
deprecated: Set<string>;
|
|
44
|
+
};
|
|
51
45
|
|
|
52
46
|
export type CoinWrappedType =
|
|
53
47
|
| {
|
|
@@ -1,76 +1,64 @@
|
|
|
1
|
-
import {
|
|
2
|
-
SupportCoins,
|
|
3
|
-
SupportAssetCoins,
|
|
4
|
-
SupportMarketCoins,
|
|
5
|
-
SupportStakeMarketCoins,
|
|
6
|
-
SupportStakeRewardCoins,
|
|
7
|
-
SupportBorrowIncentiveCoins,
|
|
8
|
-
SupportBorrowIncentiveRewardCoins,
|
|
9
|
-
SupportSCoin,
|
|
10
|
-
SupportSuiBridgeCoins,
|
|
11
|
-
} from './common';
|
|
12
|
-
|
|
13
1
|
export type Coins = {
|
|
14
|
-
[K in
|
|
2
|
+
[K in string]: K;
|
|
15
3
|
};
|
|
16
4
|
|
|
17
5
|
export type AssetCoins = {
|
|
18
|
-
[K in
|
|
6
|
+
[K in string]: K;
|
|
19
7
|
};
|
|
20
8
|
|
|
21
9
|
export type MarketCoins = {
|
|
22
|
-
[K in
|
|
10
|
+
[K in string]: K;
|
|
23
11
|
};
|
|
24
12
|
|
|
25
13
|
export type SCoins = {
|
|
26
|
-
[K in
|
|
14
|
+
[K in string]: K;
|
|
27
15
|
};
|
|
28
16
|
|
|
29
17
|
export type StakeMarketCoins = {
|
|
30
|
-
[K in
|
|
18
|
+
[K in string]: K;
|
|
31
19
|
};
|
|
32
20
|
|
|
33
21
|
export type StakeRewardCoins = {
|
|
34
|
-
[key in
|
|
22
|
+
[key in string]: string;
|
|
35
23
|
};
|
|
36
24
|
|
|
37
25
|
export type SuiBridgeCoins = {
|
|
38
|
-
[K in
|
|
26
|
+
[K in string]: K;
|
|
39
27
|
};
|
|
40
28
|
|
|
41
29
|
export type BorrowIncentiveRewardCoins = {
|
|
42
|
-
[key in
|
|
30
|
+
[key in string]: string[];
|
|
43
31
|
};
|
|
44
32
|
|
|
45
33
|
export type AssetCoinIds = {
|
|
46
|
-
[key in
|
|
34
|
+
[key in string]: string;
|
|
47
35
|
};
|
|
48
36
|
|
|
49
37
|
export type SCoinIds = {
|
|
50
|
-
[key in
|
|
38
|
+
[key in string]: string;
|
|
51
39
|
};
|
|
52
40
|
|
|
53
41
|
export type SCoinTreasuryCaps = {
|
|
54
|
-
[key in
|
|
42
|
+
[key in string]: string;
|
|
55
43
|
};
|
|
56
44
|
|
|
57
45
|
export type SCoinConverterTreasury = {
|
|
58
|
-
[key in
|
|
46
|
+
[key in string]: string;
|
|
59
47
|
};
|
|
60
48
|
|
|
61
49
|
type PickFromUnion<T, K extends string> = K extends T ? K : never;
|
|
62
50
|
|
|
63
51
|
export type WormholeCoinIds = {
|
|
64
52
|
[key in PickFromUnion<
|
|
65
|
-
|
|
53
|
+
string,
|
|
66
54
|
'weth' | 'wbtc' | 'wusdc' | 'wusdt' | 'wapt' | 'wsol'
|
|
67
55
|
>]: string;
|
|
68
56
|
};
|
|
69
57
|
|
|
70
58
|
export type VoloCoinIds = {
|
|
71
|
-
[key in PickFromUnion<
|
|
59
|
+
[key in PickFromUnion<string, 'vsui'>]: string;
|
|
72
60
|
};
|
|
73
61
|
|
|
74
62
|
export type SuiBridgedCoinPackageIds = {
|
|
75
|
-
[key in
|
|
63
|
+
[key in string]: string;
|
|
76
64
|
};
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { SupportAssetCoins, SupportOracleType } from './common';
|
|
2
|
-
|
|
3
1
|
export type xOracleRules = {
|
|
4
|
-
primary:
|
|
5
|
-
secondary:
|
|
2
|
+
primary: string[];
|
|
3
|
+
secondary: string[];
|
|
6
4
|
};
|
|
7
5
|
export type xOracleRuleType = keyof xOracleRules;
|
|
8
6
|
|
|
9
7
|
export type xOracleListType = {
|
|
10
|
-
[key in
|
|
8
|
+
[key in string]: xOracleRules;
|
|
11
9
|
};
|
package/src/types/model.ts
CHANGED
|
@@ -11,6 +11,9 @@ import type {
|
|
|
11
11
|
import { ScallopCache } from 'src/models/scallopCache';
|
|
12
12
|
import { AddressesInterface } from './address';
|
|
13
13
|
import { QueryClient, QueryClientConfig } from '@tanstack/query-core';
|
|
14
|
+
import { AxiosInstance } from 'axios';
|
|
15
|
+
import { PoolAddress, Whitelist } from './constant';
|
|
16
|
+
import { ScallopConstants } from 'src/models/scallopConstants';
|
|
14
17
|
|
|
15
18
|
export type ScallopClientFnReturnType<T extends boolean> = T extends true
|
|
16
19
|
? SuiTransactionBlockResponse
|
|
@@ -35,12 +38,16 @@ export type ScallopAddressInstanceParams = ScallopBaseInstanceParams & {
|
|
|
35
38
|
cache?: ScallopCache;
|
|
36
39
|
};
|
|
37
40
|
|
|
41
|
+
export type ScallopConstantsInstanceParams = {
|
|
42
|
+
address?: ScallopAddress;
|
|
43
|
+
};
|
|
44
|
+
|
|
38
45
|
export type ScallopIndexerInstanceParams = {
|
|
39
46
|
cache?: ScallopCache;
|
|
40
47
|
};
|
|
41
48
|
|
|
42
49
|
export type ScallopUtilsInstanceParams = ScallopBaseInstanceParams & {
|
|
43
|
-
|
|
50
|
+
constants?: ScallopConstants;
|
|
44
51
|
};
|
|
45
52
|
|
|
46
53
|
export type ScallopQueryInstanceParams = ScallopBaseInstanceParams & {
|
|
@@ -56,40 +63,52 @@ export type ScallopClientInstanceParams = ScallopBaseInstanceParams & {
|
|
|
56
63
|
builder?: ScallopBuilder;
|
|
57
64
|
};
|
|
58
65
|
|
|
59
|
-
export type
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
network?: NetworkType;
|
|
63
|
-
forceInterface?: Partial<Record<NetworkType, AddressesInterface>>;
|
|
66
|
+
export type ScallopCacheConfig = {
|
|
67
|
+
tokensPerInterval?: number; // How many requests per interval
|
|
68
|
+
interval?: number; // Interval in milliseconds
|
|
64
69
|
};
|
|
65
70
|
|
|
66
|
-
export type
|
|
67
|
-
addressId?: string;
|
|
68
|
-
forceAddressesInterface?: Partial<Record<NetworkType, AddressesInterface>>;
|
|
71
|
+
export type ScallopCacheParams = {
|
|
69
72
|
walletAddress?: string;
|
|
73
|
+
cacheOptions?: QueryClientConfig;
|
|
74
|
+
config?: ScallopCacheConfig;
|
|
70
75
|
} & SuiKitParams;
|
|
71
76
|
|
|
72
|
-
export type
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
ScallopCacheParams;
|
|
77
|
-
|
|
78
|
-
export type ScallopBuilderParams = ScallopParams & {
|
|
79
|
-
pythEndpoints?: string[];
|
|
80
|
-
usePythPullModel?: boolean;
|
|
81
|
-
useOnChainXOracleList?: boolean;
|
|
82
|
-
} & ScallopQueryParams;
|
|
77
|
+
export type ScallopIndexerParams = ScallopCacheParams & {
|
|
78
|
+
indexerApiUrl?: string;
|
|
79
|
+
axios?: AxiosInstance;
|
|
80
|
+
};
|
|
83
81
|
|
|
84
|
-
export type
|
|
82
|
+
export type ScallopAddressParams = ScallopCacheParams & {
|
|
83
|
+
addressApiUrl?: string;
|
|
84
|
+
addressId: string;
|
|
85
|
+
auth?: string;
|
|
86
|
+
network?: NetworkType;
|
|
87
|
+
forceAddressesInterface?: Partial<Record<NetworkType, AddressesInterface>>;
|
|
88
|
+
};
|
|
85
89
|
|
|
86
|
-
export type
|
|
87
|
-
|
|
90
|
+
export type ScallopConstantsParams = ScallopAddressParams & {
|
|
91
|
+
poolAddressesApiUrl?: string;
|
|
92
|
+
whitelistApiUrl?: string;
|
|
93
|
+
forcePoolAddressInterface?: Record<string, PoolAddress>;
|
|
94
|
+
forceWhitelistInterface?: Whitelist;
|
|
88
95
|
};
|
|
89
96
|
|
|
90
|
-
export type
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
97
|
+
export type ScallopUtilsParams = ScallopAddressParams &
|
|
98
|
+
ScallopConstantsParams & {
|
|
99
|
+
pythEndpoints?: string[];
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export type ScallopQueryParams = ScallopUtilsParams & ScallopIndexerParams;
|
|
103
|
+
|
|
104
|
+
export type ScallopBuilderParams = ScallopQueryParams & {
|
|
105
|
+
usePythPullModel?: boolean;
|
|
106
|
+
useOnChainXOracleList?: boolean;
|
|
95
107
|
};
|
|
108
|
+
|
|
109
|
+
export type ScallopClientParams = ScallopBuilderParams;
|
|
110
|
+
export type ScallopParams = SuiKitParams &
|
|
111
|
+
ScallopAddressParams &
|
|
112
|
+
ScallopConstantsParams & {
|
|
113
|
+
walletAddress?: string;
|
|
114
|
+
};
|