@scallop-io/sui-scallop-sdk 1.4.19 → 1.4.21
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/constants/enum.d.ts +2 -2
- package/dist/constants/poolAddress.d.ts +3 -1
- package/dist/constants/queryKeys.d.ts +2 -2
- package/dist/index.js +400 -115
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +398 -110
- package/dist/index.mjs.map +1 -1
- package/dist/models/scallopQuery.d.ts +13 -6
- package/dist/models/scallopUtils.d.ts +2 -2
- package/dist/queries/borrowIncentiveQuery.d.ts +2 -0
- package/dist/queries/poolAddressesQuery.d.ts +3 -1
- package/dist/queries/portfolioQuery.d.ts +4 -3
- package/dist/queries/priceQuery.d.ts +2 -0
- package/dist/queries/sCoinQuery.d.ts +1 -1
- package/dist/types/query/portfolio.d.ts +4 -0
- package/package.json +1 -1
- package/src/builders/borrowIncentiveBuilder.ts +29 -7
- package/src/builders/coreBuilder.ts +66 -10
- package/src/builders/oracle.ts +44 -4
- package/src/builders/referralBuilder.ts +20 -4
- package/src/builders/spoolBuilder.ts +38 -4
- package/src/builders/vescaBuilder.ts +25 -5
- package/src/constants/coinGecko.ts +1 -0
- package/src/constants/common.ts +2 -0
- package/src/constants/enum.ts +8 -0
- package/src/constants/poolAddress.ts +165 -58
- package/src/constants/pyth.ts +1 -0
- package/src/constants/queryKeys.ts +2 -2
- package/src/models/scallopUtils.ts +3 -0
- package/src/queries/poolAddressesQuery.ts +15 -3
- package/src/queries/portfolioQuery.ts +16 -5
- package/src/queries/vescaQuery.ts +18 -4
- package/src/types/query/portfolio.ts +4 -0
- package/dist/test.d.ts +0 -1
- package/src/test.ts +0 -17
|
@@ -317,6 +317,7 @@ export declare class ScallopQuery {
|
|
|
317
317
|
fud?: import("../types").BorrowIncentivePool | undefined;
|
|
318
318
|
deep?: import("../types").BorrowIncentivePool | undefined;
|
|
319
319
|
fdusd?: import("../types").BorrowIncentivePool | undefined;
|
|
320
|
+
blub?: import("../types").BorrowIncentivePool | undefined;
|
|
320
321
|
}>;
|
|
321
322
|
/**
|
|
322
323
|
* Get borrow incentive accounts data.
|
|
@@ -344,6 +345,7 @@ export declare class ScallopQuery {
|
|
|
344
345
|
fud?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
|
|
345
346
|
deep?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
|
|
346
347
|
fdusd?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
|
|
348
|
+
blub?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
|
|
347
349
|
}>;
|
|
348
350
|
/**
|
|
349
351
|
* Get user lending and spool infomation for specific pools.
|
|
@@ -376,6 +378,7 @@ export declare class ScallopQuery {
|
|
|
376
378
|
fud?: import("../types").Lending | undefined;
|
|
377
379
|
deep?: import("../types").Lending | undefined;
|
|
378
380
|
fdusd?: import("../types").Lending | undefined;
|
|
381
|
+
blub?: import("../types").Lending | undefined;
|
|
379
382
|
}>;
|
|
380
383
|
/**
|
|
381
384
|
* Get user lending and spool information for specific pool.
|
|
@@ -491,7 +494,7 @@ export declare class ScallopQuery {
|
|
|
491
494
|
* @param ownerAddress - The owner address.
|
|
492
495
|
* @return All market sCoin amounts.
|
|
493
496
|
*/
|
|
494
|
-
getSCoinAmounts(sCoinNames?: SupportSCoin[], ownerAddress?: string): Promise<import("../types").OptionalKeys<Record<"susdc" | "ssbeth" | "ssbusdt" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep" | "sfdusd", number>>>;
|
|
497
|
+
getSCoinAmounts(sCoinNames?: SupportSCoin[], ownerAddress?: string): Promise<import("../types").OptionalKeys<Record<"susdc" | "ssbeth" | "ssbusdt" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep" | "sfdusd" | "sblub", number>>>;
|
|
495
498
|
/**
|
|
496
499
|
* Get sCoin amount.
|
|
497
500
|
*
|
|
@@ -506,7 +509,7 @@ export declare class ScallopQuery {
|
|
|
506
509
|
* @returns
|
|
507
510
|
*/
|
|
508
511
|
getSCoinSwapRate(fromSCoin: SupportSCoin, toSCoin: SupportSCoin): Promise<number>;
|
|
509
|
-
getFlashLoanFees(assetCoinNames?: SupportAssetCoins[]): Promise<Record<"usdc" | "sbeth" | "sbusdt" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd", number>>;
|
|
512
|
+
getFlashLoanFees(assetCoinNames?: SupportAssetCoins[]): Promise<Record<"usdc" | "sbeth" | "sbusdt" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "blub", number>>;
|
|
510
513
|
/**
|
|
511
514
|
* Get supply limit of lending pool
|
|
512
515
|
*/
|
|
@@ -554,6 +557,7 @@ export declare class ScallopQuery {
|
|
|
554
557
|
sfud?: number | undefined;
|
|
555
558
|
sdeep?: number | undefined;
|
|
556
559
|
sfdusd?: number | undefined;
|
|
560
|
+
sblub?: number | undefined;
|
|
557
561
|
usdc?: number | undefined;
|
|
558
562
|
sbeth?: number | undefined;
|
|
559
563
|
sbusdt?: number | undefined;
|
|
@@ -572,13 +576,14 @@ export declare class ScallopQuery {
|
|
|
572
576
|
fud?: number | undefined;
|
|
573
577
|
deep?: number | undefined;
|
|
574
578
|
fdusd?: number | undefined;
|
|
579
|
+
blub?: number | undefined;
|
|
575
580
|
swapt?: number | undefined;
|
|
576
581
|
}>;
|
|
577
582
|
/**
|
|
578
583
|
* Query all address (lending pool, collateral pool, borrow dynamics, interest models, etc.) of all pool
|
|
579
584
|
* @returns
|
|
580
585
|
*/
|
|
581
|
-
getPoolAddresses(): Promise<import("../types").OptionalKeys<Record<"usdc" | "sbeth" | "sbusdt" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd", {
|
|
586
|
+
getPoolAddresses(): Promise<import("../types").OptionalKeys<Record<"usdc" | "sbeth" | "sbusdt" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "blub", {
|
|
582
587
|
coinName: string;
|
|
583
588
|
symbol: string;
|
|
584
589
|
lendingPoolAddress?: string;
|
|
@@ -602,6 +607,8 @@ export declare class ScallopQuery {
|
|
|
602
607
|
sCoinMetadataId?: string;
|
|
603
608
|
spoolName?: string;
|
|
604
609
|
decimals: number;
|
|
610
|
+
pythFeed?: string;
|
|
611
|
+
pythFeedObjectId?: string;
|
|
605
612
|
}>>>;
|
|
606
613
|
/**
|
|
607
614
|
* Get user portfolio
|
|
@@ -615,7 +622,7 @@ export declare class ScallopQuery {
|
|
|
615
622
|
suppliedCoin: number;
|
|
616
623
|
suppliedValue: number;
|
|
617
624
|
stakedCoin: number;
|
|
618
|
-
coinName: "usdc" | "sbeth" | "sbusdt" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd";
|
|
625
|
+
coinName: "usdc" | "sbeth" | "sbusdt" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "blub";
|
|
619
626
|
symbol: string;
|
|
620
627
|
coinType: string;
|
|
621
628
|
coinPrice: number;
|
|
@@ -632,7 +639,7 @@ export declare class ScallopQuery {
|
|
|
632
639
|
availableCollateralInUsd: number;
|
|
633
640
|
totalUnhealthyCollateralInUsd: number;
|
|
634
641
|
borrowedPools: {
|
|
635
|
-
coinName: "usdc" | "sbeth" | "sbusdt" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd";
|
|
642
|
+
coinName: "usdc" | "sbeth" | "sbusdt" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "blub";
|
|
636
643
|
symbol: string;
|
|
637
644
|
coinDecimals: number;
|
|
638
645
|
coinType: string;
|
|
@@ -642,7 +649,7 @@ export declare class ScallopQuery {
|
|
|
642
649
|
borrowApr: number | undefined;
|
|
643
650
|
borrowApy: number | undefined;
|
|
644
651
|
incentiveInfos: {
|
|
645
|
-
coinName: "usdc" | "sbeth" | "sbusdt" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "susdc" | "ssbeth" | "ssbusdt" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep" | "sfdusd";
|
|
652
|
+
coinName: "usdc" | "sbeth" | "sbusdt" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "blub" | "susdc" | "ssbeth" | "ssbusdt" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep" | "sfdusd" | "sblub";
|
|
646
653
|
symbol: string;
|
|
647
654
|
coinType: string;
|
|
648
655
|
incentiveApr: number;
|
|
@@ -65,7 +65,7 @@ export declare class ScallopUtils {
|
|
|
65
65
|
* if no `scallop_...` is encountered, return coinName
|
|
66
66
|
* @return sCoin name
|
|
67
67
|
*/
|
|
68
|
-
parseSCoinTypeNameToMarketCoinName(coinName: string): "susdc" | "ssbeth" | "ssbusdt" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep" | "sfdusd";
|
|
68
|
+
parseSCoinTypeNameToMarketCoinName(coinName: string): "susdc" | "ssbeth" | "ssbusdt" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep" | "sfdusd" | "sblub";
|
|
69
69
|
/**
|
|
70
70
|
* Convert sCoin name into sCoin type
|
|
71
71
|
* @param sCoinName
|
|
@@ -77,7 +77,7 @@ export declare class ScallopUtils {
|
|
|
77
77
|
* @param sCoinType
|
|
78
78
|
* @returns sCoin name
|
|
79
79
|
*/
|
|
80
|
-
parseSCoinNameFromType(sCoinType: string): "susdc" | "ssbeth" | "ssbusdt" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep" | "sfdusd";
|
|
80
|
+
parseSCoinNameFromType(sCoinType: string): "susdc" | "ssbeth" | "ssbusdt" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep" | "sfdusd" | "sblub";
|
|
81
81
|
/**
|
|
82
82
|
* Convert sCoin name into its underlying coin type
|
|
83
83
|
* @param sCoinName
|
|
@@ -34,6 +34,7 @@ export declare const getBorrowIncentivePools: (query: ScallopQuery, borrowIncent
|
|
|
34
34
|
fud?: BorrowIncentivePool | undefined;
|
|
35
35
|
deep?: BorrowIncentivePool | undefined;
|
|
36
36
|
fdusd?: BorrowIncentivePool | undefined;
|
|
37
|
+
blub?: BorrowIncentivePool | undefined;
|
|
37
38
|
}>;
|
|
38
39
|
/**
|
|
39
40
|
* Query borrow incentive accounts data.
|
|
@@ -63,6 +64,7 @@ export declare const queryBorrowIncentiveAccounts: ({ utils, }: {
|
|
|
63
64
|
fud?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
|
|
64
65
|
deep?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
|
|
65
66
|
fdusd?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
|
|
67
|
+
blub?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
|
|
66
68
|
}>;
|
|
67
69
|
/**
|
|
68
70
|
* Check veSca bind status
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ScallopQuery } from 'src/models';
|
|
2
2
|
import { OptionalKeys } from 'src/types';
|
|
3
|
-
export declare const getAllAddresses: (query: ScallopQuery) => Promise<OptionalKeys<Record<"usdc" | "sbeth" | "sbusdt" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd", {
|
|
3
|
+
export declare const getAllAddresses: (query: ScallopQuery) => Promise<OptionalKeys<Record<"usdc" | "sbeth" | "sbusdt" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "blub", {
|
|
4
4
|
coinName: string;
|
|
5
5
|
symbol: string;
|
|
6
6
|
lendingPoolAddress?: string;
|
|
@@ -24,4 +24,6 @@ export declare const getAllAddresses: (query: ScallopQuery) => Promise<OptionalK
|
|
|
24
24
|
sCoinMetadataId?: string;
|
|
25
25
|
spoolName?: string;
|
|
26
26
|
decimals: number;
|
|
27
|
+
pythFeed?: string;
|
|
28
|
+
pythFeedObjectId?: string;
|
|
27
29
|
}>>>;
|
|
@@ -29,6 +29,7 @@ export declare const getLendings: (query: ScallopQuery, poolCoinNames?: SupportP
|
|
|
29
29
|
fud?: Lending | undefined;
|
|
30
30
|
deep?: Lending | undefined;
|
|
31
31
|
fdusd?: Lending | undefined;
|
|
32
|
+
blub?: Lending | undefined;
|
|
32
33
|
}>;
|
|
33
34
|
/**
|
|
34
35
|
* Get user lending infomation for specific pool.
|
|
@@ -88,7 +89,7 @@ export declare const getUserPortfolio: (query: ScallopQuery, walletAddress: stri
|
|
|
88
89
|
suppliedCoin: number;
|
|
89
90
|
suppliedValue: number;
|
|
90
91
|
stakedCoin: number;
|
|
91
|
-
coinName: "usdc" | "sbeth" | "sbusdt" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd";
|
|
92
|
+
coinName: "usdc" | "sbeth" | "sbusdt" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "blub";
|
|
92
93
|
symbol: string;
|
|
93
94
|
coinType: string;
|
|
94
95
|
coinPrice: number;
|
|
@@ -105,7 +106,7 @@ export declare const getUserPortfolio: (query: ScallopQuery, walletAddress: stri
|
|
|
105
106
|
availableCollateralInUsd: number;
|
|
106
107
|
totalUnhealthyCollateralInUsd: number;
|
|
107
108
|
borrowedPools: {
|
|
108
|
-
coinName: "usdc" | "sbeth" | "sbusdt" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd";
|
|
109
|
+
coinName: "usdc" | "sbeth" | "sbusdt" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "blub";
|
|
109
110
|
symbol: string;
|
|
110
111
|
coinDecimals: number;
|
|
111
112
|
coinType: string;
|
|
@@ -115,7 +116,7 @@ export declare const getUserPortfolio: (query: ScallopQuery, walletAddress: stri
|
|
|
115
116
|
borrowApr: number | undefined;
|
|
116
117
|
borrowApy: number | undefined;
|
|
117
118
|
incentiveInfos: {
|
|
118
|
-
coinName: "usdc" | "sbeth" | "sbusdt" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "susdc" | "ssbeth" | "ssbusdt" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep" | "sfdusd";
|
|
119
|
+
coinName: "usdc" | "sbeth" | "sbusdt" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "blub" | "susdc" | "ssbeth" | "ssbusdt" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep" | "sfdusd" | "sblub";
|
|
119
120
|
symbol: string;
|
|
120
121
|
coinType: string;
|
|
121
122
|
incentiveApr: number;
|
|
@@ -32,6 +32,7 @@ export declare const getAllCoinPrices: (query: ScallopQuery, marketPools?: Marke
|
|
|
32
32
|
sfud?: number | undefined;
|
|
33
33
|
sdeep?: number | undefined;
|
|
34
34
|
sfdusd?: number | undefined;
|
|
35
|
+
sblub?: number | undefined;
|
|
35
36
|
usdc?: number | undefined;
|
|
36
37
|
sbeth?: number | undefined;
|
|
37
38
|
sbusdt?: number | undefined;
|
|
@@ -50,5 +51,6 @@ export declare const getAllCoinPrices: (query: ScallopQuery, marketPools?: Marke
|
|
|
50
51
|
fud?: number | undefined;
|
|
51
52
|
deep?: number | undefined;
|
|
52
53
|
fdusd?: number | undefined;
|
|
54
|
+
blub?: number | undefined;
|
|
53
55
|
swapt?: number | undefined;
|
|
54
56
|
}>;
|
|
@@ -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<"susdc" | "ssbeth" | "ssbusdt" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep" | "sfdusd", number>>>;
|
|
22
|
+
}, sCoinNames?: SupportSCoin[], ownerAddress?: string) => Promise<OptionalKeys<Record<"susdc" | "ssbeth" | "ssbusdt" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep" | "sfdusd" | "sblub", number>>>;
|
|
23
23
|
/**
|
|
24
24
|
* Query owned sCoin amount.
|
|
25
25
|
*
|
|
@@ -105,10 +105,14 @@ export type ObligationBorrowIncentive = {
|
|
|
105
105
|
rewards: ObligationBorrowIcentiveReward[];
|
|
106
106
|
};
|
|
107
107
|
export type TotalValueLocked = {
|
|
108
|
+
supplyLendingValue: number;
|
|
109
|
+
supplyCollateralValue: number;
|
|
108
110
|
supplyValue: number;
|
|
109
111
|
borrowValue: number;
|
|
110
112
|
totalValue: number;
|
|
111
113
|
supplyValueChangeRatio?: number;
|
|
114
|
+
supplyLendingValueChangeRatio?: number;
|
|
115
|
+
supplyCollateralValueChangeRatio?: number;
|
|
112
116
|
borrowValueChangeRatio?: number;
|
|
113
117
|
totalValueChangeRatio?: number;
|
|
114
118
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Transaction } from '@mysten/sui/transactions';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import {
|
|
3
|
+
SuiTxBlock as SuiKitTxBlock,
|
|
4
|
+
SUI_CLOCK_OBJECT_ID,
|
|
5
|
+
} from '@scallop-io/sui-kit';
|
|
4
6
|
import { getObligations, getObligationLocked } from '../queries';
|
|
5
7
|
import { requireSender } from '../utils';
|
|
6
8
|
import type { SuiObjectArg } from '@scallop-io/sui-kit';
|
|
@@ -108,7 +110,11 @@ const generateBorrowIncentiveNormalMethod: GenerateBorrowIncentiveNormalMethod =
|
|
|
108
110
|
obligationKey,
|
|
109
111
|
obligationId,
|
|
110
112
|
borrowIncentiveIds.obligationAccessStore,
|
|
111
|
-
|
|
113
|
+
txBlock.sharedObjectRef({
|
|
114
|
+
objectId: SUI_CLOCK_OBJECT_ID,
|
|
115
|
+
mutable: false,
|
|
116
|
+
initialSharedVersion: '1',
|
|
117
|
+
}),
|
|
112
118
|
]
|
|
113
119
|
);
|
|
114
120
|
},
|
|
@@ -127,7 +133,11 @@ const generateBorrowIncentiveNormalMethod: GenerateBorrowIncentiveNormalMethod =
|
|
|
127
133
|
veScaIds.treasury,
|
|
128
134
|
veScaIds.table,
|
|
129
135
|
veScaKey,
|
|
130
|
-
|
|
136
|
+
txBlock.sharedObjectRef({
|
|
137
|
+
objectId: SUI_CLOCK_OBJECT_ID,
|
|
138
|
+
mutable: false,
|
|
139
|
+
initialSharedVersion: '1',
|
|
140
|
+
}),
|
|
131
141
|
],
|
|
132
142
|
[]
|
|
133
143
|
);
|
|
@@ -142,7 +152,11 @@ const generateBorrowIncentiveNormalMethod: GenerateBorrowIncentiveNormalMethod =
|
|
|
142
152
|
borrowIncentiveIds.incentiveAccounts,
|
|
143
153
|
obligationKey,
|
|
144
154
|
obligationId,
|
|
145
|
-
|
|
155
|
+
txBlock.sharedObjectRef({
|
|
156
|
+
objectId: SUI_CLOCK_OBJECT_ID,
|
|
157
|
+
mutable: false,
|
|
158
|
+
initialSharedVersion: '1',
|
|
159
|
+
}),
|
|
146
160
|
]
|
|
147
161
|
);
|
|
148
162
|
},
|
|
@@ -157,7 +171,11 @@ const generateBorrowIncentiveNormalMethod: GenerateBorrowIncentiveNormalMethod =
|
|
|
157
171
|
borrowIncentiveIds.incentiveAccounts,
|
|
158
172
|
obligationKey,
|
|
159
173
|
obligationId,
|
|
160
|
-
|
|
174
|
+
txBlock.sharedObjectRef({
|
|
175
|
+
objectId: SUI_CLOCK_OBJECT_ID,
|
|
176
|
+
mutable: false,
|
|
177
|
+
initialSharedVersion: '1',
|
|
178
|
+
}),
|
|
161
179
|
],
|
|
162
180
|
[rewardType]
|
|
163
181
|
);
|
|
@@ -172,7 +190,11 @@ const generateBorrowIncentiveNormalMethod: GenerateBorrowIncentiveNormalMethod =
|
|
|
172
190
|
borrowIncentiveIds.incentiveAccounts,
|
|
173
191
|
obligation,
|
|
174
192
|
veScaKey,
|
|
175
|
-
|
|
193
|
+
txBlock.sharedObjectRef({
|
|
194
|
+
objectId: SUI_CLOCK_OBJECT_ID,
|
|
195
|
+
mutable: false,
|
|
196
|
+
initialSharedVersion: '1',
|
|
197
|
+
}),
|
|
176
198
|
]
|
|
177
199
|
);
|
|
178
200
|
},
|
|
@@ -126,7 +126,11 @@ const generateCoreNormalMethod: GenerateCoreNormalMethod = ({
|
|
|
126
126
|
coreIds.coinDecimalsRegistry,
|
|
127
127
|
txBlock.pure.u64(amount),
|
|
128
128
|
coreIds.xOracle,
|
|
129
|
-
|
|
129
|
+
txBlock.sharedObjectRef({
|
|
130
|
+
objectId: SUI_CLOCK_OBJECT_ID,
|
|
131
|
+
mutable: false,
|
|
132
|
+
initialSharedVersion: '1',
|
|
133
|
+
}),
|
|
130
134
|
],
|
|
131
135
|
[coinType]
|
|
132
136
|
);
|
|
@@ -137,7 +141,16 @@ const generateCoreNormalMethod: GenerateCoreNormalMethod = ({
|
|
|
137
141
|
return builder.moveCall(
|
|
138
142
|
txBlock,
|
|
139
143
|
`${coreIds.protocolPkg}::mint::mint`,
|
|
140
|
-
[
|
|
144
|
+
[
|
|
145
|
+
coreIds.version,
|
|
146
|
+
coreIds.market,
|
|
147
|
+
coin,
|
|
148
|
+
txBlock.sharedObjectRef({
|
|
149
|
+
objectId: SUI_CLOCK_OBJECT_ID,
|
|
150
|
+
mutable: false,
|
|
151
|
+
initialSharedVersion: '1',
|
|
152
|
+
}),
|
|
153
|
+
],
|
|
141
154
|
[coinType]
|
|
142
155
|
);
|
|
143
156
|
},
|
|
@@ -147,7 +160,16 @@ const generateCoreNormalMethod: GenerateCoreNormalMethod = ({
|
|
|
147
160
|
return builder.moveCall(
|
|
148
161
|
txBlock,
|
|
149
162
|
`${coreIds.protocolPkg}::mint::mint_entry`,
|
|
150
|
-
[
|
|
163
|
+
[
|
|
164
|
+
coreIds.version,
|
|
165
|
+
coreIds.market,
|
|
166
|
+
coin,
|
|
167
|
+
txBlock.sharedObjectRef({
|
|
168
|
+
objectId: SUI_CLOCK_OBJECT_ID,
|
|
169
|
+
mutable: false,
|
|
170
|
+
initialSharedVersion: '1',
|
|
171
|
+
}),
|
|
172
|
+
],
|
|
151
173
|
[coinType]
|
|
152
174
|
);
|
|
153
175
|
},
|
|
@@ -157,7 +179,16 @@ const generateCoreNormalMethod: GenerateCoreNormalMethod = ({
|
|
|
157
179
|
return builder.moveCall(
|
|
158
180
|
txBlock,
|
|
159
181
|
`${coreIds.protocolPkg}::redeem::redeem`,
|
|
160
|
-
[
|
|
182
|
+
[
|
|
183
|
+
coreIds.version,
|
|
184
|
+
coreIds.market,
|
|
185
|
+
marketCoin,
|
|
186
|
+
txBlock.sharedObjectRef({
|
|
187
|
+
objectId: SUI_CLOCK_OBJECT_ID,
|
|
188
|
+
mutable: false,
|
|
189
|
+
initialSharedVersion: '1',
|
|
190
|
+
}),
|
|
191
|
+
],
|
|
161
192
|
[coinType]
|
|
162
193
|
);
|
|
163
194
|
},
|
|
@@ -167,7 +198,16 @@ const generateCoreNormalMethod: GenerateCoreNormalMethod = ({
|
|
|
167
198
|
return builder.moveCall(
|
|
168
199
|
txBlock,
|
|
169
200
|
`${coreIds.protocolPkg}::redeem::redeem_entry`,
|
|
170
|
-
[
|
|
201
|
+
[
|
|
202
|
+
coreIds.version,
|
|
203
|
+
coreIds.market,
|
|
204
|
+
marketCoin,
|
|
205
|
+
txBlock.sharedObjectRef({
|
|
206
|
+
objectId: SUI_CLOCK_OBJECT_ID,
|
|
207
|
+
mutable: false,
|
|
208
|
+
initialSharedVersion: '1',
|
|
209
|
+
}),
|
|
210
|
+
],
|
|
171
211
|
[coinType]
|
|
172
212
|
);
|
|
173
213
|
},
|
|
@@ -185,7 +225,11 @@ const generateCoreNormalMethod: GenerateCoreNormalMethod = ({
|
|
|
185
225
|
coreIds.coinDecimalsRegistry,
|
|
186
226
|
amount,
|
|
187
227
|
coreIds.xOracle,
|
|
188
|
-
|
|
228
|
+
txBlock.sharedObjectRef({
|
|
229
|
+
objectId: SUI_CLOCK_OBJECT_ID,
|
|
230
|
+
mutable: false,
|
|
231
|
+
initialSharedVersion: '1',
|
|
232
|
+
}),
|
|
189
233
|
],
|
|
190
234
|
[coinType]
|
|
191
235
|
);
|
|
@@ -211,7 +255,11 @@ const generateCoreNormalMethod: GenerateCoreNormalMethod = ({
|
|
|
211
255
|
borrowReferral,
|
|
212
256
|
typeof amount === 'number' ? txBlock.pure.u64(amount) : amount,
|
|
213
257
|
coreIds.xOracle,
|
|
214
|
-
|
|
258
|
+
txBlock.sharedObjectRef({
|
|
259
|
+
objectId: SUI_CLOCK_OBJECT_ID,
|
|
260
|
+
mutable: false,
|
|
261
|
+
initialSharedVersion: '1',
|
|
262
|
+
}),
|
|
215
263
|
],
|
|
216
264
|
[coinType, referralWitnessType]
|
|
217
265
|
);
|
|
@@ -230,7 +278,11 @@ const generateCoreNormalMethod: GenerateCoreNormalMethod = ({
|
|
|
230
278
|
coreIds.coinDecimalsRegistry,
|
|
231
279
|
txBlock.pure.u64(amount),
|
|
232
280
|
coreIds.xOracle,
|
|
233
|
-
|
|
281
|
+
txBlock.sharedObjectRef({
|
|
282
|
+
objectId: SUI_CLOCK_OBJECT_ID,
|
|
283
|
+
mutable: false,
|
|
284
|
+
initialSharedVersion: '1',
|
|
285
|
+
}),
|
|
234
286
|
],
|
|
235
287
|
[coinType]
|
|
236
288
|
);
|
|
@@ -245,7 +297,11 @@ const generateCoreNormalMethod: GenerateCoreNormalMethod = ({
|
|
|
245
297
|
obligation,
|
|
246
298
|
coreIds.market,
|
|
247
299
|
coin,
|
|
248
|
-
|
|
300
|
+
txBlock.sharedObjectRef({
|
|
301
|
+
objectId: SUI_CLOCK_OBJECT_ID,
|
|
302
|
+
mutable: false,
|
|
303
|
+
initialSharedVersion: '1',
|
|
304
|
+
}),
|
|
249
305
|
],
|
|
250
306
|
[coinType]
|
|
251
307
|
);
|
|
@@ -449,7 +505,7 @@ const generateCoreQuickMethod: GenerateCoreQuickMethod = ({
|
|
|
449
505
|
)) ?? [];
|
|
450
506
|
const updateCoinNames = [...obligationCoinNames, poolCoinName];
|
|
451
507
|
await updateOracles(builder, txBlock, updateCoinNames);
|
|
452
|
-
return
|
|
508
|
+
return txBlock.borrowWithReferral(
|
|
453
509
|
obligationInfo.obligationId,
|
|
454
510
|
obligationInfo.obligationKey as SuiObjectArg,
|
|
455
511
|
borrowReferral,
|
package/src/builders/oracle.ts
CHANGED
|
@@ -231,7 +231,19 @@ const confirmPriceUpdateRequest = (
|
|
|
231
231
|
) => {
|
|
232
232
|
const target = `${packageId}::x_oracle::confirm_price_update_request`;
|
|
233
233
|
const typeArgs = [coinType];
|
|
234
|
-
txBlock.moveCall(
|
|
234
|
+
txBlock.moveCall(
|
|
235
|
+
target,
|
|
236
|
+
[
|
|
237
|
+
xOracleId,
|
|
238
|
+
request,
|
|
239
|
+
txBlock.sharedObjectRef({
|
|
240
|
+
objectId: SUI_CLOCK_OBJECT_ID,
|
|
241
|
+
mutable: false,
|
|
242
|
+
initialSharedVersion: '1',
|
|
243
|
+
}),
|
|
244
|
+
],
|
|
245
|
+
typeArgs
|
|
246
|
+
);
|
|
235
247
|
return txBlock;
|
|
236
248
|
};
|
|
237
249
|
|
|
@@ -257,7 +269,16 @@ const updateSupraPrice = (
|
|
|
257
269
|
) => {
|
|
258
270
|
txBlock.moveCall(
|
|
259
271
|
`${packageId}::rule::set_price`,
|
|
260
|
-
[
|
|
272
|
+
[
|
|
273
|
+
request,
|
|
274
|
+
holderId,
|
|
275
|
+
registryId,
|
|
276
|
+
txBlock.sharedObjectRef({
|
|
277
|
+
objectId: SUI_CLOCK_OBJECT_ID,
|
|
278
|
+
mutable: false,
|
|
279
|
+
initialSharedVersion: '1',
|
|
280
|
+
}),
|
|
281
|
+
],
|
|
261
282
|
[coinType]
|
|
262
283
|
);
|
|
263
284
|
};
|
|
@@ -284,7 +305,16 @@ const updateSwitchboardPrice = (
|
|
|
284
305
|
) => {
|
|
285
306
|
txBlock.moveCall(
|
|
286
307
|
`${packageId}::rule::set_price`,
|
|
287
|
-
[
|
|
308
|
+
[
|
|
309
|
+
request,
|
|
310
|
+
aggregatorId,
|
|
311
|
+
registryId,
|
|
312
|
+
txBlock.sharedObjectRef({
|
|
313
|
+
objectId: SUI_CLOCK_OBJECT_ID,
|
|
314
|
+
mutable: false,
|
|
315
|
+
initialSharedVersion: '1',
|
|
316
|
+
}),
|
|
317
|
+
],
|
|
288
318
|
[coinType]
|
|
289
319
|
);
|
|
290
320
|
};
|
|
@@ -315,7 +345,17 @@ const updatePythPrice = (
|
|
|
315
345
|
) => {
|
|
316
346
|
txBlock.moveCall(
|
|
317
347
|
`${packageId}::rule::set_price`,
|
|
318
|
-
[
|
|
348
|
+
[
|
|
349
|
+
request,
|
|
350
|
+
stateId,
|
|
351
|
+
feedObjectId,
|
|
352
|
+
registryId,
|
|
353
|
+
txBlock.sharedObjectRef({
|
|
354
|
+
objectId: SUI_CLOCK_OBJECT_ID,
|
|
355
|
+
mutable: false,
|
|
356
|
+
initialSharedVersion: '1',
|
|
357
|
+
}),
|
|
358
|
+
],
|
|
319
359
|
[coinType]
|
|
320
360
|
);
|
|
321
361
|
};
|
|
@@ -42,7 +42,11 @@ const generateReferralNormalMethod: GenerateReferralNormalMethod = ({
|
|
|
42
42
|
referralIds.referralBindings,
|
|
43
43
|
txBlock.pure.id(veScaKeyId),
|
|
44
44
|
veScaTable,
|
|
45
|
-
|
|
45
|
+
txBlock.sharedObjectRef({
|
|
46
|
+
objectId: SUI_CLOCK_OBJECT_ID,
|
|
47
|
+
mutable: false,
|
|
48
|
+
initialSharedVersion: '1',
|
|
49
|
+
}),
|
|
46
50
|
],
|
|
47
51
|
[]
|
|
48
52
|
);
|
|
@@ -58,7 +62,11 @@ const generateReferralNormalMethod: GenerateReferralNormalMethod = ({
|
|
|
58
62
|
referralIds.referralBindings,
|
|
59
63
|
referralIds.authorizedWitnessList,
|
|
60
64
|
referralIds.referralTiers,
|
|
61
|
-
|
|
65
|
+
txBlock.sharedObjectRef({
|
|
66
|
+
objectId: SUI_CLOCK_OBJECT_ID,
|
|
67
|
+
mutable: false,
|
|
68
|
+
initialSharedVersion: '1',
|
|
69
|
+
}),
|
|
62
70
|
],
|
|
63
71
|
[coinType]
|
|
64
72
|
);
|
|
@@ -72,7 +80,11 @@ const generateReferralNormalMethod: GenerateReferralNormalMethod = ({
|
|
|
72
80
|
referralIds.version,
|
|
73
81
|
ticket,
|
|
74
82
|
referralIds.referralRevenuePool,
|
|
75
|
-
|
|
83
|
+
txBlock.sharedObjectRef({
|
|
84
|
+
objectId: SUI_CLOCK_OBJECT_ID,
|
|
85
|
+
mutable: false,
|
|
86
|
+
initialSharedVersion: '1',
|
|
87
|
+
}),
|
|
76
88
|
],
|
|
77
89
|
[coinType]
|
|
78
90
|
);
|
|
@@ -89,7 +101,11 @@ const generateReferralNormalMethod: GenerateReferralNormalMethod = ({
|
|
|
89
101
|
referralIds.version,
|
|
90
102
|
referralIds.referralRevenuePool,
|
|
91
103
|
veScaKey,
|
|
92
|
-
|
|
104
|
+
txBlock.sharedObjectRef({
|
|
105
|
+
objectId: SUI_CLOCK_OBJECT_ID,
|
|
106
|
+
mutable: false,
|
|
107
|
+
initialSharedVersion: '1',
|
|
108
|
+
}),
|
|
93
109
|
],
|
|
94
110
|
[coinType]
|
|
95
111
|
);
|
|
@@ -136,7 +136,14 @@ const generateSpoolNormalMethod: GenerateSpoolNormalMethod = ({
|
|
|
136
136
|
return builder.moveCall(
|
|
137
137
|
txBlock,
|
|
138
138
|
`${spoolIds.spoolPkg}::user::new_spool_account`,
|
|
139
|
-
[
|
|
139
|
+
[
|
|
140
|
+
stakePoolId,
|
|
141
|
+
txBlock.sharedObjectRef({
|
|
142
|
+
objectId: SUI_CLOCK_OBJECT_ID,
|
|
143
|
+
mutable: false,
|
|
144
|
+
initialSharedVersion: '1',
|
|
145
|
+
}),
|
|
146
|
+
],
|
|
140
147
|
[marketCoinType]
|
|
141
148
|
);
|
|
142
149
|
},
|
|
@@ -149,7 +156,16 @@ const generateSpoolNormalMethod: GenerateSpoolNormalMethod = ({
|
|
|
149
156
|
builder.moveCall(
|
|
150
157
|
txBlock,
|
|
151
158
|
`${spoolIds.spoolPkg}::user::stake`,
|
|
152
|
-
[
|
|
159
|
+
[
|
|
160
|
+
stakePoolId,
|
|
161
|
+
stakeAccount,
|
|
162
|
+
coin,
|
|
163
|
+
txBlock.sharedObjectRef({
|
|
164
|
+
objectId: SUI_CLOCK_OBJECT_ID,
|
|
165
|
+
mutable: false,
|
|
166
|
+
initialSharedVersion: '1',
|
|
167
|
+
}),
|
|
168
|
+
],
|
|
153
169
|
[marketCoinType]
|
|
154
170
|
);
|
|
155
171
|
},
|
|
@@ -162,7 +178,16 @@ const generateSpoolNormalMethod: GenerateSpoolNormalMethod = ({
|
|
|
162
178
|
return builder.moveCall(
|
|
163
179
|
txBlock,
|
|
164
180
|
`${spoolIds.spoolPkg}::user::unstake`,
|
|
165
|
-
[
|
|
181
|
+
[
|
|
182
|
+
stakePoolId,
|
|
183
|
+
stakeAccount,
|
|
184
|
+
amount,
|
|
185
|
+
txBlock.sharedObjectRef({
|
|
186
|
+
objectId: SUI_CLOCK_OBJECT_ID,
|
|
187
|
+
mutable: false,
|
|
188
|
+
initialSharedVersion: '1',
|
|
189
|
+
}),
|
|
190
|
+
],
|
|
166
191
|
[marketCoinType]
|
|
167
192
|
);
|
|
168
193
|
},
|
|
@@ -180,7 +205,16 @@ const generateSpoolNormalMethod: GenerateSpoolNormalMethod = ({
|
|
|
180
205
|
return builder.moveCall(
|
|
181
206
|
txBlock,
|
|
182
207
|
`${spoolIds.spoolPkg}::user::redeem_rewards`,
|
|
183
|
-
[
|
|
208
|
+
[
|
|
209
|
+
stakePoolId,
|
|
210
|
+
rewardPoolId,
|
|
211
|
+
stakeAccount,
|
|
212
|
+
txBlock.sharedObjectRef({
|
|
213
|
+
objectId: SUI_CLOCK_OBJECT_ID,
|
|
214
|
+
mutable: false,
|
|
215
|
+
initialSharedVersion: '1',
|
|
216
|
+
}),
|
|
217
|
+
],
|
|
184
218
|
[marketCoinType, rewardCoinType]
|
|
185
219
|
);
|
|
186
220
|
},
|