@myx-trade/sdk 0.1.226 → 0.1.229
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 +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +59 -22
- package/dist/index.mjs +59 -21
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -758,8 +758,7 @@ interface PoolSymbolAllResponse {
|
|
|
758
758
|
baseTokenIcon: string;
|
|
759
759
|
}
|
|
760
760
|
|
|
761
|
-
declare const getBaseUrlByEnv: (
|
|
762
|
-
declare const getForwardUrlByEnv: (isProd?: boolean) => string;
|
|
761
|
+
declare const getBaseUrlByEnv: () => "https://api-beta.myx.finance" | "https://api-test.myx.cash" | "https://api.myx.finance";
|
|
763
762
|
declare const getOraclePrice: (chainId: ChainId, poolIds?: string[]) => Promise<PriceResponse>;
|
|
764
763
|
interface LevelConfig {
|
|
765
764
|
fundingFeeRate1: number;
|
|
@@ -788,7 +787,7 @@ interface GetPoolLevelConfigParams {
|
|
|
788
787
|
/**
|
|
789
788
|
* Get Pool Level Config
|
|
790
789
|
*/
|
|
791
|
-
declare const getPoolDetail: (chainId: number, poolId: string
|
|
790
|
+
declare const getPoolDetail: (chainId: number, poolId: string) => Promise<PoolResponse>;
|
|
792
791
|
declare const getPoolOpenOrders: (accessToken: string, address: string, chainId: ChainId) => Promise<PoolOpenOrdersResponse>;
|
|
793
792
|
/**
|
|
794
793
|
* Get Kline Data
|
|
@@ -1231,6 +1230,7 @@ interface MyxClientConfig {
|
|
|
1231
1230
|
walletClient?: WalletClient;
|
|
1232
1231
|
brokerAddress: string;
|
|
1233
1232
|
isTestnet?: boolean;
|
|
1233
|
+
isBetaMode?: boolean;
|
|
1234
1234
|
poolingInterval?: number;
|
|
1235
1235
|
seamlessMode?: boolean;
|
|
1236
1236
|
socketConfig?: Partial<Omit<WebSocketConfig, "url">>;
|
|
@@ -1471,7 +1471,7 @@ declare class Api {
|
|
|
1471
1471
|
private configManager;
|
|
1472
1472
|
private logger;
|
|
1473
1473
|
constructor(configManager: ConfigManager, logger: Logger);
|
|
1474
|
-
getHost(): "https://api.myx.finance" | "https://api-test.myx.cash";
|
|
1474
|
+
getHost(): "https://api-beta.myx.finance" | "https://api-test.myx.cash" | "https://api.myx.finance";
|
|
1475
1475
|
getTradeFlow({ accessToken, address, ...params }: GetHistoryOrdersParams & AccessTokenRequest): Promise<ApiResponse<TradeFlowItem[]>>;
|
|
1476
1476
|
getPoolSymbolAll(): Promise<ApiResponse<PoolSymbolAllResponse[]>>;
|
|
1477
1477
|
fetchForwarderGetApi(params: FetchForwarderGetParams): Promise<FetchForwarderGetResponse>;
|
|
@@ -3380,4 +3380,4 @@ declare class MyxClient {
|
|
|
3380
3380
|
getAccessToken(): Promise<string | null>;
|
|
3381
3381
|
}
|
|
3382
3382
|
|
|
3383
|
-
export { type AccessTokenRequest, type AccessTokenResponse$1 as AccessTokenResponse, type AccessTokenType, type AddFavoriteParams, type 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,
|
|
3383
|
+
export { type AccessTokenRequest, type AccessTokenResponse$1 as AccessTokenResponse, type AccessTokenType, type AddFavoriteParams, type 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, getMarketDetail, getMarketList, getOraclePrice, getPoolDetail, getPoolList, getPoolOpenOrders, getPriceData, getPricesData, getTickerData, getTokenInfo, index as market, index$3 as pool, index$1 as quote };
|
package/dist/index.d.ts
CHANGED
|
@@ -758,8 +758,7 @@ interface PoolSymbolAllResponse {
|
|
|
758
758
|
baseTokenIcon: string;
|
|
759
759
|
}
|
|
760
760
|
|
|
761
|
-
declare const getBaseUrlByEnv: (
|
|
762
|
-
declare const getForwardUrlByEnv: (isProd?: boolean) => string;
|
|
761
|
+
declare const getBaseUrlByEnv: () => "https://api-beta.myx.finance" | "https://api-test.myx.cash" | "https://api.myx.finance";
|
|
763
762
|
declare const getOraclePrice: (chainId: ChainId, poolIds?: string[]) => Promise<PriceResponse>;
|
|
764
763
|
interface LevelConfig {
|
|
765
764
|
fundingFeeRate1: number;
|
|
@@ -788,7 +787,7 @@ interface GetPoolLevelConfigParams {
|
|
|
788
787
|
/**
|
|
789
788
|
* Get Pool Level Config
|
|
790
789
|
*/
|
|
791
|
-
declare const getPoolDetail: (chainId: number, poolId: string
|
|
790
|
+
declare const getPoolDetail: (chainId: number, poolId: string) => Promise<PoolResponse>;
|
|
792
791
|
declare const getPoolOpenOrders: (accessToken: string, address: string, chainId: ChainId) => Promise<PoolOpenOrdersResponse>;
|
|
793
792
|
/**
|
|
794
793
|
* Get Kline Data
|
|
@@ -1231,6 +1230,7 @@ interface MyxClientConfig {
|
|
|
1231
1230
|
walletClient?: WalletClient;
|
|
1232
1231
|
brokerAddress: string;
|
|
1233
1232
|
isTestnet?: boolean;
|
|
1233
|
+
isBetaMode?: boolean;
|
|
1234
1234
|
poolingInterval?: number;
|
|
1235
1235
|
seamlessMode?: boolean;
|
|
1236
1236
|
socketConfig?: Partial<Omit<WebSocketConfig, "url">>;
|
|
@@ -1471,7 +1471,7 @@ declare class Api {
|
|
|
1471
1471
|
private configManager;
|
|
1472
1472
|
private logger;
|
|
1473
1473
|
constructor(configManager: ConfigManager, logger: Logger);
|
|
1474
|
-
getHost(): "https://api.myx.finance" | "https://api-test.myx.cash";
|
|
1474
|
+
getHost(): "https://api-beta.myx.finance" | "https://api-test.myx.cash" | "https://api.myx.finance";
|
|
1475
1475
|
getTradeFlow({ accessToken, address, ...params }: GetHistoryOrdersParams & AccessTokenRequest): Promise<ApiResponse<TradeFlowItem[]>>;
|
|
1476
1476
|
getPoolSymbolAll(): Promise<ApiResponse<PoolSymbolAllResponse[]>>;
|
|
1477
1477
|
fetchForwarderGetApi(params: FetchForwarderGetParams): Promise<FetchForwarderGetResponse>;
|
|
@@ -3380,4 +3380,4 @@ declare class MyxClient {
|
|
|
3380
3380
|
getAccessToken(): Promise<string | null>;
|
|
3381
3381
|
}
|
|
3382
3382
|
|
|
3383
|
-
export { type AccessTokenRequest, type AccessTokenResponse$1 as AccessTokenResponse, type AccessTokenType, type AddFavoriteParams, type 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,
|
|
3383
|
+
export { type AccessTokenRequest, type AccessTokenResponse$1 as AccessTokenResponse, type AccessTokenType, type AddFavoriteParams, type 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, getMarketDetail, getMarketList, getOraclePrice, getPoolDetail, getPoolList, getPoolOpenOrders, getPriceData, getPricesData, getTickerData, getTokenInfo, index as market, index$3 as pool, index$1 as quote };
|
package/dist/index.js
CHANGED
|
@@ -68,7 +68,6 @@ __export(index_exports, {
|
|
|
68
68
|
getBalanceOf: () => getBalanceOf,
|
|
69
69
|
getBaseDetail: () => getBaseDetail,
|
|
70
70
|
getBaseUrlByEnv: () => getBaseUrlByEnv,
|
|
71
|
-
getForwardUrlByEnv: () => getForwardUrlByEnv,
|
|
72
71
|
getMarketDetail: () => getMarketDetail,
|
|
73
72
|
getMarketList: () => getMarketList,
|
|
74
73
|
getOraclePrice: () => getOraclePrice,
|
|
@@ -1479,10 +1478,33 @@ var LINEA_SEPOLIA = {
|
|
|
1479
1478
|
FORWARDER: "0x6C40462A4d45BA4119af59Fb9e41b8eaC9293962"
|
|
1480
1479
|
};
|
|
1481
1480
|
|
|
1481
|
+
// src/config/address/BSC_TEST_NET.ts
|
|
1482
|
+
var BSC_TEST_NET = {
|
|
1483
|
+
USDC: "0xe944d7c0f7005a76E898Ee3B9Ec10479EbA9Cc02",
|
|
1484
|
+
POOL_MANAGER: "0x9DAF6eFaf86563DE06188d5d9c79E2E2193D2dE7",
|
|
1485
|
+
Account: "0xf708d4702f4db570f585cb90DdbB79d327f74f79",
|
|
1486
|
+
POSITION_MANAGER: "0x4f7D3158c667d289d76F11598B1C1d0A36B2b146",
|
|
1487
|
+
ORDER_MANAGER: "0x5681BFF512F7F50fE238E09FDe96987c85cDadB4",
|
|
1488
|
+
PYTH: "0x4374e5a8b9C22271E9EB878A2AA31DE97DF15DAF",
|
|
1489
|
+
// !!! 非Pyth Adapter
|
|
1490
|
+
ERC20: "0xe944d7c0f7005a76E898Ee3B9Ec10479EbA9Cc02",
|
|
1491
|
+
LIQUIDITY_ROUTER: "0x255fAb155BEf51F1E41fb082038846362Ec8b11e",
|
|
1492
|
+
BASE_POOL: "0xB1Fcb9f15aAAe4066C23920b5D2f2684153221d0",
|
|
1493
|
+
QUOTE_POOL: "0xe9fd41E5a2CD0E9b400099D14382455BfACde8De",
|
|
1494
|
+
ORACLE: "0x91601276dD3024009cA57ACf409928336C5626E4",
|
|
1495
|
+
// MYXOracle
|
|
1496
|
+
EIP7702Delegation: "0x8db55115330611D7D5E0046473B3F6E6ed9361b6",
|
|
1497
|
+
MARKET_MANAGER: "0x1D2cb62dC52782D0a8A3832cB2Ba118b703eAAB4",
|
|
1498
|
+
DATA_PROVIDER: "0x827c4D63eCafE28bC7f1aFF460f9A14b4938d76e",
|
|
1499
|
+
ORACLE_RESERVE: "0xCF72C9fB77cF051F079151d5955753A5b93F4E92",
|
|
1500
|
+
FORWARDER: "0x2912Ae76E175776B44E3a0f67E60F2624AEeED03"
|
|
1501
|
+
};
|
|
1502
|
+
|
|
1482
1503
|
// src/config/address.ts
|
|
1483
1504
|
var address_default = {
|
|
1484
1505
|
[421614 /* ARB_TESTNET */]: ARB_TEST_SEPOLIA,
|
|
1485
|
-
[59141 /* LINEA_SEPOLIA */]: LINEA_SEPOLIA
|
|
1506
|
+
[59141 /* LINEA_SEPOLIA */]: LINEA_SEPOLIA,
|
|
1507
|
+
[97 /* BSC_TESTNET */]: BSC_TEST_NET
|
|
1486
1508
|
};
|
|
1487
1509
|
|
|
1488
1510
|
// src/web3/index.ts
|
|
@@ -1807,7 +1829,7 @@ var RotationProvider = class extends import_providers.BaseProvider {
|
|
|
1807
1829
|
// package.json
|
|
1808
1830
|
var package_default = {
|
|
1809
1831
|
name: "@myx-trade/sdk",
|
|
1810
|
-
version: "0.1.
|
|
1832
|
+
version: "0.1.229",
|
|
1811
1833
|
private: false,
|
|
1812
1834
|
publishConfig: {
|
|
1813
1835
|
access: "public"
|
|
@@ -2084,12 +2106,15 @@ var getPoolList = async () => {
|
|
|
2084
2106
|
};
|
|
2085
2107
|
|
|
2086
2108
|
// src/api/index.ts
|
|
2087
|
-
var getBaseUrlByEnv = (
|
|
2088
|
-
const
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2109
|
+
var getBaseUrlByEnv = () => {
|
|
2110
|
+
const { isTestnet, isBetaMode } = web3_default?.getConfigManager()?.getConfig() || {};
|
|
2111
|
+
if (isBetaMode) {
|
|
2112
|
+
return "https://api-beta.myx.finance";
|
|
2113
|
+
} else if (isTestnet) {
|
|
2114
|
+
return "https://api-test.myx.cash";
|
|
2115
|
+
} else {
|
|
2116
|
+
return "https://api.myx.finance";
|
|
2117
|
+
}
|
|
2093
2118
|
};
|
|
2094
2119
|
var getOraclePrice = async (chainId, poolIds = []) => {
|
|
2095
2120
|
if (!!poolIds.length) {
|
|
@@ -2103,9 +2128,9 @@ var getOraclePrice = async (chainId, poolIds = []) => {
|
|
|
2103
2128
|
}
|
|
2104
2129
|
return Promise.reject(new Error("Invalid pool id"));
|
|
2105
2130
|
};
|
|
2106
|
-
var getPoolDetail = async (chainId, poolId
|
|
2131
|
+
var getPoolDetail = async (chainId, poolId) => {
|
|
2107
2132
|
return await http.get(
|
|
2108
|
-
`${getBaseUrlByEnv(
|
|
2133
|
+
`${getBaseUrlByEnv()}/openapi/gateway/scan/market/info?chainId=${chainId}&poolId=${poolId}`
|
|
2109
2134
|
);
|
|
2110
2135
|
};
|
|
2111
2136
|
var getPoolOpenOrders = async (accessToken, address, chainId) => {
|
|
@@ -2121,9 +2146,8 @@ var getPoolOpenOrders = async (accessToken, address, chainId) => {
|
|
|
2121
2146
|
);
|
|
2122
2147
|
};
|
|
2123
2148
|
var getTickerData = async ({ chainId, poolIds }, envParams) => {
|
|
2124
|
-
const isProd = envParams?.isProd ?? true;
|
|
2125
2149
|
return http.get(
|
|
2126
|
-
`${getBaseUrlByEnv(
|
|
2150
|
+
`${getBaseUrlByEnv()}/openapi/gateway/quote/candle/tickers`,
|
|
2127
2151
|
{
|
|
2128
2152
|
chainId,
|
|
2129
2153
|
poolIds: poolIds.join(",")
|
|
@@ -13595,20 +13619,22 @@ var MAINNET_CHAIN_IDS = [
|
|
|
13595
13619
|
56 /* BSC_MAINNET */,
|
|
13596
13620
|
59144 /* LINEA_MAINNET */,
|
|
13597
13621
|
42161 /* ARB_MAINNET */,
|
|
13598
|
-
204 /* OPBNB_MAINNET */,
|
|
13599
13622
|
56 /* BSC_MAINNET */
|
|
13600
13623
|
];
|
|
13601
13624
|
var TESTNET_CHAIN_IDS = [
|
|
13602
13625
|
59141 /* LINEA_SEPOLIA */,
|
|
13603
13626
|
421614 /* ARB_TESTNET */,
|
|
13604
|
-
|
|
13627
|
+
97 /* BSC_TESTNET */
|
|
13628
|
+
];
|
|
13629
|
+
var BETA_ENV_CHAIN_IDS = [
|
|
13605
13630
|
97 /* BSC_TESTNET */
|
|
13606
13631
|
];
|
|
13607
13632
|
|
|
13608
13633
|
// src/manager/const/socket.ts
|
|
13609
13634
|
var WEBSOCKET_URL = {
|
|
13610
13635
|
TestNet: "wss://oapi-test.myx.cash/ws",
|
|
13611
|
-
MainNet: "wss://oapi.myx.finance/ws"
|
|
13636
|
+
MainNet: "wss://oapi.myx.finance/ws",
|
|
13637
|
+
BetaNet: "wss://oapi-beta.myx.finance/ws"
|
|
13612
13638
|
};
|
|
13613
13639
|
|
|
13614
13640
|
// src/manager/subscription/SubScription.ts
|
|
@@ -13618,7 +13644,7 @@ var SubScription = class {
|
|
|
13618
13644
|
this.prevAccessToken = "";
|
|
13619
13645
|
this.configManager = configManager;
|
|
13620
13646
|
this.logger = logger;
|
|
13621
|
-
const socketUrl = configManager.getConfig()?.isTestnet ? WEBSOCKET_URL.TestNet : WEBSOCKET_URL.MainNet;
|
|
13647
|
+
const socketUrl = configManager.getConfig()?.isTestnet ? WEBSOCKET_URL.TestNet : configManager.getConfig()?.isBetaMode ? WEBSOCKET_URL.BetaNet : WEBSOCKET_URL.MainNet;
|
|
13622
13648
|
this.wsClient = new MyxWebSocketClient({
|
|
13623
13649
|
logLevel: this.configManager.getConfig()?.logLevel,
|
|
13624
13650
|
url: socketUrl,
|
|
@@ -13805,6 +13831,7 @@ var ConfigManager = class {
|
|
|
13805
13831
|
this._isGettingAccessToken = false;
|
|
13806
13832
|
const mergedConfig = {
|
|
13807
13833
|
isTestnet: false,
|
|
13834
|
+
isBetaMode: false,
|
|
13808
13835
|
...config
|
|
13809
13836
|
};
|
|
13810
13837
|
this.validateConfig(mergedConfig);
|
|
@@ -13852,13 +13879,19 @@ var ConfigManager = class {
|
|
|
13852
13879
|
this.validateConfig(this.config);
|
|
13853
13880
|
}
|
|
13854
13881
|
validateConfig(config) {
|
|
13855
|
-
const { isTestnet, chainId } = config;
|
|
13882
|
+
const { isTestnet, isBetaMode, chainId } = config;
|
|
13856
13883
|
if (isTestnet) {
|
|
13857
13884
|
if (!TESTNET_CHAIN_IDS.includes(chainId))
|
|
13858
13885
|
throw new MyxSDKError(
|
|
13859
13886
|
"INVALID_CHAIN_ID" /* InvalidChainId */,
|
|
13860
13887
|
`chainId ${chainId} is not in the range of TESTNET_CHAIN_IDS`
|
|
13861
13888
|
);
|
|
13889
|
+
} else if (isBetaMode) {
|
|
13890
|
+
if (!BETA_ENV_CHAIN_IDS.includes(chainId))
|
|
13891
|
+
throw new MyxSDKError(
|
|
13892
|
+
"INVALID_CHAIN_ID" /* InvalidChainId */,
|
|
13893
|
+
`chainId ${chainId} is not in the range of BETA_ENV_CHAIN_IDS`
|
|
13894
|
+
);
|
|
13862
13895
|
} else {
|
|
13863
13896
|
if (!MAINNET_CHAIN_IDS.includes(chainId))
|
|
13864
13897
|
throw new MyxSDKError(
|
|
@@ -21497,8 +21530,14 @@ var Api = class {
|
|
|
21497
21530
|
this.logger = logger;
|
|
21498
21531
|
}
|
|
21499
21532
|
getHost() {
|
|
21500
|
-
const
|
|
21501
|
-
|
|
21533
|
+
const { isTestnet, isBetaMode } = this.configManager.getConfig();
|
|
21534
|
+
if (isBetaMode) {
|
|
21535
|
+
return "https://api-beta.myx.finance";
|
|
21536
|
+
} else if (isTestnet) {
|
|
21537
|
+
return "https://api-test.myx.cash";
|
|
21538
|
+
} else {
|
|
21539
|
+
return "https://api.myx.finance";
|
|
21540
|
+
}
|
|
21502
21541
|
}
|
|
21503
21542
|
async getTradeFlow({
|
|
21504
21543
|
accessToken,
|
|
@@ -21943,7 +21982,6 @@ var Seamless = class {
|
|
|
21943
21982
|
chainId: forwarderJsonRpcContractDomain.chainId,
|
|
21944
21983
|
verifyingContract: forwarderJsonRpcContractDomain.verifyingContract
|
|
21945
21984
|
};
|
|
21946
|
-
this.logger.info("domain-->", domain);
|
|
21947
21985
|
const walletProvider = provider ?? await getSignerProvider(chainId);
|
|
21948
21986
|
const signature = await walletProvider.signTypedData(domain, contractTypes, {
|
|
21949
21987
|
from,
|
|
@@ -22320,7 +22358,6 @@ var MyxClient = class {
|
|
|
22320
22358
|
getBalanceOf,
|
|
22321
22359
|
getBaseDetail,
|
|
22322
22360
|
getBaseUrlByEnv,
|
|
22323
|
-
getForwardUrlByEnv,
|
|
22324
22361
|
getMarketDetail,
|
|
22325
22362
|
getMarketList,
|
|
22326
22363
|
getOraclePrice,
|
package/dist/index.mjs
CHANGED
|
@@ -1397,10 +1397,33 @@ var LINEA_SEPOLIA = {
|
|
|
1397
1397
|
FORWARDER: "0x6C40462A4d45BA4119af59Fb9e41b8eaC9293962"
|
|
1398
1398
|
};
|
|
1399
1399
|
|
|
1400
|
+
// src/config/address/BSC_TEST_NET.ts
|
|
1401
|
+
var BSC_TEST_NET = {
|
|
1402
|
+
USDC: "0xe944d7c0f7005a76E898Ee3B9Ec10479EbA9Cc02",
|
|
1403
|
+
POOL_MANAGER: "0x9DAF6eFaf86563DE06188d5d9c79E2E2193D2dE7",
|
|
1404
|
+
Account: "0xf708d4702f4db570f585cb90DdbB79d327f74f79",
|
|
1405
|
+
POSITION_MANAGER: "0x4f7D3158c667d289d76F11598B1C1d0A36B2b146",
|
|
1406
|
+
ORDER_MANAGER: "0x5681BFF512F7F50fE238E09FDe96987c85cDadB4",
|
|
1407
|
+
PYTH: "0x4374e5a8b9C22271E9EB878A2AA31DE97DF15DAF",
|
|
1408
|
+
// !!! 非Pyth Adapter
|
|
1409
|
+
ERC20: "0xe944d7c0f7005a76E898Ee3B9Ec10479EbA9Cc02",
|
|
1410
|
+
LIQUIDITY_ROUTER: "0x255fAb155BEf51F1E41fb082038846362Ec8b11e",
|
|
1411
|
+
BASE_POOL: "0xB1Fcb9f15aAAe4066C23920b5D2f2684153221d0",
|
|
1412
|
+
QUOTE_POOL: "0xe9fd41E5a2CD0E9b400099D14382455BfACde8De",
|
|
1413
|
+
ORACLE: "0x91601276dD3024009cA57ACf409928336C5626E4",
|
|
1414
|
+
// MYXOracle
|
|
1415
|
+
EIP7702Delegation: "0x8db55115330611D7D5E0046473B3F6E6ed9361b6",
|
|
1416
|
+
MARKET_MANAGER: "0x1D2cb62dC52782D0a8A3832cB2Ba118b703eAAB4",
|
|
1417
|
+
DATA_PROVIDER: "0x827c4D63eCafE28bC7f1aFF460f9A14b4938d76e",
|
|
1418
|
+
ORACLE_RESERVE: "0xCF72C9fB77cF051F079151d5955753A5b93F4E92",
|
|
1419
|
+
FORWARDER: "0x2912Ae76E175776B44E3a0f67E60F2624AEeED03"
|
|
1420
|
+
};
|
|
1421
|
+
|
|
1400
1422
|
// src/config/address.ts
|
|
1401
1423
|
var address_default = {
|
|
1402
1424
|
[421614 /* ARB_TESTNET */]: ARB_TEST_SEPOLIA,
|
|
1403
|
-
[59141 /* LINEA_SEPOLIA */]: LINEA_SEPOLIA
|
|
1425
|
+
[59141 /* LINEA_SEPOLIA */]: LINEA_SEPOLIA,
|
|
1426
|
+
[97 /* BSC_TESTNET */]: BSC_TEST_NET
|
|
1404
1427
|
};
|
|
1405
1428
|
|
|
1406
1429
|
// src/web3/index.ts
|
|
@@ -1731,7 +1754,7 @@ var RotationProvider = class extends BaseProvider {
|
|
|
1731
1754
|
// package.json
|
|
1732
1755
|
var package_default = {
|
|
1733
1756
|
name: "@myx-trade/sdk",
|
|
1734
|
-
version: "0.1.
|
|
1757
|
+
version: "0.1.229",
|
|
1735
1758
|
private: false,
|
|
1736
1759
|
publishConfig: {
|
|
1737
1760
|
access: "public"
|
|
@@ -2008,12 +2031,15 @@ var getPoolList = async () => {
|
|
|
2008
2031
|
};
|
|
2009
2032
|
|
|
2010
2033
|
// src/api/index.ts
|
|
2011
|
-
var getBaseUrlByEnv = (
|
|
2012
|
-
const
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2034
|
+
var getBaseUrlByEnv = () => {
|
|
2035
|
+
const { isTestnet, isBetaMode } = web3_default?.getConfigManager()?.getConfig() || {};
|
|
2036
|
+
if (isBetaMode) {
|
|
2037
|
+
return "https://api-beta.myx.finance";
|
|
2038
|
+
} else if (isTestnet) {
|
|
2039
|
+
return "https://api-test.myx.cash";
|
|
2040
|
+
} else {
|
|
2041
|
+
return "https://api.myx.finance";
|
|
2042
|
+
}
|
|
2017
2043
|
};
|
|
2018
2044
|
var getOraclePrice = async (chainId, poolIds = []) => {
|
|
2019
2045
|
if (!!poolIds.length) {
|
|
@@ -2027,9 +2053,9 @@ var getOraclePrice = async (chainId, poolIds = []) => {
|
|
|
2027
2053
|
}
|
|
2028
2054
|
return Promise.reject(new Error("Invalid pool id"));
|
|
2029
2055
|
};
|
|
2030
|
-
var getPoolDetail = async (chainId, poolId
|
|
2056
|
+
var getPoolDetail = async (chainId, poolId) => {
|
|
2031
2057
|
return await http.get(
|
|
2032
|
-
`${getBaseUrlByEnv(
|
|
2058
|
+
`${getBaseUrlByEnv()}/openapi/gateway/scan/market/info?chainId=${chainId}&poolId=${poolId}`
|
|
2033
2059
|
);
|
|
2034
2060
|
};
|
|
2035
2061
|
var getPoolOpenOrders = async (accessToken, address, chainId) => {
|
|
@@ -2045,9 +2071,8 @@ var getPoolOpenOrders = async (accessToken, address, chainId) => {
|
|
|
2045
2071
|
);
|
|
2046
2072
|
};
|
|
2047
2073
|
var getTickerData = async ({ chainId, poolIds }, envParams) => {
|
|
2048
|
-
const isProd = envParams?.isProd ?? true;
|
|
2049
2074
|
return http.get(
|
|
2050
|
-
`${getBaseUrlByEnv(
|
|
2075
|
+
`${getBaseUrlByEnv()}/openapi/gateway/quote/candle/tickers`,
|
|
2051
2076
|
{
|
|
2052
2077
|
chainId,
|
|
2053
2078
|
poolIds: poolIds.join(",")
|
|
@@ -13519,20 +13544,22 @@ var MAINNET_CHAIN_IDS = [
|
|
|
13519
13544
|
56 /* BSC_MAINNET */,
|
|
13520
13545
|
59144 /* LINEA_MAINNET */,
|
|
13521
13546
|
42161 /* ARB_MAINNET */,
|
|
13522
|
-
204 /* OPBNB_MAINNET */,
|
|
13523
13547
|
56 /* BSC_MAINNET */
|
|
13524
13548
|
];
|
|
13525
13549
|
var TESTNET_CHAIN_IDS = [
|
|
13526
13550
|
59141 /* LINEA_SEPOLIA */,
|
|
13527
13551
|
421614 /* ARB_TESTNET */,
|
|
13528
|
-
|
|
13552
|
+
97 /* BSC_TESTNET */
|
|
13553
|
+
];
|
|
13554
|
+
var BETA_ENV_CHAIN_IDS = [
|
|
13529
13555
|
97 /* BSC_TESTNET */
|
|
13530
13556
|
];
|
|
13531
13557
|
|
|
13532
13558
|
// src/manager/const/socket.ts
|
|
13533
13559
|
var WEBSOCKET_URL = {
|
|
13534
13560
|
TestNet: "wss://oapi-test.myx.cash/ws",
|
|
13535
|
-
MainNet: "wss://oapi.myx.finance/ws"
|
|
13561
|
+
MainNet: "wss://oapi.myx.finance/ws",
|
|
13562
|
+
BetaNet: "wss://oapi-beta.myx.finance/ws"
|
|
13536
13563
|
};
|
|
13537
13564
|
|
|
13538
13565
|
// src/manager/subscription/SubScription.ts
|
|
@@ -13542,7 +13569,7 @@ var SubScription = class {
|
|
|
13542
13569
|
this.prevAccessToken = "";
|
|
13543
13570
|
this.configManager = configManager;
|
|
13544
13571
|
this.logger = logger;
|
|
13545
|
-
const socketUrl = configManager.getConfig()?.isTestnet ? WEBSOCKET_URL.TestNet : WEBSOCKET_URL.MainNet;
|
|
13572
|
+
const socketUrl = configManager.getConfig()?.isTestnet ? WEBSOCKET_URL.TestNet : configManager.getConfig()?.isBetaMode ? WEBSOCKET_URL.BetaNet : WEBSOCKET_URL.MainNet;
|
|
13546
13573
|
this.wsClient = new MyxWebSocketClient({
|
|
13547
13574
|
logLevel: this.configManager.getConfig()?.logLevel,
|
|
13548
13575
|
url: socketUrl,
|
|
@@ -13729,6 +13756,7 @@ var ConfigManager = class {
|
|
|
13729
13756
|
this._isGettingAccessToken = false;
|
|
13730
13757
|
const mergedConfig = {
|
|
13731
13758
|
isTestnet: false,
|
|
13759
|
+
isBetaMode: false,
|
|
13732
13760
|
...config
|
|
13733
13761
|
};
|
|
13734
13762
|
this.validateConfig(mergedConfig);
|
|
@@ -13776,13 +13804,19 @@ var ConfigManager = class {
|
|
|
13776
13804
|
this.validateConfig(this.config);
|
|
13777
13805
|
}
|
|
13778
13806
|
validateConfig(config) {
|
|
13779
|
-
const { isTestnet, chainId } = config;
|
|
13807
|
+
const { isTestnet, isBetaMode, chainId } = config;
|
|
13780
13808
|
if (isTestnet) {
|
|
13781
13809
|
if (!TESTNET_CHAIN_IDS.includes(chainId))
|
|
13782
13810
|
throw new MyxSDKError(
|
|
13783
13811
|
"INVALID_CHAIN_ID" /* InvalidChainId */,
|
|
13784
13812
|
`chainId ${chainId} is not in the range of TESTNET_CHAIN_IDS`
|
|
13785
13813
|
);
|
|
13814
|
+
} else if (isBetaMode) {
|
|
13815
|
+
if (!BETA_ENV_CHAIN_IDS.includes(chainId))
|
|
13816
|
+
throw new MyxSDKError(
|
|
13817
|
+
"INVALID_CHAIN_ID" /* InvalidChainId */,
|
|
13818
|
+
`chainId ${chainId} is not in the range of BETA_ENV_CHAIN_IDS`
|
|
13819
|
+
);
|
|
13786
13820
|
} else {
|
|
13787
13821
|
if (!MAINNET_CHAIN_IDS.includes(chainId))
|
|
13788
13822
|
throw new MyxSDKError(
|
|
@@ -21421,8 +21455,14 @@ var Api = class {
|
|
|
21421
21455
|
this.logger = logger;
|
|
21422
21456
|
}
|
|
21423
21457
|
getHost() {
|
|
21424
|
-
const
|
|
21425
|
-
|
|
21458
|
+
const { isTestnet, isBetaMode } = this.configManager.getConfig();
|
|
21459
|
+
if (isBetaMode) {
|
|
21460
|
+
return "https://api-beta.myx.finance";
|
|
21461
|
+
} else if (isTestnet) {
|
|
21462
|
+
return "https://api-test.myx.cash";
|
|
21463
|
+
} else {
|
|
21464
|
+
return "https://api.myx.finance";
|
|
21465
|
+
}
|
|
21426
21466
|
}
|
|
21427
21467
|
async getTradeFlow({
|
|
21428
21468
|
accessToken,
|
|
@@ -21867,7 +21907,6 @@ var Seamless = class {
|
|
|
21867
21907
|
chainId: forwarderJsonRpcContractDomain.chainId,
|
|
21868
21908
|
verifyingContract: forwarderJsonRpcContractDomain.verifyingContract
|
|
21869
21909
|
};
|
|
21870
|
-
this.logger.info("domain-->", domain);
|
|
21871
21910
|
const walletProvider = provider ?? await getSignerProvider(chainId);
|
|
21872
21911
|
const signature = await walletProvider.signTypedData(domain, contractTypes, {
|
|
21873
21912
|
from,
|
|
@@ -22243,7 +22282,6 @@ export {
|
|
|
22243
22282
|
getBalanceOf,
|
|
22244
22283
|
getBaseDetail,
|
|
22245
22284
|
getBaseUrlByEnv,
|
|
22246
|
-
getForwardUrlByEnv,
|
|
22247
22285
|
getMarketDetail,
|
|
22248
22286
|
getMarketList,
|
|
22249
22287
|
getOraclePrice,
|