@myx-trade/sdk 0.1.17 → 0.1.19
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 +32 -3
- package/dist/index.d.ts +32 -3
- package/dist/index.js +99 -91
- package/dist/index.mjs +99 -91
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -421,6 +421,8 @@ interface SearchResultContractItem {
|
|
|
421
421
|
liquidity: string;
|
|
422
422
|
basePrice: string;
|
|
423
423
|
priceChange: string;
|
|
424
|
+
tvl: string;
|
|
425
|
+
marketCap: string;
|
|
424
426
|
}
|
|
425
427
|
interface SearchResultCookItem {
|
|
426
428
|
chainId: ChainId;
|
|
@@ -606,6 +608,18 @@ declare const getHistoryOrders: ({ accessToken, ...params }: GetHistoryOrdersPar
|
|
|
606
608
|
/**
|
|
607
609
|
* Get position history
|
|
608
610
|
*/
|
|
611
|
+
declare enum CloseTypeEnum {
|
|
612
|
+
Open = 0,
|
|
613
|
+
PartialClose = 1,
|
|
614
|
+
FullClose = 2,
|
|
615
|
+
Liquidation = 3,
|
|
616
|
+
EarlyClose = 4,
|
|
617
|
+
MarketClose = 5,
|
|
618
|
+
ADL = 6,
|
|
619
|
+
TP = 7,
|
|
620
|
+
SL = 8,
|
|
621
|
+
Increase = 9
|
|
622
|
+
}
|
|
609
623
|
interface PositionHistoryItem {
|
|
610
624
|
chainId: number;
|
|
611
625
|
poolId: string;
|
|
@@ -623,6 +637,8 @@ interface PositionHistoryItem {
|
|
|
623
637
|
baseSymbol: string;
|
|
624
638
|
quoteSymbol: string;
|
|
625
639
|
userLeverage: number;
|
|
640
|
+
closeType: CloseTypeEnum;
|
|
641
|
+
avgClosePrice: string;
|
|
626
642
|
}
|
|
627
643
|
declare const getPositionHistory: ({ accessToken, ...params }: GetHistoryOrdersParams & AccessTokenRequest) => Promise<ApiResponse<PositionHistoryItem[]>>;
|
|
628
644
|
/**
|
|
@@ -644,6 +660,8 @@ interface TradeFlowItem {
|
|
|
644
660
|
baseSymbol: string;
|
|
645
661
|
quoteSymbol: string;
|
|
646
662
|
userLeverage: number;
|
|
663
|
+
executionFee: string;
|
|
664
|
+
type: OperationEnum;
|
|
647
665
|
}
|
|
648
666
|
declare const getTradeFlow: ({ accessToken, ...params }: GetHistoryOrdersParams & AccessTokenRequest) => Promise<ApiResponse<TradeFlowItem[]>>;
|
|
649
667
|
|
|
@@ -1134,7 +1152,7 @@ interface AccessTokenResponse {
|
|
|
1134
1152
|
}
|
|
1135
1153
|
interface MyxClientConfig {
|
|
1136
1154
|
chainId: number;
|
|
1137
|
-
signer
|
|
1155
|
+
signer?: Signer;
|
|
1138
1156
|
walletClient?: WalletClient;
|
|
1139
1157
|
brokerAddress: string;
|
|
1140
1158
|
isTestnet?: boolean;
|
|
@@ -1151,6 +1169,8 @@ declare class ConfigManager {
|
|
|
1151
1169
|
private accessToken?;
|
|
1152
1170
|
private accessTokenExpiry?;
|
|
1153
1171
|
constructor(config: MyxClientConfig);
|
|
1172
|
+
clear(): void;
|
|
1173
|
+
auth(params: Pick<MyxClientConfig, "signer" | "getAccessToken">): void;
|
|
1154
1174
|
private validateConfig;
|
|
1155
1175
|
/**
|
|
1156
1176
|
* 获取有效的 accessToken,自动处理获取和刷新
|
|
@@ -1348,11 +1368,12 @@ declare class Position {
|
|
|
1348
1368
|
* @desc temp skip eip7702
|
|
1349
1369
|
* @todo adjustCollateral 调整保证金
|
|
1350
1370
|
*/
|
|
1351
|
-
adjustCollateral({ poolId, positionId, adjustAmount, quoteToken, }: {
|
|
1371
|
+
adjustCollateral({ poolId, positionId, adjustAmount, quoteToken, poolOracleType, }: {
|
|
1352
1372
|
poolId: string;
|
|
1353
1373
|
positionId: string;
|
|
1354
1374
|
adjustAmount: string;
|
|
1355
1375
|
quoteToken: string;
|
|
1376
|
+
poolOracleType: OracleType;
|
|
1356
1377
|
}): Promise<{
|
|
1357
1378
|
code: number;
|
|
1358
1379
|
data: {
|
|
@@ -1522,6 +1543,14 @@ declare class MyxClient {
|
|
|
1522
1543
|
*/
|
|
1523
1544
|
getConfigManager(): ConfigManager;
|
|
1524
1545
|
constructor(options: MyxClientConfig);
|
|
1546
|
+
/**
|
|
1547
|
+
* auth the client
|
|
1548
|
+
*/
|
|
1549
|
+
auth(params: Pick<MyxClientConfig, "signer" | "getAccessToken" | "walletClient">): void;
|
|
1550
|
+
/**
|
|
1551
|
+
* close the client
|
|
1552
|
+
*/
|
|
1553
|
+
close(): void;
|
|
1525
1554
|
}
|
|
1526
1555
|
|
|
1527
|
-
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, 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, Market, MarketCapType, type MarketDetailResponse, type MarketInfo, type MarketInfoMap, 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, 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 };
|
|
1556
|
+
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, Market, MarketCapType, type MarketDetailResponse, type MarketInfo, type MarketInfoMap, 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, 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
|
@@ -421,6 +421,8 @@ interface SearchResultContractItem {
|
|
|
421
421
|
liquidity: string;
|
|
422
422
|
basePrice: string;
|
|
423
423
|
priceChange: string;
|
|
424
|
+
tvl: string;
|
|
425
|
+
marketCap: string;
|
|
424
426
|
}
|
|
425
427
|
interface SearchResultCookItem {
|
|
426
428
|
chainId: ChainId;
|
|
@@ -606,6 +608,18 @@ declare const getHistoryOrders: ({ accessToken, ...params }: GetHistoryOrdersPar
|
|
|
606
608
|
/**
|
|
607
609
|
* Get position history
|
|
608
610
|
*/
|
|
611
|
+
declare enum CloseTypeEnum {
|
|
612
|
+
Open = 0,
|
|
613
|
+
PartialClose = 1,
|
|
614
|
+
FullClose = 2,
|
|
615
|
+
Liquidation = 3,
|
|
616
|
+
EarlyClose = 4,
|
|
617
|
+
MarketClose = 5,
|
|
618
|
+
ADL = 6,
|
|
619
|
+
TP = 7,
|
|
620
|
+
SL = 8,
|
|
621
|
+
Increase = 9
|
|
622
|
+
}
|
|
609
623
|
interface PositionHistoryItem {
|
|
610
624
|
chainId: number;
|
|
611
625
|
poolId: string;
|
|
@@ -623,6 +637,8 @@ interface PositionHistoryItem {
|
|
|
623
637
|
baseSymbol: string;
|
|
624
638
|
quoteSymbol: string;
|
|
625
639
|
userLeverage: number;
|
|
640
|
+
closeType: CloseTypeEnum;
|
|
641
|
+
avgClosePrice: string;
|
|
626
642
|
}
|
|
627
643
|
declare const getPositionHistory: ({ accessToken, ...params }: GetHistoryOrdersParams & AccessTokenRequest) => Promise<ApiResponse<PositionHistoryItem[]>>;
|
|
628
644
|
/**
|
|
@@ -644,6 +660,8 @@ interface TradeFlowItem {
|
|
|
644
660
|
baseSymbol: string;
|
|
645
661
|
quoteSymbol: string;
|
|
646
662
|
userLeverage: number;
|
|
663
|
+
executionFee: string;
|
|
664
|
+
type: OperationEnum;
|
|
647
665
|
}
|
|
648
666
|
declare const getTradeFlow: ({ accessToken, ...params }: GetHistoryOrdersParams & AccessTokenRequest) => Promise<ApiResponse<TradeFlowItem[]>>;
|
|
649
667
|
|
|
@@ -1134,7 +1152,7 @@ interface AccessTokenResponse {
|
|
|
1134
1152
|
}
|
|
1135
1153
|
interface MyxClientConfig {
|
|
1136
1154
|
chainId: number;
|
|
1137
|
-
signer
|
|
1155
|
+
signer?: Signer;
|
|
1138
1156
|
walletClient?: WalletClient;
|
|
1139
1157
|
brokerAddress: string;
|
|
1140
1158
|
isTestnet?: boolean;
|
|
@@ -1151,6 +1169,8 @@ declare class ConfigManager {
|
|
|
1151
1169
|
private accessToken?;
|
|
1152
1170
|
private accessTokenExpiry?;
|
|
1153
1171
|
constructor(config: MyxClientConfig);
|
|
1172
|
+
clear(): void;
|
|
1173
|
+
auth(params: Pick<MyxClientConfig, "signer" | "getAccessToken">): void;
|
|
1154
1174
|
private validateConfig;
|
|
1155
1175
|
/**
|
|
1156
1176
|
* 获取有效的 accessToken,自动处理获取和刷新
|
|
@@ -1348,11 +1368,12 @@ declare class Position {
|
|
|
1348
1368
|
* @desc temp skip eip7702
|
|
1349
1369
|
* @todo adjustCollateral 调整保证金
|
|
1350
1370
|
*/
|
|
1351
|
-
adjustCollateral({ poolId, positionId, adjustAmount, quoteToken, }: {
|
|
1371
|
+
adjustCollateral({ poolId, positionId, adjustAmount, quoteToken, poolOracleType, }: {
|
|
1352
1372
|
poolId: string;
|
|
1353
1373
|
positionId: string;
|
|
1354
1374
|
adjustAmount: string;
|
|
1355
1375
|
quoteToken: string;
|
|
1376
|
+
poolOracleType: OracleType;
|
|
1356
1377
|
}): Promise<{
|
|
1357
1378
|
code: number;
|
|
1358
1379
|
data: {
|
|
@@ -1522,6 +1543,14 @@ declare class MyxClient {
|
|
|
1522
1543
|
*/
|
|
1523
1544
|
getConfigManager(): ConfigManager;
|
|
1524
1545
|
constructor(options: MyxClientConfig);
|
|
1546
|
+
/**
|
|
1547
|
+
* auth the client
|
|
1548
|
+
*/
|
|
1549
|
+
auth(params: Pick<MyxClientConfig, "signer" | "getAccessToken" | "walletClient">): void;
|
|
1550
|
+
/**
|
|
1551
|
+
* close the client
|
|
1552
|
+
*/
|
|
1553
|
+
close(): void;
|
|
1525
1554
|
}
|
|
1526
1555
|
|
|
1527
|
-
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, 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, Market, MarketCapType, type MarketDetailResponse, type MarketInfo, type MarketInfoMap, 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, 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 };
|
|
1556
|
+
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, Market, MarketCapType, type MarketDetailResponse, type MarketInfo, type MarketInfoMap, 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, 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 };
|