@scallop-io/sui-scallop-sdk 2.0.0-alpha.1 → 2.0.0-alpha.10
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 +71 -11
- package/dist/index.d.ts +71 -11
- package/dist/index.js +16 -16
- package/dist/index.mjs +4 -4
- package/package.json +1 -1
- package/src/builders/coreBuilder.ts +33 -33
- package/src/builders/{oracle.ts → oracles/index.ts} +47 -45
- package/src/builders/oracles/pyth.ts +44 -0
- package/src/builders/oracles/switchboard.ts +270 -0
- package/src/constants/testAddress.ts +36 -487
- package/src/models/scallopAddress.ts +10 -1
- package/src/models/scallopBuilder.ts +4 -6
- package/src/models/scallopCache.ts +2 -2
- package/src/models/scallopClient.ts +8 -11
- package/src/models/scallopConstants.ts +94 -36
- package/src/models/scallopQuery.ts +18 -16
- package/src/models/scallopUtils.ts +14 -8
- package/src/queries/borrowIncentiveQuery.ts +4 -2
- package/src/queries/coreQuery.ts +4 -2
- package/src/queries/index.ts +1 -0
- package/src/queries/poolAddressesQuery.ts +31 -12
- package/src/queries/portfolioQuery.ts +4 -12
- package/src/queries/switchboardQuery.ts +64 -0
- package/src/queries/xOracleQuery.ts +29 -21
- package/src/types/address.ts +11 -3
- package/src/types/constant/common.ts +1 -0
- package/src/types/constant/xOracle.ts +5 -2
- package/src/types/model.ts +2 -0
- package/src/types/query/portfolio.ts +1 -0
- package/src/utils/query.ts +3 -4
- package/src/models/scallopPrice.ts +0 -0
package/dist/index.d.mts
CHANGED
|
@@ -328,7 +328,6 @@ declare class ScallopConstants {
|
|
|
328
328
|
private _poolAddresses;
|
|
329
329
|
private _whitelist;
|
|
330
330
|
private _coinDecimals;
|
|
331
|
-
private _coinNameToCoinTypeMap;
|
|
332
331
|
private _coinNameToOldMarketCoinTypeMap;
|
|
333
332
|
private _scoinRawNameToSCoinNameMap;
|
|
334
333
|
private _scoinTypeToSCoinNameMap;
|
|
@@ -338,6 +337,7 @@ declare class ScallopConstants {
|
|
|
338
337
|
private _coinTypes;
|
|
339
338
|
private _sCoinTypes;
|
|
340
339
|
private _coinTypeToCoinNameMap;
|
|
340
|
+
private _supportedBorrowIncentiveRewards;
|
|
341
341
|
constructor(params: ScallopConstantsParams, instance?: ScallopConstantsInstanceParams);
|
|
342
342
|
get isAddressInitialized(): boolean;
|
|
343
343
|
get isInitialized(): boolean;
|
|
@@ -346,17 +346,61 @@ declare class ScallopConstants {
|
|
|
346
346
|
get whitelist(): Whitelist;
|
|
347
347
|
parseToOldMarketCoin(coinType: string): string;
|
|
348
348
|
get protocolObjectId(): string;
|
|
349
|
+
/**
|
|
350
|
+
* @description
|
|
351
|
+
* Return maps of coin names to coin decimals.
|
|
352
|
+
*/
|
|
349
353
|
get coinDecimals(): Record<string, number | undefined>;
|
|
354
|
+
/**
|
|
355
|
+
* @description
|
|
356
|
+
* Return maps of coin names to coin types.
|
|
357
|
+
*/
|
|
350
358
|
get coinTypes(): Record<string, string | undefined>;
|
|
351
|
-
|
|
352
|
-
|
|
359
|
+
/**
|
|
360
|
+
* @description
|
|
361
|
+
* Return maps of coin types to its coin name
|
|
362
|
+
*/
|
|
353
363
|
get coinTypeToCoinNameMap(): Record<string, string | undefined>;
|
|
364
|
+
/**
|
|
365
|
+
* @description
|
|
366
|
+
* Return maps of wormhole coin types to its coin name.
|
|
367
|
+
*/
|
|
368
|
+
get wormholeCoinTypeToCoinName(): Record<string, string | undefined>;
|
|
369
|
+
/**
|
|
370
|
+
* @description
|
|
371
|
+
* Return maps of coin name to its old market coin type (...::reserve::MarketCoin<coinType>)
|
|
372
|
+
*/
|
|
354
373
|
get coinNameToOldMarketCoinTypeMap(): Record<string, string | undefined>;
|
|
374
|
+
/**
|
|
375
|
+
* @description
|
|
376
|
+
* Return maps of sCoin raw name from its type to its sCoin name. (e.g. 'scallop_sui' -> 'ssui')
|
|
377
|
+
*/
|
|
355
378
|
get sCoinRawNameToScoinNameMap(): Record<string, string | undefined>;
|
|
379
|
+
/**
|
|
380
|
+
* @description
|
|
381
|
+
* Return maps of scoin type to its sCoin name
|
|
382
|
+
*/
|
|
356
383
|
get sCoinTypeToSCoinNameMap(): Record<string, string | undefined>;
|
|
384
|
+
/**
|
|
385
|
+
* @description
|
|
386
|
+
* Return maps of volo coin type to its coin name
|
|
387
|
+
*/
|
|
357
388
|
get voloCoinTypeToCoinNameMap(): Record<string, string | undefined>;
|
|
389
|
+
/**
|
|
390
|
+
* @description
|
|
391
|
+
* Return maps of sui bridge coin type to its coin name
|
|
392
|
+
*/
|
|
358
393
|
get suiBridgeCoinTypeToCoinNameMap(): Record<string, string | undefined>;
|
|
394
|
+
/**
|
|
395
|
+
* @description
|
|
396
|
+
* Return maps of sCoin coin name to its coin type
|
|
397
|
+
*/
|
|
359
398
|
get sCoinTypes(): Record<string, string | undefined>;
|
|
399
|
+
/**
|
|
400
|
+
* @description
|
|
401
|
+
* Return set of supported coin types for borrow incentive rewards
|
|
402
|
+
* (all supported pools + sCoins + custom coins from `whitelist.borrowIncentiveRewards`)
|
|
403
|
+
*/
|
|
360
404
|
get supportedBorrowIncentiveRewards(): Set<string>;
|
|
361
405
|
private isEmptyObject;
|
|
362
406
|
private readApi;
|
|
@@ -395,7 +439,7 @@ declare class ScallopUtils {
|
|
|
395
439
|
* @param force - Whether to force initialization.
|
|
396
440
|
* @param address - ScallopAddress instance.
|
|
397
441
|
*/
|
|
398
|
-
init(force?: boolean
|
|
442
|
+
init(force?: boolean): Promise<void>;
|
|
399
443
|
/**
|
|
400
444
|
* Convert coin name to symbol.
|
|
401
445
|
*
|
|
@@ -707,7 +751,7 @@ declare class ScallopQuery {
|
|
|
707
751
|
* @param force - Whether to force initialization.
|
|
708
752
|
* @param address - ScallopAddress instance.
|
|
709
753
|
*/
|
|
710
|
-
init(force?: boolean
|
|
754
|
+
init(force?: boolean): Promise<void>;
|
|
711
755
|
/**
|
|
712
756
|
* @deprecated use getMarketPools
|
|
713
757
|
* Query market data.
|
|
@@ -1210,6 +1254,12 @@ declare class ScallopQuery {
|
|
|
1210
1254
|
* @returns
|
|
1211
1255
|
*/
|
|
1212
1256
|
getAssetOracles(): Promise<Record<string, xOracleRules>>;
|
|
1257
|
+
/**
|
|
1258
|
+
* Get switchboard on-demand aggregator object id based on coinType
|
|
1259
|
+
* @param coinType
|
|
1260
|
+
* @returns
|
|
1261
|
+
*/
|
|
1262
|
+
getSwitchboardOnDemandAggregatorObjectIds(coinName: string[]): Promise<string[]>;
|
|
1213
1263
|
}
|
|
1214
1264
|
|
|
1215
1265
|
/**
|
|
@@ -1240,7 +1290,7 @@ declare class ScallopBuilder {
|
|
|
1240
1290
|
* @param force - Whether to force initialization.
|
|
1241
1291
|
* @param address - ScallopAddress instance.
|
|
1242
1292
|
*/
|
|
1243
|
-
init(force?: boolean
|
|
1293
|
+
init(force?: boolean): Promise<void>;
|
|
1244
1294
|
/**
|
|
1245
1295
|
* Create a scallop txBlock instance that enhances transaction block.
|
|
1246
1296
|
*
|
|
@@ -1948,6 +1998,7 @@ type Whitelist = {
|
|
|
1948
1998
|
wormhole: Set<string>;
|
|
1949
1999
|
oracles: Set<string>;
|
|
1950
2000
|
borrowIncentiveRewards: Set<string>;
|
|
2001
|
+
rewardsAsPoint: Set<string>;
|
|
1951
2002
|
pythEndpoints: Set<string>;
|
|
1952
2003
|
deprecated: Set<string>;
|
|
1953
2004
|
};
|
|
@@ -2003,9 +2054,11 @@ type SuiBridgedCoinPackageIds = {
|
|
|
2003
2054
|
[key in string]: string;
|
|
2004
2055
|
};
|
|
2005
2056
|
|
|
2057
|
+
declare const _SUPPORT_ORACLES: readonly ["supra", "switchboard", "pyth"];
|
|
2058
|
+
type SupportOracleType = (typeof _SUPPORT_ORACLES)[number];
|
|
2006
2059
|
type xOracleRules = {
|
|
2007
|
-
primary:
|
|
2008
|
-
secondary:
|
|
2060
|
+
primary: SupportOracleType[];
|
|
2061
|
+
secondary: SupportOracleType[];
|
|
2009
2062
|
};
|
|
2010
2063
|
type xOracleRuleType = keyof xOracleRules;
|
|
2011
2064
|
type xOracleListType = {
|
|
@@ -2752,6 +2805,7 @@ type ObligationBorrowIcentiveReward = {
|
|
|
2752
2805
|
symbol: string;
|
|
2753
2806
|
coinDecimal: number;
|
|
2754
2807
|
coinPrice: number;
|
|
2808
|
+
weightedBorrowAmount: number;
|
|
2755
2809
|
availableClaimCoin: number;
|
|
2756
2810
|
availableClaimAmount: number;
|
|
2757
2811
|
boostValue: number;
|
|
@@ -2805,8 +2859,6 @@ type VeScaTreasuryInfo = {
|
|
|
2805
2859
|
averageLockingPeriodUnit: string;
|
|
2806
2860
|
};
|
|
2807
2861
|
|
|
2808
|
-
declare const _SUPPORT_ORACLES: readonly ["supra", "switchboard", "pyth"];
|
|
2809
|
-
type SupportOracleType = (typeof _SUPPORT_ORACLES)[number];
|
|
2810
2862
|
interface AddressesInterface {
|
|
2811
2863
|
core: {
|
|
2812
2864
|
version: string;
|
|
@@ -2838,6 +2890,8 @@ interface AddressesInterface {
|
|
|
2838
2890
|
} : K extends (typeof _SUPPORT_ORACLES)[1] ? {
|
|
2839
2891
|
registry: string;
|
|
2840
2892
|
registryCap: string;
|
|
2893
|
+
registryTableId: string;
|
|
2894
|
+
state: string;
|
|
2841
2895
|
} : K extends (typeof _SUPPORT_ORACLES)[2] ? {
|
|
2842
2896
|
registry: string;
|
|
2843
2897
|
registryCap: string;
|
|
@@ -2848,6 +2902,10 @@ interface AddressesInterface {
|
|
|
2848
2902
|
} & {
|
|
2849
2903
|
xOracle: string;
|
|
2850
2904
|
xOracleCap: string;
|
|
2905
|
+
primaryPriceUpdatePolicyObject: string;
|
|
2906
|
+
secondaryPriceUpdatePolicyObject: string;
|
|
2907
|
+
primaryPriceUpdatePolicyVecsetId: string;
|
|
2908
|
+
secondaryPriceUpdatePolicyVecsetId: string;
|
|
2851
2909
|
};
|
|
2852
2910
|
packages: Partial<Record<string, {
|
|
2853
2911
|
id: string;
|
|
@@ -2925,6 +2983,7 @@ type ScallopClientVeScaReturnType<T extends boolean> = T extends true ? SuiTrans
|
|
|
2925
2983
|
};
|
|
2926
2984
|
type ScallopBaseInstanceParams = {
|
|
2927
2985
|
suiKit?: SuiKit;
|
|
2986
|
+
cache?: ScallopCache;
|
|
2928
2987
|
};
|
|
2929
2988
|
type ScallopCacheInstanceParams = ScallopBaseInstanceParams & {
|
|
2930
2989
|
queryClient?: QueryClient;
|
|
@@ -2934,6 +2993,7 @@ type ScallopAddressInstanceParams = ScallopBaseInstanceParams & {
|
|
|
2934
2993
|
};
|
|
2935
2994
|
type ScallopConstantsInstanceParams = {
|
|
2936
2995
|
address?: ScallopAddress;
|
|
2996
|
+
cache?: ScallopCache;
|
|
2937
2997
|
};
|
|
2938
2998
|
type ScallopIndexerInstanceParams = {
|
|
2939
2999
|
cache?: ScallopCache;
|
|
@@ -3005,4 +3065,4 @@ declare const MIN_TOP_UP_AMOUNT: 1000000000;
|
|
|
3005
3065
|
|
|
3006
3066
|
declare const xOracleList: xOracleListType;
|
|
3007
3067
|
|
|
3008
|
-
export { API_BASE_URL, type AddressStringPath, type AddressesInterface, type AssetCoinIds, type AssetCoins, type BalanceSheet, type BaseScallopTxBlock, type BorrowDynamic, type BorrowFee, type BorrowIncentiveAccountKey, type BorrowIncentiveAccounts, type BorrowIncentiveAccountsQueryInterface, type BorrowIncentiveIds, type BorrowIncentiveNormalMethods, type BorrowIncentivePool, type BorrowIncentivePoolPoints, type BorrowIncentivePools, type BorrowIncentivePoolsQueryInterface, type BorrowIncentiveQuickMethods, type BorrowIncentiveRewardCoins, type BorrowIncentiveTxBlock, type CalculatedBorrowIncentivePoolPointData, type CalculatedMarketCollateralData, type CalculatedMarketPoolData, type CalculatedSpoolData, type CalculatedSpoolRewardPoolData, type CoinAmounts, type CoinPrices, type CoinWrappedType, type Coins, type CollateralStat, type CoreIds, type CoreNormalMethods, type CoreQuickMethods, type CoreTxBlock, DEFAULT_CACHE_OPTIONS, type GenerateBorrowIncentiveNormalMethod, type GenerateBorrowIncentiveQuickMethod, type GenerateCoreNormalMethod, type GenerateCoreQuickMethod, type GenerateLoyaltyProgramNormalMethod, type GenerateLoyaltyProgramQuickMethod, type GenerateSCoinNormalMethod, type GenerateSCoinQuickMethod, type GenerateSpoolNormalMethod, type GenerateSpoolQuickMethod, type GenerateVeScaNormalMethod, type GenerateVeScaQuickMethod, IS_VE_SCA_TEST, type InterestModel, type Lending, type Lendings, type LoyaltyProgramIds, type LoyaltyProgramInfo, type LoyaltyProgramNormalMethods, type LoyaltyProgramQuickMethods, type LoyaltyProgramTxBlock, MAX_LOCK_DURATION, MAX_LOCK_ROUNDS, MIN_INITIAL_LOCK_AMOUNT, MIN_TOP_UP_AMOUNT, type Market, type MarketCoinAmounts, type MarketCoins, type MarketCollateral, type MarketCollaterals, type MarketPool, type MarketPools, type MarketQueryInterface, type NestedResult, OLD_BORROW_INCENTIVE_PROTOCOL_ID, type Obligation, type ObligationAccount, type ObligationAccounts, type ObligationBorrowIcentiveReward, type ObligationBorrowIncentive, type ObligationCollateral, type ObligationDebt, type ObligationQueryInterface, type OptionalKeys, type OriginBorrowIncentiveAccountData, type OriginBorrowIncentiveAccountPoolData, type OriginBorrowIncentivePoolData, type OriginBorrowIncentivePoolPointData, type OriginMarketCollateralData, type OriginMarketPoolData, type OriginSpoolData, type OriginSpoolRewardPoolData, type ParsedBorrowIncentiveAccountData, type ParsedBorrowIncentiveAccountPoolData, type ParsedBorrowIncentivePoolData, type ParsedBorrowIncentivePoolPointData, type ParsedMarketCollateralData, type ParsedMarketPoolData, type ParsedSpoolData, type ParsedSpoolRewardPoolData, type PoolAddress, RPC_PROVIDERS, type RedeemScaQuickReturnType, type RiskModel, SCA_COIN_TYPE, type SCoinAmounts, type SCoinConverterTreasury, type SCoinIds, type SCoinTreasuryCaps, type SCoinTxBlock, type SCoins, SDK_API_BASE_URL, Scallop, ScallopAddress, type ScallopAddressInstanceParams, type ScallopAddressParams, type ScallopBaseInstanceParams, ScallopBuilder, type ScallopBuilderInstanceParams, type ScallopBuilderParams, ScallopCache, type ScallopCacheConfig, type ScallopCacheInstanceParams, type ScallopCacheParams, ScallopClient, type ScallopClientFnReturnType, type ScallopClientInstanceParams, type ScallopClientParams, type ScallopClientVeScaReturnType, ScallopConstants, type ScallopConstantsInstanceParams, type ScallopConstantsParams, ScallopIndexer, type ScallopIndexerInstanceParams, type ScallopIndexerParams, type ScallopParams, ScallopQuery, type ScallopQueryInstanceParams, type ScallopQueryParams, type ScallopTxBlock, ScallopUtils, type ScallopUtilsInstanceParams, type ScallopUtilsParams, type SelectCoinReturnType, type Spool, type SpoolData, type SpoolIds, type SpoolNormalMethods, type SpoolQuickMethods, type SpoolRewardPool, type SpoolTxBlock, type Spools, type StakeAccount, type StakeAccounts, type StakeMarketCoins, type StakePool, type StakePools, type StakeRewardCoins, type StakeRewardPool, type StakeRewardPools, type SuiBridgeCoins, type SuiBridgedCoinPackageIds, type SuiTxBlockWithBorrowIncentiveNormalMethods, type SuiTxBlockWithCoreNormalMethods, type SuiTxBlockWithLoyaltyProgramNormalMethods, type SuiTxBlockWithSCoin, type SuiTxBlockWithSCoinNormalMethods, type SuiTxBlockWithSpool, type SuiTxBlockWithSpoolNormalMethods, type SuiTxBlockWithVeScaNormalMethods, TEST_ADDRESSES, type TotalValueLocked, UNLOCK_ROUND_DURATION, USE_TEST_ADDRESS, type VeScaNormalMethods, type VeScaQuickMethods, type VeScaTreasuryFields, type VeScaTreasuryInfo, type VeScaTxBlock, type Vesca, type VescaIds, type VoloCoinIds, type Whitelist, type WormholeCoinIds, queryKeys, type sCoinBalance, type sCoinNormalMethods, type sCoinPkgIds, type sCoinQuickMethods, xOracleList, type xOracleListType, type xOracleRuleType, type xOracleRules };
|
|
3068
|
+
export { API_BASE_URL, type AddressStringPath, type AddressesInterface, type AssetCoinIds, type AssetCoins, type BalanceSheet, type BaseScallopTxBlock, type BorrowDynamic, type BorrowFee, type BorrowIncentiveAccountKey, type BorrowIncentiveAccounts, type BorrowIncentiveAccountsQueryInterface, type BorrowIncentiveIds, type BorrowIncentiveNormalMethods, type BorrowIncentivePool, type BorrowIncentivePoolPoints, type BorrowIncentivePools, type BorrowIncentivePoolsQueryInterface, type BorrowIncentiveQuickMethods, type BorrowIncentiveRewardCoins, type BorrowIncentiveTxBlock, type CalculatedBorrowIncentivePoolPointData, type CalculatedMarketCollateralData, type CalculatedMarketPoolData, type CalculatedSpoolData, type CalculatedSpoolRewardPoolData, type CoinAmounts, type CoinPrices, type CoinWrappedType, type Coins, type CollateralStat, type CoreIds, type CoreNormalMethods, type CoreQuickMethods, type CoreTxBlock, DEFAULT_CACHE_OPTIONS, type GenerateBorrowIncentiveNormalMethod, type GenerateBorrowIncentiveQuickMethod, type GenerateCoreNormalMethod, type GenerateCoreQuickMethod, type GenerateLoyaltyProgramNormalMethod, type GenerateLoyaltyProgramQuickMethod, type GenerateSCoinNormalMethod, type GenerateSCoinQuickMethod, type GenerateSpoolNormalMethod, type GenerateSpoolQuickMethod, type GenerateVeScaNormalMethod, type GenerateVeScaQuickMethod, IS_VE_SCA_TEST, type InterestModel, type Lending, type Lendings, type LoyaltyProgramIds, type LoyaltyProgramInfo, type LoyaltyProgramNormalMethods, type LoyaltyProgramQuickMethods, type LoyaltyProgramTxBlock, MAX_LOCK_DURATION, MAX_LOCK_ROUNDS, MIN_INITIAL_LOCK_AMOUNT, MIN_TOP_UP_AMOUNT, type Market, type MarketCoinAmounts, type MarketCoins, type MarketCollateral, type MarketCollaterals, type MarketPool, type MarketPools, type MarketQueryInterface, type NestedResult, OLD_BORROW_INCENTIVE_PROTOCOL_ID, type Obligation, type ObligationAccount, type ObligationAccounts, type ObligationBorrowIcentiveReward, type ObligationBorrowIncentive, type ObligationCollateral, type ObligationDebt, type ObligationQueryInterface, type OptionalKeys, type OriginBorrowIncentiveAccountData, type OriginBorrowIncentiveAccountPoolData, type OriginBorrowIncentivePoolData, type OriginBorrowIncentivePoolPointData, type OriginMarketCollateralData, type OriginMarketPoolData, type OriginSpoolData, type OriginSpoolRewardPoolData, type ParsedBorrowIncentiveAccountData, type ParsedBorrowIncentiveAccountPoolData, type ParsedBorrowIncentivePoolData, type ParsedBorrowIncentivePoolPointData, type ParsedMarketCollateralData, type ParsedMarketPoolData, type ParsedSpoolData, type ParsedSpoolRewardPoolData, type PoolAddress, RPC_PROVIDERS, type RedeemScaQuickReturnType, type RiskModel, SCA_COIN_TYPE, type SCoinAmounts, type SCoinConverterTreasury, type SCoinIds, type SCoinTreasuryCaps, type SCoinTxBlock, type SCoins, SDK_API_BASE_URL, Scallop, ScallopAddress, type ScallopAddressInstanceParams, type ScallopAddressParams, type ScallopBaseInstanceParams, ScallopBuilder, type ScallopBuilderInstanceParams, type ScallopBuilderParams, ScallopCache, type ScallopCacheConfig, type ScallopCacheInstanceParams, type ScallopCacheParams, ScallopClient, type ScallopClientFnReturnType, type ScallopClientInstanceParams, type ScallopClientParams, type ScallopClientVeScaReturnType, ScallopConstants, type ScallopConstantsInstanceParams, type ScallopConstantsParams, ScallopIndexer, type ScallopIndexerInstanceParams, type ScallopIndexerParams, type ScallopParams, ScallopQuery, type ScallopQueryInstanceParams, type ScallopQueryParams, type ScallopTxBlock, ScallopUtils, type ScallopUtilsInstanceParams, type ScallopUtilsParams, type SelectCoinReturnType, type Spool, type SpoolData, type SpoolIds, type SpoolNormalMethods, type SpoolQuickMethods, type SpoolRewardPool, type SpoolTxBlock, type Spools, type StakeAccount, type StakeAccounts, type StakeMarketCoins, type StakePool, type StakePools, type StakeRewardCoins, type StakeRewardPool, type StakeRewardPools, type SuiBridgeCoins, type SuiBridgedCoinPackageIds, type SuiTxBlockWithBorrowIncentiveNormalMethods, type SuiTxBlockWithCoreNormalMethods, type SuiTxBlockWithLoyaltyProgramNormalMethods, type SuiTxBlockWithSCoin, type SuiTxBlockWithSCoinNormalMethods, type SuiTxBlockWithSpool, type SuiTxBlockWithSpoolNormalMethods, type SuiTxBlockWithVeScaNormalMethods, type SupportOracleType, TEST_ADDRESSES, type TotalValueLocked, UNLOCK_ROUND_DURATION, USE_TEST_ADDRESS, type VeScaNormalMethods, type VeScaQuickMethods, type VeScaTreasuryFields, type VeScaTreasuryInfo, type VeScaTxBlock, type Vesca, type VescaIds, type VoloCoinIds, type Whitelist, type WormholeCoinIds, _SUPPORT_ORACLES, queryKeys, type sCoinBalance, type sCoinNormalMethods, type sCoinPkgIds, type sCoinQuickMethods, xOracleList, type xOracleListType, type xOracleRuleType, type xOracleRules };
|
package/dist/index.d.ts
CHANGED
|
@@ -328,7 +328,6 @@ declare class ScallopConstants {
|
|
|
328
328
|
private _poolAddresses;
|
|
329
329
|
private _whitelist;
|
|
330
330
|
private _coinDecimals;
|
|
331
|
-
private _coinNameToCoinTypeMap;
|
|
332
331
|
private _coinNameToOldMarketCoinTypeMap;
|
|
333
332
|
private _scoinRawNameToSCoinNameMap;
|
|
334
333
|
private _scoinTypeToSCoinNameMap;
|
|
@@ -338,6 +337,7 @@ declare class ScallopConstants {
|
|
|
338
337
|
private _coinTypes;
|
|
339
338
|
private _sCoinTypes;
|
|
340
339
|
private _coinTypeToCoinNameMap;
|
|
340
|
+
private _supportedBorrowIncentiveRewards;
|
|
341
341
|
constructor(params: ScallopConstantsParams, instance?: ScallopConstantsInstanceParams);
|
|
342
342
|
get isAddressInitialized(): boolean;
|
|
343
343
|
get isInitialized(): boolean;
|
|
@@ -346,17 +346,61 @@ declare class ScallopConstants {
|
|
|
346
346
|
get whitelist(): Whitelist;
|
|
347
347
|
parseToOldMarketCoin(coinType: string): string;
|
|
348
348
|
get protocolObjectId(): string;
|
|
349
|
+
/**
|
|
350
|
+
* @description
|
|
351
|
+
* Return maps of coin names to coin decimals.
|
|
352
|
+
*/
|
|
349
353
|
get coinDecimals(): Record<string, number | undefined>;
|
|
354
|
+
/**
|
|
355
|
+
* @description
|
|
356
|
+
* Return maps of coin names to coin types.
|
|
357
|
+
*/
|
|
350
358
|
get coinTypes(): Record<string, string | undefined>;
|
|
351
|
-
|
|
352
|
-
|
|
359
|
+
/**
|
|
360
|
+
* @description
|
|
361
|
+
* Return maps of coin types to its coin name
|
|
362
|
+
*/
|
|
353
363
|
get coinTypeToCoinNameMap(): Record<string, string | undefined>;
|
|
364
|
+
/**
|
|
365
|
+
* @description
|
|
366
|
+
* Return maps of wormhole coin types to its coin name.
|
|
367
|
+
*/
|
|
368
|
+
get wormholeCoinTypeToCoinName(): Record<string, string | undefined>;
|
|
369
|
+
/**
|
|
370
|
+
* @description
|
|
371
|
+
* Return maps of coin name to its old market coin type (...::reserve::MarketCoin<coinType>)
|
|
372
|
+
*/
|
|
354
373
|
get coinNameToOldMarketCoinTypeMap(): Record<string, string | undefined>;
|
|
374
|
+
/**
|
|
375
|
+
* @description
|
|
376
|
+
* Return maps of sCoin raw name from its type to its sCoin name. (e.g. 'scallop_sui' -> 'ssui')
|
|
377
|
+
*/
|
|
355
378
|
get sCoinRawNameToScoinNameMap(): Record<string, string | undefined>;
|
|
379
|
+
/**
|
|
380
|
+
* @description
|
|
381
|
+
* Return maps of scoin type to its sCoin name
|
|
382
|
+
*/
|
|
356
383
|
get sCoinTypeToSCoinNameMap(): Record<string, string | undefined>;
|
|
384
|
+
/**
|
|
385
|
+
* @description
|
|
386
|
+
* Return maps of volo coin type to its coin name
|
|
387
|
+
*/
|
|
357
388
|
get voloCoinTypeToCoinNameMap(): Record<string, string | undefined>;
|
|
389
|
+
/**
|
|
390
|
+
* @description
|
|
391
|
+
* Return maps of sui bridge coin type to its coin name
|
|
392
|
+
*/
|
|
358
393
|
get suiBridgeCoinTypeToCoinNameMap(): Record<string, string | undefined>;
|
|
394
|
+
/**
|
|
395
|
+
* @description
|
|
396
|
+
* Return maps of sCoin coin name to its coin type
|
|
397
|
+
*/
|
|
359
398
|
get sCoinTypes(): Record<string, string | undefined>;
|
|
399
|
+
/**
|
|
400
|
+
* @description
|
|
401
|
+
* Return set of supported coin types for borrow incentive rewards
|
|
402
|
+
* (all supported pools + sCoins + custom coins from `whitelist.borrowIncentiveRewards`)
|
|
403
|
+
*/
|
|
360
404
|
get supportedBorrowIncentiveRewards(): Set<string>;
|
|
361
405
|
private isEmptyObject;
|
|
362
406
|
private readApi;
|
|
@@ -395,7 +439,7 @@ declare class ScallopUtils {
|
|
|
395
439
|
* @param force - Whether to force initialization.
|
|
396
440
|
* @param address - ScallopAddress instance.
|
|
397
441
|
*/
|
|
398
|
-
init(force?: boolean
|
|
442
|
+
init(force?: boolean): Promise<void>;
|
|
399
443
|
/**
|
|
400
444
|
* Convert coin name to symbol.
|
|
401
445
|
*
|
|
@@ -707,7 +751,7 @@ declare class ScallopQuery {
|
|
|
707
751
|
* @param force - Whether to force initialization.
|
|
708
752
|
* @param address - ScallopAddress instance.
|
|
709
753
|
*/
|
|
710
|
-
init(force?: boolean
|
|
754
|
+
init(force?: boolean): Promise<void>;
|
|
711
755
|
/**
|
|
712
756
|
* @deprecated use getMarketPools
|
|
713
757
|
* Query market data.
|
|
@@ -1210,6 +1254,12 @@ declare class ScallopQuery {
|
|
|
1210
1254
|
* @returns
|
|
1211
1255
|
*/
|
|
1212
1256
|
getAssetOracles(): Promise<Record<string, xOracleRules>>;
|
|
1257
|
+
/**
|
|
1258
|
+
* Get switchboard on-demand aggregator object id based on coinType
|
|
1259
|
+
* @param coinType
|
|
1260
|
+
* @returns
|
|
1261
|
+
*/
|
|
1262
|
+
getSwitchboardOnDemandAggregatorObjectIds(coinName: string[]): Promise<string[]>;
|
|
1213
1263
|
}
|
|
1214
1264
|
|
|
1215
1265
|
/**
|
|
@@ -1240,7 +1290,7 @@ declare class ScallopBuilder {
|
|
|
1240
1290
|
* @param force - Whether to force initialization.
|
|
1241
1291
|
* @param address - ScallopAddress instance.
|
|
1242
1292
|
*/
|
|
1243
|
-
init(force?: boolean
|
|
1293
|
+
init(force?: boolean): Promise<void>;
|
|
1244
1294
|
/**
|
|
1245
1295
|
* Create a scallop txBlock instance that enhances transaction block.
|
|
1246
1296
|
*
|
|
@@ -1948,6 +1998,7 @@ type Whitelist = {
|
|
|
1948
1998
|
wormhole: Set<string>;
|
|
1949
1999
|
oracles: Set<string>;
|
|
1950
2000
|
borrowIncentiveRewards: Set<string>;
|
|
2001
|
+
rewardsAsPoint: Set<string>;
|
|
1951
2002
|
pythEndpoints: Set<string>;
|
|
1952
2003
|
deprecated: Set<string>;
|
|
1953
2004
|
};
|
|
@@ -2003,9 +2054,11 @@ type SuiBridgedCoinPackageIds = {
|
|
|
2003
2054
|
[key in string]: string;
|
|
2004
2055
|
};
|
|
2005
2056
|
|
|
2057
|
+
declare const _SUPPORT_ORACLES: readonly ["supra", "switchboard", "pyth"];
|
|
2058
|
+
type SupportOracleType = (typeof _SUPPORT_ORACLES)[number];
|
|
2006
2059
|
type xOracleRules = {
|
|
2007
|
-
primary:
|
|
2008
|
-
secondary:
|
|
2060
|
+
primary: SupportOracleType[];
|
|
2061
|
+
secondary: SupportOracleType[];
|
|
2009
2062
|
};
|
|
2010
2063
|
type xOracleRuleType = keyof xOracleRules;
|
|
2011
2064
|
type xOracleListType = {
|
|
@@ -2752,6 +2805,7 @@ type ObligationBorrowIcentiveReward = {
|
|
|
2752
2805
|
symbol: string;
|
|
2753
2806
|
coinDecimal: number;
|
|
2754
2807
|
coinPrice: number;
|
|
2808
|
+
weightedBorrowAmount: number;
|
|
2755
2809
|
availableClaimCoin: number;
|
|
2756
2810
|
availableClaimAmount: number;
|
|
2757
2811
|
boostValue: number;
|
|
@@ -2805,8 +2859,6 @@ type VeScaTreasuryInfo = {
|
|
|
2805
2859
|
averageLockingPeriodUnit: string;
|
|
2806
2860
|
};
|
|
2807
2861
|
|
|
2808
|
-
declare const _SUPPORT_ORACLES: readonly ["supra", "switchboard", "pyth"];
|
|
2809
|
-
type SupportOracleType = (typeof _SUPPORT_ORACLES)[number];
|
|
2810
2862
|
interface AddressesInterface {
|
|
2811
2863
|
core: {
|
|
2812
2864
|
version: string;
|
|
@@ -2838,6 +2890,8 @@ interface AddressesInterface {
|
|
|
2838
2890
|
} : K extends (typeof _SUPPORT_ORACLES)[1] ? {
|
|
2839
2891
|
registry: string;
|
|
2840
2892
|
registryCap: string;
|
|
2893
|
+
registryTableId: string;
|
|
2894
|
+
state: string;
|
|
2841
2895
|
} : K extends (typeof _SUPPORT_ORACLES)[2] ? {
|
|
2842
2896
|
registry: string;
|
|
2843
2897
|
registryCap: string;
|
|
@@ -2848,6 +2902,10 @@ interface AddressesInterface {
|
|
|
2848
2902
|
} & {
|
|
2849
2903
|
xOracle: string;
|
|
2850
2904
|
xOracleCap: string;
|
|
2905
|
+
primaryPriceUpdatePolicyObject: string;
|
|
2906
|
+
secondaryPriceUpdatePolicyObject: string;
|
|
2907
|
+
primaryPriceUpdatePolicyVecsetId: string;
|
|
2908
|
+
secondaryPriceUpdatePolicyVecsetId: string;
|
|
2851
2909
|
};
|
|
2852
2910
|
packages: Partial<Record<string, {
|
|
2853
2911
|
id: string;
|
|
@@ -2925,6 +2983,7 @@ type ScallopClientVeScaReturnType<T extends boolean> = T extends true ? SuiTrans
|
|
|
2925
2983
|
};
|
|
2926
2984
|
type ScallopBaseInstanceParams = {
|
|
2927
2985
|
suiKit?: SuiKit;
|
|
2986
|
+
cache?: ScallopCache;
|
|
2928
2987
|
};
|
|
2929
2988
|
type ScallopCacheInstanceParams = ScallopBaseInstanceParams & {
|
|
2930
2989
|
queryClient?: QueryClient;
|
|
@@ -2934,6 +2993,7 @@ type ScallopAddressInstanceParams = ScallopBaseInstanceParams & {
|
|
|
2934
2993
|
};
|
|
2935
2994
|
type ScallopConstantsInstanceParams = {
|
|
2936
2995
|
address?: ScallopAddress;
|
|
2996
|
+
cache?: ScallopCache;
|
|
2937
2997
|
};
|
|
2938
2998
|
type ScallopIndexerInstanceParams = {
|
|
2939
2999
|
cache?: ScallopCache;
|
|
@@ -3005,4 +3065,4 @@ declare const MIN_TOP_UP_AMOUNT: 1000000000;
|
|
|
3005
3065
|
|
|
3006
3066
|
declare const xOracleList: xOracleListType;
|
|
3007
3067
|
|
|
3008
|
-
export { API_BASE_URL, type AddressStringPath, type AddressesInterface, type AssetCoinIds, type AssetCoins, type BalanceSheet, type BaseScallopTxBlock, type BorrowDynamic, type BorrowFee, type BorrowIncentiveAccountKey, type BorrowIncentiveAccounts, type BorrowIncentiveAccountsQueryInterface, type BorrowIncentiveIds, type BorrowIncentiveNormalMethods, type BorrowIncentivePool, type BorrowIncentivePoolPoints, type BorrowIncentivePools, type BorrowIncentivePoolsQueryInterface, type BorrowIncentiveQuickMethods, type BorrowIncentiveRewardCoins, type BorrowIncentiveTxBlock, type CalculatedBorrowIncentivePoolPointData, type CalculatedMarketCollateralData, type CalculatedMarketPoolData, type CalculatedSpoolData, type CalculatedSpoolRewardPoolData, type CoinAmounts, type CoinPrices, type CoinWrappedType, type Coins, type CollateralStat, type CoreIds, type CoreNormalMethods, type CoreQuickMethods, type CoreTxBlock, DEFAULT_CACHE_OPTIONS, type GenerateBorrowIncentiveNormalMethod, type GenerateBorrowIncentiveQuickMethod, type GenerateCoreNormalMethod, type GenerateCoreQuickMethod, type GenerateLoyaltyProgramNormalMethod, type GenerateLoyaltyProgramQuickMethod, type GenerateSCoinNormalMethod, type GenerateSCoinQuickMethod, type GenerateSpoolNormalMethod, type GenerateSpoolQuickMethod, type GenerateVeScaNormalMethod, type GenerateVeScaQuickMethod, IS_VE_SCA_TEST, type InterestModel, type Lending, type Lendings, type LoyaltyProgramIds, type LoyaltyProgramInfo, type LoyaltyProgramNormalMethods, type LoyaltyProgramQuickMethods, type LoyaltyProgramTxBlock, MAX_LOCK_DURATION, MAX_LOCK_ROUNDS, MIN_INITIAL_LOCK_AMOUNT, MIN_TOP_UP_AMOUNT, type Market, type MarketCoinAmounts, type MarketCoins, type MarketCollateral, type MarketCollaterals, type MarketPool, type MarketPools, type MarketQueryInterface, type NestedResult, OLD_BORROW_INCENTIVE_PROTOCOL_ID, type Obligation, type ObligationAccount, type ObligationAccounts, type ObligationBorrowIcentiveReward, type ObligationBorrowIncentive, type ObligationCollateral, type ObligationDebt, type ObligationQueryInterface, type OptionalKeys, type OriginBorrowIncentiveAccountData, type OriginBorrowIncentiveAccountPoolData, type OriginBorrowIncentivePoolData, type OriginBorrowIncentivePoolPointData, type OriginMarketCollateralData, type OriginMarketPoolData, type OriginSpoolData, type OriginSpoolRewardPoolData, type ParsedBorrowIncentiveAccountData, type ParsedBorrowIncentiveAccountPoolData, type ParsedBorrowIncentivePoolData, type ParsedBorrowIncentivePoolPointData, type ParsedMarketCollateralData, type ParsedMarketPoolData, type ParsedSpoolData, type ParsedSpoolRewardPoolData, type PoolAddress, RPC_PROVIDERS, type RedeemScaQuickReturnType, type RiskModel, SCA_COIN_TYPE, type SCoinAmounts, type SCoinConverterTreasury, type SCoinIds, type SCoinTreasuryCaps, type SCoinTxBlock, type SCoins, SDK_API_BASE_URL, Scallop, ScallopAddress, type ScallopAddressInstanceParams, type ScallopAddressParams, type ScallopBaseInstanceParams, ScallopBuilder, type ScallopBuilderInstanceParams, type ScallopBuilderParams, ScallopCache, type ScallopCacheConfig, type ScallopCacheInstanceParams, type ScallopCacheParams, ScallopClient, type ScallopClientFnReturnType, type ScallopClientInstanceParams, type ScallopClientParams, type ScallopClientVeScaReturnType, ScallopConstants, type ScallopConstantsInstanceParams, type ScallopConstantsParams, ScallopIndexer, type ScallopIndexerInstanceParams, type ScallopIndexerParams, type ScallopParams, ScallopQuery, type ScallopQueryInstanceParams, type ScallopQueryParams, type ScallopTxBlock, ScallopUtils, type ScallopUtilsInstanceParams, type ScallopUtilsParams, type SelectCoinReturnType, type Spool, type SpoolData, type SpoolIds, type SpoolNormalMethods, type SpoolQuickMethods, type SpoolRewardPool, type SpoolTxBlock, type Spools, type StakeAccount, type StakeAccounts, type StakeMarketCoins, type StakePool, type StakePools, type StakeRewardCoins, type StakeRewardPool, type StakeRewardPools, type SuiBridgeCoins, type SuiBridgedCoinPackageIds, type SuiTxBlockWithBorrowIncentiveNormalMethods, type SuiTxBlockWithCoreNormalMethods, type SuiTxBlockWithLoyaltyProgramNormalMethods, type SuiTxBlockWithSCoin, type SuiTxBlockWithSCoinNormalMethods, type SuiTxBlockWithSpool, type SuiTxBlockWithSpoolNormalMethods, type SuiTxBlockWithVeScaNormalMethods, TEST_ADDRESSES, type TotalValueLocked, UNLOCK_ROUND_DURATION, USE_TEST_ADDRESS, type VeScaNormalMethods, type VeScaQuickMethods, type VeScaTreasuryFields, type VeScaTreasuryInfo, type VeScaTxBlock, type Vesca, type VescaIds, type VoloCoinIds, type Whitelist, type WormholeCoinIds, queryKeys, type sCoinBalance, type sCoinNormalMethods, type sCoinPkgIds, type sCoinQuickMethods, xOracleList, type xOracleListType, type xOracleRuleType, type xOracleRules };
|
|
3068
|
+
export { API_BASE_URL, type AddressStringPath, type AddressesInterface, type AssetCoinIds, type AssetCoins, type BalanceSheet, type BaseScallopTxBlock, type BorrowDynamic, type BorrowFee, type BorrowIncentiveAccountKey, type BorrowIncentiveAccounts, type BorrowIncentiveAccountsQueryInterface, type BorrowIncentiveIds, type BorrowIncentiveNormalMethods, type BorrowIncentivePool, type BorrowIncentivePoolPoints, type BorrowIncentivePools, type BorrowIncentivePoolsQueryInterface, type BorrowIncentiveQuickMethods, type BorrowIncentiveRewardCoins, type BorrowIncentiveTxBlock, type CalculatedBorrowIncentivePoolPointData, type CalculatedMarketCollateralData, type CalculatedMarketPoolData, type CalculatedSpoolData, type CalculatedSpoolRewardPoolData, type CoinAmounts, type CoinPrices, type CoinWrappedType, type Coins, type CollateralStat, type CoreIds, type CoreNormalMethods, type CoreQuickMethods, type CoreTxBlock, DEFAULT_CACHE_OPTIONS, type GenerateBorrowIncentiveNormalMethod, type GenerateBorrowIncentiveQuickMethod, type GenerateCoreNormalMethod, type GenerateCoreQuickMethod, type GenerateLoyaltyProgramNormalMethod, type GenerateLoyaltyProgramQuickMethod, type GenerateSCoinNormalMethod, type GenerateSCoinQuickMethod, type GenerateSpoolNormalMethod, type GenerateSpoolQuickMethod, type GenerateVeScaNormalMethod, type GenerateVeScaQuickMethod, IS_VE_SCA_TEST, type InterestModel, type Lending, type Lendings, type LoyaltyProgramIds, type LoyaltyProgramInfo, type LoyaltyProgramNormalMethods, type LoyaltyProgramQuickMethods, type LoyaltyProgramTxBlock, MAX_LOCK_DURATION, MAX_LOCK_ROUNDS, MIN_INITIAL_LOCK_AMOUNT, MIN_TOP_UP_AMOUNT, type Market, type MarketCoinAmounts, type MarketCoins, type MarketCollateral, type MarketCollaterals, type MarketPool, type MarketPools, type MarketQueryInterface, type NestedResult, OLD_BORROW_INCENTIVE_PROTOCOL_ID, type Obligation, type ObligationAccount, type ObligationAccounts, type ObligationBorrowIcentiveReward, type ObligationBorrowIncentive, type ObligationCollateral, type ObligationDebt, type ObligationQueryInterface, type OptionalKeys, type OriginBorrowIncentiveAccountData, type OriginBorrowIncentiveAccountPoolData, type OriginBorrowIncentivePoolData, type OriginBorrowIncentivePoolPointData, type OriginMarketCollateralData, type OriginMarketPoolData, type OriginSpoolData, type OriginSpoolRewardPoolData, type ParsedBorrowIncentiveAccountData, type ParsedBorrowIncentiveAccountPoolData, type ParsedBorrowIncentivePoolData, type ParsedBorrowIncentivePoolPointData, type ParsedMarketCollateralData, type ParsedMarketPoolData, type ParsedSpoolData, type ParsedSpoolRewardPoolData, type PoolAddress, RPC_PROVIDERS, type RedeemScaQuickReturnType, type RiskModel, SCA_COIN_TYPE, type SCoinAmounts, type SCoinConverterTreasury, type SCoinIds, type SCoinTreasuryCaps, type SCoinTxBlock, type SCoins, SDK_API_BASE_URL, Scallop, ScallopAddress, type ScallopAddressInstanceParams, type ScallopAddressParams, type ScallopBaseInstanceParams, ScallopBuilder, type ScallopBuilderInstanceParams, type ScallopBuilderParams, ScallopCache, type ScallopCacheConfig, type ScallopCacheInstanceParams, type ScallopCacheParams, ScallopClient, type ScallopClientFnReturnType, type ScallopClientInstanceParams, type ScallopClientParams, type ScallopClientVeScaReturnType, ScallopConstants, type ScallopConstantsInstanceParams, type ScallopConstantsParams, ScallopIndexer, type ScallopIndexerInstanceParams, type ScallopIndexerParams, type ScallopParams, ScallopQuery, type ScallopQueryInstanceParams, type ScallopQueryParams, type ScallopTxBlock, ScallopUtils, type ScallopUtilsInstanceParams, type ScallopUtilsParams, type SelectCoinReturnType, type Spool, type SpoolData, type SpoolIds, type SpoolNormalMethods, type SpoolQuickMethods, type SpoolRewardPool, type SpoolTxBlock, type Spools, type StakeAccount, type StakeAccounts, type StakeMarketCoins, type StakePool, type StakePools, type StakeRewardCoins, type StakeRewardPool, type StakeRewardPools, type SuiBridgeCoins, type SuiBridgedCoinPackageIds, type SuiTxBlockWithBorrowIncentiveNormalMethods, type SuiTxBlockWithCoreNormalMethods, type SuiTxBlockWithLoyaltyProgramNormalMethods, type SuiTxBlockWithSCoin, type SuiTxBlockWithSCoinNormalMethods, type SuiTxBlockWithSpool, type SuiTxBlockWithSpoolNormalMethods, type SuiTxBlockWithVeScaNormalMethods, type SupportOracleType, TEST_ADDRESSES, type TotalValueLocked, UNLOCK_ROUND_DURATION, USE_TEST_ADDRESS, type VeScaNormalMethods, type VeScaQuickMethods, type VeScaTreasuryFields, type VeScaTreasuryInfo, type VeScaTxBlock, type Vesca, type VescaIds, type VoloCoinIds, type Whitelist, type WormholeCoinIds, _SUPPORT_ORACLES, queryKeys, type sCoinBalance, type sCoinNormalMethods, type sCoinPkgIds, type sCoinQuickMethods, xOracleList, type xOracleListType, type xOracleRuleType, type xOracleRules };
|