@scallop-io/sui-scallop-sdk 0.47.0-alpha.1 → 0.47.0-alpha.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/constants/common.d.ts +4 -4
- package/dist/index.js +26 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -10
- package/dist/index.mjs.map +1 -1
- package/dist/models/scallopQuery.d.ts +8 -2
- package/dist/queries/coreQuery.d.ts +4 -2
- package/dist/queries/portfolioQuery.d.ts +1 -0
- package/dist/queries/sCoinQuery.d.ts +1 -1
- package/dist/queries/spoolQuery.d.ts +1 -0
- package/package.json +1 -1
- package/src/constants/common.ts +4 -0
- package/src/constants/enum.ts +9 -0
- package/src/models/scallopClient.ts +1 -1
- package/src/models/scallopIndexer.ts +3 -3
- package/src/queries/coreQuery.ts +14 -9
- package/src/queries/spoolQuery.ts +1 -0
|
@@ -51,6 +51,7 @@ export declare class ScallopQuery {
|
|
|
51
51
|
* @return Market pools data.
|
|
52
52
|
*/
|
|
53
53
|
getMarketPools(poolCoinNames?: SupportPoolCoins[], indexer?: boolean): Promise<{
|
|
54
|
+
usdc?: import("../types").MarketPool | undefined;
|
|
54
55
|
weth?: import("../types").MarketPool | undefined;
|
|
55
56
|
wbtc?: import("../types").MarketPool | undefined;
|
|
56
57
|
wusdc?: import("../types").MarketPool | undefined;
|
|
@@ -84,6 +85,7 @@ export declare class ScallopQuery {
|
|
|
84
85
|
* @return Market collaterals data.
|
|
85
86
|
*/
|
|
86
87
|
getMarketCollaterals(collateralCoinNames?: SupportCollateralCoins[], indexer?: boolean): Promise<{
|
|
88
|
+
usdc?: import("../types").MarketCollateral | undefined;
|
|
87
89
|
weth?: import("../types").MarketCollateral | undefined;
|
|
88
90
|
wbtc?: import("../types").MarketCollateral | undefined;
|
|
89
91
|
wusdc?: import("../types").MarketCollateral | undefined;
|
|
@@ -173,6 +175,7 @@ export declare class ScallopQuery {
|
|
|
173
175
|
* @return Spools data.
|
|
174
176
|
*/
|
|
175
177
|
getSpools(stakeMarketCoinNames?: SupportStakeMarketCoins[], indexer?: boolean): Promise<{
|
|
178
|
+
susdc?: import("../types").Spool | undefined;
|
|
176
179
|
sweth?: import("../types").Spool | undefined;
|
|
177
180
|
ssui?: import("../types").Spool | undefined;
|
|
178
181
|
swusdc?: import("../types").Spool | undefined;
|
|
@@ -216,6 +219,7 @@ export declare class ScallopQuery {
|
|
|
216
219
|
* @return Stake pools data.
|
|
217
220
|
*/
|
|
218
221
|
getStakePools(stakeMarketCoinNames?: SupportStakeMarketCoins[]): Promise<{
|
|
222
|
+
susdc?: import("../types").StakePool | undefined;
|
|
219
223
|
sweth?: import("../types").StakePool | undefined;
|
|
220
224
|
ssui?: import("../types").StakePool | undefined;
|
|
221
225
|
swusdc?: import("../types").StakePool | undefined;
|
|
@@ -247,6 +251,7 @@ export declare class ScallopQuery {
|
|
|
247
251
|
* @return Stake reward pools data.
|
|
248
252
|
*/
|
|
249
253
|
getStakeRewardPools(stakeMarketCoinNames?: SupportStakeMarketCoins[]): Promise<{
|
|
254
|
+
susdc?: import("../types").StakeRewardPool | undefined;
|
|
250
255
|
sweth?: import("../types").StakeRewardPool | undefined;
|
|
251
256
|
ssui?: import("../types").StakeRewardPool | undefined;
|
|
252
257
|
swusdc?: import("../types").StakeRewardPool | undefined;
|
|
@@ -310,6 +315,7 @@ export declare class ScallopQuery {
|
|
|
310
315
|
* @return All lending and spool infomation.
|
|
311
316
|
*/
|
|
312
317
|
getLendings(poolCoinNames?: SupportPoolCoins[], ownerAddress?: string, indexer?: boolean): Promise<{
|
|
318
|
+
usdc?: import("../types").Lending | undefined;
|
|
313
319
|
weth?: import("../types").Lending | undefined;
|
|
314
320
|
wbtc?: import("../types").Lending | undefined;
|
|
315
321
|
wusdc?: import("../types").Lending | undefined;
|
|
@@ -421,7 +427,7 @@ export declare class ScallopQuery {
|
|
|
421
427
|
* @param ownerAddress - The owner address.
|
|
422
428
|
* @return All market sCoin amounts.
|
|
423
429
|
*/
|
|
424
|
-
getSCoinAmounts(sCoinNames?: SupportSCoin[], ownerAddress?: string): Promise<import("../types").OptionalKeys<Record<"sweth" | "ssui" | "swusdc" | "swusdt" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "swsol" | "swbtc", number>>>;
|
|
430
|
+
getSCoinAmounts(sCoinNames?: SupportSCoin[], ownerAddress?: string): Promise<import("../types").OptionalKeys<Record<"susdc" | "sweth" | "ssui" | "swusdc" | "swusdt" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "swsol" | "swbtc", number>>>;
|
|
425
431
|
/**
|
|
426
432
|
* Get sCoin amount.
|
|
427
433
|
*
|
|
@@ -436,7 +442,7 @@ export declare class ScallopQuery {
|
|
|
436
442
|
* @returns
|
|
437
443
|
*/
|
|
438
444
|
getSCoinSwapRate(fromSCoin: SupportSCoin, toSCoin: SupportSCoin): Promise<number>;
|
|
439
|
-
getFlashLoanFees(assetCoinNames?: SupportAssetCoins[]): Promise<Record<"weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca", number>>;
|
|
445
|
+
getFlashLoanFees(assetCoinNames?: SupportAssetCoins[]): Promise<Record<"usdc" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca", number>>;
|
|
440
446
|
/**
|
|
441
447
|
* Get supply limit of supply pool
|
|
442
448
|
*/
|
|
@@ -26,6 +26,7 @@ export declare const queryMarket: (query: ScallopQuery, indexer?: boolean) => Pr
|
|
|
26
26
|
* @return Market pools data.
|
|
27
27
|
*/
|
|
28
28
|
export declare const getMarketPools: (query: ScallopQuery, poolCoinNames?: SupportPoolCoins[], indexer?: boolean) => Promise<{
|
|
29
|
+
usdc?: MarketPool | undefined;
|
|
29
30
|
weth?: MarketPool | undefined;
|
|
30
31
|
wbtc?: MarketPool | undefined;
|
|
31
32
|
wusdc?: MarketPool | undefined;
|
|
@@ -63,6 +64,7 @@ export declare const getMarketPool: (query: ScallopQuery, poolCoinName: SupportP
|
|
|
63
64
|
* @return Market collaterals data.
|
|
64
65
|
*/
|
|
65
66
|
export declare const getMarketCollaterals: (query: ScallopQuery, collateralCoinNames?: SupportCollateralCoins[], indexer?: boolean) => Promise<{
|
|
67
|
+
usdc?: MarketCollateral | undefined;
|
|
66
68
|
weth?: MarketCollateral | undefined;
|
|
67
69
|
wbtc?: MarketCollateral | undefined;
|
|
68
70
|
wusdc?: MarketCollateral | undefined;
|
|
@@ -101,10 +103,10 @@ export declare const getObligations: ({ address, }: {
|
|
|
101
103
|
* Query obligation locked status.
|
|
102
104
|
*
|
|
103
105
|
* @param query - The Scallop query instance.
|
|
104
|
-
* @param
|
|
106
|
+
* @param obligation - The obligation id or the obligation object.
|
|
105
107
|
* @return Obligation locked status.
|
|
106
108
|
*/
|
|
107
|
-
export declare const getObligationLocked: (cache: ScallopCache,
|
|
109
|
+
export declare const getObligationLocked: (cache: ScallopCache, obligation: string | SuiObjectData) => Promise<boolean>;
|
|
108
110
|
/**
|
|
109
111
|
* Query obligation data.
|
|
110
112
|
*
|
|
@@ -10,6 +10,7 @@ import type { Market, SupportPoolCoins, MarketPool, Spool, StakeAccount, Lending
|
|
|
10
10
|
* @return User lending infomation for specific pools.
|
|
11
11
|
*/
|
|
12
12
|
export declare const getLendings: (query: ScallopQuery, poolCoinNames?: SupportPoolCoins[], ownerAddress?: string, indexer?: boolean) => Promise<{
|
|
13
|
+
usdc?: Lending | undefined;
|
|
13
14
|
weth?: Lending | undefined;
|
|
14
15
|
wbtc?: Lending | undefined;
|
|
15
16
|
wusdc?: Lending | undefined;
|
|
@@ -19,7 +19,7 @@ export declare const getSCoinTotalSupply: ({ utils, }: {
|
|
|
19
19
|
*/
|
|
20
20
|
export declare const getSCoinAmounts: ({ utils, }: {
|
|
21
21
|
utils: ScallopUtils;
|
|
22
|
-
}, sCoinNames?: SupportSCoin[], ownerAddress?: string) => Promise<OptionalKeys<Record<"sweth" | "ssui" | "swusdc" | "swusdt" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "swsol" | "swbtc", number>>>;
|
|
22
|
+
}, sCoinNames?: SupportSCoin[], ownerAddress?: string) => Promise<OptionalKeys<Record<"susdc" | "sweth" | "ssui" | "swusdc" | "swusdt" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "swsol" | "swbtc", number>>>;
|
|
23
23
|
/**
|
|
24
24
|
* Query owned sCoin amount.
|
|
25
25
|
*
|
|
@@ -9,6 +9,7 @@ import type { MarketPool, Spool, StakePool, StakeRewardPool, StakeAccounts, Supp
|
|
|
9
9
|
* @return Spools data.
|
|
10
10
|
*/
|
|
11
11
|
export declare const getSpools: (query: ScallopQuery, stakeMarketCoinNames?: SupportStakeMarketCoins[], indexer?: boolean) => Promise<{
|
|
12
|
+
susdc?: Spool | undefined;
|
|
12
13
|
sweth?: Spool | undefined;
|
|
13
14
|
ssui?: Spool | undefined;
|
|
14
15
|
swusdc?: Spool | undefined;
|
package/package.json
CHANGED
package/src/constants/common.ts
CHANGED
|
@@ -34,6 +34,7 @@ export const OLD_BORROW_INCENTIVE_PROTOCOL_ID =
|
|
|
34
34
|
'0xc63072e7f5f4983a2efaf5bdba1480d5e7d74d57948e1c7cc436f8e22cbeb410' as const;
|
|
35
35
|
|
|
36
36
|
export const SUPPORT_POOLS = [
|
|
37
|
+
'usdc', // native USDC
|
|
37
38
|
'weth',
|
|
38
39
|
'wbtc',
|
|
39
40
|
'wusdc',
|
|
@@ -49,6 +50,7 @@ export const SUPPORT_POOLS = [
|
|
|
49
50
|
] as const;
|
|
50
51
|
|
|
51
52
|
export const SUPPORT_COLLATERALS = [
|
|
53
|
+
'usdc',
|
|
52
54
|
'weth',
|
|
53
55
|
'wbtc',
|
|
54
56
|
'wusdc',
|
|
@@ -64,6 +66,7 @@ export const SUPPORT_COLLATERALS = [
|
|
|
64
66
|
] as const;
|
|
65
67
|
|
|
66
68
|
export const SUPPORT_SPOOLS = [
|
|
69
|
+
'susdc',
|
|
67
70
|
'sweth',
|
|
68
71
|
'ssui',
|
|
69
72
|
'swusdc',
|
|
@@ -75,6 +78,7 @@ export const SUPPORT_SPOOLS = [
|
|
|
75
78
|
] as const;
|
|
76
79
|
|
|
77
80
|
export const SUPPORT_SCOIN = [
|
|
81
|
+
'susdc',
|
|
78
82
|
'ssui',
|
|
79
83
|
'swusdc',
|
|
80
84
|
'swusdt',
|
package/src/constants/enum.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type * as types from '../types';
|
|
|
2
2
|
import { IS_VE_SCA_TEST } from './common';
|
|
3
3
|
|
|
4
4
|
export const coinDecimals: types.SupportCoinDecimals = {
|
|
5
|
+
usdc: 6,
|
|
5
6
|
weth: 8,
|
|
6
7
|
wbtc: 8,
|
|
7
8
|
wusdc: 6,
|
|
@@ -14,6 +15,7 @@ export const coinDecimals: types.SupportCoinDecimals = {
|
|
|
14
15
|
hasui: 9,
|
|
15
16
|
vsui: 9,
|
|
16
17
|
sca: 9,
|
|
18
|
+
susdc: 6,
|
|
17
19
|
sweth: 8,
|
|
18
20
|
swbtc: 8,
|
|
19
21
|
swusdc: 6,
|
|
@@ -29,6 +31,7 @@ export const coinDecimals: types.SupportCoinDecimals = {
|
|
|
29
31
|
};
|
|
30
32
|
|
|
31
33
|
export const assetCoins: types.AssetCoins = {
|
|
34
|
+
usdc: 'usdc',
|
|
32
35
|
weth: 'weth',
|
|
33
36
|
wbtc: 'wbtc',
|
|
34
37
|
wusdc: 'wusdc',
|
|
@@ -44,6 +47,7 @@ export const assetCoins: types.AssetCoins = {
|
|
|
44
47
|
};
|
|
45
48
|
|
|
46
49
|
export const marketCoins: types.MarketCoins = {
|
|
50
|
+
susdc: 'susdc',
|
|
47
51
|
sweth: 'sweth',
|
|
48
52
|
swbtc: 'swbtc',
|
|
49
53
|
swusdc: 'swusdc',
|
|
@@ -59,6 +63,7 @@ export const marketCoins: types.MarketCoins = {
|
|
|
59
63
|
};
|
|
60
64
|
|
|
61
65
|
export const sCoins: types.SCoins = {
|
|
66
|
+
susdc: 'susdc',
|
|
62
67
|
sweth: 'sweth',
|
|
63
68
|
swusdc: 'swusdc',
|
|
64
69
|
swusdt: 'swusdt',
|
|
@@ -73,6 +78,7 @@ export const sCoins: types.SCoins = {
|
|
|
73
78
|
};
|
|
74
79
|
|
|
75
80
|
export const stakeMarketCoins: types.StakeMarketCoins = {
|
|
81
|
+
susdc: 'susdc',
|
|
76
82
|
sweth: 'sweth',
|
|
77
83
|
ssui: 'ssui',
|
|
78
84
|
swusdc: 'swusdc',
|
|
@@ -92,6 +98,7 @@ export const spoolRewardCoins: types.StakeRewardCoins = {
|
|
|
92
98
|
safsui: 'sui',
|
|
93
99
|
shasui: 'sui',
|
|
94
100
|
svsui: 'sui',
|
|
101
|
+
susdc: 'sui',
|
|
95
102
|
};
|
|
96
103
|
|
|
97
104
|
export const borrowIncentiveRewardCoins: types.BorrowIncentiveRewardCoins = {
|
|
@@ -106,6 +113,7 @@ export const borrowIncentiveRewardCoins: types.BorrowIncentiveRewardCoins = {
|
|
|
106
113
|
};
|
|
107
114
|
|
|
108
115
|
export const coinIds: types.AssetCoinIds = {
|
|
116
|
+
usdc: '0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7',
|
|
109
117
|
sui: '0x0000000000000000000000000000000000000000000000000000000000000002',
|
|
110
118
|
weth: '0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5',
|
|
111
119
|
wbtc: '0x027792d9fed7f9844eb4839566001bb6f6cb4804f66aa2da6fe1ee242d896881',
|
|
@@ -137,6 +145,7 @@ export const voloCoinIds: types.VoloCoinIds = {
|
|
|
137
145
|
|
|
138
146
|
// PROD VERSION
|
|
139
147
|
export const sCoinIds: types.SCoinIds = {
|
|
148
|
+
susdc: '', // TODO: sCoin contract
|
|
140
149
|
ssui: '0xaafc4f740de0dd0dde642a31148fb94517087052f19afb0f7bed1dc41a50c77b::scallop_sui::SCALLOP_SUI',
|
|
141
150
|
scetus:
|
|
142
151
|
'0xea346ce428f91ab007210443efcea5f5cdbbb3aae7e9affc0ca93f9203c31f0c::scallop_cetus::SCALLOP_CETUS',
|
|
@@ -72,7 +72,7 @@ export class ScallopIndexer {
|
|
|
72
72
|
return await this._requestClient.get<{
|
|
73
73
|
pools: MarketPool[];
|
|
74
74
|
collaterals: MarketCollateral[];
|
|
75
|
-
}>(`/api/market`);
|
|
75
|
+
}>(`/api/market/migrate`);
|
|
76
76
|
},
|
|
77
77
|
});
|
|
78
78
|
|
|
@@ -149,7 +149,7 @@ export class ScallopIndexer {
|
|
|
149
149
|
queryFn: async () => {
|
|
150
150
|
return await this._requestClient.get<{
|
|
151
151
|
spools: Spool[];
|
|
152
|
-
}>(`/api/spools`);
|
|
152
|
+
}>(`/api/spools/migrate`);
|
|
153
153
|
},
|
|
154
154
|
});
|
|
155
155
|
|
|
@@ -187,7 +187,7 @@ export class ScallopIndexer {
|
|
|
187
187
|
queryFn: async () => {
|
|
188
188
|
return await this._requestClient.get<{
|
|
189
189
|
borrowIncentivePools: BorrowIncentivePool[];
|
|
190
|
-
}>(`/api/borrowIncentivePools`);
|
|
190
|
+
}>(`/api/borrowIncentivePools/migrate`);
|
|
191
191
|
},
|
|
192
192
|
});
|
|
193
193
|
|
package/src/queries/coreQuery.ts
CHANGED
|
@@ -768,24 +768,29 @@ export const getObligations = async (
|
|
|
768
768
|
* Query obligation locked status.
|
|
769
769
|
*
|
|
770
770
|
* @param query - The Scallop query instance.
|
|
771
|
-
* @param
|
|
771
|
+
* @param obligation - The obligation id or the obligation object.
|
|
772
772
|
* @return Obligation locked status.
|
|
773
773
|
*/
|
|
774
774
|
export const getObligationLocked = async (
|
|
775
775
|
cache: ScallopCache,
|
|
776
|
-
|
|
776
|
+
obligation: string | SuiObjectData
|
|
777
777
|
) => {
|
|
778
|
-
const obligationObjectResponse =
|
|
779
|
-
|
|
780
|
-
|
|
778
|
+
const obligationObjectResponse =
|
|
779
|
+
typeof obligation === 'string'
|
|
780
|
+
? (
|
|
781
|
+
await cache.queryGetObject(obligation, {
|
|
782
|
+
showContent: true,
|
|
783
|
+
})
|
|
784
|
+
)?.data
|
|
785
|
+
: obligation;
|
|
781
786
|
let obligationLocked = false;
|
|
782
787
|
if (
|
|
783
|
-
obligationObjectResponse
|
|
784
|
-
obligationObjectResponse?.
|
|
785
|
-
'lock_key' in obligationObjectResponse.
|
|
788
|
+
obligationObjectResponse &&
|
|
789
|
+
obligationObjectResponse?.content?.dataType === 'moveObject' &&
|
|
790
|
+
'lock_key' in obligationObjectResponse.content.fields
|
|
786
791
|
) {
|
|
787
792
|
obligationLocked = Boolean(
|
|
788
|
-
obligationObjectResponse.
|
|
793
|
+
obligationObjectResponse.content.fields.lock_key
|
|
789
794
|
);
|
|
790
795
|
}
|
|
791
796
|
|