haedal-vault-sdk 1.0.2 → 1.0.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/index.d.ts +140 -3
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/docs/vest-test-guide.md +103 -0
- package/package.json +4 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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, SuiAddressType, FullClient, CoinAsset, SuiResource } from '@cetusprotocol/common-sdk';
|
|
3
|
+
import { PaginationArgs, DataPage, CoinPairType, IModule as IModule$1, Package, SuiAddressType, FullClient, CoinAsset, SuiResource } from '@cetusprotocol/common-sdk';
|
|
4
4
|
import { Pool as Pool$1, CetusClmmSDK } from '@cetusprotocol/sui-clmm-sdk';
|
|
5
5
|
import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
6
6
|
import * as _pythnetwork_price_service_sdk from '@pythnetwork/price-service-sdk';
|
|
@@ -500,8 +500,120 @@ declare class PythPriceModule implements IModule {
|
|
|
500
500
|
getFeedInfo(coinType: string, forceRefresh: boolean): Promise<FeedInfo>;
|
|
501
501
|
}
|
|
502
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
|
+
position: VaultsPosition;
|
|
519
|
+
balance: string;
|
|
520
|
+
total_supply: string;
|
|
521
|
+
impaired_a: string;
|
|
522
|
+
impaired_b: string;
|
|
523
|
+
cetus_amount: string;
|
|
524
|
+
redeemed_amount: string;
|
|
525
|
+
allocated_lp_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
|
+
period: number;
|
|
575
|
+
} & CoinPairType;
|
|
576
|
+
|
|
503
577
|
type BigNumber = Decimal.Value | number | string;
|
|
504
578
|
|
|
579
|
+
declare class VestModule implements IModule$1<VolatileVaultsSDK> {
|
|
580
|
+
protected _sdk: VolatileVaultsSDK;
|
|
581
|
+
constructor(sdk: VolatileVaultsSDK);
|
|
582
|
+
get sdk(): VolatileVaultsSDK;
|
|
583
|
+
vestNftIsAvailable(vest_nft_id: string, vester_infos_handle: string): Promise<boolean>;
|
|
584
|
+
/**
|
|
585
|
+
* Get the vest create event list
|
|
586
|
+
* @returns {Promise<VestCreateEvent[]>} The vest create event list
|
|
587
|
+
*/
|
|
588
|
+
getVestCreateEventList(): Promise<VestCreateEvent[]>;
|
|
589
|
+
getVaultsVestInfoList(vault_ids: string[]): Promise<VaultsVestInfo[]>;
|
|
590
|
+
/**
|
|
591
|
+
* Get the vaults vest info
|
|
592
|
+
* @param vault_id - The vault id
|
|
593
|
+
* @param force_refresh - Whether to force refresh the cache
|
|
594
|
+
* @returns {Promise<VaultsVestInfo>} The vaults vest info
|
|
595
|
+
*/
|
|
596
|
+
getVaultsVestInfo(vault_id: string, force_refresh?: boolean): Promise<VaultsVestInfo>;
|
|
597
|
+
/**
|
|
598
|
+
* Get the vault vest event
|
|
599
|
+
* @param vault_id - The vault id
|
|
600
|
+
* @returns {VestCreateEvent} The vault vest event
|
|
601
|
+
*/
|
|
602
|
+
getVaultVestEvent(vault_id: string): Promise<VestCreateEvent>;
|
|
603
|
+
/**
|
|
604
|
+
* Get the vault vest nft list
|
|
605
|
+
* @param owner - The owner address
|
|
606
|
+
* @returns {Promise<VaultVestNFT[]>} The vault vest nft list
|
|
607
|
+
*/
|
|
608
|
+
getOwnerVaultVestNFT(owner: string): Promise<VaultVestNFT[]>;
|
|
609
|
+
/**
|
|
610
|
+
* Build the redeem payload
|
|
611
|
+
* @param options - The redeem options
|
|
612
|
+
* @returns {Transaction} The redeem payload
|
|
613
|
+
*/
|
|
614
|
+
buildRedeemPayload(options: RedeemOption[], tx?: Transaction): Promise<Transaction>;
|
|
615
|
+
}
|
|
616
|
+
|
|
505
617
|
/**
|
|
506
618
|
* Represents options and configurations for an SDK.
|
|
507
619
|
*/
|
|
@@ -526,6 +638,10 @@ type SdkOptions = {
|
|
|
526
638
|
* Vaults configuration.
|
|
527
639
|
*/
|
|
528
640
|
vaults: VaultsConfigs;
|
|
641
|
+
/**
|
|
642
|
+
* Vest configuration.
|
|
643
|
+
*/
|
|
644
|
+
vest?: Package<VestConfigs>;
|
|
529
645
|
};
|
|
530
646
|
/**
|
|
531
647
|
* The entry class of VolatileVaultsSDK, which is almost responsible for all interactions with Vaults.
|
|
@@ -552,6 +668,10 @@ declare class VolatileVaultsSDK {
|
|
|
552
668
|
* Client for interacting with the Aggregator service.
|
|
553
669
|
*/
|
|
554
670
|
protected _aggregatorClient: AggregatorClient;
|
|
671
|
+
/**
|
|
672
|
+
* Module for interacting with vest.
|
|
673
|
+
*/
|
|
674
|
+
protected _vest: VestModule;
|
|
555
675
|
/**
|
|
556
676
|
* SDK for interacting with Cetus CLMM (Constant Product Automated Market Maker).
|
|
557
677
|
*/
|
|
@@ -597,6 +717,11 @@ declare class VolatileVaultsSDK {
|
|
|
597
717
|
* @returns {CetusClmmSDK} The CetusClmmSDK instance.
|
|
598
718
|
*/
|
|
599
719
|
get CetusClmmSDK(): CetusClmmSDK;
|
|
720
|
+
/**
|
|
721
|
+
* Getter for the VestModule instance.
|
|
722
|
+
* @returns {VestModule} The VestModule instance.
|
|
723
|
+
*/
|
|
724
|
+
get Vest(): VestModule;
|
|
600
725
|
/**
|
|
601
726
|
* Verifies if the sender address is valid.
|
|
602
727
|
* @throws Error if the sender address is invalid.
|
|
@@ -799,6 +924,18 @@ declare function getPositionPriceRange(tick_lower_index: number, tick_upper_inde
|
|
|
799
924
|
minPrice: string;
|
|
800
925
|
maxPrice: string;
|
|
801
926
|
};
|
|
927
|
+
/**
|
|
928
|
+
* Parses the vault vest info from the Sui object response.
|
|
929
|
+
* @param res - The Sui object response containing the vault vest info.
|
|
930
|
+
* @returns The parsed vault vest info.
|
|
931
|
+
*/
|
|
932
|
+
declare function parseVaultsVestInfo(res: SuiObjectResponse): VaultsVestInfo;
|
|
933
|
+
/**
|
|
934
|
+
* Parses the vault vest NFT from the Sui object response.
|
|
935
|
+
* @param res - The Sui object response containing the vault vest NFT.
|
|
936
|
+
* @returns The parsed vault vest NFT.
|
|
937
|
+
*/
|
|
938
|
+
declare function parseVaultVestNFT(res: SuiObjectResponse): VaultVestNFT;
|
|
802
939
|
|
|
803
940
|
declare const checkIsMinOrMaxIndex: (tick: number, type: "min" | "max", tickSpacing: number) => boolean;
|
|
804
941
|
declare function convertU64BytesToDecimal(bytes: number[]): string;
|
|
@@ -862,4 +999,4 @@ interface InitSDKOptions {
|
|
|
862
999
|
declare function initVaultSDK(options: InitSDKOptions): VolatileVaultsSDK;
|
|
863
1000
|
declare const defaultProvider: string[];
|
|
864
1001
|
|
|
865
|
-
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 };
|
|
1002
|
+
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 };
|