haedal-vault-sdk 1.0.2 → 1.1.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/dist/index.d.ts +145 -4
- 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,8 +1,8 @@
|
|
|
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
|
-
import {
|
|
5
|
+
import { TransactionObjectArgument, Transaction } from '@mysten/sui/transactions';
|
|
6
6
|
import * as _pythnetwork_price_service_sdk from '@pythnetwork/price-service-sdk';
|
|
7
7
|
import { SuiPriceServiceConnection, SuiPythClient } from '@pythnetwork/pyth-sui-js';
|
|
8
8
|
import BN from 'bn.js';
|
|
@@ -150,6 +150,10 @@ type WithdrawOptions = {
|
|
|
150
150
|
mode: WithdrawMode;
|
|
151
151
|
slippage?: number;
|
|
152
152
|
partner?: string;
|
|
153
|
+
extra_burn?: {
|
|
154
|
+
lp_burn_coin: TransactionObjectArgument;
|
|
155
|
+
burn_lp_amount: string;
|
|
156
|
+
};
|
|
153
157
|
};
|
|
154
158
|
type WithdrawMode = 'FixedOneSide' | 'OnlyCoinA' | 'OnlyCoinB';
|
|
155
159
|
type WithdrawCalculationOptions = {
|
|
@@ -500,8 +504,120 @@ declare class PythPriceModule implements IModule {
|
|
|
500
504
|
getFeedInfo(coinType: string, forceRefresh: boolean): Promise<FeedInfo>;
|
|
501
505
|
}
|
|
502
506
|
|
|
507
|
+
type VestConfigs = {
|
|
508
|
+
versioned_id: string;
|
|
509
|
+
create_event_list: VestCreateEvent[];
|
|
510
|
+
};
|
|
511
|
+
type GlobalVestingPeriod = {
|
|
512
|
+
period: number;
|
|
513
|
+
release_time: string;
|
|
514
|
+
cetus_amount: string;
|
|
515
|
+
redeemed_amount: string;
|
|
516
|
+
};
|
|
517
|
+
type VaultsVestInfo = {
|
|
518
|
+
id: string;
|
|
519
|
+
vault_id: string;
|
|
520
|
+
index: number;
|
|
521
|
+
lp_coin_type: string;
|
|
522
|
+
position: VaultsPosition;
|
|
523
|
+
balance: string;
|
|
524
|
+
total_supply: string;
|
|
525
|
+
impaired_a: string;
|
|
526
|
+
impaired_b: string;
|
|
527
|
+
cetus_amount: string;
|
|
528
|
+
redeemed_amount: string;
|
|
529
|
+
allocated_lp_amount: string;
|
|
530
|
+
start_time: string;
|
|
531
|
+
global_vesting_periods: GlobalVestingPeriod[];
|
|
532
|
+
vest_infos: {
|
|
533
|
+
id: string;
|
|
534
|
+
size: string;
|
|
535
|
+
};
|
|
536
|
+
url: string;
|
|
537
|
+
} & CoinPairType;
|
|
538
|
+
type VaultsPosition = {
|
|
539
|
+
description: string;
|
|
540
|
+
id: string;
|
|
541
|
+
index: number;
|
|
542
|
+
liquidity: string;
|
|
543
|
+
name: string;
|
|
544
|
+
pool_id: string;
|
|
545
|
+
tick_lower_index: number;
|
|
546
|
+
tick_upper_index: number;
|
|
547
|
+
url: string;
|
|
548
|
+
} & CoinPairType;
|
|
549
|
+
type PeriodInfo = {
|
|
550
|
+
period: number;
|
|
551
|
+
cetus_amount: string;
|
|
552
|
+
is_redeemed: boolean;
|
|
553
|
+
};
|
|
554
|
+
type VestCreateEvent = {
|
|
555
|
+
clmm_vester_id: string;
|
|
556
|
+
lp_coin_type: string;
|
|
557
|
+
pool_id: string;
|
|
558
|
+
position_id: string;
|
|
559
|
+
vault_id: string;
|
|
560
|
+
vault_vester_id: string;
|
|
561
|
+
};
|
|
562
|
+
type VaultVestNFT = {
|
|
563
|
+
id: string;
|
|
564
|
+
index: number;
|
|
565
|
+
vault_id: string;
|
|
566
|
+
lp_amount: string;
|
|
567
|
+
redeemed_amount: string;
|
|
568
|
+
impaired_a: string;
|
|
569
|
+
impaired_b: string;
|
|
570
|
+
period_infos: PeriodInfo[];
|
|
571
|
+
url: string;
|
|
572
|
+
name: string;
|
|
573
|
+
vester_id: string;
|
|
574
|
+
};
|
|
575
|
+
type RedeemOption = {
|
|
576
|
+
vault_id: string;
|
|
577
|
+
vesting_nft_id: string;
|
|
578
|
+
period: number;
|
|
579
|
+
} & CoinPairType;
|
|
580
|
+
|
|
503
581
|
type BigNumber = Decimal.Value | number | string;
|
|
504
582
|
|
|
583
|
+
declare class VestModule implements IModule$1<VolatileVaultsSDK> {
|
|
584
|
+
protected _sdk: VolatileVaultsSDK;
|
|
585
|
+
constructor(sdk: VolatileVaultsSDK);
|
|
586
|
+
get sdk(): VolatileVaultsSDK;
|
|
587
|
+
vestNftIsAvailable(vest_nft_id: string, vester_infos_handle: string): Promise<boolean>;
|
|
588
|
+
/**
|
|
589
|
+
* Get the vest create event list
|
|
590
|
+
* @returns {Promise<VestCreateEvent[]>} The vest create event list
|
|
591
|
+
*/
|
|
592
|
+
getVestCreateEventList(): Promise<VestCreateEvent[]>;
|
|
593
|
+
getVaultsVestInfoList(vault_ids: string[]): Promise<VaultsVestInfo[]>;
|
|
594
|
+
/**
|
|
595
|
+
* Get the vaults vest info
|
|
596
|
+
* @param vault_id - The vault id
|
|
597
|
+
* @param force_refresh - Whether to force refresh the cache
|
|
598
|
+
* @returns {Promise<VaultsVestInfo>} The vaults vest info
|
|
599
|
+
*/
|
|
600
|
+
getVaultsVestInfo(vault_id: string, force_refresh?: boolean): Promise<VaultsVestInfo>;
|
|
601
|
+
/**
|
|
602
|
+
* Get the vault vest event
|
|
603
|
+
* @param vault_id - The vault id
|
|
604
|
+
* @returns {VestCreateEvent} The vault vest event
|
|
605
|
+
*/
|
|
606
|
+
getVaultVestEvent(vault_id: string): Promise<VestCreateEvent>;
|
|
607
|
+
/**
|
|
608
|
+
* Get the vault vest nft list
|
|
609
|
+
* @param owner - The owner address
|
|
610
|
+
* @returns {Promise<VaultVestNFT[]>} The vault vest nft list
|
|
611
|
+
*/
|
|
612
|
+
getOwnerVaultVestNFT(owner: string): Promise<VaultVestNFT[]>;
|
|
613
|
+
/**
|
|
614
|
+
* Build the redeem payload
|
|
615
|
+
* @param options - The redeem options
|
|
616
|
+
* @returns {Transaction} The redeem payload
|
|
617
|
+
*/
|
|
618
|
+
buildRedeemPayload(options: RedeemOption[], tx?: Transaction): Promise<Transaction>;
|
|
619
|
+
}
|
|
620
|
+
|
|
505
621
|
/**
|
|
506
622
|
* Represents options and configurations for an SDK.
|
|
507
623
|
*/
|
|
@@ -526,6 +642,10 @@ type SdkOptions = {
|
|
|
526
642
|
* Vaults configuration.
|
|
527
643
|
*/
|
|
528
644
|
vaults: VaultsConfigs;
|
|
645
|
+
/**
|
|
646
|
+
* Vest configuration.
|
|
647
|
+
*/
|
|
648
|
+
vest?: Package<VestConfigs>;
|
|
529
649
|
};
|
|
530
650
|
/**
|
|
531
651
|
* The entry class of VolatileVaultsSDK, which is almost responsible for all interactions with Vaults.
|
|
@@ -552,6 +672,10 @@ declare class VolatileVaultsSDK {
|
|
|
552
672
|
* Client for interacting with the Aggregator service.
|
|
553
673
|
*/
|
|
554
674
|
protected _aggregatorClient: AggregatorClient;
|
|
675
|
+
/**
|
|
676
|
+
* Module for interacting with vest.
|
|
677
|
+
*/
|
|
678
|
+
protected _vest: VestModule;
|
|
555
679
|
/**
|
|
556
680
|
* SDK for interacting with Cetus CLMM (Constant Product Automated Market Maker).
|
|
557
681
|
*/
|
|
@@ -597,6 +721,11 @@ declare class VolatileVaultsSDK {
|
|
|
597
721
|
* @returns {CetusClmmSDK} The CetusClmmSDK instance.
|
|
598
722
|
*/
|
|
599
723
|
get CetusClmmSDK(): CetusClmmSDK;
|
|
724
|
+
/**
|
|
725
|
+
* Getter for the VestModule instance.
|
|
726
|
+
* @returns {VestModule} The VestModule instance.
|
|
727
|
+
*/
|
|
728
|
+
get Vest(): VestModule;
|
|
600
729
|
/**
|
|
601
730
|
* Verifies if the sender address is valid.
|
|
602
731
|
* @throws Error if the sender address is invalid.
|
|
@@ -799,6 +928,18 @@ declare function getPositionPriceRange(tick_lower_index: number, tick_upper_inde
|
|
|
799
928
|
minPrice: string;
|
|
800
929
|
maxPrice: string;
|
|
801
930
|
};
|
|
931
|
+
/**
|
|
932
|
+
* Parses the vault vest info from the Sui object response.
|
|
933
|
+
* @param res - The Sui object response containing the vault vest info.
|
|
934
|
+
* @returns The parsed vault vest info.
|
|
935
|
+
*/
|
|
936
|
+
declare function parseVaultsVestInfo(res: SuiObjectResponse): VaultsVestInfo;
|
|
937
|
+
/**
|
|
938
|
+
* Parses the vault vest NFT from the Sui object response.
|
|
939
|
+
* @param res - The Sui object response containing the vault vest NFT.
|
|
940
|
+
* @returns The parsed vault vest NFT.
|
|
941
|
+
*/
|
|
942
|
+
declare function parseVaultVestNFT(res: SuiObjectResponse): VaultVestNFT;
|
|
802
943
|
|
|
803
944
|
declare const checkIsMinOrMaxIndex: (tick: number, type: "min" | "max", tickSpacing: number) => boolean;
|
|
804
945
|
declare function convertU64BytesToDecimal(bytes: number[]): string;
|
|
@@ -862,4 +1003,4 @@ interface InitSDKOptions {
|
|
|
862
1003
|
declare function initVaultSDK(options: InitSDKOptions): VolatileVaultsSDK;
|
|
863
1004
|
declare const defaultProvider: string[];
|
|
864
1005
|
|
|
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 };
|
|
1006
|
+
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 };
|