haedal-vault-sdk 1.0.0 → 1.0.2-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.ts +146 -7
- package/dist/index.js +16 -2
- package/dist/index.mjs +16 -2
- package/docs/vest-test-guide.md +103 -0
- package/jest.config.js +10 -14
- package/package.json +11 -8
- package/tsup.config.js +9 -6
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { CoinBalance } from '@mysten/sui/client';
|
|
1
|
+
import { CoinBalance, SuiObjectResponse } from '@mysten/sui/client';
|
|
2
2
|
import { AggregatorClient } from '@cetusprotocol/aggregator-sdk';
|
|
3
|
-
import { PaginationArgs, DataPage,
|
|
3
|
+
import { PaginationArgs, DataPage, CoinPairType, IModule as IModule$1, Package, SuiAddressType, FullClient, CoinAsset, SuiResource } from '@cetusprotocol/common-sdk';
|
|
4
|
+
import { Pool as Pool$1, CetusClmmSDK } from '@cetusprotocol/sui-clmm-sdk';
|
|
4
5
|
import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
5
6
|
import * as _pythnetwork_price_service_sdk from '@pythnetwork/price-service-sdk';
|
|
6
7
|
import { SuiPriceServiceConnection, SuiPythClient } from '@pythnetwork/pyth-sui-js';
|
|
@@ -471,7 +472,7 @@ declare class PythPriceModule implements IModule {
|
|
|
471
472
|
* @returns A promise that resolves to a record mapping coin types to their respective price information.
|
|
472
473
|
*/
|
|
473
474
|
getLatestPrice(coinTypeList: string[], useCache?: boolean): Promise<Record<string, Price>>;
|
|
474
|
-
getPriceFeedsUpdateData(feedIds: string[]): Promise<Buffer[] | undefined>;
|
|
475
|
+
getPriceFeedsUpdateData(feedIds: string[]): Promise<Buffer<ArrayBufferLike>[] | undefined>;
|
|
475
476
|
getLatestPriceFeeds(feedIds: string[]): Promise<_pythnetwork_price_service_sdk.PriceFeed[] | undefined>;
|
|
476
477
|
/**
|
|
477
478
|
* Builds the payload to update Pyth price feeds with the provided coin types and transaction.
|
|
@@ -499,8 +500,121 @@ declare class PythPriceModule implements IModule {
|
|
|
499
500
|
getFeedInfo(coinType: string, forceRefresh: boolean): Promise<FeedInfo>;
|
|
500
501
|
}
|
|
501
502
|
|
|
503
|
+
type VestConfigs = {
|
|
504
|
+
versioned_id: string;
|
|
505
|
+
create_event_list: VestCreateEvent[];
|
|
506
|
+
};
|
|
507
|
+
type GlobalVestingPeriod = {
|
|
508
|
+
period: number;
|
|
509
|
+
release_time: string;
|
|
510
|
+
cetus_amount: string;
|
|
511
|
+
redeemed_amount: string;
|
|
512
|
+
};
|
|
513
|
+
type VaultsVestInfo = {
|
|
514
|
+
id: string;
|
|
515
|
+
vault_id: string;
|
|
516
|
+
index: number;
|
|
517
|
+
lp_coin_type: string;
|
|
518
|
+
vest_coin_type: string;
|
|
519
|
+
position: VaultsPosition;
|
|
520
|
+
balance: string;
|
|
521
|
+
total_supply: string;
|
|
522
|
+
impaired_a: string;
|
|
523
|
+
impaired_b: string;
|
|
524
|
+
cetus_amount: string;
|
|
525
|
+
redeemed_amount: string;
|
|
526
|
+
start_time: string;
|
|
527
|
+
global_vesting_periods: GlobalVestingPeriod[];
|
|
528
|
+
vest_infos: {
|
|
529
|
+
id: string;
|
|
530
|
+
size: string;
|
|
531
|
+
};
|
|
532
|
+
url: string;
|
|
533
|
+
} & CoinPairType;
|
|
534
|
+
type VaultsPosition = {
|
|
535
|
+
description: string;
|
|
536
|
+
id: string;
|
|
537
|
+
index: number;
|
|
538
|
+
liquidity: string;
|
|
539
|
+
name: string;
|
|
540
|
+
pool_id: string;
|
|
541
|
+
tick_lower_index: number;
|
|
542
|
+
tick_upper_index: number;
|
|
543
|
+
url: string;
|
|
544
|
+
} & CoinPairType;
|
|
545
|
+
type PeriodInfo = {
|
|
546
|
+
period: number;
|
|
547
|
+
cetus_amount: string;
|
|
548
|
+
is_redeemed: boolean;
|
|
549
|
+
};
|
|
550
|
+
type VestCreateEvent = {
|
|
551
|
+
clmm_vester_id: string;
|
|
552
|
+
lp_coin_type: string;
|
|
553
|
+
pool_id: string;
|
|
554
|
+
position_id: string;
|
|
555
|
+
vault_id: string;
|
|
556
|
+
vault_vester_id: string;
|
|
557
|
+
};
|
|
558
|
+
type VaultVestNFT = {
|
|
559
|
+
id: string;
|
|
560
|
+
index: number;
|
|
561
|
+
vault_id: string;
|
|
562
|
+
lp_amount: string;
|
|
563
|
+
redeemed_amount: string;
|
|
564
|
+
impaired_a: string;
|
|
565
|
+
impaired_b: string;
|
|
566
|
+
period_infos: PeriodInfo[];
|
|
567
|
+
url: string;
|
|
568
|
+
name: string;
|
|
569
|
+
vester_id: string;
|
|
570
|
+
};
|
|
571
|
+
type RedeemOption = {
|
|
572
|
+
vault_id: string;
|
|
573
|
+
vesting_nft_id: string;
|
|
574
|
+
vest_coin_type: string;
|
|
575
|
+
period: number;
|
|
576
|
+
} & CoinPairType;
|
|
577
|
+
|
|
502
578
|
type BigNumber = Decimal.Value | number | string;
|
|
503
579
|
|
|
580
|
+
declare class VestModule implements IModule$1<VolatileVaultsSDK> {
|
|
581
|
+
protected _sdk: VolatileVaultsSDK;
|
|
582
|
+
constructor(sdk: VolatileVaultsSDK);
|
|
583
|
+
get sdk(): VolatileVaultsSDK;
|
|
584
|
+
vestNftIsAvailable(vest_nft_id: string, vester_infos_handle: string): Promise<boolean>;
|
|
585
|
+
/**
|
|
586
|
+
* Get the vest create event list
|
|
587
|
+
* @returns {Promise<VestCreateEvent[]>} The vest create event list
|
|
588
|
+
*/
|
|
589
|
+
getVestCreateEventList(): Promise<VestCreateEvent[]>;
|
|
590
|
+
getVaultsVestInfoList(vault_ids: string[]): Promise<VaultsVestInfo[]>;
|
|
591
|
+
/**
|
|
592
|
+
* Get the vaults vest info
|
|
593
|
+
* @param vault_id - The vault id
|
|
594
|
+
* @param force_refresh - Whether to force refresh the cache
|
|
595
|
+
* @returns {Promise<VaultsVestInfo>} The vaults vest info
|
|
596
|
+
*/
|
|
597
|
+
getVaultsVestInfo(vault_id: string, force_refresh?: boolean): Promise<VaultsVestInfo>;
|
|
598
|
+
/**
|
|
599
|
+
* Get the vault vest event
|
|
600
|
+
* @param vault_id - The vault id
|
|
601
|
+
* @returns {VestCreateEvent} The vault vest event
|
|
602
|
+
*/
|
|
603
|
+
getVaultVestEvent(vault_id: string): Promise<VestCreateEvent>;
|
|
604
|
+
/**
|
|
605
|
+
* Get the vault vest nft list
|
|
606
|
+
* @param owner - The owner address
|
|
607
|
+
* @returns {Promise<VaultVestNFT[]>} The vault vest nft list
|
|
608
|
+
*/
|
|
609
|
+
getOwnerVaultVestNFT(owner: string): Promise<VaultVestNFT[]>;
|
|
610
|
+
/**
|
|
611
|
+
* Build the redeem payload
|
|
612
|
+
* @param options - The redeem options
|
|
613
|
+
* @returns {Transaction} The redeem payload
|
|
614
|
+
*/
|
|
615
|
+
buildRedeemPayload(options: RedeemOption[], tx?: Transaction): Promise<Transaction>;
|
|
616
|
+
}
|
|
617
|
+
|
|
504
618
|
/**
|
|
505
619
|
* Represents options and configurations for an SDK.
|
|
506
620
|
*/
|
|
@@ -525,6 +639,10 @@ type SdkOptions = {
|
|
|
525
639
|
* Vaults configuration.
|
|
526
640
|
*/
|
|
527
641
|
vaults: VaultsConfigs;
|
|
642
|
+
/**
|
|
643
|
+
* Vest configuration.
|
|
644
|
+
*/
|
|
645
|
+
vest?: Package<VestConfigs>;
|
|
528
646
|
};
|
|
529
647
|
/**
|
|
530
648
|
* The entry class of VolatileVaultsSDK, which is almost responsible for all interactions with Vaults.
|
|
@@ -551,6 +669,10 @@ declare class VolatileVaultsSDK {
|
|
|
551
669
|
* Client for interacting with the Aggregator service.
|
|
552
670
|
*/
|
|
553
671
|
protected _aggregatorClient: AggregatorClient;
|
|
672
|
+
/**
|
|
673
|
+
* Module for interacting with vest.
|
|
674
|
+
*/
|
|
675
|
+
protected _vest: VestModule;
|
|
554
676
|
/**
|
|
555
677
|
* SDK for interacting with Cetus CLMM (Constant Product Automated Market Maker).
|
|
556
678
|
*/
|
|
@@ -583,9 +705,9 @@ declare class VolatileVaultsSDK {
|
|
|
583
705
|
get PythPrice(): PythPriceModule;
|
|
584
706
|
/**
|
|
585
707
|
* Getter for the fullClient property.
|
|
586
|
-
* @returns {
|
|
708
|
+
* @returns {FullClient} The fullClient property value.
|
|
587
709
|
*/
|
|
588
|
-
get FullClient():
|
|
710
|
+
get FullClient(): FullClient;
|
|
589
711
|
/**
|
|
590
712
|
* Getter for the AggregatorClient instance.
|
|
591
713
|
* @returns {AggregatorClient} The AggregatorClient instance.
|
|
@@ -596,6 +718,11 @@ declare class VolatileVaultsSDK {
|
|
|
596
718
|
* @returns {CetusClmmSDK} The CetusClmmSDK instance.
|
|
597
719
|
*/
|
|
598
720
|
get CetusClmmSDK(): CetusClmmSDK;
|
|
721
|
+
/**
|
|
722
|
+
* Getter for the VestModule instance.
|
|
723
|
+
* @returns {VestModule} The VestModule instance.
|
|
724
|
+
*/
|
|
725
|
+
get Vest(): VestModule;
|
|
599
726
|
/**
|
|
600
727
|
* Verifies if the sender address is valid.
|
|
601
728
|
* @throws Error if the sender address is invalid.
|
|
@@ -609,7 +736,7 @@ declare class VolatileVaultsSDK {
|
|
|
609
736
|
* @param coinType The type of the coin.
|
|
610
737
|
* @returns an array of coin assets.
|
|
611
738
|
*/
|
|
612
|
-
getOwnerCoinAssets(suiAddress: string, coinType?: string | null
|
|
739
|
+
getOwnerCoinAssets(suiAddress: string, coinType?: string | null): Promise<CoinAsset[]>;
|
|
613
740
|
/**
|
|
614
741
|
* Gets all coin balances for the given owner and coin type.
|
|
615
742
|
*
|
|
@@ -798,6 +925,18 @@ declare function getPositionPriceRange(tick_lower_index: number, tick_upper_inde
|
|
|
798
925
|
minPrice: string;
|
|
799
926
|
maxPrice: string;
|
|
800
927
|
};
|
|
928
|
+
/**
|
|
929
|
+
* Parses the vault vest info from the Sui object response.
|
|
930
|
+
* @param res - The Sui object response containing the vault vest info.
|
|
931
|
+
* @returns The parsed vault vest info.
|
|
932
|
+
*/
|
|
933
|
+
declare function parseVaultsVestInfo(res: SuiObjectResponse): VaultsVestInfo;
|
|
934
|
+
/**
|
|
935
|
+
* Parses the vault vest NFT from the Sui object response.
|
|
936
|
+
* @param res - The Sui object response containing the vault vest NFT.
|
|
937
|
+
* @returns The parsed vault vest NFT.
|
|
938
|
+
*/
|
|
939
|
+
declare function parseVaultVestNFT(res: SuiObjectResponse): VaultVestNFT;
|
|
801
940
|
|
|
802
941
|
declare const checkIsMinOrMaxIndex: (tick: number, type: "min" | "max", tickSpacing: number) => boolean;
|
|
803
942
|
declare function convertU64BytesToDecimal(bytes: number[]): string;
|
|
@@ -861,4 +1000,4 @@ interface InitSDKOptions {
|
|
|
861
1000
|
declare function initVaultSDK(options: InitSDKOptions): VolatileVaultsSDK;
|
|
862
1001
|
declare const defaultProvider: string[];
|
|
863
1002
|
|
|
864
|
-
export { Balances, BigNumber, ClmmPoolBalance, ClmmVault, CollectFeeOptions, CollectRewardOptions, DepositCalculationOptions, DepositCalculationResult, DepositCalculationValueOptions, DepositMode, DepositOptions, FeedInfo, LiquidityRange, LpCallback, PackageConfigs, Pool, PoolCoinTypes, Price, PythNodeError, PythPriceModule, SdkEnv, SdkOptions, VaultsBalance, VaultsConfigs, VaultsModule, VolatileVaultsSDK, WithdrawCalculationOptions, WithdrawCalculationResult, WithdrawMode, WithdrawOptions, WrapperPosition, buildPoolData, buildVaultsBalance, calculateAum, calculateDepositRatioFixTokenA, calculateTotalAumBasedOnQuote, checkIsMinOrMaxIndex, convertU64BytesToDecimal, VolatileVaultsSDK as default, defaultProvider, estCoinAmountsFromTotalAmount, feed_map_mainnet, feed_map_testnet, getCoinAmountsFromRatio, getPositionPriceRange, getPriceWithFormattedDecimals, getPrimitivePricesFromBaseQuote, getQuotePerBaseAndBasePerQuote, getShareBufferAssets, getUpdatePriceType, getVaultValidBalances, get_lp_amount_by_liquidity, get_lp_amount_by_tvl, get_share_liquidity_by_amount, initMainnetSDK, initTestnetSDK, initVaultSDK, oraclePriceMultiplierDecimal, printTransaction, toSuiObjectId, vaults_mainnet, vaults_testnet };
|
|
1003
|
+
export { Balances, BigNumber, ClmmPoolBalance, ClmmVault, CollectFeeOptions, CollectRewardOptions, DepositCalculationOptions, DepositCalculationResult, DepositCalculationValueOptions, DepositMode, DepositOptions, FeedInfo, GlobalVestingPeriod, LiquidityRange, LpCallback, PackageConfigs, PeriodInfo, Pool, PoolCoinTypes, Price, PythNodeError, PythPriceModule, RedeemOption, SdkEnv, SdkOptions, VaultVestNFT, VaultsBalance, VaultsConfigs, VaultsModule, VaultsPosition, VaultsVestInfo, VestConfigs, VestCreateEvent, VestModule, VolatileVaultsSDK, WithdrawCalculationOptions, WithdrawCalculationResult, WithdrawMode, WithdrawOptions, WrapperPosition, buildPoolData, buildVaultsBalance, calculateAum, calculateDepositRatioFixTokenA, calculateTotalAumBasedOnQuote, checkIsMinOrMaxIndex, convertU64BytesToDecimal, VolatileVaultsSDK as default, defaultProvider, estCoinAmountsFromTotalAmount, feed_map_mainnet, feed_map_testnet, getCoinAmountsFromRatio, getPositionPriceRange, getPriceWithFormattedDecimals, getPrimitivePricesFromBaseQuote, getQuotePerBaseAndBasePerQuote, getShareBufferAssets, getUpdatePriceType, getVaultValidBalances, get_lp_amount_by_liquidity, get_lp_amount_by_tvl, get_share_liquidity_by_amount, initMainnetSDK, initTestnetSDK, initVaultSDK, oraclePriceMultiplierDecimal, parseVaultVestNFT, parseVaultsVestInfo, printTransaction, toSuiObjectId, vaults_mainnet, vaults_testnet };
|