@myx-trade/sdk 0.1.192 → 0.1.194
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 +197 -136
- package/dist/index.d.ts +197 -136
- package/dist/index.js +354 -466
- package/dist/index.mjs +353 -448
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as ethers from 'ethers';
|
|
2
|
+
import { AddressLike, Signer, ethers as ethers$1 } from 'ethers';
|
|
2
3
|
export { formatUnits, parseUnits } from 'ethers';
|
|
3
4
|
import { Options, Event } from 'reconnecting-websocket';
|
|
4
5
|
import { WalletClient } from 'viem';
|
|
@@ -48,49 +49,49 @@ interface CancelTpSLParams {
|
|
|
48
49
|
orderId: string;
|
|
49
50
|
}
|
|
50
51
|
|
|
51
|
-
declare const createPool: ({ chainId, baseToken, marketId }: CreatePoolRequest) => Promise<
|
|
52
|
+
declare const createPool: ({ chainId, baseToken, marketId }: CreatePoolRequest) => Promise<string | undefined>;
|
|
52
53
|
|
|
53
|
-
declare const getMarketPoolId: ({ chainId, baseToken, marketId, }: CreatePoolRequest) => Promise<
|
|
54
|
-
declare const getMarketPools: (chainId: ChainId) => Promise<
|
|
54
|
+
declare const getMarketPoolId: ({ chainId, baseToken, marketId, }: CreatePoolRequest) => Promise<string | undefined>;
|
|
55
|
+
declare const getMarketPools: (chainId: ChainId) => Promise<string[]>;
|
|
55
56
|
declare const getPoolInfo$1: (chainId: ChainId, poolId: string, marketPrice?: bigint) => Promise<{
|
|
56
57
|
quotePool: {
|
|
57
|
-
poolToken:
|
|
58
|
-
exchangeRate:
|
|
59
|
-
poolTokenPrice:
|
|
60
|
-
poolTokenSupply:
|
|
58
|
+
poolToken: string;
|
|
59
|
+
exchangeRate: bigint;
|
|
60
|
+
poolTokenPrice: bigint;
|
|
61
|
+
poolTokenSupply: bigint;
|
|
61
62
|
};
|
|
62
63
|
basePool: {
|
|
63
|
-
poolToken:
|
|
64
|
-
exchangeRate:
|
|
65
|
-
poolTokenPrice:
|
|
66
|
-
poolTokenSupply:
|
|
64
|
+
poolToken: string;
|
|
65
|
+
exchangeRate: bigint;
|
|
66
|
+
poolTokenPrice: bigint;
|
|
67
|
+
poolTokenSupply: bigint;
|
|
67
68
|
};
|
|
68
69
|
reserveInfo: {
|
|
69
|
-
baseTotalAmount:
|
|
70
|
-
baseReservedAmount:
|
|
71
|
-
quoteTotalAmount:
|
|
72
|
-
quoteReservedAmount:
|
|
70
|
+
baseTotalAmount: bigint;
|
|
71
|
+
baseReservedAmount: bigint;
|
|
72
|
+
quoteTotalAmount: bigint;
|
|
73
|
+
quoteReservedAmount: bigint;
|
|
73
74
|
};
|
|
74
75
|
fundingInfo: {
|
|
75
|
-
nextFundingRate:
|
|
76
|
-
lastFundingFeeTracker:
|
|
77
|
-
nextEpochTime:
|
|
76
|
+
nextFundingRate: bigint;
|
|
77
|
+
lastFundingFeeTracker: bigint;
|
|
78
|
+
nextEpochTime: bigint;
|
|
78
79
|
};
|
|
79
80
|
ioTracker: {
|
|
80
|
-
tracker:
|
|
81
|
-
longSize:
|
|
82
|
-
shortSize:
|
|
83
|
-
poolEntryPrice:
|
|
81
|
+
tracker: bigint;
|
|
82
|
+
longSize: bigint;
|
|
83
|
+
shortSize: bigint;
|
|
84
|
+
poolEntryPrice: bigint;
|
|
84
85
|
};
|
|
85
86
|
}>;
|
|
86
87
|
|
|
87
|
-
declare const getUserGenesisShare: (chainId: ChainId, tokenAddress: string, account: string) => Promise<
|
|
88
|
+
declare const getUserGenesisShare: (chainId: ChainId, tokenAddress: string, account: string) => Promise<bigint>;
|
|
88
89
|
|
|
89
|
-
declare const addTpSl: (params: AddTpSLParams) => Promise<
|
|
90
|
+
declare const addTpSl: (params: AddTpSLParams) => Promise<ethers.ContractTransactionReceipt | null>;
|
|
90
91
|
|
|
91
|
-
declare const cancelTpSl: (params: CancelTpSLParams) => Promise<
|
|
92
|
+
declare const cancelTpSl: (params: CancelTpSLParams) => Promise<ethers.ContractTransactionReceipt | null>;
|
|
92
93
|
|
|
93
|
-
declare const reprime: (chainId: ChainId, poolId: string, marketId: string) => Promise<
|
|
94
|
+
declare const reprime: (chainId: ChainId, poolId: string, marketId: string) => Promise<ethers.ContractTransactionReceipt | null>;
|
|
94
95
|
|
|
95
96
|
/**
|
|
96
97
|
* Trading related types and enums
|
|
@@ -645,10 +646,6 @@ interface HistoryOrderItem {
|
|
|
645
646
|
userLeverage: number;
|
|
646
647
|
cancelReason?: string;
|
|
647
648
|
}
|
|
648
|
-
/**
|
|
649
|
-
* Get history orders
|
|
650
|
-
*/
|
|
651
|
-
declare const getHistoryOrders: ({ accessToken, address, ...params }: GetHistoryOrdersParams & AccessTokenRequest, envParams: HttpEnvParams) => Promise<ApiResponse<HistoryOrderItem[]>>;
|
|
652
649
|
/**
|
|
653
650
|
* Get position history
|
|
654
651
|
*/
|
|
@@ -684,7 +681,6 @@ interface PositionHistoryItem {
|
|
|
684
681
|
closeType: CloseTypeEnum;
|
|
685
682
|
avgClosePrice: string;
|
|
686
683
|
}
|
|
687
|
-
declare const getPositionHistory: ({ accessToken, address, ...params }: GetHistoryOrdersParams & AccessTokenRequest, envParams: HttpEnvParams) => Promise<ApiResponse<PositionHistoryItem[]>>;
|
|
688
684
|
/**
|
|
689
685
|
* Get Trade Flow
|
|
690
686
|
*/
|
|
@@ -715,7 +711,6 @@ interface TradeFlowItem {
|
|
|
715
711
|
referralRebate: string;
|
|
716
712
|
rebateClaimedAmount: string;
|
|
717
713
|
}
|
|
718
|
-
declare const getTradeFlow: ({ accessToken, address, ...params }: GetHistoryOrdersParams & AccessTokenRequest, envParams: HttpEnvParams) => Promise<ApiResponse<TradeFlowItem[]>>;
|
|
719
714
|
|
|
720
715
|
type ForwarderTxParams = {
|
|
721
716
|
from: string;
|
|
@@ -727,7 +722,6 @@ type ForwarderTxParams = {
|
|
|
727
722
|
deadline: number;
|
|
728
723
|
signature: string;
|
|
729
724
|
};
|
|
730
|
-
declare const forwarderTxApi: (params: ForwarderTxParams, chainId: number, isProd?: boolean) => Promise<ApiResponse<any>>;
|
|
731
725
|
type FetchForwarderGetParams = {
|
|
732
726
|
requestId: string;
|
|
733
727
|
};
|
|
@@ -743,11 +737,8 @@ type FetchForwarderGetResponseData = {
|
|
|
743
737
|
reason: string;
|
|
744
738
|
};
|
|
745
739
|
type FetchForwarderGetResponse = BaseResponse<FetchForwarderGetResponseData>;
|
|
746
|
-
declare const fetchForwarderGetApi: (params: FetchForwarderGetParams, isProd?: boolean) => Promise<FetchForwarderGetResponse>;
|
|
747
740
|
|
|
748
|
-
declare const getPoolList: (
|
|
749
|
-
isProd?: boolean;
|
|
750
|
-
}) => Promise<ApiResponse<any[]>>;
|
|
741
|
+
declare const getPoolList: () => Promise<ApiResponse<any[]>>;
|
|
751
742
|
interface PoolSymbolAllResponse {
|
|
752
743
|
chainId: number;
|
|
753
744
|
marketId: string;
|
|
@@ -756,13 +747,10 @@ interface PoolSymbolAllResponse {
|
|
|
756
747
|
quoteSymbol: string;
|
|
757
748
|
baseTokenIcon: string;
|
|
758
749
|
}
|
|
759
|
-
declare const getPoolSymbolAll: ({ isProd, }: {
|
|
760
|
-
isProd?: boolean;
|
|
761
|
-
}) => Promise<ApiResponse<PoolSymbolAllResponse[]>>;
|
|
762
750
|
|
|
763
|
-
declare const getBaseUrlByEnv: (isProd
|
|
764
|
-
declare const getForwardUrlByEnv: (isProd
|
|
765
|
-
declare const getOraclePrice: (chainId: ChainId, poolIds?: string[]
|
|
751
|
+
declare const getBaseUrlByEnv: (isProd?: boolean) => "https://api.myx.finance" | "https://api-test.myx.cash";
|
|
752
|
+
declare const getForwardUrlByEnv: (isProd?: boolean) => string;
|
|
753
|
+
declare const getOraclePrice: (chainId: ChainId, poolIds?: string[]) => Promise<PriceResponse>;
|
|
766
754
|
interface LevelConfig {
|
|
767
755
|
fundingFeeRate1: number;
|
|
768
756
|
fundingFeeRate1Max: number;
|
|
@@ -790,11 +778,8 @@ interface GetPoolLevelConfigParams {
|
|
|
790
778
|
/**
|
|
791
779
|
* Get Pool Level Config
|
|
792
780
|
*/
|
|
793
|
-
declare const getPoolLevelConfig: ({ poolId, chainId, isProd, }: GetPoolLevelConfigParams) => Promise<ApiResponse<PoolLevelConfig>>;
|
|
794
781
|
declare const getPoolDetail: (chainId: number, poolId: string, isProd?: boolean) => Promise<PoolResponse>;
|
|
795
|
-
declare const
|
|
796
|
-
declare const getOrders: (accessToken: string, address: string, isProd?: boolean) => Promise<PositionResponse>;
|
|
797
|
-
declare const getPoolOpenOrders: (accessToken: string, address: string, chainId: ChainId, isProd?: boolean) => Promise<PoolOpenOrdersResponse>;
|
|
782
|
+
declare const getPoolOpenOrders: (accessToken: string, address: string, chainId: ChainId) => Promise<PoolOpenOrdersResponse>;
|
|
798
783
|
/**
|
|
799
784
|
* Get Kline Data
|
|
800
785
|
*/
|
|
@@ -805,17 +790,14 @@ interface GetKlineDataParams {
|
|
|
805
790
|
limit: number;
|
|
806
791
|
interval: HttpKlineIntervalEnum;
|
|
807
792
|
}
|
|
808
|
-
declare const getKlineData: ({ chainId, poolId, endTime, limit, interval }: GetKlineDataParams, envParams: HttpEnvParams) => Promise<ApiResponse<KlineDataItemType[]>>;
|
|
809
793
|
/**
|
|
810
794
|
* Get Kline Latest Bar
|
|
811
795
|
*/
|
|
812
|
-
declare const getKlineLatestBar: (params: Pick<GetKlineDataParams, "chainId" | "poolId" | "interval">, envParams: HttpEnvParams) => Promise<ApiResponse<KlineDataItemType>>;
|
|
813
796
|
interface GetTickerDataParams {
|
|
814
797
|
chainId: ChainId;
|
|
815
798
|
poolIds: string[];
|
|
816
799
|
}
|
|
817
800
|
declare const getTickerData: ({ chainId, poolIds }: GetTickerDataParams, envParams: HttpEnvParams) => Promise<ApiResponse<TickerDataItem[]>>;
|
|
818
|
-
declare const getAllTickers: (envParams: HttpEnvParams) => Promise<ApiResponse<TickerDataItem[]>>;
|
|
819
801
|
/**
|
|
820
802
|
* search
|
|
821
803
|
*/
|
|
@@ -825,8 +807,6 @@ interface SearchMarketParams {
|
|
|
825
807
|
type?: SearchSecondTypeEnum;
|
|
826
808
|
searchKey?: string;
|
|
827
809
|
}
|
|
828
|
-
declare const searchMarketAuth: ({ accessToken, address, ...params }: SearchMarketParams & AccessTokenRequest, envParams: HttpEnvParams) => Promise<ApiResponse<SearchResultResponse>>;
|
|
829
|
-
declare const searchMarket: ({ ...params }: SearchMarketParams, envParams: HttpEnvParams) => Promise<ApiResponse<SearchResultResponse>>;
|
|
830
810
|
/**
|
|
831
811
|
* favorite
|
|
832
812
|
*/
|
|
@@ -834,12 +814,10 @@ interface AddFavoriteParams {
|
|
|
834
814
|
poolId: string;
|
|
835
815
|
chainId: ChainId;
|
|
836
816
|
}
|
|
837
|
-
declare const addFavorite: ({ accessToken, address, ...params }: AddFavoriteParams & AccessTokenRequest, envParams: HttpEnvParams) => Promise<ApiResponse<null>>;
|
|
838
817
|
interface RemoveFavoriteParams {
|
|
839
818
|
poolId: string;
|
|
840
819
|
chainId: ChainId;
|
|
841
820
|
}
|
|
842
|
-
declare const removeFavorite: ({ accessToken, address, ...params }: RemoveFavoriteParams & AccessTokenRequest, envParams: HttpEnvParams) => Promise<ApiResponse<null>>;
|
|
843
821
|
/**
|
|
844
822
|
* Favorites List
|
|
845
823
|
*/
|
|
@@ -852,18 +830,17 @@ interface FavoritesListParams {
|
|
|
852
830
|
timeInterval?: FavoritesTimeInterval;
|
|
853
831
|
chainId: ChainId | 0;
|
|
854
832
|
}
|
|
855
|
-
declare const getFavoritesList: ({ accessToken, address, ...params }: FavoritesListParams & AccessTokenRequest, envParams: HttpEnvParams) => Promise<ApiResponse<FavoritesListItem[]>>;
|
|
856
833
|
interface GetBaseDetailParams {
|
|
857
834
|
chainId: ChainId;
|
|
858
835
|
poolId: string;
|
|
859
836
|
}
|
|
860
|
-
declare const getBaseDetail: ({ ...params }: GetBaseDetailParams
|
|
837
|
+
declare const getBaseDetail: ({ ...params }: GetBaseDetailParams) => Promise<ApiResponse<BaseDetailResponse>>;
|
|
861
838
|
interface GetMarketDetailParams {
|
|
862
839
|
chainId: number;
|
|
863
840
|
poolId: string;
|
|
864
841
|
}
|
|
865
|
-
declare const getMarketDetail: ({ ...params }: GetMarketDetailParams
|
|
866
|
-
declare const getMarketList: (
|
|
842
|
+
declare const getMarketDetail: ({ ...params }: GetMarketDetailParams) => Promise<ApiResponse<MarketDetailResponse>>;
|
|
843
|
+
declare const getMarketList: () => Promise<ApiResponse<MarketInfo[]>>;
|
|
867
844
|
|
|
868
845
|
declare const getPoolInfo: (chainId: ChainId, poolId: string) => Promise<MarketPool | undefined>;
|
|
869
846
|
|
|
@@ -923,21 +900,21 @@ interface PreviewWithdrawDataParams {
|
|
|
923
900
|
amount: string | number;
|
|
924
901
|
}
|
|
925
902
|
|
|
926
|
-
declare const claimBasePoolRebate: (params: ClaimParams) => Promise<
|
|
927
|
-
declare const claimBasePoolRebates: (params: ClaimRebatesParams) => Promise<
|
|
903
|
+
declare const claimBasePoolRebate: (params: ClaimParams) => Promise<ethers.ContractTransactionResponse | undefined>;
|
|
904
|
+
declare const claimBasePoolRebates: (params: ClaimRebatesParams) => Promise<ethers.ContractTransactionResponse | undefined>;
|
|
928
905
|
|
|
929
|
-
declare const deposit$1: (params: Deposit) => Promise<
|
|
906
|
+
declare const deposit$1: (params: Deposit) => Promise<ethers.ContractTransactionResponse | undefined>;
|
|
930
907
|
|
|
931
|
-
declare const withdraw$1: (params: WithdrawParams) => Promise<
|
|
908
|
+
declare const withdraw$1: (params: WithdrawParams) => Promise<ethers.ContractTransactionReceipt | null | undefined>;
|
|
932
909
|
|
|
933
|
-
declare const getRewards$1: (params: RewardsParams) => Promise<
|
|
910
|
+
declare const getRewards$1: (params: RewardsParams) => Promise<bigint | undefined>;
|
|
934
911
|
|
|
935
912
|
declare const previewUserWithdrawData: ({ chainId, account, poolId, amount }: PreviewWithdrawDataParams) => Promise<{
|
|
936
|
-
baseAmountOut:
|
|
937
|
-
rebateAmount:
|
|
913
|
+
baseAmountOut: bigint;
|
|
914
|
+
rebateAmount: bigint;
|
|
938
915
|
} | undefined>;
|
|
939
916
|
|
|
940
|
-
declare const getLpPrice$1: (chainId: ChainId, poolId: string) => Promise<
|
|
917
|
+
declare const getLpPrice$1: (chainId: ChainId, poolId: string) => Promise<bigint | undefined>;
|
|
941
918
|
|
|
942
919
|
declare const index$2_claimBasePoolRebate: typeof claimBasePoolRebate;
|
|
943
920
|
declare const index$2_claimBasePoolRebates: typeof claimBasePoolRebates;
|
|
@@ -946,18 +923,18 @@ declare namespace index$2 {
|
|
|
946
923
|
export { index$2_claimBasePoolRebate as claimBasePoolRebate, index$2_claimBasePoolRebates as claimBasePoolRebates, deposit$1 as deposit, getLpPrice$1 as getLpPrice, getRewards$1 as getRewards, index$2_previewUserWithdrawData as previewUserWithdrawData, withdraw$1 as withdraw };
|
|
947
924
|
}
|
|
948
925
|
|
|
949
|
-
declare const deposit: (params: Deposit) => Promise<
|
|
926
|
+
declare const deposit: (params: Deposit) => Promise<ethers.ContractTransactionResponse | undefined>;
|
|
950
927
|
|
|
951
|
-
declare const withdraw: (params: WithdrawParams) => Promise<
|
|
928
|
+
declare const withdraw: (params: WithdrawParams) => Promise<ethers.ContractTransactionReceipt | null | undefined>;
|
|
952
929
|
|
|
953
|
-
declare const transfer: (chainId: ChainId, fromPoolId: string, toPoolId: string, amount: number) => Promise<
|
|
930
|
+
declare const transfer: (chainId: ChainId, fromPoolId: string, toPoolId: string, amount: number) => Promise<ethers.ContractTransactionResponse | null>;
|
|
954
931
|
|
|
955
|
-
declare const getRewards: (params: RewardsParams) => Promise<
|
|
932
|
+
declare const getRewards: (params: RewardsParams) => Promise<bigint | undefined>;
|
|
956
933
|
|
|
957
|
-
declare const claimQuotePoolRebate: (params: ClaimParams) => Promise<
|
|
958
|
-
declare const claimQuotePoolRebates: (params: ClaimRebatesParams) => Promise<
|
|
934
|
+
declare const claimQuotePoolRebate: (params: ClaimParams) => Promise<ethers.ContractTransactionResponse | undefined>;
|
|
935
|
+
declare const claimQuotePoolRebates: (params: ClaimRebatesParams) => Promise<ethers.ContractTransactionResponse | undefined>;
|
|
959
936
|
|
|
960
|
-
declare const getLpPrice: (chainId: ChainId, poolId: string) => Promise<
|
|
937
|
+
declare const getLpPrice: (chainId: ChainId, poolId: string) => Promise<bigint | undefined>;
|
|
961
938
|
|
|
962
939
|
declare const index$1_claimQuotePoolRebate: typeof claimQuotePoolRebate;
|
|
963
940
|
declare const index$1_claimQuotePoolRebates: typeof claimQuotePoolRebates;
|
|
@@ -970,9 +947,16 @@ declare namespace index$1 {
|
|
|
970
947
|
export { index$1_claimQuotePoolRebate as claimQuotePoolRebate, index$1_claimQuotePoolRebates as claimQuotePoolRebates, index$1_deposit as deposit, index$1_getLpPrice as getLpPrice, index$1_getRewards as getRewards, index$1_transfer as transfer, index$1_withdraw as withdraw };
|
|
971
948
|
}
|
|
972
949
|
|
|
973
|
-
declare const getMarket: (chainId: ChainId, marketId: string) => Promise<
|
|
950
|
+
declare const getMarket: (chainId: ChainId, marketId: string) => Promise<([string, bigint, bigint, bigint, bigint, bigint] & {
|
|
951
|
+
quoteToken: string;
|
|
952
|
+
baseReserveRatio: bigint;
|
|
953
|
+
quoteReserveRatio: bigint;
|
|
954
|
+
oracleFeeUsd: bigint;
|
|
955
|
+
oracleRefundFeeUsd: bigint;
|
|
956
|
+
poolPrimeThreshold: bigint;
|
|
957
|
+
}) | undefined>;
|
|
974
958
|
|
|
975
|
-
declare const getOracleFee: (chainId: ChainId, marketId: string) => Promise<
|
|
959
|
+
declare const getOracleFee: (chainId: ChainId, marketId: string) => Promise<bigint | undefined>;
|
|
976
960
|
|
|
977
961
|
declare const index_getMarket: typeof getMarket;
|
|
978
962
|
declare const index_getOracleFee: typeof getOracleFee;
|
|
@@ -988,7 +972,7 @@ declare const getPricesData: (chainId: ChainId, poolIds: string[]) => Promise<{
|
|
|
988
972
|
oracleType: OracleType;
|
|
989
973
|
vaa: string;
|
|
990
974
|
}[] | undefined>;
|
|
991
|
-
declare const getPriceData: (chainId: ChainId, poolId: string
|
|
975
|
+
declare const getPriceData: (chainId: ChainId, poolId: string) => Promise<{
|
|
992
976
|
poolId: string;
|
|
993
977
|
price: string;
|
|
994
978
|
value: bigint;
|
|
@@ -1015,9 +999,9 @@ declare const bigintAmountSlipperCalculator: (amount: bigint, slipper?: Number)
|
|
|
1015
999
|
declare const getTokenInfo: (chainId: number, tokenAddress: string, account?: string) => Promise<{
|
|
1016
1000
|
balance?: number | undefined;
|
|
1017
1001
|
address: string;
|
|
1018
|
-
name:
|
|
1019
|
-
symbol:
|
|
1020
|
-
decimals:
|
|
1002
|
+
name: string;
|
|
1003
|
+
symbol: string;
|
|
1004
|
+
decimals: bigint;
|
|
1021
1005
|
icon: string;
|
|
1022
1006
|
totalSupply: number;
|
|
1023
1007
|
}>;
|
|
@@ -1231,7 +1215,7 @@ interface MyxClientConfig {
|
|
|
1231
1215
|
signer?: Signer;
|
|
1232
1216
|
seamlessAccount?: {
|
|
1233
1217
|
masterAddress: string;
|
|
1234
|
-
wallet: ethers.Wallet | null;
|
|
1218
|
+
wallet: ethers$1.Wallet | null;
|
|
1235
1219
|
authorized: boolean;
|
|
1236
1220
|
};
|
|
1237
1221
|
walletClient?: WalletClient;
|
|
@@ -1251,7 +1235,7 @@ declare class ConfigManager {
|
|
|
1251
1235
|
clear(): void;
|
|
1252
1236
|
startSeamlessMode(open: boolean): MyxClientConfig;
|
|
1253
1237
|
updateSeamlessWallet({ wallet, authorized, masterAddress }: {
|
|
1254
|
-
wallet?: ethers.Wallet;
|
|
1238
|
+
wallet?: ethers$1.Wallet;
|
|
1255
1239
|
authorized?: boolean;
|
|
1256
1240
|
masterAddress?: string;
|
|
1257
1241
|
}): void;
|
|
@@ -1359,7 +1343,7 @@ declare class Utils {
|
|
|
1359
1343
|
quoteAddress: string;
|
|
1360
1344
|
amount?: string;
|
|
1361
1345
|
spenderAddress?: string;
|
|
1362
|
-
signer?: ethers.Signer;
|
|
1346
|
+
signer?: ethers$1.Signer;
|
|
1363
1347
|
}): Promise<{
|
|
1364
1348
|
code: number;
|
|
1365
1349
|
message: any;
|
|
@@ -1402,7 +1386,68 @@ declare class Utils {
|
|
|
1402
1386
|
marketPrice: string;
|
|
1403
1387
|
}): Promise<{
|
|
1404
1388
|
code: number;
|
|
1405
|
-
data:
|
|
1389
|
+
data: [[string, bigint, bigint, bigint] & {
|
|
1390
|
+
poolToken: string;
|
|
1391
|
+
exchangeRate: bigint;
|
|
1392
|
+
poolTokenPrice: bigint;
|
|
1393
|
+
poolTokenSupply: bigint;
|
|
1394
|
+
}, [string, bigint, bigint, bigint] & {
|
|
1395
|
+
poolToken: string;
|
|
1396
|
+
exchangeRate: bigint;
|
|
1397
|
+
poolTokenPrice: bigint;
|
|
1398
|
+
poolTokenSupply: bigint;
|
|
1399
|
+
}, [bigint, bigint, bigint, bigint] & {
|
|
1400
|
+
baseTotalAmount: bigint;
|
|
1401
|
+
baseReservedAmount: bigint;
|
|
1402
|
+
quoteTotalAmount: bigint;
|
|
1403
|
+
quoteReservedAmount: bigint;
|
|
1404
|
+
}, [bigint, bigint, bigint] & {
|
|
1405
|
+
nextFundingRate: bigint;
|
|
1406
|
+
lastFundingFeeTracker: bigint;
|
|
1407
|
+
nextEpochTime: bigint;
|
|
1408
|
+
}, [bigint, bigint, bigint, bigint] & {
|
|
1409
|
+
tracker: bigint;
|
|
1410
|
+
longSize: bigint;
|
|
1411
|
+
shortSize: bigint;
|
|
1412
|
+
poolEntryPrice: bigint;
|
|
1413
|
+
}, [bigint, bigint] & {
|
|
1414
|
+
windowCaps: bigint;
|
|
1415
|
+
openInterest: bigint;
|
|
1416
|
+
}] & {
|
|
1417
|
+
basePool: [string, bigint, bigint, bigint] & {
|
|
1418
|
+
poolToken: string;
|
|
1419
|
+
exchangeRate: bigint;
|
|
1420
|
+
poolTokenPrice: bigint;
|
|
1421
|
+
poolTokenSupply: bigint;
|
|
1422
|
+
};
|
|
1423
|
+
quotePool: [string, bigint, bigint, bigint] & {
|
|
1424
|
+
poolToken: string;
|
|
1425
|
+
exchangeRate: bigint;
|
|
1426
|
+
poolTokenPrice: bigint;
|
|
1427
|
+
poolTokenSupply: bigint;
|
|
1428
|
+
};
|
|
1429
|
+
reserveInfo: [bigint, bigint, bigint, bigint] & {
|
|
1430
|
+
baseTotalAmount: bigint;
|
|
1431
|
+
baseReservedAmount: bigint;
|
|
1432
|
+
quoteTotalAmount: bigint;
|
|
1433
|
+
quoteReservedAmount: bigint;
|
|
1434
|
+
};
|
|
1435
|
+
fundingInfo: [bigint, bigint, bigint] & {
|
|
1436
|
+
nextFundingRate: bigint;
|
|
1437
|
+
lastFundingFeeTracker: bigint;
|
|
1438
|
+
nextEpochTime: bigint;
|
|
1439
|
+
};
|
|
1440
|
+
oi: [bigint, bigint, bigint, bigint] & {
|
|
1441
|
+
tracker: bigint;
|
|
1442
|
+
longSize: bigint;
|
|
1443
|
+
shortSize: bigint;
|
|
1444
|
+
poolEntryPrice: bigint;
|
|
1445
|
+
};
|
|
1446
|
+
liquidityInfo: [bigint, bigint] & {
|
|
1447
|
+
windowCaps: bigint;
|
|
1448
|
+
openInterest: bigint;
|
|
1449
|
+
};
|
|
1450
|
+
};
|
|
1406
1451
|
message?: undefined;
|
|
1407
1452
|
} | {
|
|
1408
1453
|
code: number;
|
|
@@ -1411,12 +1456,45 @@ declare class Utils {
|
|
|
1411
1456
|
}>;
|
|
1412
1457
|
}
|
|
1413
1458
|
|
|
1459
|
+
declare class Api {
|
|
1460
|
+
private configManager;
|
|
1461
|
+
private logger;
|
|
1462
|
+
constructor(configManager: ConfigManager, logger: Logger);
|
|
1463
|
+
getHost(): "https://api.myx.finance" | "https://api-test.myx.cash";
|
|
1464
|
+
getTradeFlow({ accessToken, address, ...params }: GetHistoryOrdersParams & AccessTokenRequest): Promise<ApiResponse<TradeFlowItem[]>>;
|
|
1465
|
+
getPoolSymbolAll(): Promise<ApiResponse<PoolSymbolAllResponse[]>>;
|
|
1466
|
+
fetchForwarderGetApi(params: FetchForwarderGetParams): Promise<FetchForwarderGetResponse>;
|
|
1467
|
+
getPoolList(): Promise<ApiResponse<any[]>>;
|
|
1468
|
+
forwarderTxApi(params: ForwarderTxParams, chainId: number): Promise<ApiResponse<any>>;
|
|
1469
|
+
getOraclePrice(chainId: ChainId, poolIds?: string[]): Promise<Record<string, any>>;
|
|
1470
|
+
getPoolDetail(chainId: number, poolId: string): Promise<PoolResponse>;
|
|
1471
|
+
getPoolLevelConfig({ poolId, chainId, }: GetPoolLevelConfigParams): Promise<ApiResponse<PoolLevelConfig>>;
|
|
1472
|
+
getPositions(accessToken: string, address: string): Promise<PositionResponse>;
|
|
1473
|
+
getOrders(accessToken: string, address: string): Promise<PositionResponse>;
|
|
1474
|
+
getPoolOpenOrders(accessToken: string, address: string, chainId: ChainId): Promise<PoolOpenOrdersResponse>;
|
|
1475
|
+
getKlineData({ chainId, poolId, endTime, limit, interval }: GetKlineDataParams): Promise<ApiResponse<KlineDataItemType[]>>;
|
|
1476
|
+
getKlineLatestBar(params: Pick<GetKlineDataParams, "chainId" | "poolId" | "interval">): Promise<ApiResponse<KlineDataItemType>>;
|
|
1477
|
+
getTickerData({ chainId, poolIds }: GetTickerDataParams): Promise<ApiResponse<TickerDataItem[]>>;
|
|
1478
|
+
getAllTickers(): Promise<ApiResponse<TickerDataItem[]>>;
|
|
1479
|
+
searchMarketAuth({ accessToken, address, ...params }: SearchMarketParams & AccessTokenRequest): Promise<ApiResponse<SearchResultResponse>>;
|
|
1480
|
+
searchMarket({ ...params }: SearchMarketParams): Promise<ApiResponse<SearchResultResponse>>;
|
|
1481
|
+
addFavorite({ accessToken, address, ...params }: AddFavoriteParams & AccessTokenRequest): Promise<ApiResponse<null>>;
|
|
1482
|
+
removeFavorite({ accessToken, address, ...params }: RemoveFavoriteParams & AccessTokenRequest): Promise<ApiResponse<null>>;
|
|
1483
|
+
getFavoritesList({ accessToken, address, ...params }: FavoritesListParams & AccessTokenRequest): Promise<ApiResponse<FavoritesListItem[]>>;
|
|
1484
|
+
getBaseDetail({ ...params }: GetBaseDetailParams): Promise<ApiResponse<BaseDetailResponse>>;
|
|
1485
|
+
getMarketDetail({ ...params }: GetMarketDetailParams): Promise<ApiResponse<MarketDetailResponse>>;
|
|
1486
|
+
getHistoryOrders({ accessToken, address, ...params }: GetHistoryOrdersParams & AccessTokenRequest): Promise<ApiResponse<HistoryOrderItem[]>>;
|
|
1487
|
+
getPositionHistory({ accessToken, address, ...params }: GetHistoryOrdersParams & AccessTokenRequest): Promise<ApiResponse<PositionHistoryItem[]>>;
|
|
1488
|
+
getMarketList(): Promise<ApiResponse<MarketInfo[]>>;
|
|
1489
|
+
}
|
|
1490
|
+
|
|
1414
1491
|
declare class Markets {
|
|
1415
1492
|
private configManager;
|
|
1416
1493
|
private utils;
|
|
1417
|
-
|
|
1494
|
+
private api;
|
|
1495
|
+
constructor(configManager: ConfigManager, utils: Utils, api: Api);
|
|
1418
1496
|
getMarkets(): Promise<never[]>;
|
|
1419
|
-
getPoolLevelConfig(poolId: string): Promise<PoolLevelConfig>;
|
|
1497
|
+
getPoolLevelConfig(poolId: string, chainId: number): Promise<PoolLevelConfig>;
|
|
1420
1498
|
/**
|
|
1421
1499
|
* kline start
|
|
1422
1500
|
*/
|
|
@@ -1480,24 +1558,6 @@ declare class Account {
|
|
|
1480
1558
|
code: number;
|
|
1481
1559
|
data: any;
|
|
1482
1560
|
}>;
|
|
1483
|
-
/**
|
|
1484
|
-
* get tradable amount
|
|
1485
|
-
*/
|
|
1486
|
-
getTradableAmount({ poolId, chainId, address }: {
|
|
1487
|
-
poolId: string;
|
|
1488
|
-
chainId: number;
|
|
1489
|
-
address: string;
|
|
1490
|
-
}): Promise<{
|
|
1491
|
-
code: number;
|
|
1492
|
-
data: {
|
|
1493
|
-
profitIsReleased: any;
|
|
1494
|
-
freeAmount: any;
|
|
1495
|
-
tradeableProfit: any;
|
|
1496
|
-
};
|
|
1497
|
-
} | {
|
|
1498
|
-
code: number;
|
|
1499
|
-
data?: undefined;
|
|
1500
|
-
}>;
|
|
1501
1561
|
getAvailableMarginBalance({ poolId, chainId, address }: {
|
|
1502
1562
|
poolId: string;
|
|
1503
1563
|
chainId: number;
|
|
@@ -1559,10 +1619,11 @@ declare class Seamless {
|
|
|
1559
1619
|
private logger;
|
|
1560
1620
|
private utils;
|
|
1561
1621
|
private account;
|
|
1562
|
-
|
|
1563
|
-
|
|
1622
|
+
private api;
|
|
1623
|
+
constructor(configManager: ConfigManager, logger: Logger, utils: Utils, account: Account, api: Api);
|
|
1624
|
+
onCheckRelayer(account: string, relayer: string, chainId: number): Promise<boolean>;
|
|
1564
1625
|
getUSDPermitParams(deadline: number, chainId: number): Promise<{
|
|
1565
|
-
token: string | ethers.Addressable;
|
|
1626
|
+
token: string | ethers$1.Addressable;
|
|
1566
1627
|
owner: string;
|
|
1567
1628
|
spender: string;
|
|
1568
1629
|
value: bigint;
|
|
@@ -1579,7 +1640,7 @@ declare class Seamless {
|
|
|
1579
1640
|
deadline: number;
|
|
1580
1641
|
data: string;
|
|
1581
1642
|
nonce: string;
|
|
1582
|
-
}, chainId: number, provider?: ethers.Signer): Promise<ApiResponse<any>>;
|
|
1643
|
+
}, chainId: number, provider?: ethers$1.Signer): Promise<ApiResponse<any>>;
|
|
1583
1644
|
authorizeSeamlessAccount({ approve, seamlessAddress, chainId }: {
|
|
1584
1645
|
approve: boolean;
|
|
1585
1646
|
seamlessAddress: string;
|
|
@@ -1601,7 +1662,7 @@ declare class Seamless {
|
|
|
1601
1662
|
data: {
|
|
1602
1663
|
masterAddress: string;
|
|
1603
1664
|
seamlessAccount: string;
|
|
1604
|
-
authorized:
|
|
1665
|
+
authorized: boolean;
|
|
1605
1666
|
};
|
|
1606
1667
|
}>;
|
|
1607
1668
|
exportSeamlessPrivateKey({ password, apiKey }: {
|
|
@@ -1620,9 +1681,9 @@ declare class Seamless {
|
|
|
1620
1681
|
}): Promise<{
|
|
1621
1682
|
code: number;
|
|
1622
1683
|
data: {
|
|
1623
|
-
masterAddress:
|
|
1684
|
+
masterAddress: string;
|
|
1624
1685
|
seamlessAccount: string;
|
|
1625
|
-
authorized:
|
|
1686
|
+
authorized: boolean;
|
|
1626
1687
|
apiKey: string;
|
|
1627
1688
|
};
|
|
1628
1689
|
}>;
|
|
@@ -1642,7 +1703,7 @@ declare class Seamless {
|
|
|
1642
1703
|
data: {
|
|
1643
1704
|
masterAddress: string;
|
|
1644
1705
|
seamlessAccount: string;
|
|
1645
|
-
authorized:
|
|
1706
|
+
authorized: boolean;
|
|
1646
1707
|
apiKey: string;
|
|
1647
1708
|
};
|
|
1648
1709
|
message?: undefined;
|
|
@@ -1659,7 +1720,8 @@ declare class Position {
|
|
|
1659
1720
|
private utils;
|
|
1660
1721
|
private seamless;
|
|
1661
1722
|
private account;
|
|
1662
|
-
|
|
1723
|
+
private api;
|
|
1724
|
+
constructor(configManager: ConfigManager, logger: Logger, utils: Utils, seamless: Seamless, account: Account, api: Api);
|
|
1663
1725
|
listPositions(address: string): Promise<{
|
|
1664
1726
|
code: number;
|
|
1665
1727
|
message: string;
|
|
@@ -1720,7 +1782,8 @@ declare class Order {
|
|
|
1720
1782
|
private utils;
|
|
1721
1783
|
private seamless;
|
|
1722
1784
|
private account;
|
|
1723
|
-
|
|
1785
|
+
private api;
|
|
1786
|
+
constructor(configManager: ConfigManager, logger: Logger, utils: Utils, seamless: Seamless, account: Account, api: Api);
|
|
1724
1787
|
createIncreaseOrder(params: PlaceOrderParams, tradingFee: string): Promise<{
|
|
1725
1788
|
code: number;
|
|
1726
1789
|
message: string;
|
|
@@ -1730,14 +1793,13 @@ declare class Order {
|
|
|
1730
1793
|
message: string;
|
|
1731
1794
|
data: {
|
|
1732
1795
|
success: boolean;
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
gasUsed: any;
|
|
1796
|
+
transactionHash: string;
|
|
1797
|
+
blockNumber: number | undefined;
|
|
1798
|
+
gasUsed: string | undefined;
|
|
1737
1799
|
status: string;
|
|
1738
1800
|
confirmations: number;
|
|
1739
1801
|
timestamp: number;
|
|
1740
|
-
receipt:
|
|
1802
|
+
receipt: ethers$1.ContractTransactionReceipt | null;
|
|
1741
1803
|
};
|
|
1742
1804
|
} | {
|
|
1743
1805
|
code: number;
|
|
@@ -1758,14 +1820,14 @@ declare class Order {
|
|
|
1758
1820
|
} | {
|
|
1759
1821
|
code: number;
|
|
1760
1822
|
message: string;
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
gasUsed: any;
|
|
1823
|
+
transactionHash: string;
|
|
1824
|
+
blockNumber: number | undefined;
|
|
1825
|
+
gasUsed: string | undefined;
|
|
1765
1826
|
status: string;
|
|
1766
1827
|
confirmations: number;
|
|
1767
1828
|
timestamp: number;
|
|
1768
|
-
receipt:
|
|
1829
|
+
receipt: ethers$1.ContractTransactionReceipt | null;
|
|
1830
|
+
data?: undefined;
|
|
1769
1831
|
} | {
|
|
1770
1832
|
code: number;
|
|
1771
1833
|
message: any;
|
|
@@ -1787,14 +1849,13 @@ declare class Order {
|
|
|
1787
1849
|
message: string;
|
|
1788
1850
|
data: {
|
|
1789
1851
|
success: boolean;
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
gasUsed: any;
|
|
1852
|
+
transactionHash: string;
|
|
1853
|
+
blockNumber: number | undefined;
|
|
1854
|
+
gasUsed: string | undefined;
|
|
1794
1855
|
status: string;
|
|
1795
1856
|
confirmations: number;
|
|
1796
1857
|
timestamp: number;
|
|
1797
|
-
receipt:
|
|
1858
|
+
receipt: ethers$1.ContractTransactionReceipt | null;
|
|
1798
1859
|
};
|
|
1799
1860
|
} | {
|
|
1800
1861
|
code: number;
|
|
@@ -1810,14 +1871,13 @@ declare class Order {
|
|
|
1810
1871
|
message: string;
|
|
1811
1872
|
data: {
|
|
1812
1873
|
success: boolean;
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
gasUsed: any;
|
|
1874
|
+
transactionHash: string;
|
|
1875
|
+
blockNumber: number | undefined;
|
|
1876
|
+
gasUsed: string | undefined;
|
|
1817
1877
|
status: string;
|
|
1818
1878
|
confirmations: number;
|
|
1819
1879
|
timestamp: number;
|
|
1820
|
-
receipt:
|
|
1880
|
+
receipt: ethers$1.ContractTransactionReceipt | null;
|
|
1821
1881
|
};
|
|
1822
1882
|
} | {
|
|
1823
1883
|
code: number;
|
|
@@ -1843,7 +1903,7 @@ declare class Order {
|
|
|
1843
1903
|
}>;
|
|
1844
1904
|
updateOrderTpSl(params: UpdateOrderParams, quoteAddress: string, chainId: number): Promise<{
|
|
1845
1905
|
code: number;
|
|
1846
|
-
data:
|
|
1906
|
+
data: ethers$1.ContractTransactionReceipt | null;
|
|
1847
1907
|
message: string;
|
|
1848
1908
|
} | {
|
|
1849
1909
|
code: number;
|
|
@@ -1881,6 +1941,7 @@ declare class MyxClient {
|
|
|
1881
1941
|
utils: Utils;
|
|
1882
1942
|
account: Account;
|
|
1883
1943
|
seamless: Seamless;
|
|
1944
|
+
api: Api;
|
|
1884
1945
|
/**
|
|
1885
1946
|
* 获取配置管理器(用于访问 accessToken 相关方法)
|
|
1886
1947
|
*/
|
|
@@ -1901,4 +1962,4 @@ declare class MyxClient {
|
|
|
1901
1962
|
getAccessToken(): Promise<string | null>;
|
|
1902
1963
|
}
|
|
1903
1964
|
|
|
1904
|
-
export { type AccessTokenRequest, type AccessTokenResponse$1 as AccessTokenResponse, type AccessTokenType, type AddFavoriteParams, type Address$1 as Address, type ApiResponse, type BaseDetailResponse, type BaseResponse, COMMON_LP_AMOUNT_DECIMALS, COMMON_PRICE_DECIMALS, ChainId, type ChainIdRequest, CloseTypeEnum, type DashboardType, Direction, DirectionEnum, ErrorCode, ExecTypeEnum, type FavoritesListItem, type FavoritesListParams, type FavoritesTimeInterval, type FavoritesType, type FetchForwarderGetParams, type FetchForwarderGetResponse, type FetchForwarderGetResponseData, ForwarderGetStatus, type ForwarderTxParams, type GetBaseDetailParams, type GetHistoryOrdersParams, type GetKlineDataParams, type GetMarketDetailParams, type GetPoolLevelConfigParams, type GetTickerDataParams, type HistoryOrderItem, type HttpEnvParams, HttpKlineIntervalEnum, type KlineDataItemType, type KlineDataResponse, type KlineResolution, type LevelConfig, MarketCapType, type MarketDetailResponse, type MarketInfo, type MarketPool, type MarketPoolResponse, MarketPoolState, MarketType, MyxClient, type MyxClientConfig, type MyxSubscriptionOptions, type NetWorkFee, type ObjectType, type OnKlineCallback, type OnOrderCallback, type OnPositionCallback, type OnTickersAllCallback, type OnTickersCallback, OperationEnum, OperationType, OracleType, type Order$1 as Order, OrderStatus, OrderStatusEnum, OrderType, OrderTypeEnum, type PlaceOrderParams, type PoolLevelConfig, type PoolOpenOrder, type PoolOpenOrdersResponse, type PoolResponse, type PoolSymbolAllResponse, type Position$1 as Position, type PositionHistoryItem, type PositionResponse, type PositionTpSlOrderParams, type PositionType, type PriceResponse, type PriceType, type RemoveFavoriteParams, type SearchMarketParams, type SearchResultContractItem, type SearchResultCookItem, type SearchResultEarnItem, type SearchResultResponse, SearchSecondTypeEnum, SearchTypeEnum, type StatDashBoardResponse, type TickerDataItem, type TickersDataResponse, TimeInForce, TradeFlowAccountTypeEnum, type TradeFlowItem, TradeFlowTypeEnum, type TradingResult, TriggerType, TriggerTypeEnum, type UpdateOrderTpSlParams,
|
|
1965
|
+
export { type AccessTokenRequest, type AccessTokenResponse$1 as AccessTokenResponse, type AccessTokenType, type AddFavoriteParams, type Address$1 as Address, type ApiResponse, type BaseDetailResponse, type BaseResponse, COMMON_LP_AMOUNT_DECIMALS, COMMON_PRICE_DECIMALS, ChainId, type ChainIdRequest, CloseTypeEnum, type DashboardType, Direction, DirectionEnum, ErrorCode, ExecTypeEnum, type FavoritesListItem, type FavoritesListParams, type FavoritesTimeInterval, type FavoritesType, type FetchForwarderGetParams, type FetchForwarderGetResponse, type FetchForwarderGetResponseData, ForwarderGetStatus, type ForwarderTxParams, type GetBaseDetailParams, type GetHistoryOrdersParams, type GetKlineDataParams, type GetMarketDetailParams, type GetPoolLevelConfigParams, type GetTickerDataParams, type HistoryOrderItem, type HttpEnvParams, HttpKlineIntervalEnum, type KlineDataItemType, type KlineDataResponse, type KlineResolution, type LevelConfig, MarketCapType, type MarketDetailResponse, type MarketInfo, type MarketPool, type MarketPoolResponse, MarketPoolState, MarketType, MyxClient, type MyxClientConfig, type MyxSubscriptionOptions, type NetWorkFee, type ObjectType, type OnKlineCallback, type OnOrderCallback, type OnPositionCallback, type OnTickersAllCallback, type OnTickersCallback, OperationEnum, OperationType, OracleType, type Order$1 as Order, OrderStatus, OrderStatusEnum, OrderType, OrderTypeEnum, type PlaceOrderParams, type PoolLevelConfig, type PoolOpenOrder, type PoolOpenOrdersResponse, type PoolResponse, type PoolSymbolAllResponse, type Position$1 as Position, type PositionHistoryItem, type PositionResponse, type PositionTpSlOrderParams, type PositionType, type PriceResponse, type PriceType, type RemoveFavoriteParams, type SearchMarketParams, type SearchResultContractItem, type SearchResultCookItem, type SearchResultEarnItem, type SearchResultResponse, SearchSecondTypeEnum, SearchTypeEnum, type StatDashBoardResponse, type TickerDataItem, type TickersDataResponse, TimeInForce, TradeFlowAccountTypeEnum, type TradeFlowItem, TradeFlowTypeEnum, type TradingResult, TriggerType, TriggerTypeEnum, type UpdateOrderTpSlParams, approve, index$2 as base, bigintAmountSlipperCalculator, bigintTradingGasPriceWithRatio, bigintTradingGasToRatioCalculator, getAllowanceApproved, getBalanceOf, getBaseDetail, getBaseUrlByEnv, getForwardUrlByEnv, getMarketDetail, getMarketList, getOraclePrice, getPoolDetail, getPoolList, getPoolOpenOrders, getPriceData, getPricesData, getTickerData, getTokenInfo, index as market, index$3 as pool, index$1 as quote };
|