@scallop-io/sui-scallop-sdk 2.0.0-alpha.9 → 2.0.0
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/README.md +28 -5
- package/dist/index.d.mts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +3 -3
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
- package/src/constants/testAddress.ts +9 -5
- package/src/models/scallopConstants.ts +14 -3
- package/src/models/scallopUtils.ts +3 -1
- package/src/queries/portfolioQuery.ts +3 -2
- package/src/types/constant/common.ts +1 -0
- package/src/types/query/portfolio.ts +3 -2
package/package.json
CHANGED
|
@@ -122,12 +122,16 @@ export const TEST_ADDRESSES: AddressesInterface = {
|
|
|
122
122
|
'0x1edeae568fde99e090dbdec4bcdbd33a15f53a1ce1f87aeef1a560dedf4b4a90',
|
|
123
123
|
primaryPriceUpdatePolicyObject:
|
|
124
124
|
'0xbcd908d0ee6d63d726e61676f3feeec3d19817f4849bbecf372dd3399f247f6b',
|
|
125
|
+
// '0x56e48a141f20a3a6a6d3fc43e58b01fc63f756c08224870e7890c80ec9d2afee' // prod
|
|
125
126
|
secondaryPriceUpdatePolicyObject:
|
|
126
127
|
'0x624a6f120777bb30e718b86e836c205ef4229448052377dc3d78272a6662b2c0',
|
|
128
|
+
// '0xef4d9430ae42c1b24199ac55e87ddd7262622447ee3c7de8868efe839b3d8705' // prod
|
|
127
129
|
primaryPriceUpdatePolicyVecsetId:
|
|
128
130
|
'0xfb1330aa028ed6a159b742c71b5a79b3b6824cf71efa40ea82b52486ad209264',
|
|
131
|
+
// '0xc22c9d691ee4c780de09db91d8b487d863211ebf08720772144bcf716318826c', // prod
|
|
129
132
|
secondaryPriceUpdatePolicyVecsetId:
|
|
130
133
|
'0x4b827acc73f3f53f808dd73a7ee0a60ae61e84322176bece72b26467030b467c',
|
|
134
|
+
// '0x3b184ff859f5de30eeaf186898e5224925be6bb6d2baa74347ef471a8cd1c0d3' // prod
|
|
131
135
|
supra: {
|
|
132
136
|
registry: '',
|
|
133
137
|
registryCap: '',
|
|
@@ -304,7 +308,7 @@ export const TEST_ADDRESSES: AddressesInterface = {
|
|
|
304
308
|
coinType:
|
|
305
309
|
'0x88618204de2dfdc2597681a8441ee726b0dc13494c41e319c3264eb7b35fea90::scallop_sui::SCALLOP_SUI',
|
|
306
310
|
metaData: '',
|
|
307
|
-
symbol: '',
|
|
311
|
+
symbol: 'sSUI',
|
|
308
312
|
treasury:
|
|
309
313
|
'0x03f1d94a40bd9f5d556bacb5c5245732b185572f6a29b36ad8b555d9a8a24f09',
|
|
310
314
|
},
|
|
@@ -312,7 +316,7 @@ export const TEST_ADDRESSES: AddressesInterface = {
|
|
|
312
316
|
coinType:
|
|
313
317
|
'0x9f64a180373a6b66595025ae16a4ab701f0af1dd5c7ce1ac91dc112e52c2a3f8::scallop_sca::SCALLOP_SCA',
|
|
314
318
|
metaData: '',
|
|
315
|
-
symbol: '',
|
|
319
|
+
symbol: 'sSCA',
|
|
316
320
|
treasury:
|
|
317
321
|
'0x1b05d2cd8b20dba19da073a54195fc52d2f438ea19dea0713bae7a7dab308199',
|
|
318
322
|
},
|
|
@@ -321,7 +325,7 @@ export const TEST_ADDRESSES: AddressesInterface = {
|
|
|
321
325
|
'0x55ed015f9f006c0c96ad36ebe3b3570d088e8498f52defea48e5634c110e485c::scallop_usdc::SCALLOP_USDC',
|
|
322
326
|
treasury:
|
|
323
327
|
'0x6ef82ef94472dcb8c2cdeac8df38874024c08570ca165986ba56d1e38fe0c0a3',
|
|
324
|
-
symbol: '',
|
|
328
|
+
symbol: 'sUSDC',
|
|
325
329
|
metaData:
|
|
326
330
|
'0x763a21eba338e00bc684aaad80491c89eea5f247b59c47df45b17610c9ad58f2',
|
|
327
331
|
},
|
|
@@ -329,7 +333,7 @@ export const TEST_ADDRESSES: AddressesInterface = {
|
|
|
329
333
|
coinType:
|
|
330
334
|
'0x34f0a2e793e1f79ceac72cfe3bb95f65541da449418289ccd12922d16140c882::scallop_deep::SCALLOP_DEEP',
|
|
331
335
|
metaData: '',
|
|
332
|
-
symbol: '',
|
|
336
|
+
symbol: 'sDEEP',
|
|
333
337
|
treasury:
|
|
334
338
|
'0x71d41465cf2d16fa0206126526bebdf65c8871d1fcfbd0c2237db2306afd67ba',
|
|
335
339
|
},
|
|
@@ -337,7 +341,7 @@ export const TEST_ADDRESSES: AddressesInterface = {
|
|
|
337
341
|
coinType:
|
|
338
342
|
'0x3b23c05f917052255a0b16a534dbd4446911aa4a30bd3497cdf5b736551e7ef8::scallop_fud::SCALLOP_FUD',
|
|
339
343
|
metaData: '',
|
|
340
|
-
symbol: '',
|
|
344
|
+
symbol: 'sFUD',
|
|
341
345
|
treasury:
|
|
342
346
|
'0x858c492d51425b922c040c1a389e185b3b00d565e7d72ead1a81dc733104660d',
|
|
343
347
|
},
|
|
@@ -36,6 +36,7 @@ export class ScallopConstants {
|
|
|
36
36
|
scoin: new Set(),
|
|
37
37
|
spool: new Set(),
|
|
38
38
|
borrowIncentiveRewards: new Set(),
|
|
39
|
+
rewardsAsPoint: new Set(),
|
|
39
40
|
suiBridge: new Set(),
|
|
40
41
|
wormhole: new Set(),
|
|
41
42
|
oracles: new Set(),
|
|
@@ -98,10 +99,20 @@ export class ScallopConstants {
|
|
|
98
99
|
}
|
|
99
100
|
|
|
100
101
|
get isInitialized() {
|
|
102
|
+
const REQUIRED_WHITELIST_KEYS = [
|
|
103
|
+
'lending',
|
|
104
|
+
'collateral',
|
|
105
|
+
'borrowing',
|
|
106
|
+
'packages',
|
|
107
|
+
'scoin',
|
|
108
|
+
'spool',
|
|
109
|
+
'oracles',
|
|
110
|
+
'pythEndpoints',
|
|
111
|
+
] as const;
|
|
101
112
|
return (
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
this.
|
|
113
|
+
this.isAddressInitialized && // address is initialized
|
|
114
|
+
!this.isEmptyObject(this._poolAddresses) && // poolAddresses is initialized
|
|
115
|
+
REQUIRED_WHITELIST_KEYS.every((t) => this.whitelist[t].size > 0) // whitelist is initialized
|
|
105
116
|
);
|
|
106
117
|
}
|
|
107
118
|
|
|
@@ -554,7 +554,9 @@ export class ScallopUtils {
|
|
|
554
554
|
public getSupportedPoolAddresses(): PoolAddress[] {
|
|
555
555
|
return this.constants.poolAddresses
|
|
556
556
|
? Object.values(this.constants.poolAddresses).filter(
|
|
557
|
-
(
|
|
557
|
+
(poolAddress): poolAddress is PoolAddress =>
|
|
558
|
+
poolAddress !== undefined &&
|
|
559
|
+
this.constants.whitelist.lending.has(poolAddress.coinName)
|
|
558
560
|
)
|
|
559
561
|
: [];
|
|
560
562
|
}
|
|
@@ -13,7 +13,7 @@ import type {
|
|
|
13
13
|
CoinAmounts,
|
|
14
14
|
CoinPrices,
|
|
15
15
|
TotalValueLocked,
|
|
16
|
-
|
|
16
|
+
ObligationBorrowIncentiveReward,
|
|
17
17
|
MarketPools,
|
|
18
18
|
MarketCollaterals,
|
|
19
19
|
} from '../types';
|
|
@@ -534,7 +534,7 @@ export const getObligationAccount = async (
|
|
|
534
534
|
const coinName = poolCoinName as string;
|
|
535
535
|
const borrowIncentivePool = borrowIncentivePools[coinName];
|
|
536
536
|
if (borrowIncentivePool) {
|
|
537
|
-
const rewards:
|
|
537
|
+
const rewards: ObligationBorrowIncentiveReward[] = [];
|
|
538
538
|
Object.entries(borrowIncentiveAccount.pointList).forEach(
|
|
539
539
|
([key, accountPoint]) => {
|
|
540
540
|
const poolPoint =
|
|
@@ -590,6 +590,7 @@ export const getObligationAccount = async (
|
|
|
590
590
|
symbol: poolPoint.symbol,
|
|
591
591
|
coinDecimal: poolPoint.coinDecimal,
|
|
592
592
|
coinPrice: poolPoint.coinPrice,
|
|
593
|
+
weightedBorrowAmount: accountBorrowedAmount.toNumber(),
|
|
593
594
|
availableClaimAmount: availableClaimAmount.toNumber(),
|
|
594
595
|
availableClaimCoin: availableClaimCoin.toNumber(),
|
|
595
596
|
boostValue,
|
|
@@ -108,12 +108,13 @@ export type ObligationDebt = {
|
|
|
108
108
|
availableRepayCoin: number;
|
|
109
109
|
};
|
|
110
110
|
|
|
111
|
-
export type
|
|
111
|
+
export type ObligationBorrowIncentiveReward = {
|
|
112
112
|
coinName: string;
|
|
113
113
|
coinType: string;
|
|
114
114
|
symbol: string;
|
|
115
115
|
coinDecimal: number;
|
|
116
116
|
coinPrice: number;
|
|
117
|
+
weightedBorrowAmount: number;
|
|
117
118
|
availableClaimCoin: number;
|
|
118
119
|
availableClaimAmount: number;
|
|
119
120
|
boostValue: number;
|
|
@@ -125,7 +126,7 @@ export type ObligationBorrowIncentive = {
|
|
|
125
126
|
symbol: string;
|
|
126
127
|
coinDecimal: number;
|
|
127
128
|
coinPrice: number;
|
|
128
|
-
rewards:
|
|
129
|
+
rewards: ObligationBorrowIncentiveReward[];
|
|
129
130
|
};
|
|
130
131
|
|
|
131
132
|
export type TotalValueLocked = {
|