@myx-trade/sdk 0.1.189 → 0.1.190
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 +49 -31
- package/dist/index.d.ts +49 -31
- package/dist/index.js +356 -148
- package/dist/index.mjs +354 -146
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -61,19 +61,19 @@ __export(index_exports, {
|
|
|
61
61
|
addFavorite: () => addFavorite,
|
|
62
62
|
approve: () => approve,
|
|
63
63
|
base: () => base_exports,
|
|
64
|
-
baseUrl: () => baseUrl,
|
|
65
64
|
bigintAmountSlipperCalculator: () => bigintAmountSlipperCalculator,
|
|
66
65
|
bigintTradingGasPriceWithRatio: () => bigintTradingGasPriceWithRatio,
|
|
67
66
|
bigintTradingGasToRatioCalculator: () => bigintTradingGasToRatioCalculator,
|
|
68
67
|
fetchForwarderGetApi: () => fetchForwarderGetApi,
|
|
69
68
|
formatUnits: () => import_ethers22.formatUnits,
|
|
70
|
-
forwardUrl: () => forwardUrl,
|
|
71
69
|
forwarderTxApi: () => forwarderTxApi,
|
|
72
70
|
getAllTickers: () => getAllTickers,
|
|
73
71
|
getAllowanceApproved: () => getAllowanceApproved,
|
|
74
72
|
getBalanceOf: () => getBalanceOf,
|
|
75
73
|
getBaseDetail: () => getBaseDetail,
|
|
74
|
+
getBaseUrlByEnv: () => getBaseUrlByEnv,
|
|
76
75
|
getFavoritesList: () => getFavoritesList,
|
|
76
|
+
getForwardUrlByEnv: () => getForwardUrlByEnv,
|
|
77
77
|
getHistoryOrders: () => getHistoryOrders,
|
|
78
78
|
getKlineData: () => getKlineData,
|
|
79
79
|
getKlineLatestBar: () => getKlineLatestBar,
|
|
@@ -1824,7 +1824,7 @@ var RotationProvider = class extends import_providers.BaseProvider {
|
|
|
1824
1824
|
// package.json
|
|
1825
1825
|
var package_default = {
|
|
1826
1826
|
name: "@myx-trade/sdk",
|
|
1827
|
-
version: "0.1.
|
|
1827
|
+
version: "0.1.190",
|
|
1828
1828
|
private: false,
|
|
1829
1829
|
publishConfig: {
|
|
1830
1830
|
access: "public"
|
|
@@ -2089,10 +2089,11 @@ var ExecTypeEnum = /* @__PURE__ */ ((ExecTypeEnum2) => {
|
|
|
2089
2089
|
var getHistoryOrders = async ({
|
|
2090
2090
|
accessToken,
|
|
2091
2091
|
address,
|
|
2092
|
+
isProd = true,
|
|
2092
2093
|
...params
|
|
2093
2094
|
}) => {
|
|
2094
2095
|
return http.get(
|
|
2095
|
-
`${
|
|
2096
|
+
`${getBaseUrlByEnv(isProd)}/openapi/gateway/scan/order/closed`,
|
|
2096
2097
|
params,
|
|
2097
2098
|
{
|
|
2098
2099
|
headers: {
|
|
@@ -2118,10 +2119,11 @@ var CloseTypeEnum = /* @__PURE__ */ ((CloseTypeEnum2) => {
|
|
|
2118
2119
|
var getPositionHistory = async ({
|
|
2119
2120
|
accessToken,
|
|
2120
2121
|
address,
|
|
2122
|
+
isProd = true,
|
|
2121
2123
|
...params
|
|
2122
2124
|
}) => {
|
|
2123
2125
|
return http.get(
|
|
2124
|
-
`${
|
|
2126
|
+
`${getBaseUrlByEnv(isProd)}/openapi/gateway/scan/position/closed`,
|
|
2125
2127
|
params,
|
|
2126
2128
|
{
|
|
2127
2129
|
headers: {
|
|
@@ -2140,10 +2142,11 @@ var TradeFlowAccountTypeEnum = /* @__PURE__ */ ((TradeFlowAccountTypeEnum2) => {
|
|
|
2140
2142
|
var getTradeFlow = async ({
|
|
2141
2143
|
accessToken,
|
|
2142
2144
|
address,
|
|
2145
|
+
isProd = true,
|
|
2143
2146
|
...params
|
|
2144
2147
|
}) => {
|
|
2145
2148
|
return http.get(
|
|
2146
|
-
`${
|
|
2149
|
+
`${getBaseUrlByEnv(isProd)}/openapi/gateway/scan/trade/flow`,
|
|
2147
2150
|
params,
|
|
2148
2151
|
{
|
|
2149
2152
|
headers: {
|
|
@@ -2155,10 +2158,9 @@ var getTradeFlow = async ({
|
|
|
2155
2158
|
};
|
|
2156
2159
|
|
|
2157
2160
|
// src/api/seamless/index.ts
|
|
2158
|
-
var forwarderTxApi = async (params, chainId) => {
|
|
2159
|
-
console.log("forwarderTxApi params-->", params);
|
|
2161
|
+
var forwarderTxApi = async (params, chainId, isProd = true) => {
|
|
2160
2162
|
return http.post(
|
|
2161
|
-
`${
|
|
2163
|
+
`${getForwardUrlByEnv(isProd)}/forwarder/tx-v2`,
|
|
2162
2164
|
params,
|
|
2163
2165
|
{
|
|
2164
2166
|
headers: {
|
|
@@ -2174,31 +2176,39 @@ var ForwarderGetStatus = /* @__PURE__ */ ((ForwarderGetStatus2) => {
|
|
|
2174
2176
|
ForwarderGetStatus2[ForwarderGetStatus2["EXECUTED"] = 9] = "EXECUTED";
|
|
2175
2177
|
return ForwarderGetStatus2;
|
|
2176
2178
|
})(ForwarderGetStatus || {});
|
|
2177
|
-
var fetchForwarderGetApi = async (params) => {
|
|
2179
|
+
var fetchForwarderGetApi = async (params, isProd = true) => {
|
|
2178
2180
|
const rs = await http.get(
|
|
2179
|
-
`${
|
|
2181
|
+
`${getForwardUrlByEnv(isProd)}/forwarder/get${addQueryParams(params)}`
|
|
2180
2182
|
);
|
|
2181
2183
|
return rs;
|
|
2182
2184
|
};
|
|
2183
2185
|
|
|
2184
2186
|
// src/api/pool/index.ts
|
|
2185
|
-
var getPoolList = async (
|
|
2187
|
+
var getPoolList = async ({
|
|
2188
|
+
isProd = true
|
|
2189
|
+
}) => {
|
|
2186
2190
|
return http.get(
|
|
2187
|
-
`${
|
|
2191
|
+
`${getBaseUrlByEnv(isProd)}/openapi/gateway/scan/market/list`
|
|
2188
2192
|
);
|
|
2189
2193
|
};
|
|
2190
|
-
var getPoolSymbolAll = async (
|
|
2194
|
+
var getPoolSymbolAll = async ({
|
|
2195
|
+
isProd = true
|
|
2196
|
+
}) => {
|
|
2191
2197
|
return http.get(
|
|
2192
|
-
`${
|
|
2198
|
+
`${getBaseUrlByEnv(isProd)}/openapi/gateway/scan/pools`
|
|
2193
2199
|
);
|
|
2194
2200
|
};
|
|
2195
2201
|
|
|
2196
2202
|
// src/api/index.ts
|
|
2197
|
-
var
|
|
2198
|
-
|
|
2199
|
-
|
|
2203
|
+
var getBaseUrlByEnv = (isProd) => {
|
|
2204
|
+
return isProd ? "https://api.myx.finance" : "https://api-test.myx.cash";
|
|
2205
|
+
};
|
|
2206
|
+
var getForwardUrlByEnv = (isProd) => {
|
|
2207
|
+
return isProd ? "https://api.myx.finance/v2/agent" : "https://api-test.myx.cash/v2/agent";
|
|
2208
|
+
};
|
|
2209
|
+
var getOraclePrice = async (chainId, poolIds = [], isProd = true) => {
|
|
2200
2210
|
if (!!poolIds.length) {
|
|
2201
|
-
return http.get(`${
|
|
2211
|
+
return http.get(`${getBaseUrlByEnv(isProd)}/openapi/gateway/quote/price/oracles`, {
|
|
2202
2212
|
chainId,
|
|
2203
2213
|
poolIds: poolIds.join(",")
|
|
2204
2214
|
});
|
|
@@ -2207,23 +2217,24 @@ var getOraclePrice = async (chainId, poolIds = []) => {
|
|
|
2207
2217
|
};
|
|
2208
2218
|
var getPoolLevelConfig = async ({
|
|
2209
2219
|
poolId,
|
|
2210
|
-
chainId
|
|
2220
|
+
chainId,
|
|
2221
|
+
isProd = true
|
|
2211
2222
|
}) => {
|
|
2212
2223
|
return http.get(
|
|
2213
|
-
`${
|
|
2224
|
+
`${getBaseUrlByEnv(isProd)}/openapi/gateway/risk/market_pool/level_config${addQueryParams({
|
|
2214
2225
|
poolId,
|
|
2215
2226
|
chainId
|
|
2216
2227
|
})}`
|
|
2217
2228
|
);
|
|
2218
2229
|
};
|
|
2219
|
-
var getPoolDetail = async (chainId, poolId) => {
|
|
2230
|
+
var getPoolDetail = async (chainId, poolId, isProd = true) => {
|
|
2220
2231
|
return await http.get(
|
|
2221
|
-
`${
|
|
2232
|
+
`${getBaseUrlByEnv(isProd)}/openapi/gateway/scan/market/info?chainId=${chainId}&poolId=${poolId}`
|
|
2222
2233
|
);
|
|
2223
2234
|
};
|
|
2224
|
-
var getPositions = async (accessToken, address) => {
|
|
2235
|
+
var getPositions = async (accessToken, address, isProd = true) => {
|
|
2225
2236
|
return await http.get(
|
|
2226
|
-
`${
|
|
2237
|
+
`${getBaseUrlByEnv(isProd)}/openapi/gateway/scan/position/open`,
|
|
2227
2238
|
void 0,
|
|
2228
2239
|
// params
|
|
2229
2240
|
{
|
|
@@ -2234,16 +2245,16 @@ var getPositions = async (accessToken, address) => {
|
|
|
2234
2245
|
}
|
|
2235
2246
|
);
|
|
2236
2247
|
};
|
|
2237
|
-
var getOrders = async (accessToken, address) => {
|
|
2248
|
+
var getOrders = async (accessToken, address, isProd = true) => {
|
|
2238
2249
|
return await http.get(
|
|
2239
|
-
`${
|
|
2250
|
+
`${getBaseUrlByEnv(isProd)}/openapi/gateway/scan/order/open`,
|
|
2240
2251
|
void 0,
|
|
2241
2252
|
{ headers: { myx_openapi_access_token: accessToken, myx_openapi_account: address } }
|
|
2242
2253
|
);
|
|
2243
2254
|
};
|
|
2244
|
-
var getPoolOpenOrders = async (accessToken, address, chainId) => {
|
|
2255
|
+
var getPoolOpenOrders = async (accessToken, address, chainId, isProd = true) => {
|
|
2245
2256
|
return await http.get(
|
|
2246
|
-
`${
|
|
2257
|
+
`${getBaseUrlByEnv(isProd)}/openapi/gateway/scan/market/pool-order/open?chainId=${chainId}`,
|
|
2247
2258
|
void 0,
|
|
2248
2259
|
{ headers: { myx_openapi_access_token: accessToken, myx_openapi_account: address } }
|
|
2249
2260
|
);
|
|
@@ -2253,10 +2264,11 @@ var getKlineData = ({
|
|
|
2253
2264
|
poolId,
|
|
2254
2265
|
endTime,
|
|
2255
2266
|
limit,
|
|
2256
|
-
interval
|
|
2267
|
+
interval,
|
|
2268
|
+
isProd = true
|
|
2257
2269
|
}) => {
|
|
2258
2270
|
return http.get(
|
|
2259
|
-
`${
|
|
2271
|
+
`${getBaseUrlByEnv(isProd)}/openapi/gateway/quote/candles`,
|
|
2260
2272
|
{
|
|
2261
2273
|
chainId,
|
|
2262
2274
|
poolId,
|
|
@@ -2266,36 +2278,40 @@ var getKlineData = ({
|
|
|
2266
2278
|
}
|
|
2267
2279
|
);
|
|
2268
2280
|
};
|
|
2269
|
-
var getKlineLatestBar = async (params) => {
|
|
2281
|
+
var getKlineLatestBar = async (params, isProd = true) => {
|
|
2270
2282
|
return http.get(
|
|
2271
|
-
`${
|
|
2283
|
+
`${getBaseUrlByEnv(isProd)}/openapi/gateway/quote/candle/latest`,
|
|
2272
2284
|
params
|
|
2273
2285
|
);
|
|
2274
2286
|
};
|
|
2275
2287
|
var getTickerData = async ({
|
|
2276
2288
|
chainId,
|
|
2277
|
-
poolIds
|
|
2289
|
+
poolIds,
|
|
2290
|
+
isProd = true
|
|
2278
2291
|
}) => {
|
|
2279
2292
|
return http.get(
|
|
2280
|
-
`${
|
|
2293
|
+
`${getBaseUrlByEnv(isProd)}/openapi/gateway/quote/candle/tickers`,
|
|
2281
2294
|
{
|
|
2282
2295
|
chainId,
|
|
2283
2296
|
poolIds: poolIds.join(",")
|
|
2284
2297
|
}
|
|
2285
2298
|
);
|
|
2286
2299
|
};
|
|
2287
|
-
var getAllTickers = async (
|
|
2300
|
+
var getAllTickers = async ({
|
|
2301
|
+
isProd = true
|
|
2302
|
+
}) => {
|
|
2288
2303
|
return http.get(
|
|
2289
|
-
`${
|
|
2304
|
+
`${getBaseUrlByEnv(isProd)}/v2/mx-gateway/quote/candle/all_tickers`
|
|
2290
2305
|
);
|
|
2291
2306
|
};
|
|
2292
2307
|
var searchMarketAuth = async ({
|
|
2293
2308
|
accessToken,
|
|
2294
2309
|
address,
|
|
2310
|
+
isProd = true,
|
|
2295
2311
|
...params
|
|
2296
2312
|
}) => {
|
|
2297
2313
|
return http.get(
|
|
2298
|
-
`${
|
|
2314
|
+
`${getBaseUrlByEnv(isProd)}/openapi/gateway/scan/market/ac-search`,
|
|
2299
2315
|
params,
|
|
2300
2316
|
{
|
|
2301
2317
|
headers: {
|
|
@@ -2305,19 +2321,23 @@ var searchMarketAuth = async ({
|
|
|
2305
2321
|
}
|
|
2306
2322
|
);
|
|
2307
2323
|
};
|
|
2308
|
-
var searchMarket = async ({
|
|
2324
|
+
var searchMarket = async ({
|
|
2325
|
+
isProd = true,
|
|
2326
|
+
...params
|
|
2327
|
+
}) => {
|
|
2309
2328
|
return http.get(
|
|
2310
|
-
`${
|
|
2329
|
+
`${getBaseUrlByEnv(isProd)}/openapi/gateway/scan/market/search`,
|
|
2311
2330
|
params
|
|
2312
2331
|
);
|
|
2313
2332
|
};
|
|
2314
2333
|
var addFavorite = async ({
|
|
2315
2334
|
accessToken,
|
|
2316
2335
|
address,
|
|
2336
|
+
isProd = true,
|
|
2317
2337
|
...params
|
|
2318
2338
|
}) => {
|
|
2319
2339
|
return http.get(
|
|
2320
|
-
`${
|
|
2340
|
+
`${getBaseUrlByEnv(isProd)}/openapi/gateway/scan/market/add-favorites`,
|
|
2321
2341
|
params,
|
|
2322
2342
|
{
|
|
2323
2343
|
headers: {
|
|
@@ -2330,10 +2350,11 @@ var addFavorite = async ({
|
|
|
2330
2350
|
var removeFavorite = async ({
|
|
2331
2351
|
accessToken,
|
|
2332
2352
|
address,
|
|
2353
|
+
isProd = true,
|
|
2333
2354
|
...params
|
|
2334
2355
|
}) => {
|
|
2335
2356
|
return http.get(
|
|
2336
|
-
`${
|
|
2357
|
+
`${getBaseUrlByEnv(isProd)}/openapi/gateway/scan/market/cancel-favorites`,
|
|
2337
2358
|
params,
|
|
2338
2359
|
{
|
|
2339
2360
|
headers: {
|
|
@@ -2346,10 +2367,11 @@ var removeFavorite = async ({
|
|
|
2346
2367
|
var getFavoritesList = async ({
|
|
2347
2368
|
accessToken,
|
|
2348
2369
|
address,
|
|
2370
|
+
isProd = true,
|
|
2349
2371
|
...params
|
|
2350
2372
|
}) => {
|
|
2351
2373
|
return http.get(
|
|
2352
|
-
`${
|
|
2374
|
+
`${getBaseUrlByEnv(isProd)}/openapi/gateway/scan/market/favorites`,
|
|
2353
2375
|
params,
|
|
2354
2376
|
{
|
|
2355
2377
|
headers: {
|
|
@@ -2359,20 +2381,28 @@ var getFavoritesList = async ({
|
|
|
2359
2381
|
}
|
|
2360
2382
|
);
|
|
2361
2383
|
};
|
|
2362
|
-
var getBaseDetail = async (
|
|
2384
|
+
var getBaseDetail = async ({
|
|
2385
|
+
isProd = true,
|
|
2386
|
+
...params
|
|
2387
|
+
}) => {
|
|
2363
2388
|
return http.get(
|
|
2364
|
-
`${
|
|
2389
|
+
`${getBaseUrlByEnv(isProd)}/openapi/gateway/scan/market/base-details`,
|
|
2365
2390
|
params
|
|
2366
2391
|
);
|
|
2367
2392
|
};
|
|
2368
|
-
var getMarketDetail = async (
|
|
2393
|
+
var getMarketDetail = async ({
|
|
2394
|
+
isProd = true,
|
|
2395
|
+
...params
|
|
2396
|
+
}) => {
|
|
2369
2397
|
return http.get(
|
|
2370
|
-
`${
|
|
2398
|
+
`${getBaseUrlByEnv(isProd)}/openapi/gateway/scan/market/detail`,
|
|
2371
2399
|
params
|
|
2372
2400
|
);
|
|
2373
2401
|
};
|
|
2374
|
-
var getMarketList = async (
|
|
2375
|
-
|
|
2402
|
+
var getMarketList = async ({
|
|
2403
|
+
isProd = true
|
|
2404
|
+
}) => {
|
|
2405
|
+
return http.get(`${getBaseUrlByEnv(isProd)}/openapi/gateway/scan/market`);
|
|
2376
2406
|
};
|
|
2377
2407
|
|
|
2378
2408
|
// src/web3/index.ts
|
|
@@ -5411,6 +5441,11 @@ var BasePool_default = [
|
|
|
5411
5441
|
|
|
5412
5442
|
// src/abi/Broker.json
|
|
5413
5443
|
var Broker_default = [
|
|
5444
|
+
{
|
|
5445
|
+
type: "constructor",
|
|
5446
|
+
payable: false,
|
|
5447
|
+
inputs: []
|
|
5448
|
+
},
|
|
5414
5449
|
{
|
|
5415
5450
|
type: "error",
|
|
5416
5451
|
name: "ECDSAInvalidSignature",
|
|
@@ -5760,7 +5795,16 @@ var Broker_default = [
|
|
|
5760
5795
|
constant: true,
|
|
5761
5796
|
stateMutability: "view",
|
|
5762
5797
|
payable: false,
|
|
5763
|
-
inputs: [
|
|
5798
|
+
inputs: [
|
|
5799
|
+
{
|
|
5800
|
+
type: "uint8",
|
|
5801
|
+
name: "assetClass"
|
|
5802
|
+
},
|
|
5803
|
+
{
|
|
5804
|
+
type: "uint8",
|
|
5805
|
+
name: "riskTier"
|
|
5806
|
+
}
|
|
5807
|
+
],
|
|
5764
5808
|
outputs: [
|
|
5765
5809
|
{
|
|
5766
5810
|
type: "uint256[]"
|
|
@@ -5773,7 +5817,16 @@ var Broker_default = [
|
|
|
5773
5817
|
constant: true,
|
|
5774
5818
|
stateMutability: "view",
|
|
5775
5819
|
payable: false,
|
|
5776
|
-
inputs: [
|
|
5820
|
+
inputs: [
|
|
5821
|
+
{
|
|
5822
|
+
type: "uint8",
|
|
5823
|
+
name: "assetClass"
|
|
5824
|
+
},
|
|
5825
|
+
{
|
|
5826
|
+
type: "uint8",
|
|
5827
|
+
name: "riskTier"
|
|
5828
|
+
}
|
|
5829
|
+
],
|
|
5777
5830
|
outputs: [
|
|
5778
5831
|
{
|
|
5779
5832
|
type: "uint256[]"
|
|
@@ -5824,6 +5877,82 @@ var Broker_default = [
|
|
|
5824
5877
|
],
|
|
5825
5878
|
outputs: []
|
|
5826
5879
|
},
|
|
5880
|
+
{
|
|
5881
|
+
type: "function",
|
|
5882
|
+
name: "batchSetSpecialFeeTiers",
|
|
5883
|
+
constant: false,
|
|
5884
|
+
payable: false,
|
|
5885
|
+
inputs: [
|
|
5886
|
+
{
|
|
5887
|
+
type: "tuple[]",
|
|
5888
|
+
name: "params",
|
|
5889
|
+
components: [
|
|
5890
|
+
{
|
|
5891
|
+
type: "uint8",
|
|
5892
|
+
name: "assetClass"
|
|
5893
|
+
},
|
|
5894
|
+
{
|
|
5895
|
+
type: "uint8",
|
|
5896
|
+
name: "riskTier"
|
|
5897
|
+
},
|
|
5898
|
+
{
|
|
5899
|
+
type: "uint8",
|
|
5900
|
+
name: "feeTier"
|
|
5901
|
+
},
|
|
5902
|
+
{
|
|
5903
|
+
type: "int32",
|
|
5904
|
+
name: "makerFeeRate"
|
|
5905
|
+
},
|
|
5906
|
+
{
|
|
5907
|
+
type: "uint32",
|
|
5908
|
+
name: "takerFeeRate"
|
|
5909
|
+
}
|
|
5910
|
+
]
|
|
5911
|
+
}
|
|
5912
|
+
],
|
|
5913
|
+
outputs: []
|
|
5914
|
+
},
|
|
5915
|
+
{
|
|
5916
|
+
type: "function",
|
|
5917
|
+
name: "batchUpdateFeeTiers",
|
|
5918
|
+
constant: false,
|
|
5919
|
+
payable: false,
|
|
5920
|
+
inputs: [
|
|
5921
|
+
{
|
|
5922
|
+
type: "tuple[]",
|
|
5923
|
+
name: "params",
|
|
5924
|
+
components: [
|
|
5925
|
+
{
|
|
5926
|
+
type: "uint8",
|
|
5927
|
+
name: "assetClass"
|
|
5928
|
+
},
|
|
5929
|
+
{
|
|
5930
|
+
type: "uint8",
|
|
5931
|
+
name: "riskTier"
|
|
5932
|
+
},
|
|
5933
|
+
{
|
|
5934
|
+
type: "uint8",
|
|
5935
|
+
name: "feeTier"
|
|
5936
|
+
},
|
|
5937
|
+
{
|
|
5938
|
+
type: "tuple",
|
|
5939
|
+
name: "addOnFeeRate",
|
|
5940
|
+
components: [
|
|
5941
|
+
{
|
|
5942
|
+
type: "uint32",
|
|
5943
|
+
name: "takerFeeRate"
|
|
5944
|
+
},
|
|
5945
|
+
{
|
|
5946
|
+
type: "uint32",
|
|
5947
|
+
name: "makerFeeRate"
|
|
5948
|
+
}
|
|
5949
|
+
]
|
|
5950
|
+
}
|
|
5951
|
+
]
|
|
5952
|
+
}
|
|
5953
|
+
],
|
|
5954
|
+
outputs: []
|
|
5955
|
+
},
|
|
5827
5956
|
{
|
|
5828
5957
|
type: "function",
|
|
5829
5958
|
name: "cancelOrder",
|
|
@@ -5923,7 +6052,15 @@ var Broker_default = [
|
|
|
5923
6052
|
inputs: [
|
|
5924
6053
|
{
|
|
5925
6054
|
type: "uint8",
|
|
5926
|
-
name: "
|
|
6055
|
+
name: "assetClass"
|
|
6056
|
+
},
|
|
6057
|
+
{
|
|
6058
|
+
type: "uint8",
|
|
6059
|
+
name: "riskTier"
|
|
6060
|
+
},
|
|
6061
|
+
{
|
|
6062
|
+
type: "uint8",
|
|
6063
|
+
name: "feeTier"
|
|
5927
6064
|
}
|
|
5928
6065
|
],
|
|
5929
6066
|
outputs: [
|
|
@@ -5973,6 +6110,14 @@ var Broker_default = [
|
|
|
5973
6110
|
stateMutability: "view",
|
|
5974
6111
|
payable: false,
|
|
5975
6112
|
inputs: [
|
|
6113
|
+
{
|
|
6114
|
+
type: "uint8",
|
|
6115
|
+
name: "assetClass"
|
|
6116
|
+
},
|
|
6117
|
+
{
|
|
6118
|
+
type: "uint8",
|
|
6119
|
+
name: "riskTier"
|
|
6120
|
+
},
|
|
5976
6121
|
{
|
|
5977
6122
|
type: "uint8",
|
|
5978
6123
|
name: "feeTier"
|
|
@@ -6003,6 +6148,10 @@ var Broker_default = [
|
|
|
6003
6148
|
{
|
|
6004
6149
|
type: "uint8",
|
|
6005
6150
|
name: "assetClass"
|
|
6151
|
+
},
|
|
6152
|
+
{
|
|
6153
|
+
type: "uint8",
|
|
6154
|
+
name: "riskTier"
|
|
6006
6155
|
}
|
|
6007
6156
|
],
|
|
6008
6157
|
outputs: [
|
|
@@ -6615,16 +6764,30 @@ var Broker_default = [
|
|
|
6615
6764
|
payable: false,
|
|
6616
6765
|
inputs: [
|
|
6617
6766
|
{
|
|
6618
|
-
type: "
|
|
6619
|
-
name: "
|
|
6620
|
-
|
|
6621
|
-
|
|
6622
|
-
|
|
6623
|
-
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
|
|
6627
|
-
|
|
6767
|
+
type: "tuple",
|
|
6768
|
+
name: "params",
|
|
6769
|
+
components: [
|
|
6770
|
+
{
|
|
6771
|
+
type: "uint8",
|
|
6772
|
+
name: "assetClass"
|
|
6773
|
+
},
|
|
6774
|
+
{
|
|
6775
|
+
type: "uint8",
|
|
6776
|
+
name: "riskTier"
|
|
6777
|
+
},
|
|
6778
|
+
{
|
|
6779
|
+
type: "uint8",
|
|
6780
|
+
name: "feeTier"
|
|
6781
|
+
},
|
|
6782
|
+
{
|
|
6783
|
+
type: "int32",
|
|
6784
|
+
name: "makerFeeRate"
|
|
6785
|
+
},
|
|
6786
|
+
{
|
|
6787
|
+
type: "uint32",
|
|
6788
|
+
name: "takerFeeRate"
|
|
6789
|
+
}
|
|
6790
|
+
]
|
|
6628
6791
|
}
|
|
6629
6792
|
],
|
|
6630
6793
|
outputs: []
|
|
@@ -6744,25 +6907,31 @@ var Broker_default = [
|
|
|
6744
6907
|
constant: false,
|
|
6745
6908
|
payable: false,
|
|
6746
6909
|
inputs: [
|
|
6747
|
-
{
|
|
6748
|
-
type: "uint8[]",
|
|
6749
|
-
name: "assetClasses"
|
|
6750
|
-
},
|
|
6751
|
-
{
|
|
6752
|
-
type: "bool[]",
|
|
6753
|
-
name: "isEnables"
|
|
6754
|
-
},
|
|
6755
6910
|
{
|
|
6756
6911
|
type: "tuple[]",
|
|
6757
|
-
name: "
|
|
6912
|
+
name: "params",
|
|
6758
6913
|
components: [
|
|
6759
6914
|
{
|
|
6760
|
-
type: "
|
|
6761
|
-
name: "
|
|
6915
|
+
type: "uint8",
|
|
6916
|
+
name: "assetClass"
|
|
6762
6917
|
},
|
|
6763
6918
|
{
|
|
6764
|
-
type: "
|
|
6765
|
-
name: "
|
|
6919
|
+
type: "bool",
|
|
6920
|
+
name: "isEnable"
|
|
6921
|
+
},
|
|
6922
|
+
{
|
|
6923
|
+
type: "tuple",
|
|
6924
|
+
name: "baseFeeRate",
|
|
6925
|
+
components: [
|
|
6926
|
+
{
|
|
6927
|
+
type: "uint32",
|
|
6928
|
+
name: "takerFeeRate"
|
|
6929
|
+
},
|
|
6930
|
+
{
|
|
6931
|
+
type: "uint32",
|
|
6932
|
+
name: "makerFeeRate"
|
|
6933
|
+
}
|
|
6934
|
+
]
|
|
6766
6935
|
}
|
|
6767
6936
|
]
|
|
6768
6937
|
}
|
|
@@ -6790,7 +6959,15 @@ var Broker_default = [
|
|
|
6790
6959
|
inputs: [
|
|
6791
6960
|
{
|
|
6792
6961
|
type: "uint8",
|
|
6793
|
-
name: "
|
|
6962
|
+
name: "assetClass"
|
|
6963
|
+
},
|
|
6964
|
+
{
|
|
6965
|
+
type: "uint8",
|
|
6966
|
+
name: "riskTier"
|
|
6967
|
+
},
|
|
6968
|
+
{
|
|
6969
|
+
type: "uint8",
|
|
6970
|
+
name: "feeTier"
|
|
6794
6971
|
},
|
|
6795
6972
|
{
|
|
6796
6973
|
type: "tuple",
|
|
@@ -6815,9 +6992,17 @@ var Broker_default = [
|
|
|
6815
6992
|
constant: false,
|
|
6816
6993
|
payable: false,
|
|
6817
6994
|
inputs: [
|
|
6995
|
+
{
|
|
6996
|
+
type: "uint8",
|
|
6997
|
+
name: "assetClass"
|
|
6998
|
+
},
|
|
6999
|
+
{
|
|
7000
|
+
type: "uint8",
|
|
7001
|
+
name: "riskTier"
|
|
7002
|
+
},
|
|
6818
7003
|
{
|
|
6819
7004
|
type: "uint8[]",
|
|
6820
|
-
name: "
|
|
7005
|
+
name: "feeTiers"
|
|
6821
7006
|
},
|
|
6822
7007
|
{
|
|
6823
7008
|
type: "tuple[]",
|
|
@@ -9713,6 +9898,14 @@ var DataProvider_default = [
|
|
|
9713
9898
|
type: "address",
|
|
9714
9899
|
name: "brokerAddress"
|
|
9715
9900
|
},
|
|
9901
|
+
{
|
|
9902
|
+
type: "uint8[]",
|
|
9903
|
+
name: "assetClasses"
|
|
9904
|
+
},
|
|
9905
|
+
{
|
|
9906
|
+
type: "uint8[][]",
|
|
9907
|
+
name: "assetRiskTiers"
|
|
9908
|
+
},
|
|
9716
9909
|
{
|
|
9717
9910
|
type: "bool",
|
|
9718
9911
|
name: "isMYXBroker"
|
|
@@ -9720,60 +9913,74 @@ var DataProvider_default = [
|
|
|
9720
9913
|
],
|
|
9721
9914
|
outputs: [
|
|
9722
9915
|
{
|
|
9723
|
-
type: "tuple",
|
|
9724
|
-
name: "
|
|
9916
|
+
type: "tuple[]",
|
|
9917
|
+
name: "brokerFees",
|
|
9725
9918
|
components: [
|
|
9726
9919
|
{
|
|
9727
|
-
type: "
|
|
9728
|
-
name: "
|
|
9729
|
-
components: [
|
|
9730
|
-
{
|
|
9731
|
-
type: "uint8",
|
|
9732
|
-
name: "tier"
|
|
9733
|
-
},
|
|
9734
|
-
{
|
|
9735
|
-
type: "uint32",
|
|
9736
|
-
name: "takerFeeRate"
|
|
9737
|
-
},
|
|
9738
|
-
{
|
|
9739
|
-
type: "int32",
|
|
9740
|
-
name: "makerFeeRate"
|
|
9741
|
-
}
|
|
9742
|
-
]
|
|
9920
|
+
type: "uint8",
|
|
9921
|
+
name: "asset"
|
|
9743
9922
|
},
|
|
9744
9923
|
{
|
|
9745
9924
|
type: "tuple[]",
|
|
9746
|
-
name: "
|
|
9925
|
+
name: "riskTieredBrokerFees",
|
|
9747
9926
|
components: [
|
|
9748
9927
|
{
|
|
9749
9928
|
type: "uint8",
|
|
9750
|
-
name: "
|
|
9751
|
-
},
|
|
9752
|
-
{
|
|
9753
|
-
type: "uint32",
|
|
9754
|
-
name: "makerFeeRate"
|
|
9929
|
+
name: "riskTier"
|
|
9755
9930
|
},
|
|
9756
9931
|
{
|
|
9757
|
-
type: "
|
|
9758
|
-
name: "
|
|
9759
|
-
|
|
9760
|
-
|
|
9761
|
-
|
|
9762
|
-
|
|
9763
|
-
|
|
9764
|
-
|
|
9765
|
-
|
|
9766
|
-
|
|
9767
|
-
|
|
9768
|
-
|
|
9932
|
+
type: "tuple[]",
|
|
9933
|
+
name: "addOnFeeTiers",
|
|
9934
|
+
components: [
|
|
9935
|
+
{
|
|
9936
|
+
type: "uint8",
|
|
9937
|
+
name: "tier"
|
|
9938
|
+
},
|
|
9939
|
+
{
|
|
9940
|
+
type: "uint32",
|
|
9941
|
+
name: "takerFeeRate"
|
|
9942
|
+
},
|
|
9943
|
+
{
|
|
9944
|
+
type: "int32",
|
|
9945
|
+
name: "makerFeeRate"
|
|
9946
|
+
}
|
|
9947
|
+
]
|
|
9769
9948
|
},
|
|
9770
9949
|
{
|
|
9771
|
-
type: "
|
|
9772
|
-
name: "
|
|
9950
|
+
type: "tuple[]",
|
|
9951
|
+
name: "baseFeeRate",
|
|
9952
|
+
components: [
|
|
9953
|
+
{
|
|
9954
|
+
type: "uint8",
|
|
9955
|
+
name: "assetClass"
|
|
9956
|
+
},
|
|
9957
|
+
{
|
|
9958
|
+
type: "uint32",
|
|
9959
|
+
name: "makerFeeRate"
|
|
9960
|
+
},
|
|
9961
|
+
{
|
|
9962
|
+
type: "uint32",
|
|
9963
|
+
name: "takerFeeRate"
|
|
9964
|
+
}
|
|
9965
|
+
]
|
|
9773
9966
|
},
|
|
9774
9967
|
{
|
|
9775
|
-
type: "
|
|
9776
|
-
name: "
|
|
9968
|
+
type: "tuple[]",
|
|
9969
|
+
name: "specialFeeTiers",
|
|
9970
|
+
components: [
|
|
9971
|
+
{
|
|
9972
|
+
type: "uint8",
|
|
9973
|
+
name: "tier"
|
|
9974
|
+
},
|
|
9975
|
+
{
|
|
9976
|
+
type: "uint32",
|
|
9977
|
+
name: "takerFeeRate"
|
|
9978
|
+
},
|
|
9979
|
+
{
|
|
9980
|
+
type: "int32",
|
|
9981
|
+
name: "makerFeeRate"
|
|
9982
|
+
}
|
|
9983
|
+
]
|
|
9777
9984
|
}
|
|
9778
9985
|
]
|
|
9779
9986
|
}
|
|
@@ -11967,9 +12174,9 @@ var getPricesData = async (chainId, poolIds) => {
|
|
|
11967
12174
|
const result = await parsePriceData(chainId, rs.data);
|
|
11968
12175
|
return result;
|
|
11969
12176
|
};
|
|
11970
|
-
var getPriceData = async (chainId, poolId) => {
|
|
12177
|
+
var getPriceData = async (chainId, poolId, isProd) => {
|
|
11971
12178
|
if (!poolId) return;
|
|
11972
|
-
const rs = await getOraclePrice(chainId, [poolId]);
|
|
12179
|
+
const rs = await getOraclePrice(chainId, [poolId], isProd);
|
|
11973
12180
|
const data = rs?.data?.[0];
|
|
11974
12181
|
if (!data) {
|
|
11975
12182
|
throw new Error(`Unable to get price for ${poolId} in the deposit`);
|
|
@@ -12226,7 +12433,7 @@ var deposit = async (params) => {
|
|
|
12226
12433
|
let value = 0n;
|
|
12227
12434
|
let amountOut;
|
|
12228
12435
|
if (isNeedPrice) {
|
|
12229
|
-
const priceData = await getPriceData(chainId, poolId);
|
|
12436
|
+
const priceData = await getPriceData(chainId, poolId, true);
|
|
12230
12437
|
if (!priceData) return;
|
|
12231
12438
|
const referencePrice = (0, import_ethers10.parseUnits)(priceData.price, COMMON_PRICE_DECIMALS);
|
|
12232
12439
|
price.push({
|
|
@@ -12296,7 +12503,7 @@ var withdraw = async (params) => {
|
|
|
12296
12503
|
let value = 0n;
|
|
12297
12504
|
let amountOut;
|
|
12298
12505
|
if (isNeedPrice) {
|
|
12299
|
-
const priceData = await getPriceData(chainId, poolId);
|
|
12506
|
+
const priceData = await getPriceData(chainId, poolId, true);
|
|
12300
12507
|
if (!priceData) return;
|
|
12301
12508
|
const referencePrice = (0, import_ethers11.parseUnits)(priceData.price, COMMON_PRICE_DECIMALS);
|
|
12302
12509
|
price.push({
|
|
@@ -12368,7 +12575,7 @@ var getLpPrice = async (chainId, poolId) => {
|
|
|
12368
12575
|
try {
|
|
12369
12576
|
const contract = await getBasePoolContract(chainId);
|
|
12370
12577
|
let price = 0n;
|
|
12371
|
-
const res = await getPriceData(chainId, poolId);
|
|
12578
|
+
const res = await getPriceData(chainId, poolId, true);
|
|
12372
12579
|
if (res?.price) {
|
|
12373
12580
|
price = (0, import_ethers13.parseUnits)(res.price, COMMON_PRICE_DECIMALS);
|
|
12374
12581
|
}
|
|
@@ -12460,7 +12667,7 @@ var deposit2 = async (params) => {
|
|
|
12460
12667
|
let value = 0n;
|
|
12461
12668
|
let amountOut;
|
|
12462
12669
|
if (isNeedPrice) {
|
|
12463
|
-
const priceData = await getPriceData(chainId, poolId);
|
|
12670
|
+
const priceData = await getPriceData(chainId, poolId, true);
|
|
12464
12671
|
if (!priceData) return;
|
|
12465
12672
|
const referencePrice = (0, import_ethers14.parseUnits)(priceData.price, COMMON_PRICE_DECIMALS);
|
|
12466
12673
|
price.push({
|
|
@@ -12530,7 +12737,7 @@ var withdraw2 = async (params) => {
|
|
|
12530
12737
|
let value = 0n;
|
|
12531
12738
|
let amountOut;
|
|
12532
12739
|
if (isNeedPrice) {
|
|
12533
|
-
const priceData = await getPriceData(chainId, poolId);
|
|
12740
|
+
const priceData = await getPriceData(chainId, poolId, true);
|
|
12534
12741
|
if (!priceData) return;
|
|
12535
12742
|
const referencePrice = (0, import_ethers15.parseUnits)(priceData.price, COMMON_PRICE_DECIMALS);
|
|
12536
12743
|
price.push({
|
|
@@ -12732,7 +12939,7 @@ var getLpPrice2 = async (chainId, poolId) => {
|
|
|
12732
12939
|
try {
|
|
12733
12940
|
const contract = await getQuotePoolContract(chainId);
|
|
12734
12941
|
let price = 0n;
|
|
12735
|
-
const res = await getPriceData(chainId, poolId);
|
|
12942
|
+
const res = await getPriceData(chainId, poolId, true);
|
|
12736
12943
|
if (res?.price) {
|
|
12737
12944
|
price = (0, import_ethers19.parseUnits)(res.price, COMMON_PRICE_DECIMALS);
|
|
12738
12945
|
}
|
|
@@ -14169,6 +14376,7 @@ var Position = class {
|
|
|
14169
14376
|
this.account = account;
|
|
14170
14377
|
}
|
|
14171
14378
|
async listPositions(address) {
|
|
14379
|
+
const isProd = !this.configManager.getConfig().isTestnet;
|
|
14172
14380
|
const accessToken = await this.configManager.getAccessToken();
|
|
14173
14381
|
if (!accessToken) {
|
|
14174
14382
|
return {
|
|
@@ -14177,7 +14385,7 @@ var Position = class {
|
|
|
14177
14385
|
};
|
|
14178
14386
|
}
|
|
14179
14387
|
try {
|
|
14180
|
-
const res = await getPositions(accessToken, address);
|
|
14388
|
+
const res = await getPositions(accessToken, address, isProd);
|
|
14181
14389
|
return {
|
|
14182
14390
|
code: 0,
|
|
14183
14391
|
data: res.data
|
|
@@ -14191,6 +14399,7 @@ var Position = class {
|
|
|
14191
14399
|
}
|
|
14192
14400
|
}
|
|
14193
14401
|
async getPositionHistory(params, address) {
|
|
14402
|
+
const isProd = !this.configManager.getConfig().isTestnet;
|
|
14194
14403
|
const accessToken = await this.configManager.getAccessToken();
|
|
14195
14404
|
if (!accessToken) {
|
|
14196
14405
|
throw new MyxSDKError(
|
|
@@ -14198,7 +14407,7 @@ var Position = class {
|
|
|
14198
14407
|
"Invalid access token"
|
|
14199
14408
|
);
|
|
14200
14409
|
}
|
|
14201
|
-
const res = await getPositionHistory({ accessToken, ...params, address });
|
|
14410
|
+
const res = await getPositionHistory({ accessToken, ...params, address, isProd });
|
|
14202
14411
|
return {
|
|
14203
14412
|
code: 0,
|
|
14204
14413
|
data: res.data
|
|
@@ -14221,7 +14430,7 @@ var Position = class {
|
|
|
14221
14430
|
quoteToken
|
|
14222
14431
|
});
|
|
14223
14432
|
try {
|
|
14224
|
-
const priceData = await this.utils.getOraclePrice(poolId);
|
|
14433
|
+
const priceData = await this.utils.getOraclePrice(poolId, chainId);
|
|
14225
14434
|
if (!priceData) {
|
|
14226
14435
|
throw new Error("Failed to get price data");
|
|
14227
14436
|
}
|
|
@@ -15388,6 +15597,7 @@ var Order = class {
|
|
|
15388
15597
|
}
|
|
15389
15598
|
}
|
|
15390
15599
|
async getOrders(address) {
|
|
15600
|
+
const isProd = !this.configManager.getConfig().isTestnet;
|
|
15391
15601
|
const accessToken = await this.configManager.getAccessToken();
|
|
15392
15602
|
if (!accessToken) {
|
|
15393
15603
|
return {
|
|
@@ -15396,7 +15606,7 @@ var Order = class {
|
|
|
15396
15606
|
};
|
|
15397
15607
|
}
|
|
15398
15608
|
try {
|
|
15399
|
-
const res = await getOrders(accessToken, address);
|
|
15609
|
+
const res = await getOrders(accessToken, address, isProd);
|
|
15400
15610
|
return {
|
|
15401
15611
|
code: 0,
|
|
15402
15612
|
data: res.data
|
|
@@ -15411,13 +15621,14 @@ var Order = class {
|
|
|
15411
15621
|
}
|
|
15412
15622
|
async getOrderHistory(params, address) {
|
|
15413
15623
|
const accessToken = await this.configManager.getAccessToken();
|
|
15624
|
+
const isProd = !this.configManager.getConfig().isTestnet;
|
|
15414
15625
|
if (!accessToken) {
|
|
15415
15626
|
throw new MyxSDKError(
|
|
15416
15627
|
"INVALID_ACCESS_TOKEN" /* InvalidAccessToken */,
|
|
15417
15628
|
"Invalid access token"
|
|
15418
15629
|
);
|
|
15419
15630
|
}
|
|
15420
|
-
const res = await getHistoryOrders({ accessToken, ...params, address });
|
|
15631
|
+
const res = await getHistoryOrders({ accessToken, ...params, address, isProd });
|
|
15421
15632
|
return {
|
|
15422
15633
|
code: 0,
|
|
15423
15634
|
data: res.data
|
|
@@ -20187,7 +20398,7 @@ var Utils = class {
|
|
|
20187
20398
|
};
|
|
20188
20399
|
}
|
|
20189
20400
|
}
|
|
20190
|
-
async getUserTradingFeeRate(assetClass) {
|
|
20401
|
+
async getUserTradingFeeRate(assetClass, riskTier) {
|
|
20191
20402
|
const config = this.configManager.getConfig();
|
|
20192
20403
|
const brokerAddress = config.brokerAddress;
|
|
20193
20404
|
try {
|
|
@@ -20200,7 +20411,8 @@ var Utils = class {
|
|
|
20200
20411
|
const targetAddress = config.seamlessMode ? config.seamlessAccount?.masterAddress : config.signer?.getAddress();
|
|
20201
20412
|
const userFeeRate = await brokerContract.getUserFeeRate(
|
|
20202
20413
|
targetAddress,
|
|
20203
|
-
assetClass
|
|
20414
|
+
assetClass,
|
|
20415
|
+
riskTier
|
|
20204
20416
|
);
|
|
20205
20417
|
return {
|
|
20206
20418
|
code: 0,
|
|
@@ -20241,10 +20453,10 @@ var Utils = class {
|
|
|
20241
20453
|
return "0";
|
|
20242
20454
|
}
|
|
20243
20455
|
}
|
|
20244
|
-
async getOraclePrice(poolId) {
|
|
20456
|
+
async getOraclePrice(poolId, chainId) {
|
|
20245
20457
|
try {
|
|
20246
|
-
const
|
|
20247
|
-
const priceData = await getPriceData(
|
|
20458
|
+
const isProd = !this.configManager.getConfig().isTestnet;
|
|
20459
|
+
const priceData = await getPriceData(chainId, poolId, isProd);
|
|
20248
20460
|
if (!priceData) throw new Error("Failed to get price data");
|
|
20249
20461
|
return priceData;
|
|
20250
20462
|
} catch (error) {
|
|
@@ -21160,7 +21372,8 @@ var Account = class {
|
|
|
21160
21372
|
}
|
|
21161
21373
|
async getAvailableMarginBalance({ poolId, chainId, address }) {
|
|
21162
21374
|
try {
|
|
21163
|
-
const
|
|
21375
|
+
const isProd = !this.configManager.getConfig().isTestnet;
|
|
21376
|
+
const poolListRes = await getPoolList({ isProd });
|
|
21164
21377
|
if (poolListRes.code !== 9200) {
|
|
21165
21378
|
throw new MyxSDKError(
|
|
21166
21379
|
"REQUEST_FAILED" /* RequestFailed */,
|
|
@@ -21190,20 +21403,15 @@ var Account = class {
|
|
|
21190
21403
|
"Failed to get account info"
|
|
21191
21404
|
);
|
|
21192
21405
|
}
|
|
21193
|
-
this.logger.info("getAvailableMarginBalance used-->", used);
|
|
21194
21406
|
const marginAccountBalance = marginAccountBalanceRes.data;
|
|
21195
21407
|
const usedMargin = BigInt(used ?? "0");
|
|
21196
21408
|
const quoteProfit = BigInt(marginAccountBalance.quoteProfit ?? 0);
|
|
21197
|
-
this.logger.info("getAvailableMarginBalance quoteProfit-->", quoteProfit.toString);
|
|
21198
21409
|
const freeAmount = BigInt(marginAccountBalance?.freeMargin ?? 0);
|
|
21199
|
-
this.logger.info("getAvailableMarginBalance freeAmount-->", freeAmount.toString());
|
|
21200
21410
|
const accountMargin = freeAmount + quoteProfit;
|
|
21201
|
-
this.logger.info("getAvailableMarginBalance accountMargin-->", accountMargin.toString());
|
|
21202
21411
|
if (accountMargin < usedMargin) {
|
|
21203
21412
|
return BigInt(0);
|
|
21204
21413
|
}
|
|
21205
21414
|
const availableAccountMarginBalance = accountMargin - usedMargin;
|
|
21206
|
-
this.logger.info("getAvailableMarginBalance availableAccountMarginBalance-->", availableAccountMarginBalance.toString());
|
|
21207
21415
|
return availableAccountMarginBalance;
|
|
21208
21416
|
} catch (error) {
|
|
21209
21417
|
this.logger.info("getAvailableMarginBalance error-->", error);
|
|
@@ -21214,6 +21422,7 @@ var Account = class {
|
|
|
21214
21422
|
}
|
|
21215
21423
|
}
|
|
21216
21424
|
async getTradeFlow(params, address) {
|
|
21425
|
+
const isProd = !this.configManager.getConfig().isTestnet;
|
|
21217
21426
|
const accessToken = await this.configManager.getAccessToken();
|
|
21218
21427
|
if (!accessToken) {
|
|
21219
21428
|
throw new MyxSDKError(
|
|
@@ -21221,7 +21430,7 @@ var Account = class {
|
|
|
21221
21430
|
"Invalid access token"
|
|
21222
21431
|
);
|
|
21223
21432
|
}
|
|
21224
|
-
const res = await getTradeFlow({ accessToken, ...params, address });
|
|
21433
|
+
const res = await getTradeFlow({ accessToken, ...params, address, isProd });
|
|
21225
21434
|
return {
|
|
21226
21435
|
code: 0,
|
|
21227
21436
|
data: res.data
|
|
@@ -21649,6 +21858,7 @@ var Seamless = class {
|
|
|
21649
21858
|
data,
|
|
21650
21859
|
nonce
|
|
21651
21860
|
}, chainId, provider) {
|
|
21861
|
+
const isProd = !this.configManager.getConfig().isTestnet;
|
|
21652
21862
|
const forwarderContract = await getForwarderContract(chainId);
|
|
21653
21863
|
const forwarderJsonRpcContractDomain = await forwarderContract.eip712Domain();
|
|
21654
21864
|
const domain = {
|
|
@@ -21667,7 +21877,7 @@ var Seamless = class {
|
|
|
21667
21877
|
deadline,
|
|
21668
21878
|
data
|
|
21669
21879
|
});
|
|
21670
|
-
const txRs = await forwarderTxApi({ from, to, value, gas, nonce, data, deadline, signature }, chainId);
|
|
21880
|
+
const txRs = await forwarderTxApi({ from, to, value, gas, nonce, data, deadline, signature }, chainId, isProd);
|
|
21671
21881
|
return txRs;
|
|
21672
21882
|
}
|
|
21673
21883
|
async authorizeSeamlessAccount({ approve: approve2, seamlessAddress, chainId }) {
|
|
@@ -21680,7 +21890,7 @@ var Seamless = class {
|
|
|
21680
21890
|
if (approve2) {
|
|
21681
21891
|
const balanceRes = await this.account.getWalletQuoteTokenBalance(masterAddress);
|
|
21682
21892
|
const balance = balanceRes.data;
|
|
21683
|
-
const forwarderContract2 = await getForwarderContract(
|
|
21893
|
+
const forwarderContract2 = await getForwarderContract(chainId);
|
|
21684
21894
|
const pledgeFee = await forwarderContract2.getRelayFee();
|
|
21685
21895
|
const gasFee = BigInt(pledgeFee) * BigInt(FORWARD_PLEDGE_FEE_RADIO);
|
|
21686
21896
|
if (gasFee > 0 && gasFee > BigInt(balance)) {
|
|
@@ -21691,9 +21901,7 @@ var Seamless = class {
|
|
|
21691
21901
|
let permitParams = [];
|
|
21692
21902
|
if (approve2) {
|
|
21693
21903
|
try {
|
|
21694
|
-
console.log("getUSDPermitParams");
|
|
21695
21904
|
permitParams = await this.getUSDPermitParams(deadline, chainId);
|
|
21696
|
-
console.log("permitParams result-->", permitParams);
|
|
21697
21905
|
} catch (error) {
|
|
21698
21906
|
console.warn("Failed to get USD permit params, proceeding without permit:", error);
|
|
21699
21907
|
permitParams = [];
|
|
@@ -21963,19 +22171,19 @@ var MyxClient = class {
|
|
|
21963
22171
|
addFavorite,
|
|
21964
22172
|
approve,
|
|
21965
22173
|
base,
|
|
21966
|
-
baseUrl,
|
|
21967
22174
|
bigintAmountSlipperCalculator,
|
|
21968
22175
|
bigintTradingGasPriceWithRatio,
|
|
21969
22176
|
bigintTradingGasToRatioCalculator,
|
|
21970
22177
|
fetchForwarderGetApi,
|
|
21971
22178
|
formatUnits,
|
|
21972
|
-
forwardUrl,
|
|
21973
22179
|
forwarderTxApi,
|
|
21974
22180
|
getAllTickers,
|
|
21975
22181
|
getAllowanceApproved,
|
|
21976
22182
|
getBalanceOf,
|
|
21977
22183
|
getBaseDetail,
|
|
22184
|
+
getBaseUrlByEnv,
|
|
21978
22185
|
getFavoritesList,
|
|
22186
|
+
getForwardUrlByEnv,
|
|
21979
22187
|
getHistoryOrders,
|
|
21980
22188
|
getKlineData,
|
|
21981
22189
|
getKlineLatestBar,
|