@myx-trade/sdk 0.1.37 → 0.1.38
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 +24 -26
- package/dist/index.d.ts +24 -26
- package/dist/index.js +1097 -916
- package/dist/index.mjs +1035 -854
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as ethers from 'ethers';
|
|
2
|
-
import {
|
|
2
|
+
import { AddressLike, Signer, ethers as ethers$1 } from 'ethers';
|
|
3
3
|
export { formatUnits, parseUnits } from 'ethers';
|
|
4
4
|
import { Options, Event } from 'reconnecting-websocket';
|
|
5
|
-
import { WalletClient, Address as Address$
|
|
5
|
+
import { WalletClient, Address as Address$2 } from 'viem';
|
|
6
6
|
|
|
7
|
-
type Address$2 = `0x${string}` | typeof ZeroAddress;
|
|
8
7
|
declare enum ChainId {
|
|
9
8
|
LINEA_SEPOLIA = 59141,
|
|
10
9
|
LINEA_MAINNET = 59144,
|
|
@@ -19,8 +18,8 @@ declare enum ChainId {
|
|
|
19
18
|
|
|
20
19
|
interface CreatePoolRequest {
|
|
21
20
|
chainId: ChainId;
|
|
22
|
-
marketId?: string;
|
|
23
21
|
baseToken: AddressLike;
|
|
22
|
+
marketId: string;
|
|
24
23
|
}
|
|
25
24
|
declare enum PoolType {
|
|
26
25
|
Base = 0,
|
|
@@ -53,9 +52,9 @@ interface CancelTpSLParams {
|
|
|
53
52
|
orderId: string;
|
|
54
53
|
}
|
|
55
54
|
|
|
56
|
-
declare const createPool: ({ chainId, baseToken }: CreatePoolRequest) => Promise<string | undefined>;
|
|
55
|
+
declare const createPool: ({ chainId, baseToken, marketId }: CreatePoolRequest) => Promise<string | undefined>;
|
|
57
56
|
|
|
58
|
-
declare const getMarketPoolId: ({ chainId, baseToken, }: CreatePoolRequest) => Promise<string | undefined>;
|
|
57
|
+
declare const getMarketPoolId: ({ chainId, baseToken, marketId, }: CreatePoolRequest) => Promise<string | undefined>;
|
|
59
58
|
declare const getMarketPools: (chainId: ChainId) => Promise<string[]>;
|
|
60
59
|
declare const getPoolInfo$1: (chainId: ChainId, poolId: string, marketPrice?: bigint) => Promise<{
|
|
61
60
|
quotePool: {
|
|
@@ -95,7 +94,7 @@ declare const addTpSl: (params: AddTpSLParams) => Promise<ethers.ContractTransac
|
|
|
95
94
|
|
|
96
95
|
declare const cancelTpSl: (params: CancelTpSLParams) => Promise<ethers.ContractTransactionReceipt | null>;
|
|
97
96
|
|
|
98
|
-
declare const reprime: (chainId: ChainId, poolId: string) => Promise<ethers.ContractTransactionReceipt | null>;
|
|
97
|
+
declare const reprime: (chainId: ChainId, poolId: string, marketId: string) => Promise<ethers.ContractTransactionReceipt | null>;
|
|
99
98
|
|
|
100
99
|
/**
|
|
101
100
|
* Trading related types and enums
|
|
@@ -296,6 +295,7 @@ type MarketPool = {
|
|
|
296
295
|
oracleType?: number | null;
|
|
297
296
|
feedId?: number | null;
|
|
298
297
|
activeTime: number;
|
|
298
|
+
poolPreTime: number;
|
|
299
299
|
};
|
|
300
300
|
interface MarketPoolResponse extends BaseResponse {
|
|
301
301
|
data: MarketPool[];
|
|
@@ -530,6 +530,20 @@ interface MarketDetailResponse {
|
|
|
530
530
|
baseReserveRatio: string;
|
|
531
531
|
quoteReserveRatio: string;
|
|
532
532
|
}
|
|
533
|
+
interface MarketInfo {
|
|
534
|
+
chainId: number;
|
|
535
|
+
marketId: string;
|
|
536
|
+
poolId: string;
|
|
537
|
+
quoteSymbol: string;
|
|
538
|
+
quoteDecimals: number;
|
|
539
|
+
quoteToken: string;
|
|
540
|
+
baseReserveRatio: number;
|
|
541
|
+
quoteReserveRatio: number;
|
|
542
|
+
oracleFeeUsd: number;
|
|
543
|
+
oracleRefundFeeUsd: number;
|
|
544
|
+
poolPrimeThreshold: number;
|
|
545
|
+
decimals: number;
|
|
546
|
+
}
|
|
533
547
|
|
|
534
548
|
declare class Address {
|
|
535
549
|
private _addr;
|
|
@@ -769,6 +783,7 @@ interface GetMarketDetailParams {
|
|
|
769
783
|
poolId: string;
|
|
770
784
|
}
|
|
771
785
|
declare const getMarketDetail: (params: GetMarketDetailParams) => Promise<ApiResponse<MarketDetailResponse>>;
|
|
786
|
+
declare const getMarketList: () => Promise<ApiResponse<MarketInfo[]>>;
|
|
772
787
|
|
|
773
788
|
declare const getPoolInfo: (chainId: ChainId, poolId: string) => Promise<MarketPool | undefined>;
|
|
774
789
|
|
|
@@ -913,23 +928,6 @@ declare const getPriceData: (chainId: ChainId, poolId: string) => Promise<{
|
|
|
913
928
|
declare const COMMON_PRICE_DECIMALS = 30;
|
|
914
929
|
declare const COMMON_LP_AMOUNT_DECIMALS = 18;
|
|
915
930
|
|
|
916
|
-
interface MarketInfo {
|
|
917
|
-
readonly marketId: string;
|
|
918
|
-
readonly quoteToken: Address$2;
|
|
919
|
-
readonly oracleFeeUsd: bigint;
|
|
920
|
-
readonly oracleRefundFeeUsd: bigint;
|
|
921
|
-
readonly baseReserveRatio: number;
|
|
922
|
-
readonly quoteReserveRatio: number;
|
|
923
|
-
readonly poolPrimeThreshold: bigint;
|
|
924
|
-
readonly decimals: number;
|
|
925
|
-
readonly lpDecimals: number;
|
|
926
|
-
}
|
|
927
|
-
|
|
928
|
-
type MarketInfoMap = {
|
|
929
|
-
readonly [chainId: number]: MarketInfo;
|
|
930
|
-
};
|
|
931
|
-
declare const Market: MarketInfoMap;
|
|
932
|
-
|
|
933
931
|
declare const approve: (chainId: ChainId, account: string, tokenAddress: string, approveAddress: string, amount: bigint) => Promise<void>;
|
|
934
932
|
|
|
935
933
|
declare const getAllowanceApproved: (chainId: ChainId, account: string, tokenAddress: string, approveAddress: string, approveAmount: bigint) => Promise<boolean>;
|
|
@@ -1429,7 +1427,7 @@ declare class Order {
|
|
|
1429
1427
|
private logger;
|
|
1430
1428
|
private utils;
|
|
1431
1429
|
constructor(configManager: ConfigManager, logger: Logger, utils: Utils);
|
|
1432
|
-
createPositionId(poolId: string, user: Address$
|
|
1430
|
+
createPositionId(poolId: string, user: Address$2, direction: Direction, salt: bigint): Promise<string>;
|
|
1433
1431
|
createIncreaseOrder(params: PlaceOrderParams): Promise<{
|
|
1434
1432
|
code: number;
|
|
1435
1433
|
message: string;
|
|
@@ -1604,4 +1602,4 @@ declare class MyxClient {
|
|
|
1604
1602
|
getAccessToken(): Promise<string | null>;
|
|
1605
1603
|
}
|
|
1606
1604
|
|
|
1607
|
-
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 GetBaseDetailParams, type GetHistoryOrdersParams, type GetKlineDataParams, type GetMarketDetailParams, type GetPoolLevelConfigParams, type GetTickerDataParams, type HistoryOrderItem, HttpKlineIntervalEnum, type KlineDataItemType, type KlineDataResponse, type KlineResolution, type LevelConfig,
|
|
1605
|
+
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 GetBaseDetailParams, type GetHistoryOrdersParams, type GetKlineDataParams, type GetMarketDetailParams, type GetPoolLevelConfigParams, type GetTickerDataParams, type HistoryOrderItem, 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 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, type TradeFlowItem, type TradingResult, TriggerType, TriggerTypeEnum, type UpdateOrderTpSlParams, addFavorite, approve, index$2 as base, baseUrl, bigintAmountSlipperCalculator, bigintTradingGasPriceWithRatio, bigintTradingGasToRatioCalculator, getAllTickers, getAllowanceApproved, getBalanceOf, getBaseDetail, getFavoritesList, getHistoryOrders, getKlineData, getKlineLatestBar, getMarketDetail, getMarketList, getOraclePrice, getOrders, getPoolDetail, getPoolLevelConfig, getPoolOpenOrders, getPositionHistory, getPositions, getPriceData, getPricesData, getTickerData, getTokenInfo, getTradeFlow, index as market, index$3 as pool, index$1 as quote, removeFavorite, searchMarket, searchMarketAuth };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as ethers from 'ethers';
|
|
2
|
-
import {
|
|
2
|
+
import { AddressLike, Signer, ethers as ethers$1 } from 'ethers';
|
|
3
3
|
export { formatUnits, parseUnits } from 'ethers';
|
|
4
4
|
import { Options, Event } from 'reconnecting-websocket';
|
|
5
|
-
import { WalletClient, Address as Address$
|
|
5
|
+
import { WalletClient, Address as Address$2 } from 'viem';
|
|
6
6
|
|
|
7
|
-
type Address$2 = `0x${string}` | typeof ZeroAddress;
|
|
8
7
|
declare enum ChainId {
|
|
9
8
|
LINEA_SEPOLIA = 59141,
|
|
10
9
|
LINEA_MAINNET = 59144,
|
|
@@ -19,8 +18,8 @@ declare enum ChainId {
|
|
|
19
18
|
|
|
20
19
|
interface CreatePoolRequest {
|
|
21
20
|
chainId: ChainId;
|
|
22
|
-
marketId?: string;
|
|
23
21
|
baseToken: AddressLike;
|
|
22
|
+
marketId: string;
|
|
24
23
|
}
|
|
25
24
|
declare enum PoolType {
|
|
26
25
|
Base = 0,
|
|
@@ -53,9 +52,9 @@ interface CancelTpSLParams {
|
|
|
53
52
|
orderId: string;
|
|
54
53
|
}
|
|
55
54
|
|
|
56
|
-
declare const createPool: ({ chainId, baseToken }: CreatePoolRequest) => Promise<string | undefined>;
|
|
55
|
+
declare const createPool: ({ chainId, baseToken, marketId }: CreatePoolRequest) => Promise<string | undefined>;
|
|
57
56
|
|
|
58
|
-
declare const getMarketPoolId: ({ chainId, baseToken, }: CreatePoolRequest) => Promise<string | undefined>;
|
|
57
|
+
declare const getMarketPoolId: ({ chainId, baseToken, marketId, }: CreatePoolRequest) => Promise<string | undefined>;
|
|
59
58
|
declare const getMarketPools: (chainId: ChainId) => Promise<string[]>;
|
|
60
59
|
declare const getPoolInfo$1: (chainId: ChainId, poolId: string, marketPrice?: bigint) => Promise<{
|
|
61
60
|
quotePool: {
|
|
@@ -95,7 +94,7 @@ declare const addTpSl: (params: AddTpSLParams) => Promise<ethers.ContractTransac
|
|
|
95
94
|
|
|
96
95
|
declare const cancelTpSl: (params: CancelTpSLParams) => Promise<ethers.ContractTransactionReceipt | null>;
|
|
97
96
|
|
|
98
|
-
declare const reprime: (chainId: ChainId, poolId: string) => Promise<ethers.ContractTransactionReceipt | null>;
|
|
97
|
+
declare const reprime: (chainId: ChainId, poolId: string, marketId: string) => Promise<ethers.ContractTransactionReceipt | null>;
|
|
99
98
|
|
|
100
99
|
/**
|
|
101
100
|
* Trading related types and enums
|
|
@@ -296,6 +295,7 @@ type MarketPool = {
|
|
|
296
295
|
oracleType?: number | null;
|
|
297
296
|
feedId?: number | null;
|
|
298
297
|
activeTime: number;
|
|
298
|
+
poolPreTime: number;
|
|
299
299
|
};
|
|
300
300
|
interface MarketPoolResponse extends BaseResponse {
|
|
301
301
|
data: MarketPool[];
|
|
@@ -530,6 +530,20 @@ interface MarketDetailResponse {
|
|
|
530
530
|
baseReserveRatio: string;
|
|
531
531
|
quoteReserveRatio: string;
|
|
532
532
|
}
|
|
533
|
+
interface MarketInfo {
|
|
534
|
+
chainId: number;
|
|
535
|
+
marketId: string;
|
|
536
|
+
poolId: string;
|
|
537
|
+
quoteSymbol: string;
|
|
538
|
+
quoteDecimals: number;
|
|
539
|
+
quoteToken: string;
|
|
540
|
+
baseReserveRatio: number;
|
|
541
|
+
quoteReserveRatio: number;
|
|
542
|
+
oracleFeeUsd: number;
|
|
543
|
+
oracleRefundFeeUsd: number;
|
|
544
|
+
poolPrimeThreshold: number;
|
|
545
|
+
decimals: number;
|
|
546
|
+
}
|
|
533
547
|
|
|
534
548
|
declare class Address {
|
|
535
549
|
private _addr;
|
|
@@ -769,6 +783,7 @@ interface GetMarketDetailParams {
|
|
|
769
783
|
poolId: string;
|
|
770
784
|
}
|
|
771
785
|
declare const getMarketDetail: (params: GetMarketDetailParams) => Promise<ApiResponse<MarketDetailResponse>>;
|
|
786
|
+
declare const getMarketList: () => Promise<ApiResponse<MarketInfo[]>>;
|
|
772
787
|
|
|
773
788
|
declare const getPoolInfo: (chainId: ChainId, poolId: string) => Promise<MarketPool | undefined>;
|
|
774
789
|
|
|
@@ -913,23 +928,6 @@ declare const getPriceData: (chainId: ChainId, poolId: string) => Promise<{
|
|
|
913
928
|
declare const COMMON_PRICE_DECIMALS = 30;
|
|
914
929
|
declare const COMMON_LP_AMOUNT_DECIMALS = 18;
|
|
915
930
|
|
|
916
|
-
interface MarketInfo {
|
|
917
|
-
readonly marketId: string;
|
|
918
|
-
readonly quoteToken: Address$2;
|
|
919
|
-
readonly oracleFeeUsd: bigint;
|
|
920
|
-
readonly oracleRefundFeeUsd: bigint;
|
|
921
|
-
readonly baseReserveRatio: number;
|
|
922
|
-
readonly quoteReserveRatio: number;
|
|
923
|
-
readonly poolPrimeThreshold: bigint;
|
|
924
|
-
readonly decimals: number;
|
|
925
|
-
readonly lpDecimals: number;
|
|
926
|
-
}
|
|
927
|
-
|
|
928
|
-
type MarketInfoMap = {
|
|
929
|
-
readonly [chainId: number]: MarketInfo;
|
|
930
|
-
};
|
|
931
|
-
declare const Market: MarketInfoMap;
|
|
932
|
-
|
|
933
931
|
declare const approve: (chainId: ChainId, account: string, tokenAddress: string, approveAddress: string, amount: bigint) => Promise<void>;
|
|
934
932
|
|
|
935
933
|
declare const getAllowanceApproved: (chainId: ChainId, account: string, tokenAddress: string, approveAddress: string, approveAmount: bigint) => Promise<boolean>;
|
|
@@ -1429,7 +1427,7 @@ declare class Order {
|
|
|
1429
1427
|
private logger;
|
|
1430
1428
|
private utils;
|
|
1431
1429
|
constructor(configManager: ConfigManager, logger: Logger, utils: Utils);
|
|
1432
|
-
createPositionId(poolId: string, user: Address$
|
|
1430
|
+
createPositionId(poolId: string, user: Address$2, direction: Direction, salt: bigint): Promise<string>;
|
|
1433
1431
|
createIncreaseOrder(params: PlaceOrderParams): Promise<{
|
|
1434
1432
|
code: number;
|
|
1435
1433
|
message: string;
|
|
@@ -1604,4 +1602,4 @@ declare class MyxClient {
|
|
|
1604
1602
|
getAccessToken(): Promise<string | null>;
|
|
1605
1603
|
}
|
|
1606
1604
|
|
|
1607
|
-
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 GetBaseDetailParams, type GetHistoryOrdersParams, type GetKlineDataParams, type GetMarketDetailParams, type GetPoolLevelConfigParams, type GetTickerDataParams, type HistoryOrderItem, HttpKlineIntervalEnum, type KlineDataItemType, type KlineDataResponse, type KlineResolution, type LevelConfig,
|
|
1605
|
+
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 GetBaseDetailParams, type GetHistoryOrdersParams, type GetKlineDataParams, type GetMarketDetailParams, type GetPoolLevelConfigParams, type GetTickerDataParams, type HistoryOrderItem, 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 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, type TradeFlowItem, type TradingResult, TriggerType, TriggerTypeEnum, type UpdateOrderTpSlParams, addFavorite, approve, index$2 as base, baseUrl, bigintAmountSlipperCalculator, bigintTradingGasPriceWithRatio, bigintTradingGasToRatioCalculator, getAllTickers, getAllowanceApproved, getBalanceOf, getBaseDetail, getFavoritesList, getHistoryOrders, getKlineData, getKlineLatestBar, getMarketDetail, getMarketList, getOraclePrice, getOrders, getPoolDetail, getPoolLevelConfig, getPoolOpenOrders, getPositionHistory, getPositions, getPriceData, getPricesData, getTickerData, getTokenInfo, getTradeFlow, index as market, index$3 as pool, index$1 as quote, removeFavorite, searchMarket, searchMarketAuth };
|