@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.mjs
CHANGED
|
@@ -1731,7 +1731,7 @@ var RotationProvider = class extends BaseProvider {
|
|
|
1731
1731
|
// package.json
|
|
1732
1732
|
var package_default = {
|
|
1733
1733
|
name: "@myx-trade/sdk",
|
|
1734
|
-
version: "0.1.
|
|
1734
|
+
version: "0.1.190",
|
|
1735
1735
|
private: false,
|
|
1736
1736
|
publishConfig: {
|
|
1737
1737
|
access: "public"
|
|
@@ -1996,10 +1996,11 @@ var ExecTypeEnum = /* @__PURE__ */ ((ExecTypeEnum2) => {
|
|
|
1996
1996
|
var getHistoryOrders = async ({
|
|
1997
1997
|
accessToken,
|
|
1998
1998
|
address,
|
|
1999
|
+
isProd = true,
|
|
1999
2000
|
...params
|
|
2000
2001
|
}) => {
|
|
2001
2002
|
return http.get(
|
|
2002
|
-
`${
|
|
2003
|
+
`${getBaseUrlByEnv(isProd)}/openapi/gateway/scan/order/closed`,
|
|
2003
2004
|
params,
|
|
2004
2005
|
{
|
|
2005
2006
|
headers: {
|
|
@@ -2025,10 +2026,11 @@ var CloseTypeEnum = /* @__PURE__ */ ((CloseTypeEnum2) => {
|
|
|
2025
2026
|
var getPositionHistory = async ({
|
|
2026
2027
|
accessToken,
|
|
2027
2028
|
address,
|
|
2029
|
+
isProd = true,
|
|
2028
2030
|
...params
|
|
2029
2031
|
}) => {
|
|
2030
2032
|
return http.get(
|
|
2031
|
-
`${
|
|
2033
|
+
`${getBaseUrlByEnv(isProd)}/openapi/gateway/scan/position/closed`,
|
|
2032
2034
|
params,
|
|
2033
2035
|
{
|
|
2034
2036
|
headers: {
|
|
@@ -2047,10 +2049,11 @@ var TradeFlowAccountTypeEnum = /* @__PURE__ */ ((TradeFlowAccountTypeEnum2) => {
|
|
|
2047
2049
|
var getTradeFlow = async ({
|
|
2048
2050
|
accessToken,
|
|
2049
2051
|
address,
|
|
2052
|
+
isProd = true,
|
|
2050
2053
|
...params
|
|
2051
2054
|
}) => {
|
|
2052
2055
|
return http.get(
|
|
2053
|
-
`${
|
|
2056
|
+
`${getBaseUrlByEnv(isProd)}/openapi/gateway/scan/trade/flow`,
|
|
2054
2057
|
params,
|
|
2055
2058
|
{
|
|
2056
2059
|
headers: {
|
|
@@ -2062,10 +2065,9 @@ var getTradeFlow = async ({
|
|
|
2062
2065
|
};
|
|
2063
2066
|
|
|
2064
2067
|
// src/api/seamless/index.ts
|
|
2065
|
-
var forwarderTxApi = async (params, chainId) => {
|
|
2066
|
-
console.log("forwarderTxApi params-->", params);
|
|
2068
|
+
var forwarderTxApi = async (params, chainId, isProd = true) => {
|
|
2067
2069
|
return http.post(
|
|
2068
|
-
`${
|
|
2070
|
+
`${getForwardUrlByEnv(isProd)}/forwarder/tx-v2`,
|
|
2069
2071
|
params,
|
|
2070
2072
|
{
|
|
2071
2073
|
headers: {
|
|
@@ -2081,31 +2083,39 @@ var ForwarderGetStatus = /* @__PURE__ */ ((ForwarderGetStatus2) => {
|
|
|
2081
2083
|
ForwarderGetStatus2[ForwarderGetStatus2["EXECUTED"] = 9] = "EXECUTED";
|
|
2082
2084
|
return ForwarderGetStatus2;
|
|
2083
2085
|
})(ForwarderGetStatus || {});
|
|
2084
|
-
var fetchForwarderGetApi = async (params) => {
|
|
2086
|
+
var fetchForwarderGetApi = async (params, isProd = true) => {
|
|
2085
2087
|
const rs = await http.get(
|
|
2086
|
-
`${
|
|
2088
|
+
`${getForwardUrlByEnv(isProd)}/forwarder/get${addQueryParams(params)}`
|
|
2087
2089
|
);
|
|
2088
2090
|
return rs;
|
|
2089
2091
|
};
|
|
2090
2092
|
|
|
2091
2093
|
// src/api/pool/index.ts
|
|
2092
|
-
var getPoolList = async (
|
|
2094
|
+
var getPoolList = async ({
|
|
2095
|
+
isProd = true
|
|
2096
|
+
}) => {
|
|
2093
2097
|
return http.get(
|
|
2094
|
-
`${
|
|
2098
|
+
`${getBaseUrlByEnv(isProd)}/openapi/gateway/scan/market/list`
|
|
2095
2099
|
);
|
|
2096
2100
|
};
|
|
2097
|
-
var getPoolSymbolAll = async (
|
|
2101
|
+
var getPoolSymbolAll = async ({
|
|
2102
|
+
isProd = true
|
|
2103
|
+
}) => {
|
|
2098
2104
|
return http.get(
|
|
2099
|
-
`${
|
|
2105
|
+
`${getBaseUrlByEnv(isProd)}/openapi/gateway/scan/pools`
|
|
2100
2106
|
);
|
|
2101
2107
|
};
|
|
2102
2108
|
|
|
2103
2109
|
// src/api/index.ts
|
|
2104
|
-
var
|
|
2105
|
-
|
|
2106
|
-
|
|
2110
|
+
var getBaseUrlByEnv = (isProd) => {
|
|
2111
|
+
return isProd ? "https://api.myx.finance" : "https://api-test.myx.cash";
|
|
2112
|
+
};
|
|
2113
|
+
var getForwardUrlByEnv = (isProd) => {
|
|
2114
|
+
return isProd ? "https://api.myx.finance/v2/agent" : "https://api-test.myx.cash/v2/agent";
|
|
2115
|
+
};
|
|
2116
|
+
var getOraclePrice = async (chainId, poolIds = [], isProd = true) => {
|
|
2107
2117
|
if (!!poolIds.length) {
|
|
2108
|
-
return http.get(`${
|
|
2118
|
+
return http.get(`${getBaseUrlByEnv(isProd)}/openapi/gateway/quote/price/oracles`, {
|
|
2109
2119
|
chainId,
|
|
2110
2120
|
poolIds: poolIds.join(",")
|
|
2111
2121
|
});
|
|
@@ -2114,23 +2124,24 @@ var getOraclePrice = async (chainId, poolIds = []) => {
|
|
|
2114
2124
|
};
|
|
2115
2125
|
var getPoolLevelConfig = async ({
|
|
2116
2126
|
poolId,
|
|
2117
|
-
chainId
|
|
2127
|
+
chainId,
|
|
2128
|
+
isProd = true
|
|
2118
2129
|
}) => {
|
|
2119
2130
|
return http.get(
|
|
2120
|
-
`${
|
|
2131
|
+
`${getBaseUrlByEnv(isProd)}/openapi/gateway/risk/market_pool/level_config${addQueryParams({
|
|
2121
2132
|
poolId,
|
|
2122
2133
|
chainId
|
|
2123
2134
|
})}`
|
|
2124
2135
|
);
|
|
2125
2136
|
};
|
|
2126
|
-
var getPoolDetail = async (chainId, poolId) => {
|
|
2137
|
+
var getPoolDetail = async (chainId, poolId, isProd = true) => {
|
|
2127
2138
|
return await http.get(
|
|
2128
|
-
`${
|
|
2139
|
+
`${getBaseUrlByEnv(isProd)}/openapi/gateway/scan/market/info?chainId=${chainId}&poolId=${poolId}`
|
|
2129
2140
|
);
|
|
2130
2141
|
};
|
|
2131
|
-
var getPositions = async (accessToken, address) => {
|
|
2142
|
+
var getPositions = async (accessToken, address, isProd = true) => {
|
|
2132
2143
|
return await http.get(
|
|
2133
|
-
`${
|
|
2144
|
+
`${getBaseUrlByEnv(isProd)}/openapi/gateway/scan/position/open`,
|
|
2134
2145
|
void 0,
|
|
2135
2146
|
// params
|
|
2136
2147
|
{
|
|
@@ -2141,16 +2152,16 @@ var getPositions = async (accessToken, address) => {
|
|
|
2141
2152
|
}
|
|
2142
2153
|
);
|
|
2143
2154
|
};
|
|
2144
|
-
var getOrders = async (accessToken, address) => {
|
|
2155
|
+
var getOrders = async (accessToken, address, isProd = true) => {
|
|
2145
2156
|
return await http.get(
|
|
2146
|
-
`${
|
|
2157
|
+
`${getBaseUrlByEnv(isProd)}/openapi/gateway/scan/order/open`,
|
|
2147
2158
|
void 0,
|
|
2148
2159
|
{ headers: { myx_openapi_access_token: accessToken, myx_openapi_account: address } }
|
|
2149
2160
|
);
|
|
2150
2161
|
};
|
|
2151
|
-
var getPoolOpenOrders = async (accessToken, address, chainId) => {
|
|
2162
|
+
var getPoolOpenOrders = async (accessToken, address, chainId, isProd = true) => {
|
|
2152
2163
|
return await http.get(
|
|
2153
|
-
`${
|
|
2164
|
+
`${getBaseUrlByEnv(isProd)}/openapi/gateway/scan/market/pool-order/open?chainId=${chainId}`,
|
|
2154
2165
|
void 0,
|
|
2155
2166
|
{ headers: { myx_openapi_access_token: accessToken, myx_openapi_account: address } }
|
|
2156
2167
|
);
|
|
@@ -2160,10 +2171,11 @@ var getKlineData = ({
|
|
|
2160
2171
|
poolId,
|
|
2161
2172
|
endTime,
|
|
2162
2173
|
limit,
|
|
2163
|
-
interval
|
|
2174
|
+
interval,
|
|
2175
|
+
isProd = true
|
|
2164
2176
|
}) => {
|
|
2165
2177
|
return http.get(
|
|
2166
|
-
`${
|
|
2178
|
+
`${getBaseUrlByEnv(isProd)}/openapi/gateway/quote/candles`,
|
|
2167
2179
|
{
|
|
2168
2180
|
chainId,
|
|
2169
2181
|
poolId,
|
|
@@ -2173,36 +2185,40 @@ var getKlineData = ({
|
|
|
2173
2185
|
}
|
|
2174
2186
|
);
|
|
2175
2187
|
};
|
|
2176
|
-
var getKlineLatestBar = async (params) => {
|
|
2188
|
+
var getKlineLatestBar = async (params, isProd = true) => {
|
|
2177
2189
|
return http.get(
|
|
2178
|
-
`${
|
|
2190
|
+
`${getBaseUrlByEnv(isProd)}/openapi/gateway/quote/candle/latest`,
|
|
2179
2191
|
params
|
|
2180
2192
|
);
|
|
2181
2193
|
};
|
|
2182
2194
|
var getTickerData = async ({
|
|
2183
2195
|
chainId,
|
|
2184
|
-
poolIds
|
|
2196
|
+
poolIds,
|
|
2197
|
+
isProd = true
|
|
2185
2198
|
}) => {
|
|
2186
2199
|
return http.get(
|
|
2187
|
-
`${
|
|
2200
|
+
`${getBaseUrlByEnv(isProd)}/openapi/gateway/quote/candle/tickers`,
|
|
2188
2201
|
{
|
|
2189
2202
|
chainId,
|
|
2190
2203
|
poolIds: poolIds.join(",")
|
|
2191
2204
|
}
|
|
2192
2205
|
);
|
|
2193
2206
|
};
|
|
2194
|
-
var getAllTickers = async (
|
|
2207
|
+
var getAllTickers = async ({
|
|
2208
|
+
isProd = true
|
|
2209
|
+
}) => {
|
|
2195
2210
|
return http.get(
|
|
2196
|
-
`${
|
|
2211
|
+
`${getBaseUrlByEnv(isProd)}/v2/mx-gateway/quote/candle/all_tickers`
|
|
2197
2212
|
);
|
|
2198
2213
|
};
|
|
2199
2214
|
var searchMarketAuth = async ({
|
|
2200
2215
|
accessToken,
|
|
2201
2216
|
address,
|
|
2217
|
+
isProd = true,
|
|
2202
2218
|
...params
|
|
2203
2219
|
}) => {
|
|
2204
2220
|
return http.get(
|
|
2205
|
-
`${
|
|
2221
|
+
`${getBaseUrlByEnv(isProd)}/openapi/gateway/scan/market/ac-search`,
|
|
2206
2222
|
params,
|
|
2207
2223
|
{
|
|
2208
2224
|
headers: {
|
|
@@ -2212,19 +2228,23 @@ var searchMarketAuth = async ({
|
|
|
2212
2228
|
}
|
|
2213
2229
|
);
|
|
2214
2230
|
};
|
|
2215
|
-
var searchMarket = async ({
|
|
2231
|
+
var searchMarket = async ({
|
|
2232
|
+
isProd = true,
|
|
2233
|
+
...params
|
|
2234
|
+
}) => {
|
|
2216
2235
|
return http.get(
|
|
2217
|
-
`${
|
|
2236
|
+
`${getBaseUrlByEnv(isProd)}/openapi/gateway/scan/market/search`,
|
|
2218
2237
|
params
|
|
2219
2238
|
);
|
|
2220
2239
|
};
|
|
2221
2240
|
var addFavorite = async ({
|
|
2222
2241
|
accessToken,
|
|
2223
2242
|
address,
|
|
2243
|
+
isProd = true,
|
|
2224
2244
|
...params
|
|
2225
2245
|
}) => {
|
|
2226
2246
|
return http.get(
|
|
2227
|
-
`${
|
|
2247
|
+
`${getBaseUrlByEnv(isProd)}/openapi/gateway/scan/market/add-favorites`,
|
|
2228
2248
|
params,
|
|
2229
2249
|
{
|
|
2230
2250
|
headers: {
|
|
@@ -2237,10 +2257,11 @@ var addFavorite = async ({
|
|
|
2237
2257
|
var removeFavorite = async ({
|
|
2238
2258
|
accessToken,
|
|
2239
2259
|
address,
|
|
2260
|
+
isProd = true,
|
|
2240
2261
|
...params
|
|
2241
2262
|
}) => {
|
|
2242
2263
|
return http.get(
|
|
2243
|
-
`${
|
|
2264
|
+
`${getBaseUrlByEnv(isProd)}/openapi/gateway/scan/market/cancel-favorites`,
|
|
2244
2265
|
params,
|
|
2245
2266
|
{
|
|
2246
2267
|
headers: {
|
|
@@ -2253,10 +2274,11 @@ var removeFavorite = async ({
|
|
|
2253
2274
|
var getFavoritesList = async ({
|
|
2254
2275
|
accessToken,
|
|
2255
2276
|
address,
|
|
2277
|
+
isProd = true,
|
|
2256
2278
|
...params
|
|
2257
2279
|
}) => {
|
|
2258
2280
|
return http.get(
|
|
2259
|
-
`${
|
|
2281
|
+
`${getBaseUrlByEnv(isProd)}/openapi/gateway/scan/market/favorites`,
|
|
2260
2282
|
params,
|
|
2261
2283
|
{
|
|
2262
2284
|
headers: {
|
|
@@ -2266,20 +2288,28 @@ var getFavoritesList = async ({
|
|
|
2266
2288
|
}
|
|
2267
2289
|
);
|
|
2268
2290
|
};
|
|
2269
|
-
var getBaseDetail = async (
|
|
2291
|
+
var getBaseDetail = async ({
|
|
2292
|
+
isProd = true,
|
|
2293
|
+
...params
|
|
2294
|
+
}) => {
|
|
2270
2295
|
return http.get(
|
|
2271
|
-
`${
|
|
2296
|
+
`${getBaseUrlByEnv(isProd)}/openapi/gateway/scan/market/base-details`,
|
|
2272
2297
|
params
|
|
2273
2298
|
);
|
|
2274
2299
|
};
|
|
2275
|
-
var getMarketDetail = async (
|
|
2300
|
+
var getMarketDetail = async ({
|
|
2301
|
+
isProd = true,
|
|
2302
|
+
...params
|
|
2303
|
+
}) => {
|
|
2276
2304
|
return http.get(
|
|
2277
|
-
`${
|
|
2305
|
+
`${getBaseUrlByEnv(isProd)}/openapi/gateway/scan/market/detail`,
|
|
2278
2306
|
params
|
|
2279
2307
|
);
|
|
2280
2308
|
};
|
|
2281
|
-
var getMarketList = async (
|
|
2282
|
-
|
|
2309
|
+
var getMarketList = async ({
|
|
2310
|
+
isProd = true
|
|
2311
|
+
}) => {
|
|
2312
|
+
return http.get(`${getBaseUrlByEnv(isProd)}/openapi/gateway/scan/market`);
|
|
2283
2313
|
};
|
|
2284
2314
|
|
|
2285
2315
|
// src/web3/index.ts
|
|
@@ -5318,6 +5348,11 @@ var BasePool_default = [
|
|
|
5318
5348
|
|
|
5319
5349
|
// src/abi/Broker.json
|
|
5320
5350
|
var Broker_default = [
|
|
5351
|
+
{
|
|
5352
|
+
type: "constructor",
|
|
5353
|
+
payable: false,
|
|
5354
|
+
inputs: []
|
|
5355
|
+
},
|
|
5321
5356
|
{
|
|
5322
5357
|
type: "error",
|
|
5323
5358
|
name: "ECDSAInvalidSignature",
|
|
@@ -5667,7 +5702,16 @@ var Broker_default = [
|
|
|
5667
5702
|
constant: true,
|
|
5668
5703
|
stateMutability: "view",
|
|
5669
5704
|
payable: false,
|
|
5670
|
-
inputs: [
|
|
5705
|
+
inputs: [
|
|
5706
|
+
{
|
|
5707
|
+
type: "uint8",
|
|
5708
|
+
name: "assetClass"
|
|
5709
|
+
},
|
|
5710
|
+
{
|
|
5711
|
+
type: "uint8",
|
|
5712
|
+
name: "riskTier"
|
|
5713
|
+
}
|
|
5714
|
+
],
|
|
5671
5715
|
outputs: [
|
|
5672
5716
|
{
|
|
5673
5717
|
type: "uint256[]"
|
|
@@ -5680,7 +5724,16 @@ var Broker_default = [
|
|
|
5680
5724
|
constant: true,
|
|
5681
5725
|
stateMutability: "view",
|
|
5682
5726
|
payable: false,
|
|
5683
|
-
inputs: [
|
|
5727
|
+
inputs: [
|
|
5728
|
+
{
|
|
5729
|
+
type: "uint8",
|
|
5730
|
+
name: "assetClass"
|
|
5731
|
+
},
|
|
5732
|
+
{
|
|
5733
|
+
type: "uint8",
|
|
5734
|
+
name: "riskTier"
|
|
5735
|
+
}
|
|
5736
|
+
],
|
|
5684
5737
|
outputs: [
|
|
5685
5738
|
{
|
|
5686
5739
|
type: "uint256[]"
|
|
@@ -5731,6 +5784,82 @@ var Broker_default = [
|
|
|
5731
5784
|
],
|
|
5732
5785
|
outputs: []
|
|
5733
5786
|
},
|
|
5787
|
+
{
|
|
5788
|
+
type: "function",
|
|
5789
|
+
name: "batchSetSpecialFeeTiers",
|
|
5790
|
+
constant: false,
|
|
5791
|
+
payable: false,
|
|
5792
|
+
inputs: [
|
|
5793
|
+
{
|
|
5794
|
+
type: "tuple[]",
|
|
5795
|
+
name: "params",
|
|
5796
|
+
components: [
|
|
5797
|
+
{
|
|
5798
|
+
type: "uint8",
|
|
5799
|
+
name: "assetClass"
|
|
5800
|
+
},
|
|
5801
|
+
{
|
|
5802
|
+
type: "uint8",
|
|
5803
|
+
name: "riskTier"
|
|
5804
|
+
},
|
|
5805
|
+
{
|
|
5806
|
+
type: "uint8",
|
|
5807
|
+
name: "feeTier"
|
|
5808
|
+
},
|
|
5809
|
+
{
|
|
5810
|
+
type: "int32",
|
|
5811
|
+
name: "makerFeeRate"
|
|
5812
|
+
},
|
|
5813
|
+
{
|
|
5814
|
+
type: "uint32",
|
|
5815
|
+
name: "takerFeeRate"
|
|
5816
|
+
}
|
|
5817
|
+
]
|
|
5818
|
+
}
|
|
5819
|
+
],
|
|
5820
|
+
outputs: []
|
|
5821
|
+
},
|
|
5822
|
+
{
|
|
5823
|
+
type: "function",
|
|
5824
|
+
name: "batchUpdateFeeTiers",
|
|
5825
|
+
constant: false,
|
|
5826
|
+
payable: false,
|
|
5827
|
+
inputs: [
|
|
5828
|
+
{
|
|
5829
|
+
type: "tuple[]",
|
|
5830
|
+
name: "params",
|
|
5831
|
+
components: [
|
|
5832
|
+
{
|
|
5833
|
+
type: "uint8",
|
|
5834
|
+
name: "assetClass"
|
|
5835
|
+
},
|
|
5836
|
+
{
|
|
5837
|
+
type: "uint8",
|
|
5838
|
+
name: "riskTier"
|
|
5839
|
+
},
|
|
5840
|
+
{
|
|
5841
|
+
type: "uint8",
|
|
5842
|
+
name: "feeTier"
|
|
5843
|
+
},
|
|
5844
|
+
{
|
|
5845
|
+
type: "tuple",
|
|
5846
|
+
name: "addOnFeeRate",
|
|
5847
|
+
components: [
|
|
5848
|
+
{
|
|
5849
|
+
type: "uint32",
|
|
5850
|
+
name: "takerFeeRate"
|
|
5851
|
+
},
|
|
5852
|
+
{
|
|
5853
|
+
type: "uint32",
|
|
5854
|
+
name: "makerFeeRate"
|
|
5855
|
+
}
|
|
5856
|
+
]
|
|
5857
|
+
}
|
|
5858
|
+
]
|
|
5859
|
+
}
|
|
5860
|
+
],
|
|
5861
|
+
outputs: []
|
|
5862
|
+
},
|
|
5734
5863
|
{
|
|
5735
5864
|
type: "function",
|
|
5736
5865
|
name: "cancelOrder",
|
|
@@ -5830,7 +5959,15 @@ var Broker_default = [
|
|
|
5830
5959
|
inputs: [
|
|
5831
5960
|
{
|
|
5832
5961
|
type: "uint8",
|
|
5833
|
-
name: "
|
|
5962
|
+
name: "assetClass"
|
|
5963
|
+
},
|
|
5964
|
+
{
|
|
5965
|
+
type: "uint8",
|
|
5966
|
+
name: "riskTier"
|
|
5967
|
+
},
|
|
5968
|
+
{
|
|
5969
|
+
type: "uint8",
|
|
5970
|
+
name: "feeTier"
|
|
5834
5971
|
}
|
|
5835
5972
|
],
|
|
5836
5973
|
outputs: [
|
|
@@ -5880,6 +6017,14 @@ var Broker_default = [
|
|
|
5880
6017
|
stateMutability: "view",
|
|
5881
6018
|
payable: false,
|
|
5882
6019
|
inputs: [
|
|
6020
|
+
{
|
|
6021
|
+
type: "uint8",
|
|
6022
|
+
name: "assetClass"
|
|
6023
|
+
},
|
|
6024
|
+
{
|
|
6025
|
+
type: "uint8",
|
|
6026
|
+
name: "riskTier"
|
|
6027
|
+
},
|
|
5883
6028
|
{
|
|
5884
6029
|
type: "uint8",
|
|
5885
6030
|
name: "feeTier"
|
|
@@ -5910,6 +6055,10 @@ var Broker_default = [
|
|
|
5910
6055
|
{
|
|
5911
6056
|
type: "uint8",
|
|
5912
6057
|
name: "assetClass"
|
|
6058
|
+
},
|
|
6059
|
+
{
|
|
6060
|
+
type: "uint8",
|
|
6061
|
+
name: "riskTier"
|
|
5913
6062
|
}
|
|
5914
6063
|
],
|
|
5915
6064
|
outputs: [
|
|
@@ -6522,16 +6671,30 @@ var Broker_default = [
|
|
|
6522
6671
|
payable: false,
|
|
6523
6672
|
inputs: [
|
|
6524
6673
|
{
|
|
6525
|
-
type: "
|
|
6526
|
-
name: "
|
|
6527
|
-
|
|
6528
|
-
|
|
6529
|
-
|
|
6530
|
-
|
|
6531
|
-
|
|
6532
|
-
|
|
6533
|
-
|
|
6534
|
-
|
|
6674
|
+
type: "tuple",
|
|
6675
|
+
name: "params",
|
|
6676
|
+
components: [
|
|
6677
|
+
{
|
|
6678
|
+
type: "uint8",
|
|
6679
|
+
name: "assetClass"
|
|
6680
|
+
},
|
|
6681
|
+
{
|
|
6682
|
+
type: "uint8",
|
|
6683
|
+
name: "riskTier"
|
|
6684
|
+
},
|
|
6685
|
+
{
|
|
6686
|
+
type: "uint8",
|
|
6687
|
+
name: "feeTier"
|
|
6688
|
+
},
|
|
6689
|
+
{
|
|
6690
|
+
type: "int32",
|
|
6691
|
+
name: "makerFeeRate"
|
|
6692
|
+
},
|
|
6693
|
+
{
|
|
6694
|
+
type: "uint32",
|
|
6695
|
+
name: "takerFeeRate"
|
|
6696
|
+
}
|
|
6697
|
+
]
|
|
6535
6698
|
}
|
|
6536
6699
|
],
|
|
6537
6700
|
outputs: []
|
|
@@ -6651,25 +6814,31 @@ var Broker_default = [
|
|
|
6651
6814
|
constant: false,
|
|
6652
6815
|
payable: false,
|
|
6653
6816
|
inputs: [
|
|
6654
|
-
{
|
|
6655
|
-
type: "uint8[]",
|
|
6656
|
-
name: "assetClasses"
|
|
6657
|
-
},
|
|
6658
|
-
{
|
|
6659
|
-
type: "bool[]",
|
|
6660
|
-
name: "isEnables"
|
|
6661
|
-
},
|
|
6662
6817
|
{
|
|
6663
6818
|
type: "tuple[]",
|
|
6664
|
-
name: "
|
|
6819
|
+
name: "params",
|
|
6665
6820
|
components: [
|
|
6666
6821
|
{
|
|
6667
|
-
type: "
|
|
6668
|
-
name: "
|
|
6822
|
+
type: "uint8",
|
|
6823
|
+
name: "assetClass"
|
|
6669
6824
|
},
|
|
6670
6825
|
{
|
|
6671
|
-
type: "
|
|
6672
|
-
name: "
|
|
6826
|
+
type: "bool",
|
|
6827
|
+
name: "isEnable"
|
|
6828
|
+
},
|
|
6829
|
+
{
|
|
6830
|
+
type: "tuple",
|
|
6831
|
+
name: "baseFeeRate",
|
|
6832
|
+
components: [
|
|
6833
|
+
{
|
|
6834
|
+
type: "uint32",
|
|
6835
|
+
name: "takerFeeRate"
|
|
6836
|
+
},
|
|
6837
|
+
{
|
|
6838
|
+
type: "uint32",
|
|
6839
|
+
name: "makerFeeRate"
|
|
6840
|
+
}
|
|
6841
|
+
]
|
|
6673
6842
|
}
|
|
6674
6843
|
]
|
|
6675
6844
|
}
|
|
@@ -6697,7 +6866,15 @@ var Broker_default = [
|
|
|
6697
6866
|
inputs: [
|
|
6698
6867
|
{
|
|
6699
6868
|
type: "uint8",
|
|
6700
|
-
name: "
|
|
6869
|
+
name: "assetClass"
|
|
6870
|
+
},
|
|
6871
|
+
{
|
|
6872
|
+
type: "uint8",
|
|
6873
|
+
name: "riskTier"
|
|
6874
|
+
},
|
|
6875
|
+
{
|
|
6876
|
+
type: "uint8",
|
|
6877
|
+
name: "feeTier"
|
|
6701
6878
|
},
|
|
6702
6879
|
{
|
|
6703
6880
|
type: "tuple",
|
|
@@ -6722,9 +6899,17 @@ var Broker_default = [
|
|
|
6722
6899
|
constant: false,
|
|
6723
6900
|
payable: false,
|
|
6724
6901
|
inputs: [
|
|
6902
|
+
{
|
|
6903
|
+
type: "uint8",
|
|
6904
|
+
name: "assetClass"
|
|
6905
|
+
},
|
|
6906
|
+
{
|
|
6907
|
+
type: "uint8",
|
|
6908
|
+
name: "riskTier"
|
|
6909
|
+
},
|
|
6725
6910
|
{
|
|
6726
6911
|
type: "uint8[]",
|
|
6727
|
-
name: "
|
|
6912
|
+
name: "feeTiers"
|
|
6728
6913
|
},
|
|
6729
6914
|
{
|
|
6730
6915
|
type: "tuple[]",
|
|
@@ -9620,6 +9805,14 @@ var DataProvider_default = [
|
|
|
9620
9805
|
type: "address",
|
|
9621
9806
|
name: "brokerAddress"
|
|
9622
9807
|
},
|
|
9808
|
+
{
|
|
9809
|
+
type: "uint8[]",
|
|
9810
|
+
name: "assetClasses"
|
|
9811
|
+
},
|
|
9812
|
+
{
|
|
9813
|
+
type: "uint8[][]",
|
|
9814
|
+
name: "assetRiskTiers"
|
|
9815
|
+
},
|
|
9623
9816
|
{
|
|
9624
9817
|
type: "bool",
|
|
9625
9818
|
name: "isMYXBroker"
|
|
@@ -9627,60 +9820,74 @@ var DataProvider_default = [
|
|
|
9627
9820
|
],
|
|
9628
9821
|
outputs: [
|
|
9629
9822
|
{
|
|
9630
|
-
type: "tuple",
|
|
9631
|
-
name: "
|
|
9823
|
+
type: "tuple[]",
|
|
9824
|
+
name: "brokerFees",
|
|
9632
9825
|
components: [
|
|
9633
9826
|
{
|
|
9634
|
-
type: "
|
|
9635
|
-
name: "
|
|
9636
|
-
components: [
|
|
9637
|
-
{
|
|
9638
|
-
type: "uint8",
|
|
9639
|
-
name: "tier"
|
|
9640
|
-
},
|
|
9641
|
-
{
|
|
9642
|
-
type: "uint32",
|
|
9643
|
-
name: "takerFeeRate"
|
|
9644
|
-
},
|
|
9645
|
-
{
|
|
9646
|
-
type: "int32",
|
|
9647
|
-
name: "makerFeeRate"
|
|
9648
|
-
}
|
|
9649
|
-
]
|
|
9827
|
+
type: "uint8",
|
|
9828
|
+
name: "asset"
|
|
9650
9829
|
},
|
|
9651
9830
|
{
|
|
9652
9831
|
type: "tuple[]",
|
|
9653
|
-
name: "
|
|
9832
|
+
name: "riskTieredBrokerFees",
|
|
9654
9833
|
components: [
|
|
9655
9834
|
{
|
|
9656
9835
|
type: "uint8",
|
|
9657
|
-
name: "
|
|
9658
|
-
},
|
|
9659
|
-
{
|
|
9660
|
-
type: "uint32",
|
|
9661
|
-
name: "makerFeeRate"
|
|
9836
|
+
name: "riskTier"
|
|
9662
9837
|
},
|
|
9663
9838
|
{
|
|
9664
|
-
type: "
|
|
9665
|
-
name: "
|
|
9666
|
-
|
|
9667
|
-
|
|
9668
|
-
|
|
9669
|
-
|
|
9670
|
-
|
|
9671
|
-
|
|
9672
|
-
|
|
9673
|
-
|
|
9674
|
-
|
|
9675
|
-
|
|
9839
|
+
type: "tuple[]",
|
|
9840
|
+
name: "addOnFeeTiers",
|
|
9841
|
+
components: [
|
|
9842
|
+
{
|
|
9843
|
+
type: "uint8",
|
|
9844
|
+
name: "tier"
|
|
9845
|
+
},
|
|
9846
|
+
{
|
|
9847
|
+
type: "uint32",
|
|
9848
|
+
name: "takerFeeRate"
|
|
9849
|
+
},
|
|
9850
|
+
{
|
|
9851
|
+
type: "int32",
|
|
9852
|
+
name: "makerFeeRate"
|
|
9853
|
+
}
|
|
9854
|
+
]
|
|
9676
9855
|
},
|
|
9677
9856
|
{
|
|
9678
|
-
type: "
|
|
9679
|
-
name: "
|
|
9857
|
+
type: "tuple[]",
|
|
9858
|
+
name: "baseFeeRate",
|
|
9859
|
+
components: [
|
|
9860
|
+
{
|
|
9861
|
+
type: "uint8",
|
|
9862
|
+
name: "assetClass"
|
|
9863
|
+
},
|
|
9864
|
+
{
|
|
9865
|
+
type: "uint32",
|
|
9866
|
+
name: "makerFeeRate"
|
|
9867
|
+
},
|
|
9868
|
+
{
|
|
9869
|
+
type: "uint32",
|
|
9870
|
+
name: "takerFeeRate"
|
|
9871
|
+
}
|
|
9872
|
+
]
|
|
9680
9873
|
},
|
|
9681
9874
|
{
|
|
9682
|
-
type: "
|
|
9683
|
-
name: "
|
|
9875
|
+
type: "tuple[]",
|
|
9876
|
+
name: "specialFeeTiers",
|
|
9877
|
+
components: [
|
|
9878
|
+
{
|
|
9879
|
+
type: "uint8",
|
|
9880
|
+
name: "tier"
|
|
9881
|
+
},
|
|
9882
|
+
{
|
|
9883
|
+
type: "uint32",
|
|
9884
|
+
name: "takerFeeRate"
|
|
9885
|
+
},
|
|
9886
|
+
{
|
|
9887
|
+
type: "int32",
|
|
9888
|
+
name: "makerFeeRate"
|
|
9889
|
+
}
|
|
9890
|
+
]
|
|
9684
9891
|
}
|
|
9685
9892
|
]
|
|
9686
9893
|
}
|
|
@@ -11874,9 +12081,9 @@ var getPricesData = async (chainId, poolIds) => {
|
|
|
11874
12081
|
const result = await parsePriceData(chainId, rs.data);
|
|
11875
12082
|
return result;
|
|
11876
12083
|
};
|
|
11877
|
-
var getPriceData = async (chainId, poolId) => {
|
|
12084
|
+
var getPriceData = async (chainId, poolId, isProd) => {
|
|
11878
12085
|
if (!poolId) return;
|
|
11879
|
-
const rs = await getOraclePrice(chainId, [poolId]);
|
|
12086
|
+
const rs = await getOraclePrice(chainId, [poolId], isProd);
|
|
11880
12087
|
const data = rs?.data?.[0];
|
|
11881
12088
|
if (!data) {
|
|
11882
12089
|
throw new Error(`Unable to get price for ${poolId} in the deposit`);
|
|
@@ -12133,7 +12340,7 @@ var deposit = async (params) => {
|
|
|
12133
12340
|
let value = 0n;
|
|
12134
12341
|
let amountOut;
|
|
12135
12342
|
if (isNeedPrice) {
|
|
12136
|
-
const priceData = await getPriceData(chainId, poolId);
|
|
12343
|
+
const priceData = await getPriceData(chainId, poolId, true);
|
|
12137
12344
|
if (!priceData) return;
|
|
12138
12345
|
const referencePrice = parseUnits7(priceData.price, COMMON_PRICE_DECIMALS);
|
|
12139
12346
|
price.push({
|
|
@@ -12203,7 +12410,7 @@ var withdraw = async (params) => {
|
|
|
12203
12410
|
let value = 0n;
|
|
12204
12411
|
let amountOut;
|
|
12205
12412
|
if (isNeedPrice) {
|
|
12206
|
-
const priceData = await getPriceData(chainId, poolId);
|
|
12413
|
+
const priceData = await getPriceData(chainId, poolId, true);
|
|
12207
12414
|
if (!priceData) return;
|
|
12208
12415
|
const referencePrice = parseUnits8(priceData.price, COMMON_PRICE_DECIMALS);
|
|
12209
12416
|
price.push({
|
|
@@ -12275,7 +12482,7 @@ var getLpPrice = async (chainId, poolId) => {
|
|
|
12275
12482
|
try {
|
|
12276
12483
|
const contract = await getBasePoolContract(chainId);
|
|
12277
12484
|
let price = 0n;
|
|
12278
|
-
const res = await getPriceData(chainId, poolId);
|
|
12485
|
+
const res = await getPriceData(chainId, poolId, true);
|
|
12279
12486
|
if (res?.price) {
|
|
12280
12487
|
price = parseUnits10(res.price, COMMON_PRICE_DECIMALS);
|
|
12281
12488
|
}
|
|
@@ -12367,7 +12574,7 @@ var deposit2 = async (params) => {
|
|
|
12367
12574
|
let value = 0n;
|
|
12368
12575
|
let amountOut;
|
|
12369
12576
|
if (isNeedPrice) {
|
|
12370
|
-
const priceData = await getPriceData(chainId, poolId);
|
|
12577
|
+
const priceData = await getPriceData(chainId, poolId, true);
|
|
12371
12578
|
if (!priceData) return;
|
|
12372
12579
|
const referencePrice = parseUnits11(priceData.price, COMMON_PRICE_DECIMALS);
|
|
12373
12580
|
price.push({
|
|
@@ -12437,7 +12644,7 @@ var withdraw2 = async (params) => {
|
|
|
12437
12644
|
let value = 0n;
|
|
12438
12645
|
let amountOut;
|
|
12439
12646
|
if (isNeedPrice) {
|
|
12440
|
-
const priceData = await getPriceData(chainId, poolId);
|
|
12647
|
+
const priceData = await getPriceData(chainId, poolId, true);
|
|
12441
12648
|
if (!priceData) return;
|
|
12442
12649
|
const referencePrice = parseUnits12(priceData.price, COMMON_PRICE_DECIMALS);
|
|
12443
12650
|
price.push({
|
|
@@ -12639,7 +12846,7 @@ var getLpPrice2 = async (chainId, poolId) => {
|
|
|
12639
12846
|
try {
|
|
12640
12847
|
const contract = await getQuotePoolContract(chainId);
|
|
12641
12848
|
let price = 0n;
|
|
12642
|
-
const res = await getPriceData(chainId, poolId);
|
|
12849
|
+
const res = await getPriceData(chainId, poolId, true);
|
|
12643
12850
|
if (res?.price) {
|
|
12644
12851
|
price = parseUnits16(res.price, COMMON_PRICE_DECIMALS);
|
|
12645
12852
|
}
|
|
@@ -14076,6 +14283,7 @@ var Position = class {
|
|
|
14076
14283
|
this.account = account;
|
|
14077
14284
|
}
|
|
14078
14285
|
async listPositions(address) {
|
|
14286
|
+
const isProd = !this.configManager.getConfig().isTestnet;
|
|
14079
14287
|
const accessToken = await this.configManager.getAccessToken();
|
|
14080
14288
|
if (!accessToken) {
|
|
14081
14289
|
return {
|
|
@@ -14084,7 +14292,7 @@ var Position = class {
|
|
|
14084
14292
|
};
|
|
14085
14293
|
}
|
|
14086
14294
|
try {
|
|
14087
|
-
const res = await getPositions(accessToken, address);
|
|
14295
|
+
const res = await getPositions(accessToken, address, isProd);
|
|
14088
14296
|
return {
|
|
14089
14297
|
code: 0,
|
|
14090
14298
|
data: res.data
|
|
@@ -14098,6 +14306,7 @@ var Position = class {
|
|
|
14098
14306
|
}
|
|
14099
14307
|
}
|
|
14100
14308
|
async getPositionHistory(params, address) {
|
|
14309
|
+
const isProd = !this.configManager.getConfig().isTestnet;
|
|
14101
14310
|
const accessToken = await this.configManager.getAccessToken();
|
|
14102
14311
|
if (!accessToken) {
|
|
14103
14312
|
throw new MyxSDKError(
|
|
@@ -14105,7 +14314,7 @@ var Position = class {
|
|
|
14105
14314
|
"Invalid access token"
|
|
14106
14315
|
);
|
|
14107
14316
|
}
|
|
14108
|
-
const res = await getPositionHistory({ accessToken, ...params, address });
|
|
14317
|
+
const res = await getPositionHistory({ accessToken, ...params, address, isProd });
|
|
14109
14318
|
return {
|
|
14110
14319
|
code: 0,
|
|
14111
14320
|
data: res.data
|
|
@@ -14128,7 +14337,7 @@ var Position = class {
|
|
|
14128
14337
|
quoteToken
|
|
14129
14338
|
});
|
|
14130
14339
|
try {
|
|
14131
|
-
const priceData = await this.utils.getOraclePrice(poolId);
|
|
14340
|
+
const priceData = await this.utils.getOraclePrice(poolId, chainId);
|
|
14132
14341
|
if (!priceData) {
|
|
14133
14342
|
throw new Error("Failed to get price data");
|
|
14134
14343
|
}
|
|
@@ -15295,6 +15504,7 @@ var Order = class {
|
|
|
15295
15504
|
}
|
|
15296
15505
|
}
|
|
15297
15506
|
async getOrders(address) {
|
|
15507
|
+
const isProd = !this.configManager.getConfig().isTestnet;
|
|
15298
15508
|
const accessToken = await this.configManager.getAccessToken();
|
|
15299
15509
|
if (!accessToken) {
|
|
15300
15510
|
return {
|
|
@@ -15303,7 +15513,7 @@ var Order = class {
|
|
|
15303
15513
|
};
|
|
15304
15514
|
}
|
|
15305
15515
|
try {
|
|
15306
|
-
const res = await getOrders(accessToken, address);
|
|
15516
|
+
const res = await getOrders(accessToken, address, isProd);
|
|
15307
15517
|
return {
|
|
15308
15518
|
code: 0,
|
|
15309
15519
|
data: res.data
|
|
@@ -15318,13 +15528,14 @@ var Order = class {
|
|
|
15318
15528
|
}
|
|
15319
15529
|
async getOrderHistory(params, address) {
|
|
15320
15530
|
const accessToken = await this.configManager.getAccessToken();
|
|
15531
|
+
const isProd = !this.configManager.getConfig().isTestnet;
|
|
15321
15532
|
if (!accessToken) {
|
|
15322
15533
|
throw new MyxSDKError(
|
|
15323
15534
|
"INVALID_ACCESS_TOKEN" /* InvalidAccessToken */,
|
|
15324
15535
|
"Invalid access token"
|
|
15325
15536
|
);
|
|
15326
15537
|
}
|
|
15327
|
-
const res = await getHistoryOrders({ accessToken, ...params, address });
|
|
15538
|
+
const res = await getHistoryOrders({ accessToken, ...params, address, isProd });
|
|
15328
15539
|
return {
|
|
15329
15540
|
code: 0,
|
|
15330
15541
|
data: res.data
|
|
@@ -20094,7 +20305,7 @@ var Utils = class {
|
|
|
20094
20305
|
};
|
|
20095
20306
|
}
|
|
20096
20307
|
}
|
|
20097
|
-
async getUserTradingFeeRate(assetClass) {
|
|
20308
|
+
async getUserTradingFeeRate(assetClass, riskTier) {
|
|
20098
20309
|
const config = this.configManager.getConfig();
|
|
20099
20310
|
const brokerAddress = config.brokerAddress;
|
|
20100
20311
|
try {
|
|
@@ -20107,7 +20318,8 @@ var Utils = class {
|
|
|
20107
20318
|
const targetAddress = config.seamlessMode ? config.seamlessAccount?.masterAddress : config.signer?.getAddress();
|
|
20108
20319
|
const userFeeRate = await brokerContract.getUserFeeRate(
|
|
20109
20320
|
targetAddress,
|
|
20110
|
-
assetClass
|
|
20321
|
+
assetClass,
|
|
20322
|
+
riskTier
|
|
20111
20323
|
);
|
|
20112
20324
|
return {
|
|
20113
20325
|
code: 0,
|
|
@@ -20148,10 +20360,10 @@ var Utils = class {
|
|
|
20148
20360
|
return "0";
|
|
20149
20361
|
}
|
|
20150
20362
|
}
|
|
20151
|
-
async getOraclePrice(poolId) {
|
|
20363
|
+
async getOraclePrice(poolId, chainId) {
|
|
20152
20364
|
try {
|
|
20153
|
-
const
|
|
20154
|
-
const priceData = await getPriceData(
|
|
20365
|
+
const isProd = !this.configManager.getConfig().isTestnet;
|
|
20366
|
+
const priceData = await getPriceData(chainId, poolId, isProd);
|
|
20155
20367
|
if (!priceData) throw new Error("Failed to get price data");
|
|
20156
20368
|
return priceData;
|
|
20157
20369
|
} catch (error) {
|
|
@@ -21067,7 +21279,8 @@ var Account = class {
|
|
|
21067
21279
|
}
|
|
21068
21280
|
async getAvailableMarginBalance({ poolId, chainId, address }) {
|
|
21069
21281
|
try {
|
|
21070
|
-
const
|
|
21282
|
+
const isProd = !this.configManager.getConfig().isTestnet;
|
|
21283
|
+
const poolListRes = await getPoolList({ isProd });
|
|
21071
21284
|
if (poolListRes.code !== 9200) {
|
|
21072
21285
|
throw new MyxSDKError(
|
|
21073
21286
|
"REQUEST_FAILED" /* RequestFailed */,
|
|
@@ -21097,20 +21310,15 @@ var Account = class {
|
|
|
21097
21310
|
"Failed to get account info"
|
|
21098
21311
|
);
|
|
21099
21312
|
}
|
|
21100
|
-
this.logger.info("getAvailableMarginBalance used-->", used);
|
|
21101
21313
|
const marginAccountBalance = marginAccountBalanceRes.data;
|
|
21102
21314
|
const usedMargin = BigInt(used ?? "0");
|
|
21103
21315
|
const quoteProfit = BigInt(marginAccountBalance.quoteProfit ?? 0);
|
|
21104
|
-
this.logger.info("getAvailableMarginBalance quoteProfit-->", quoteProfit.toString);
|
|
21105
21316
|
const freeAmount = BigInt(marginAccountBalance?.freeMargin ?? 0);
|
|
21106
|
-
this.logger.info("getAvailableMarginBalance freeAmount-->", freeAmount.toString());
|
|
21107
21317
|
const accountMargin = freeAmount + quoteProfit;
|
|
21108
|
-
this.logger.info("getAvailableMarginBalance accountMargin-->", accountMargin.toString());
|
|
21109
21318
|
if (accountMargin < usedMargin) {
|
|
21110
21319
|
return BigInt(0);
|
|
21111
21320
|
}
|
|
21112
21321
|
const availableAccountMarginBalance = accountMargin - usedMargin;
|
|
21113
|
-
this.logger.info("getAvailableMarginBalance availableAccountMarginBalance-->", availableAccountMarginBalance.toString());
|
|
21114
21322
|
return availableAccountMarginBalance;
|
|
21115
21323
|
} catch (error) {
|
|
21116
21324
|
this.logger.info("getAvailableMarginBalance error-->", error);
|
|
@@ -21121,6 +21329,7 @@ var Account = class {
|
|
|
21121
21329
|
}
|
|
21122
21330
|
}
|
|
21123
21331
|
async getTradeFlow(params, address) {
|
|
21332
|
+
const isProd = !this.configManager.getConfig().isTestnet;
|
|
21124
21333
|
const accessToken = await this.configManager.getAccessToken();
|
|
21125
21334
|
if (!accessToken) {
|
|
21126
21335
|
throw new MyxSDKError(
|
|
@@ -21128,7 +21337,7 @@ var Account = class {
|
|
|
21128
21337
|
"Invalid access token"
|
|
21129
21338
|
);
|
|
21130
21339
|
}
|
|
21131
|
-
const res = await getTradeFlow({ accessToken, ...params, address });
|
|
21340
|
+
const res = await getTradeFlow({ accessToken, ...params, address, isProd });
|
|
21132
21341
|
return {
|
|
21133
21342
|
code: 0,
|
|
21134
21343
|
data: res.data
|
|
@@ -21556,6 +21765,7 @@ var Seamless = class {
|
|
|
21556
21765
|
data,
|
|
21557
21766
|
nonce
|
|
21558
21767
|
}, chainId, provider) {
|
|
21768
|
+
const isProd = !this.configManager.getConfig().isTestnet;
|
|
21559
21769
|
const forwarderContract = await getForwarderContract(chainId);
|
|
21560
21770
|
const forwarderJsonRpcContractDomain = await forwarderContract.eip712Domain();
|
|
21561
21771
|
const domain = {
|
|
@@ -21574,7 +21784,7 @@ var Seamless = class {
|
|
|
21574
21784
|
deadline,
|
|
21575
21785
|
data
|
|
21576
21786
|
});
|
|
21577
|
-
const txRs = await forwarderTxApi({ from, to, value, gas, nonce, data, deadline, signature }, chainId);
|
|
21787
|
+
const txRs = await forwarderTxApi({ from, to, value, gas, nonce, data, deadline, signature }, chainId, isProd);
|
|
21578
21788
|
return txRs;
|
|
21579
21789
|
}
|
|
21580
21790
|
async authorizeSeamlessAccount({ approve: approve2, seamlessAddress, chainId }) {
|
|
@@ -21587,7 +21797,7 @@ var Seamless = class {
|
|
|
21587
21797
|
if (approve2) {
|
|
21588
21798
|
const balanceRes = await this.account.getWalletQuoteTokenBalance(masterAddress);
|
|
21589
21799
|
const balance = balanceRes.data;
|
|
21590
|
-
const forwarderContract2 = await getForwarderContract(
|
|
21800
|
+
const forwarderContract2 = await getForwarderContract(chainId);
|
|
21591
21801
|
const pledgeFee = await forwarderContract2.getRelayFee();
|
|
21592
21802
|
const gasFee = BigInt(pledgeFee) * BigInt(FORWARD_PLEDGE_FEE_RADIO);
|
|
21593
21803
|
if (gasFee > 0 && gasFee > BigInt(balance)) {
|
|
@@ -21598,9 +21808,7 @@ var Seamless = class {
|
|
|
21598
21808
|
let permitParams = [];
|
|
21599
21809
|
if (approve2) {
|
|
21600
21810
|
try {
|
|
21601
|
-
console.log("getUSDPermitParams");
|
|
21602
21811
|
permitParams = await this.getUSDPermitParams(deadline, chainId);
|
|
21603
|
-
console.log("permitParams result-->", permitParams);
|
|
21604
21812
|
} catch (error) {
|
|
21605
21813
|
console.warn("Failed to get USD permit params, proceeding without permit:", error);
|
|
21606
21814
|
permitParams = [];
|
|
@@ -21869,19 +22077,19 @@ export {
|
|
|
21869
22077
|
addFavorite,
|
|
21870
22078
|
approve,
|
|
21871
22079
|
base_exports as base,
|
|
21872
|
-
baseUrl,
|
|
21873
22080
|
bigintAmountSlipperCalculator,
|
|
21874
22081
|
bigintTradingGasPriceWithRatio,
|
|
21875
22082
|
bigintTradingGasToRatioCalculator,
|
|
21876
22083
|
fetchForwarderGetApi,
|
|
21877
22084
|
formatUnits2 as formatUnits,
|
|
21878
|
-
forwardUrl,
|
|
21879
22085
|
forwarderTxApi,
|
|
21880
22086
|
getAllTickers,
|
|
21881
22087
|
getAllowanceApproved,
|
|
21882
22088
|
getBalanceOf,
|
|
21883
22089
|
getBaseDetail,
|
|
22090
|
+
getBaseUrlByEnv,
|
|
21884
22091
|
getFavoritesList,
|
|
22092
|
+
getForwardUrlByEnv,
|
|
21885
22093
|
getHistoryOrders,
|
|
21886
22094
|
getKlineData,
|
|
21887
22095
|
getKlineLatestBar,
|