@myx-trade/sdk 0.1.56 → 0.1.58
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 +131 -4
- package/dist/index.d.ts +131 -4
- package/dist/index.js +1773 -70
- package/dist/index.mjs +1769 -70
- package/package.json +4 -2
package/dist/index.js
CHANGED
|
@@ -38,6 +38,7 @@ __export(index_exports, {
|
|
|
38
38
|
DirectionEnum: () => DirectionEnum,
|
|
39
39
|
ErrorCode: () => ErrorCode,
|
|
40
40
|
ExecTypeEnum: () => ExecTypeEnum,
|
|
41
|
+
ForwarderGetStatus: () => ForwarderGetStatus,
|
|
41
42
|
HttpKlineIntervalEnum: () => HttpKlineIntervalEnum,
|
|
42
43
|
MarketCapType: () => MarketCapType,
|
|
43
44
|
MarketPoolState: () => MarketPoolState,
|
|
@@ -62,7 +63,10 @@ __export(index_exports, {
|
|
|
62
63
|
bigintAmountSlipperCalculator: () => bigintAmountSlipperCalculator,
|
|
63
64
|
bigintTradingGasPriceWithRatio: () => bigintTradingGasPriceWithRatio,
|
|
64
65
|
bigintTradingGasToRatioCalculator: () => bigintTradingGasToRatioCalculator,
|
|
66
|
+
fetchForwarderGetApi: () => fetchForwarderGetApi,
|
|
65
67
|
formatUnits: () => import_ethers22.formatUnits,
|
|
68
|
+
forwardUrl: () => forwardUrl,
|
|
69
|
+
forwarderTxApi: () => forwarderTxApi,
|
|
66
70
|
getAllTickers: () => getAllTickers,
|
|
67
71
|
getAllowanceApproved: () => getAllowanceApproved,
|
|
68
72
|
getBalanceOf: () => getBalanceOf,
|
|
@@ -1466,6 +1470,7 @@ function isSupportedChainFn(chainId) {
|
|
|
1466
1470
|
|
|
1467
1471
|
// src/config/address/ARB_TEST_SEPOLIA.ts
|
|
1468
1472
|
var ARB_TEST_SEPOLIA = {
|
|
1473
|
+
USDC: "0x7E248Ec1721639413A280d9E82e2862Cae2E6E28",
|
|
1469
1474
|
POOL_MANAGER: "0xA4A1dfbe40cB725A79D34bd529f0C1b54AB46954",
|
|
1470
1475
|
Account: "0x6136899e8c77C452bc46AcD786aA2C09fD31f947",
|
|
1471
1476
|
POSITION_MANAGER: "0x002F28be205E9A1e279d2eeF1f5e472CeA1d910C",
|
|
@@ -1476,14 +1481,13 @@ var ARB_TEST_SEPOLIA = {
|
|
|
1476
1481
|
LIQUIDITY_ROUTER: "0xd185C3f675d991735FCF6885Ff6BADE02A21313d",
|
|
1477
1482
|
BASE_POOL: "0x2c6AdaE4A01836487842b7369c1db3F441871E83",
|
|
1478
1483
|
QUOTE_POOL: "0xe1Ff495206635570A8Eaf9517125Ce66a2d09d32",
|
|
1479
|
-
BROKER: "0xB3DaeFF433c005e214D6cd73C35cD4bBCe7f94fD",
|
|
1480
|
-
// MYXBroker
|
|
1481
1484
|
ORACLE: "0x574001F6cB520b15d5a6db9F7B7a0ebf1A8E25c0",
|
|
1482
1485
|
// MYXOracle
|
|
1483
1486
|
EIP7702Delegation: "0x4e1B9aDf5Aa4a893f578c8502E6E28841b2403f3",
|
|
1484
1487
|
MARKET_MANAGER: "0x12AD75316A92a66b92c79080c555594314e7aFB3",
|
|
1485
1488
|
DATA_PROVIDER: "0x726A4978eDcb974B9889BC6f5Ee2Ec06D703038E",
|
|
1486
|
-
ORACLE_RESERVE: "0xC46b81c38091933f4811EC16E93553f9801EB863"
|
|
1489
|
+
ORACLE_RESERVE: "0xC46b81c38091933f4811EC16E93553f9801EB863",
|
|
1490
|
+
FORWARDER: "0xD41c2078fe35c8ca5f95b28Ed3017C4f7b4Bd49d"
|
|
1487
1491
|
};
|
|
1488
1492
|
|
|
1489
1493
|
// src/config/address/LINEA_SEPOLIA.ts
|
|
@@ -1494,18 +1498,18 @@ var LINEA_SEPOLIA = {
|
|
|
1494
1498
|
ORDER_MANAGER: "0x50602673C3506AFF2e7Df82dB6E93B6B134331Ae",
|
|
1495
1499
|
PYTH: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729",
|
|
1496
1500
|
// !!! 非Pyth Adapter
|
|
1497
|
-
ERC20: "
|
|
1501
|
+
ERC20: "0xD984fd34f91F92DA0586e1bE82E262fF27DC431b",
|
|
1498
1502
|
LIQUIDITY_ROUTER: "0x7fa9B7C0D95E19f180A2bf359d980c0bD3aC2503",
|
|
1499
1503
|
BASE_POOL: "0x6d3A2AB082388C35319007a2D635Cf7A8B8aF0E1",
|
|
1500
1504
|
QUOTE_POOL: "0x5A6fdFD381B76eD163b60300E619F7EB6049e7bD",
|
|
1501
|
-
BROKER: "0x0C6358400a8d86d8377640B1B783b8326b7D0fdc",
|
|
1502
|
-
// MYXBroker
|
|
1503
1505
|
ORACLE: "0xfbA4a141bb3BbD0EB34b24152caa3d2940629545",
|
|
1504
1506
|
// MYXOracle
|
|
1505
1507
|
EIP7702Delegation: "0xa55149B66A7fC4a4eF05c8da981E46Fe27695E6c",
|
|
1506
1508
|
MARKET_MANAGER: "0x96Dd73d94c7359e92a45Ff75bC90909E66332990",
|
|
1507
1509
|
DATA_PROVIDER: "0xF10B5736EA756488139135BF14aE5A542de435a9",
|
|
1508
|
-
ORACLE_RESERVE: "0xb9433C0e23f38E8Ad48B9A6e562F0a543e06a9F4"
|
|
1510
|
+
ORACLE_RESERVE: "0xb9433C0e23f38E8Ad48B9A6e562F0a543e06a9F4",
|
|
1511
|
+
USDC: "0xD984fd34f91F92DA0586e1bE82E262fF27DC431b",
|
|
1512
|
+
FORWARDER: "0xeDb8E5B27baB3125b5039fB4A9e3dCc962155d2E"
|
|
1509
1513
|
};
|
|
1510
1514
|
|
|
1511
1515
|
// src/config/address.ts
|
|
@@ -1558,6 +1562,7 @@ var linea_default = "./linea-ZTA3FOH3.png";
|
|
|
1558
1562
|
|
|
1559
1563
|
// src/config/fee.ts
|
|
1560
1564
|
var GAS_FEE_RESERVED_RATIO = 10;
|
|
1565
|
+
var SEAMLESS_ACCOUNT_GAS_LIMIT = 5e6;
|
|
1561
1566
|
|
|
1562
1567
|
// src/config/chains/LINEA_SEPOLIA.ts
|
|
1563
1568
|
var LINEA_SEPOLIA_default = {
|
|
@@ -1836,7 +1841,7 @@ var RotationProvider = class extends import_providers.BaseProvider {
|
|
|
1836
1841
|
// package.json
|
|
1837
1842
|
var package_default = {
|
|
1838
1843
|
name: "@myx-trade/sdk",
|
|
1839
|
-
version: "0.1.
|
|
1844
|
+
version: "0.1.58",
|
|
1840
1845
|
private: false,
|
|
1841
1846
|
publishConfig: {
|
|
1842
1847
|
access: "public"
|
|
@@ -1895,6 +1900,7 @@ var package_default = {
|
|
|
1895
1900
|
typescript: "^5.3.0"
|
|
1896
1901
|
},
|
|
1897
1902
|
dependencies: {
|
|
1903
|
+
"@ethersproject/bytes": "^5.8.0",
|
|
1898
1904
|
"@ethersproject/providers": "^5.8.0",
|
|
1899
1905
|
"@types/ws": "^8.18.1",
|
|
1900
1906
|
"crypto-js": "^4.2.0",
|
|
@@ -1905,7 +1911,8 @@ var package_default = {
|
|
|
1905
1911
|
"reconnecting-websocket": "^4.4.0",
|
|
1906
1912
|
viem: "^2.36.0",
|
|
1907
1913
|
wretch: "^2.11.0",
|
|
1908
|
-
ws: "^8.18.3"
|
|
1914
|
+
ws: "^8.18.3",
|
|
1915
|
+
dayjs: "^1.11.13"
|
|
1909
1916
|
}
|
|
1910
1917
|
};
|
|
1911
1918
|
|
|
@@ -2129,8 +2136,36 @@ var getTradeFlow = async ({
|
|
|
2129
2136
|
);
|
|
2130
2137
|
};
|
|
2131
2138
|
|
|
2139
|
+
// src/api/seamless/index.ts
|
|
2140
|
+
var forwarderTxApi = async (params, chainId) => {
|
|
2141
|
+
console.log("forwarderTxApi params-->", params);
|
|
2142
|
+
return http.post(
|
|
2143
|
+
`${forwardUrl}/forwarder/tx-v2`,
|
|
2144
|
+
params,
|
|
2145
|
+
{
|
|
2146
|
+
headers: {
|
|
2147
|
+
"myx-chain-id": chainId.toString()
|
|
2148
|
+
}
|
|
2149
|
+
}
|
|
2150
|
+
);
|
|
2151
|
+
};
|
|
2152
|
+
var ForwarderGetStatus = /* @__PURE__ */ ((ForwarderGetStatus2) => {
|
|
2153
|
+
ForwarderGetStatus2[ForwarderGetStatus2["EXECUTING"] = 1] = "EXECUTING";
|
|
2154
|
+
ForwarderGetStatus2[ForwarderGetStatus2["BROADCAST_FAILED"] = 2] = "BROADCAST_FAILED";
|
|
2155
|
+
ForwarderGetStatus2[ForwarderGetStatus2["TIMEOUT_CANCEL"] = 3] = "TIMEOUT_CANCEL";
|
|
2156
|
+
ForwarderGetStatus2[ForwarderGetStatus2["EXECUTED"] = 9] = "EXECUTED";
|
|
2157
|
+
return ForwarderGetStatus2;
|
|
2158
|
+
})(ForwarderGetStatus || {});
|
|
2159
|
+
var fetchForwarderGetApi = async (params) => {
|
|
2160
|
+
const rs = await http.get(
|
|
2161
|
+
`${forwardUrl}/forwarder/get${addQueryParams(params)}`
|
|
2162
|
+
);
|
|
2163
|
+
return rs;
|
|
2164
|
+
};
|
|
2165
|
+
|
|
2132
2166
|
// src/api/index.ts
|
|
2133
2167
|
var baseUrl = "https://api-test.myx.cash";
|
|
2168
|
+
var forwardUrl = "https://api-test.myx.cash/v2/agent";
|
|
2134
2169
|
var getOraclePrice = async (chainId, poolIds = []) => {
|
|
2135
2170
|
if (!!poolIds.length) {
|
|
2136
2171
|
return http.get(`${baseUrl}/openapi/gateway/quote/price/oracles`, {
|
|
@@ -9933,110 +9968,1310 @@ var DataProvider_default = [
|
|
|
9933
9968
|
}
|
|
9934
9969
|
]
|
|
9935
9970
|
}
|
|
9936
|
-
]
|
|
9971
|
+
]
|
|
9972
|
+
},
|
|
9973
|
+
{
|
|
9974
|
+
type: "function",
|
|
9975
|
+
name: "getPositionFees",
|
|
9976
|
+
constant: true,
|
|
9977
|
+
stateMutability: "view",
|
|
9978
|
+
payable: false,
|
|
9979
|
+
inputs: [
|
|
9980
|
+
{
|
|
9981
|
+
type: "bytes32",
|
|
9982
|
+
name: "positionId"
|
|
9983
|
+
},
|
|
9984
|
+
{
|
|
9985
|
+
type: "address",
|
|
9986
|
+
name: "broker"
|
|
9987
|
+
},
|
|
9988
|
+
{
|
|
9989
|
+
type: "uint256",
|
|
9990
|
+
name: "price"
|
|
9991
|
+
}
|
|
9992
|
+
],
|
|
9993
|
+
outputs: [
|
|
9994
|
+
{
|
|
9995
|
+
type: "int256",
|
|
9996
|
+
name: "netCollateral"
|
|
9997
|
+
},
|
|
9998
|
+
{
|
|
9999
|
+
type: "uint256",
|
|
10000
|
+
name: "collateralAmount"
|
|
10001
|
+
},
|
|
10002
|
+
{
|
|
10003
|
+
type: "uint256",
|
|
10004
|
+
name: "tradingFee"
|
|
10005
|
+
},
|
|
10006
|
+
{
|
|
10007
|
+
type: "int256",
|
|
10008
|
+
name: "fundingFee"
|
|
10009
|
+
}
|
|
10010
|
+
]
|
|
10011
|
+
},
|
|
10012
|
+
{
|
|
10013
|
+
type: "function",
|
|
10014
|
+
name: "getUserPositionInfos",
|
|
10015
|
+
constant: true,
|
|
10016
|
+
stateMutability: "view",
|
|
10017
|
+
payable: false,
|
|
10018
|
+
inputs: [
|
|
10019
|
+
{
|
|
10020
|
+
type: "address",
|
|
10021
|
+
name: "user"
|
|
10022
|
+
},
|
|
10023
|
+
{
|
|
10024
|
+
type: "bytes32[]",
|
|
10025
|
+
name: "poolIds"
|
|
10026
|
+
}
|
|
10027
|
+
],
|
|
10028
|
+
outputs: [
|
|
10029
|
+
{
|
|
10030
|
+
type: "tuple[]",
|
|
10031
|
+
name: "positions",
|
|
10032
|
+
components: [
|
|
10033
|
+
{
|
|
10034
|
+
type: "bytes32",
|
|
10035
|
+
name: "positionId"
|
|
10036
|
+
},
|
|
10037
|
+
{
|
|
10038
|
+
type: "bytes32",
|
|
10039
|
+
name: "poolId"
|
|
10040
|
+
},
|
|
10041
|
+
{
|
|
10042
|
+
type: "uint256",
|
|
10043
|
+
name: "size"
|
|
10044
|
+
},
|
|
10045
|
+
{
|
|
10046
|
+
type: "uint256",
|
|
10047
|
+
name: "entryPrice"
|
|
10048
|
+
},
|
|
10049
|
+
{
|
|
10050
|
+
type: "int256",
|
|
10051
|
+
name: "fundingRateIndex"
|
|
10052
|
+
},
|
|
10053
|
+
{
|
|
10054
|
+
type: "uint256",
|
|
10055
|
+
name: "earlyClosePrice"
|
|
10056
|
+
},
|
|
10057
|
+
{
|
|
10058
|
+
type: "uint8",
|
|
10059
|
+
name: "direction"
|
|
10060
|
+
},
|
|
10061
|
+
{
|
|
10062
|
+
type: "uint8",
|
|
10063
|
+
name: "riskTier"
|
|
10064
|
+
},
|
|
10065
|
+
{
|
|
10066
|
+
type: "uint64",
|
|
10067
|
+
name: "lastUpdateTime"
|
|
10068
|
+
},
|
|
10069
|
+
{
|
|
10070
|
+
type: "uint256",
|
|
10071
|
+
name: "collateralAmount"
|
|
10072
|
+
}
|
|
10073
|
+
]
|
|
10074
|
+
}
|
|
10075
|
+
]
|
|
10076
|
+
}
|
|
10077
|
+
];
|
|
10078
|
+
|
|
10079
|
+
// src/abi/Forwarder.json
|
|
10080
|
+
var Forwarder_default = [
|
|
10081
|
+
{
|
|
10082
|
+
type: "constructor",
|
|
10083
|
+
payable: false,
|
|
10084
|
+
inputs: []
|
|
10085
|
+
},
|
|
10086
|
+
{
|
|
10087
|
+
type: "error",
|
|
10088
|
+
name: "AddressEmptyCode",
|
|
10089
|
+
inputs: [
|
|
10090
|
+
{
|
|
10091
|
+
type: "address",
|
|
10092
|
+
name: "target"
|
|
10093
|
+
}
|
|
10094
|
+
]
|
|
10095
|
+
},
|
|
10096
|
+
{
|
|
10097
|
+
type: "error",
|
|
10098
|
+
name: "ERC1967InvalidImplementation",
|
|
10099
|
+
inputs: [
|
|
10100
|
+
{
|
|
10101
|
+
type: "address",
|
|
10102
|
+
name: "implementation"
|
|
10103
|
+
}
|
|
10104
|
+
]
|
|
10105
|
+
},
|
|
10106
|
+
{
|
|
10107
|
+
type: "error",
|
|
10108
|
+
name: "ERC1967NonPayable",
|
|
10109
|
+
inputs: []
|
|
10110
|
+
},
|
|
10111
|
+
{
|
|
10112
|
+
type: "error",
|
|
10113
|
+
name: "ERC2771ForwarderExpiredRequest",
|
|
10114
|
+
inputs: [
|
|
10115
|
+
{
|
|
10116
|
+
type: "uint48",
|
|
10117
|
+
name: "deadline"
|
|
10118
|
+
}
|
|
10119
|
+
]
|
|
10120
|
+
},
|
|
10121
|
+
{
|
|
10122
|
+
type: "error",
|
|
10123
|
+
name: "ERC2771ForwarderInvalidSigner",
|
|
10124
|
+
inputs: [
|
|
10125
|
+
{
|
|
10126
|
+
type: "address",
|
|
10127
|
+
name: "signer"
|
|
10128
|
+
},
|
|
10129
|
+
{
|
|
10130
|
+
type: "address",
|
|
10131
|
+
name: "from"
|
|
10132
|
+
}
|
|
10133
|
+
]
|
|
10134
|
+
},
|
|
10135
|
+
{
|
|
10136
|
+
type: "error",
|
|
10137
|
+
name: "ERC2771ForwarderMismatchedValue",
|
|
10138
|
+
inputs: [
|
|
10139
|
+
{
|
|
10140
|
+
type: "uint256",
|
|
10141
|
+
name: "requestedValue"
|
|
10142
|
+
},
|
|
10143
|
+
{
|
|
10144
|
+
type: "uint256",
|
|
10145
|
+
name: "msgValue"
|
|
10146
|
+
}
|
|
10147
|
+
]
|
|
10148
|
+
},
|
|
10149
|
+
{
|
|
10150
|
+
type: "error",
|
|
10151
|
+
name: "ERC2771UntrustfulTarget",
|
|
10152
|
+
inputs: [
|
|
10153
|
+
{
|
|
10154
|
+
type: "address",
|
|
10155
|
+
name: "target"
|
|
10156
|
+
},
|
|
10157
|
+
{
|
|
10158
|
+
type: "address",
|
|
10159
|
+
name: "forwarder"
|
|
10160
|
+
}
|
|
10161
|
+
]
|
|
10162
|
+
},
|
|
10163
|
+
{
|
|
10164
|
+
type: "error",
|
|
10165
|
+
name: "ExceedsMaximumRelayFee",
|
|
10166
|
+
inputs: []
|
|
10167
|
+
},
|
|
10168
|
+
{
|
|
10169
|
+
type: "error",
|
|
10170
|
+
name: "FailedCall",
|
|
10171
|
+
inputs: []
|
|
10172
|
+
},
|
|
10173
|
+
{
|
|
10174
|
+
type: "error",
|
|
10175
|
+
name: "InconsistentParamsLength",
|
|
10176
|
+
inputs: []
|
|
10177
|
+
},
|
|
10178
|
+
{
|
|
10179
|
+
type: "error",
|
|
10180
|
+
name: "InsufficientBalance",
|
|
10181
|
+
inputs: [
|
|
10182
|
+
{
|
|
10183
|
+
type: "uint256",
|
|
10184
|
+
name: "balance"
|
|
10185
|
+
},
|
|
10186
|
+
{
|
|
10187
|
+
type: "uint256",
|
|
10188
|
+
name: "needed"
|
|
10189
|
+
}
|
|
10190
|
+
]
|
|
10191
|
+
},
|
|
10192
|
+
{
|
|
10193
|
+
type: "error",
|
|
10194
|
+
name: "InsufficientFeeAllowance",
|
|
10195
|
+
inputs: [
|
|
10196
|
+
{
|
|
10197
|
+
type: "address",
|
|
10198
|
+
name: "user"
|
|
10199
|
+
},
|
|
10200
|
+
{
|
|
10201
|
+
type: "uint256",
|
|
10202
|
+
name: "allowance"
|
|
10203
|
+
},
|
|
10204
|
+
{
|
|
10205
|
+
type: "uint256",
|
|
10206
|
+
name: "required"
|
|
10207
|
+
}
|
|
10208
|
+
]
|
|
10209
|
+
},
|
|
10210
|
+
{
|
|
10211
|
+
type: "error",
|
|
10212
|
+
name: "InsufficientFeeBalance",
|
|
10213
|
+
inputs: [
|
|
10214
|
+
{
|
|
10215
|
+
type: "address",
|
|
10216
|
+
name: "user"
|
|
10217
|
+
},
|
|
10218
|
+
{
|
|
10219
|
+
type: "uint256",
|
|
10220
|
+
name: "balance"
|
|
10221
|
+
},
|
|
10222
|
+
{
|
|
10223
|
+
type: "uint256",
|
|
10224
|
+
name: "required"
|
|
10225
|
+
}
|
|
10226
|
+
]
|
|
10227
|
+
},
|
|
10228
|
+
{
|
|
10229
|
+
type: "error",
|
|
10230
|
+
name: "InvalidAccountNonce",
|
|
10231
|
+
inputs: [
|
|
10232
|
+
{
|
|
10233
|
+
type: "address",
|
|
10234
|
+
name: "account"
|
|
10235
|
+
},
|
|
10236
|
+
{
|
|
10237
|
+
type: "uint256",
|
|
10238
|
+
name: "currentNonce"
|
|
10239
|
+
}
|
|
10240
|
+
]
|
|
10241
|
+
},
|
|
10242
|
+
{
|
|
10243
|
+
type: "error",
|
|
10244
|
+
name: "InvalidInitialization",
|
|
10245
|
+
inputs: []
|
|
10246
|
+
},
|
|
10247
|
+
{
|
|
10248
|
+
type: "error",
|
|
10249
|
+
name: "MismatchedSender",
|
|
10250
|
+
inputs: [
|
|
10251
|
+
{
|
|
10252
|
+
type: "address",
|
|
10253
|
+
name: "sender"
|
|
10254
|
+
}
|
|
10255
|
+
]
|
|
10256
|
+
},
|
|
10257
|
+
{
|
|
10258
|
+
type: "error",
|
|
10259
|
+
name: "NotAddressManager",
|
|
10260
|
+
inputs: []
|
|
10261
|
+
},
|
|
10262
|
+
{
|
|
10263
|
+
type: "error",
|
|
10264
|
+
name: "NotAllowedTarget",
|
|
10265
|
+
inputs: [
|
|
10266
|
+
{
|
|
10267
|
+
type: "address",
|
|
10268
|
+
name: "target"
|
|
10269
|
+
}
|
|
10270
|
+
]
|
|
10271
|
+
},
|
|
10272
|
+
{
|
|
10273
|
+
type: "error",
|
|
10274
|
+
name: "NotDependencyManager",
|
|
10275
|
+
inputs: []
|
|
10276
|
+
},
|
|
10277
|
+
{
|
|
10278
|
+
type: "error",
|
|
10279
|
+
name: "NotInitializing",
|
|
10280
|
+
inputs: []
|
|
10281
|
+
},
|
|
10282
|
+
{
|
|
10283
|
+
type: "error",
|
|
10284
|
+
name: "NotProxyAdmin",
|
|
10285
|
+
inputs: []
|
|
10286
|
+
},
|
|
10287
|
+
{
|
|
10288
|
+
type: "error",
|
|
10289
|
+
name: "OnlyRelayer",
|
|
10290
|
+
inputs: []
|
|
10291
|
+
},
|
|
10292
|
+
{
|
|
10293
|
+
type: "error",
|
|
10294
|
+
name: "PermissionDenied",
|
|
10295
|
+
inputs: [
|
|
10296
|
+
{
|
|
10297
|
+
type: "address",
|
|
10298
|
+
name: "caller"
|
|
10299
|
+
},
|
|
10300
|
+
{
|
|
10301
|
+
type: "address",
|
|
10302
|
+
name: "target"
|
|
10303
|
+
}
|
|
10304
|
+
]
|
|
10305
|
+
},
|
|
10306
|
+
{
|
|
10307
|
+
type: "error",
|
|
10308
|
+
name: "ReentrancyGuardReentrantCall",
|
|
10309
|
+
inputs: []
|
|
10310
|
+
},
|
|
10311
|
+
{
|
|
10312
|
+
type: "error",
|
|
10313
|
+
name: "RelayerRegistered",
|
|
10314
|
+
inputs: [
|
|
10315
|
+
{
|
|
10316
|
+
type: "address",
|
|
10317
|
+
name: "relayer"
|
|
10318
|
+
}
|
|
10319
|
+
]
|
|
10320
|
+
},
|
|
10321
|
+
{
|
|
10322
|
+
type: "error",
|
|
10323
|
+
name: "SafeERC20FailedOperation",
|
|
10324
|
+
inputs: [
|
|
10325
|
+
{
|
|
10326
|
+
type: "address",
|
|
10327
|
+
name: "token"
|
|
10328
|
+
}
|
|
10329
|
+
]
|
|
10330
|
+
},
|
|
10331
|
+
{
|
|
10332
|
+
type: "error",
|
|
10333
|
+
name: "UUPSUnauthorizedCallContext",
|
|
10334
|
+
inputs: []
|
|
10335
|
+
},
|
|
10336
|
+
{
|
|
10337
|
+
type: "error",
|
|
10338
|
+
name: "UUPSUnsupportedProxiableUUID",
|
|
10339
|
+
inputs: [
|
|
10340
|
+
{
|
|
10341
|
+
type: "bytes32",
|
|
10342
|
+
name: "slot"
|
|
10343
|
+
}
|
|
10344
|
+
]
|
|
10345
|
+
},
|
|
10346
|
+
{
|
|
10347
|
+
type: "event",
|
|
10348
|
+
anonymous: false,
|
|
10349
|
+
name: "AddAllowedTarget",
|
|
10350
|
+
inputs: [
|
|
10351
|
+
{
|
|
10352
|
+
type: "address",
|
|
10353
|
+
name: "target",
|
|
10354
|
+
indexed: false
|
|
10355
|
+
}
|
|
10356
|
+
]
|
|
10357
|
+
},
|
|
10358
|
+
{
|
|
10359
|
+
type: "event",
|
|
10360
|
+
anonymous: false,
|
|
10361
|
+
name: "EIP712DomainChanged",
|
|
10362
|
+
inputs: []
|
|
10363
|
+
},
|
|
10364
|
+
{
|
|
10365
|
+
type: "event",
|
|
10366
|
+
anonymous: false,
|
|
10367
|
+
name: "ERC20PermitFailed",
|
|
10368
|
+
inputs: [
|
|
10369
|
+
{
|
|
10370
|
+
type: "address",
|
|
10371
|
+
name: "token",
|
|
10372
|
+
indexed: false
|
|
10373
|
+
},
|
|
10374
|
+
{
|
|
10375
|
+
type: "string",
|
|
10376
|
+
name: "reason",
|
|
10377
|
+
indexed: false
|
|
10378
|
+
}
|
|
10379
|
+
]
|
|
10380
|
+
},
|
|
10381
|
+
{
|
|
10382
|
+
type: "event",
|
|
10383
|
+
anonymous: false,
|
|
10384
|
+
name: "ERC20PermitLowLevelFailed",
|
|
10385
|
+
inputs: [
|
|
10386
|
+
{
|
|
10387
|
+
type: "bytes",
|
|
10388
|
+
name: "data",
|
|
10389
|
+
indexed: false
|
|
10390
|
+
}
|
|
10391
|
+
]
|
|
10392
|
+
},
|
|
10393
|
+
{
|
|
10394
|
+
type: "event",
|
|
10395
|
+
anonymous: false,
|
|
10396
|
+
name: "ExecutedForwardRequest",
|
|
10397
|
+
inputs: [
|
|
10398
|
+
{
|
|
10399
|
+
type: "address",
|
|
10400
|
+
name: "signer",
|
|
10401
|
+
indexed: true
|
|
10402
|
+
},
|
|
10403
|
+
{
|
|
10404
|
+
type: "uint256",
|
|
10405
|
+
name: "nonce",
|
|
10406
|
+
indexed: false
|
|
10407
|
+
},
|
|
10408
|
+
{
|
|
10409
|
+
type: "bool",
|
|
10410
|
+
name: "success",
|
|
10411
|
+
indexed: false
|
|
10412
|
+
}
|
|
10413
|
+
]
|
|
10414
|
+
},
|
|
10415
|
+
{
|
|
10416
|
+
type: "event",
|
|
10417
|
+
anonymous: false,
|
|
10418
|
+
name: "Initialized",
|
|
10419
|
+
inputs: [
|
|
10420
|
+
{
|
|
10421
|
+
type: "uint64",
|
|
10422
|
+
name: "version",
|
|
10423
|
+
indexed: false
|
|
10424
|
+
}
|
|
10425
|
+
]
|
|
10426
|
+
},
|
|
10427
|
+
{
|
|
10428
|
+
type: "event",
|
|
10429
|
+
anonymous: false,
|
|
10430
|
+
name: "RemoveAllowedTarget",
|
|
10431
|
+
inputs: [
|
|
10432
|
+
{
|
|
10433
|
+
type: "address",
|
|
10434
|
+
name: "target",
|
|
10435
|
+
indexed: false
|
|
10436
|
+
}
|
|
10437
|
+
]
|
|
10438
|
+
},
|
|
10439
|
+
{
|
|
10440
|
+
type: "event",
|
|
10441
|
+
anonymous: false,
|
|
10442
|
+
name: "SetUserRelayer",
|
|
10443
|
+
inputs: [
|
|
10444
|
+
{
|
|
10445
|
+
type: "address",
|
|
10446
|
+
name: "account",
|
|
10447
|
+
indexed: false
|
|
10448
|
+
},
|
|
10449
|
+
{
|
|
10450
|
+
type: "address",
|
|
10451
|
+
name: "relayer",
|
|
10452
|
+
indexed: false
|
|
10453
|
+
},
|
|
10454
|
+
{
|
|
10455
|
+
type: "bool",
|
|
10456
|
+
name: "enable",
|
|
10457
|
+
indexed: false
|
|
10458
|
+
}
|
|
10459
|
+
]
|
|
10460
|
+
},
|
|
10461
|
+
{
|
|
10462
|
+
type: "event",
|
|
10463
|
+
anonymous: false,
|
|
10464
|
+
name: "UpdateMaxRelayFee",
|
|
10465
|
+
inputs: [
|
|
10466
|
+
{
|
|
10467
|
+
type: "address",
|
|
10468
|
+
name: "sender",
|
|
10469
|
+
indexed: false
|
|
10470
|
+
},
|
|
10471
|
+
{
|
|
10472
|
+
type: "uint256",
|
|
10473
|
+
name: "oldMaxRelayFee",
|
|
10474
|
+
indexed: false
|
|
10475
|
+
},
|
|
10476
|
+
{
|
|
10477
|
+
type: "uint256",
|
|
10478
|
+
name: "newMaxRelayFee",
|
|
10479
|
+
indexed: false
|
|
10480
|
+
}
|
|
10481
|
+
]
|
|
10482
|
+
},
|
|
10483
|
+
{
|
|
10484
|
+
type: "event",
|
|
10485
|
+
anonymous: false,
|
|
10486
|
+
name: "UpdateRelayInfo",
|
|
10487
|
+
inputs: [
|
|
10488
|
+
{
|
|
10489
|
+
type: "address",
|
|
10490
|
+
name: "sender",
|
|
10491
|
+
indexed: false
|
|
10492
|
+
},
|
|
10493
|
+
{
|
|
10494
|
+
type: "uint256",
|
|
10495
|
+
name: "oldRelayFee",
|
|
10496
|
+
indexed: false
|
|
10497
|
+
},
|
|
10498
|
+
{
|
|
10499
|
+
type: "uint256",
|
|
10500
|
+
name: "newRelayFee",
|
|
10501
|
+
indexed: false
|
|
10502
|
+
},
|
|
10503
|
+
{
|
|
10504
|
+
type: "uint256",
|
|
10505
|
+
name: "oldRelayGas",
|
|
10506
|
+
indexed: false
|
|
10507
|
+
},
|
|
10508
|
+
{
|
|
10509
|
+
type: "uint256",
|
|
10510
|
+
name: "newRelayGas",
|
|
10511
|
+
indexed: false
|
|
10512
|
+
}
|
|
10513
|
+
]
|
|
10514
|
+
},
|
|
10515
|
+
{
|
|
10516
|
+
type: "event",
|
|
10517
|
+
anonymous: false,
|
|
10518
|
+
name: "Upgraded",
|
|
10519
|
+
inputs: [
|
|
10520
|
+
{
|
|
10521
|
+
type: "address",
|
|
10522
|
+
name: "implementation",
|
|
10523
|
+
indexed: true
|
|
10524
|
+
}
|
|
10525
|
+
]
|
|
10526
|
+
},
|
|
10527
|
+
{
|
|
10528
|
+
type: "function",
|
|
10529
|
+
name: "UPGRADE_INTERFACE_VERSION",
|
|
10530
|
+
constant: true,
|
|
10531
|
+
stateMutability: "view",
|
|
10532
|
+
payable: false,
|
|
10533
|
+
inputs: [],
|
|
10534
|
+
outputs: [
|
|
10535
|
+
{
|
|
10536
|
+
type: "string"
|
|
10537
|
+
}
|
|
10538
|
+
]
|
|
10539
|
+
},
|
|
10540
|
+
{
|
|
10541
|
+
type: "function",
|
|
10542
|
+
name: "__ERC2771ContextUpgradeable_init",
|
|
10543
|
+
constant: false,
|
|
10544
|
+
payable: false,
|
|
10545
|
+
inputs: [
|
|
10546
|
+
{
|
|
10547
|
+
type: "address",
|
|
10548
|
+
name: "trustedForwarder_"
|
|
10549
|
+
}
|
|
10550
|
+
],
|
|
10551
|
+
outputs: []
|
|
10552
|
+
},
|
|
10553
|
+
{
|
|
10554
|
+
type: "function",
|
|
10555
|
+
name: "addAllowedTarget",
|
|
10556
|
+
constant: false,
|
|
10557
|
+
payable: false,
|
|
10558
|
+
inputs: [
|
|
10559
|
+
{
|
|
10560
|
+
type: "address",
|
|
10561
|
+
name: "target"
|
|
10562
|
+
}
|
|
10563
|
+
],
|
|
10564
|
+
outputs: []
|
|
10565
|
+
},
|
|
10566
|
+
{
|
|
10567
|
+
type: "function",
|
|
10568
|
+
name: "batchExecuteForwarder",
|
|
10569
|
+
constant: false,
|
|
10570
|
+
stateMutability: "payable",
|
|
10571
|
+
payable: true,
|
|
10572
|
+
inputs: [
|
|
10573
|
+
{
|
|
10574
|
+
type: "tuple[]",
|
|
10575
|
+
name: "bundleParams",
|
|
10576
|
+
components: [
|
|
10577
|
+
{
|
|
10578
|
+
type: "address",
|
|
10579
|
+
name: "from"
|
|
10580
|
+
},
|
|
10581
|
+
{
|
|
10582
|
+
type: "address",
|
|
10583
|
+
name: "to"
|
|
10584
|
+
},
|
|
10585
|
+
{
|
|
10586
|
+
type: "uint256",
|
|
10587
|
+
name: "value"
|
|
10588
|
+
},
|
|
10589
|
+
{
|
|
10590
|
+
type: "uint256",
|
|
10591
|
+
name: "gas"
|
|
10592
|
+
},
|
|
10593
|
+
{
|
|
10594
|
+
type: "uint48",
|
|
10595
|
+
name: "deadline"
|
|
10596
|
+
},
|
|
10597
|
+
{
|
|
10598
|
+
type: "bytes",
|
|
10599
|
+
name: "data"
|
|
10600
|
+
},
|
|
10601
|
+
{
|
|
10602
|
+
type: "bytes",
|
|
10603
|
+
name: "signature"
|
|
10604
|
+
}
|
|
10605
|
+
]
|
|
10606
|
+
}
|
|
10607
|
+
],
|
|
10608
|
+
outputs: []
|
|
10609
|
+
},
|
|
10610
|
+
{
|
|
10611
|
+
type: "function",
|
|
10612
|
+
name: "eip712Domain",
|
|
10613
|
+
constant: true,
|
|
10614
|
+
stateMutability: "view",
|
|
10615
|
+
payable: false,
|
|
10616
|
+
inputs: [],
|
|
10617
|
+
outputs: [
|
|
10618
|
+
{
|
|
10619
|
+
type: "bytes1",
|
|
10620
|
+
name: "fields"
|
|
10621
|
+
},
|
|
10622
|
+
{
|
|
10623
|
+
type: "string",
|
|
10624
|
+
name: "name"
|
|
10625
|
+
},
|
|
10626
|
+
{
|
|
10627
|
+
type: "string",
|
|
10628
|
+
name: "version"
|
|
10629
|
+
},
|
|
10630
|
+
{
|
|
10631
|
+
type: "uint256",
|
|
10632
|
+
name: "chainId"
|
|
10633
|
+
},
|
|
10634
|
+
{
|
|
10635
|
+
type: "address",
|
|
10636
|
+
name: "verifyingContract"
|
|
10637
|
+
},
|
|
10638
|
+
{
|
|
10639
|
+
type: "bytes32",
|
|
10640
|
+
name: "salt"
|
|
10641
|
+
},
|
|
10642
|
+
{
|
|
10643
|
+
type: "uint256[]",
|
|
10644
|
+
name: "extensions"
|
|
10645
|
+
}
|
|
10646
|
+
]
|
|
10647
|
+
},
|
|
10648
|
+
{
|
|
10649
|
+
type: "function",
|
|
10650
|
+
name: "execute",
|
|
10651
|
+
constant: false,
|
|
10652
|
+
stateMutability: "payable",
|
|
10653
|
+
payable: true,
|
|
10654
|
+
inputs: [
|
|
10655
|
+
{
|
|
10656
|
+
type: "tuple",
|
|
10657
|
+
name: "request",
|
|
10658
|
+
components: [
|
|
10659
|
+
{
|
|
10660
|
+
type: "address",
|
|
10661
|
+
name: "from"
|
|
10662
|
+
},
|
|
10663
|
+
{
|
|
10664
|
+
type: "address",
|
|
10665
|
+
name: "to"
|
|
10666
|
+
},
|
|
10667
|
+
{
|
|
10668
|
+
type: "uint256",
|
|
10669
|
+
name: "value"
|
|
10670
|
+
},
|
|
10671
|
+
{
|
|
10672
|
+
type: "uint256",
|
|
10673
|
+
name: "gas"
|
|
10674
|
+
},
|
|
10675
|
+
{
|
|
10676
|
+
type: "uint48",
|
|
10677
|
+
name: "deadline"
|
|
10678
|
+
},
|
|
10679
|
+
{
|
|
10680
|
+
type: "bytes",
|
|
10681
|
+
name: "data"
|
|
10682
|
+
},
|
|
10683
|
+
{
|
|
10684
|
+
type: "bytes",
|
|
10685
|
+
name: "signature"
|
|
10686
|
+
}
|
|
10687
|
+
]
|
|
10688
|
+
}
|
|
10689
|
+
],
|
|
10690
|
+
outputs: []
|
|
10691
|
+
},
|
|
10692
|
+
{
|
|
10693
|
+
type: "function",
|
|
10694
|
+
name: "executeBatch",
|
|
10695
|
+
constant: false,
|
|
10696
|
+
stateMutability: "payable",
|
|
10697
|
+
payable: true,
|
|
10698
|
+
inputs: [
|
|
10699
|
+
{
|
|
10700
|
+
type: "tuple[]",
|
|
10701
|
+
name: "requests",
|
|
10702
|
+
components: [
|
|
10703
|
+
{
|
|
10704
|
+
type: "address",
|
|
10705
|
+
name: "from"
|
|
10706
|
+
},
|
|
10707
|
+
{
|
|
10708
|
+
type: "address",
|
|
10709
|
+
name: "to"
|
|
10710
|
+
},
|
|
10711
|
+
{
|
|
10712
|
+
type: "uint256",
|
|
10713
|
+
name: "value"
|
|
10714
|
+
},
|
|
10715
|
+
{
|
|
10716
|
+
type: "uint256",
|
|
10717
|
+
name: "gas"
|
|
10718
|
+
},
|
|
10719
|
+
{
|
|
10720
|
+
type: "uint48",
|
|
10721
|
+
name: "deadline"
|
|
10722
|
+
},
|
|
10723
|
+
{
|
|
10724
|
+
type: "bytes",
|
|
10725
|
+
name: "data"
|
|
10726
|
+
},
|
|
10727
|
+
{
|
|
10728
|
+
type: "bytes",
|
|
10729
|
+
name: "signature"
|
|
10730
|
+
}
|
|
10731
|
+
]
|
|
10732
|
+
},
|
|
10733
|
+
{
|
|
10734
|
+
type: "address",
|
|
10735
|
+
name: "refundReceiver"
|
|
10736
|
+
}
|
|
10737
|
+
],
|
|
10738
|
+
outputs: []
|
|
10739
|
+
},
|
|
10740
|
+
{
|
|
10741
|
+
type: "function",
|
|
10742
|
+
name: "executeForwarder",
|
|
10743
|
+
constant: false,
|
|
10744
|
+
stateMutability: "payable",
|
|
10745
|
+
payable: true,
|
|
10746
|
+
inputs: [
|
|
10747
|
+
{
|
|
10748
|
+
type: "tuple",
|
|
10749
|
+
name: "params",
|
|
10750
|
+
components: [
|
|
10751
|
+
{
|
|
10752
|
+
type: "address",
|
|
10753
|
+
name: "from"
|
|
10754
|
+
},
|
|
10755
|
+
{
|
|
10756
|
+
type: "address",
|
|
10757
|
+
name: "to"
|
|
10758
|
+
},
|
|
10759
|
+
{
|
|
10760
|
+
type: "uint256",
|
|
10761
|
+
name: "value"
|
|
10762
|
+
},
|
|
10763
|
+
{
|
|
10764
|
+
type: "uint256",
|
|
10765
|
+
name: "gas"
|
|
10766
|
+
},
|
|
10767
|
+
{
|
|
10768
|
+
type: "uint48",
|
|
10769
|
+
name: "deadline"
|
|
10770
|
+
},
|
|
10771
|
+
{
|
|
10772
|
+
type: "bytes",
|
|
10773
|
+
name: "data"
|
|
10774
|
+
},
|
|
10775
|
+
{
|
|
10776
|
+
type: "bytes",
|
|
10777
|
+
name: "signature"
|
|
10778
|
+
}
|
|
10779
|
+
]
|
|
10780
|
+
}
|
|
10781
|
+
],
|
|
10782
|
+
outputs: []
|
|
10783
|
+
},
|
|
10784
|
+
{
|
|
10785
|
+
type: "function",
|
|
10786
|
+
name: "feeToken",
|
|
10787
|
+
constant: true,
|
|
10788
|
+
stateMutability: "view",
|
|
10789
|
+
payable: false,
|
|
10790
|
+
inputs: [],
|
|
10791
|
+
outputs: [
|
|
10792
|
+
{
|
|
10793
|
+
type: "address"
|
|
10794
|
+
}
|
|
10795
|
+
]
|
|
10796
|
+
},
|
|
10797
|
+
{
|
|
10798
|
+
type: "function",
|
|
10799
|
+
name: "getAddressManager",
|
|
10800
|
+
constant: true,
|
|
10801
|
+
stateMutability: "view",
|
|
10802
|
+
payable: false,
|
|
10803
|
+
inputs: [],
|
|
10804
|
+
outputs: [
|
|
10805
|
+
{
|
|
10806
|
+
type: "address"
|
|
10807
|
+
}
|
|
10808
|
+
]
|
|
10809
|
+
},
|
|
10810
|
+
{
|
|
10811
|
+
type: "function",
|
|
10812
|
+
name: "getAllowedTargets",
|
|
10813
|
+
constant: true,
|
|
10814
|
+
stateMutability: "view",
|
|
10815
|
+
payable: false,
|
|
10816
|
+
inputs: [],
|
|
10817
|
+
outputs: [
|
|
10818
|
+
{
|
|
10819
|
+
type: "address[]"
|
|
10820
|
+
}
|
|
10821
|
+
]
|
|
10822
|
+
},
|
|
10823
|
+
{
|
|
10824
|
+
type: "function",
|
|
10825
|
+
name: "getDependencyAddress",
|
|
10826
|
+
constant: true,
|
|
10827
|
+
stateMutability: "view",
|
|
10828
|
+
payable: false,
|
|
10829
|
+
inputs: [
|
|
10830
|
+
{
|
|
10831
|
+
type: "bytes32",
|
|
10832
|
+
name: "identifier"
|
|
10833
|
+
}
|
|
10834
|
+
],
|
|
10835
|
+
outputs: [
|
|
10836
|
+
{
|
|
10837
|
+
type: "address"
|
|
10838
|
+
}
|
|
10839
|
+
]
|
|
10840
|
+
},
|
|
10841
|
+
{
|
|
10842
|
+
type: "function",
|
|
10843
|
+
name: "getFeeToken",
|
|
10844
|
+
constant: true,
|
|
10845
|
+
stateMutability: "view",
|
|
10846
|
+
payable: false,
|
|
10847
|
+
inputs: [],
|
|
10848
|
+
outputs: [
|
|
10849
|
+
{
|
|
10850
|
+
type: "address"
|
|
10851
|
+
}
|
|
10852
|
+
]
|
|
10853
|
+
},
|
|
10854
|
+
{
|
|
10855
|
+
type: "function",
|
|
10856
|
+
name: "getImplementation",
|
|
10857
|
+
constant: true,
|
|
10858
|
+
stateMutability: "view",
|
|
10859
|
+
payable: false,
|
|
10860
|
+
inputs: [],
|
|
10861
|
+
outputs: [
|
|
10862
|
+
{
|
|
10863
|
+
type: "address"
|
|
10864
|
+
}
|
|
10865
|
+
]
|
|
10866
|
+
},
|
|
10867
|
+
{
|
|
10868
|
+
type: "function",
|
|
10869
|
+
name: "getMaxRelayFee",
|
|
10870
|
+
constant: true,
|
|
10871
|
+
stateMutability: "view",
|
|
10872
|
+
payable: false,
|
|
10873
|
+
inputs: [],
|
|
10874
|
+
outputs: [
|
|
10875
|
+
{
|
|
10876
|
+
type: "uint256"
|
|
10877
|
+
}
|
|
10878
|
+
]
|
|
10879
|
+
},
|
|
10880
|
+
{
|
|
10881
|
+
type: "function",
|
|
10882
|
+
name: "getRelayFee",
|
|
10883
|
+
constant: true,
|
|
10884
|
+
stateMutability: "view",
|
|
10885
|
+
payable: false,
|
|
10886
|
+
inputs: [],
|
|
10887
|
+
outputs: [
|
|
10888
|
+
{
|
|
10889
|
+
type: "uint256"
|
|
10890
|
+
}
|
|
10891
|
+
]
|
|
10892
|
+
},
|
|
10893
|
+
{
|
|
10894
|
+
type: "function",
|
|
10895
|
+
name: "getRelayGas",
|
|
10896
|
+
constant: true,
|
|
10897
|
+
stateMutability: "view",
|
|
10898
|
+
payable: false,
|
|
10899
|
+
inputs: [],
|
|
10900
|
+
outputs: [
|
|
10901
|
+
{
|
|
10902
|
+
type: "uint256"
|
|
10903
|
+
}
|
|
10904
|
+
]
|
|
10905
|
+
},
|
|
10906
|
+
{
|
|
10907
|
+
type: "function",
|
|
10908
|
+
name: "getUserRelayers",
|
|
10909
|
+
constant: true,
|
|
10910
|
+
stateMutability: "view",
|
|
10911
|
+
payable: false,
|
|
10912
|
+
inputs: [
|
|
10913
|
+
{
|
|
10914
|
+
type: "address",
|
|
10915
|
+
name: "account"
|
|
10916
|
+
}
|
|
10917
|
+
],
|
|
10918
|
+
outputs: [
|
|
10919
|
+
{
|
|
10920
|
+
type: "address[]"
|
|
10921
|
+
}
|
|
10922
|
+
]
|
|
10923
|
+
},
|
|
10924
|
+
{
|
|
10925
|
+
type: "function",
|
|
10926
|
+
name: "initialize",
|
|
10927
|
+
constant: false,
|
|
10928
|
+
payable: false,
|
|
10929
|
+
inputs: [
|
|
10930
|
+
{
|
|
10931
|
+
type: "address",
|
|
10932
|
+
name: "addressManager"
|
|
10933
|
+
},
|
|
10934
|
+
{
|
|
10935
|
+
type: "address",
|
|
10936
|
+
name: "_feeToken"
|
|
10937
|
+
},
|
|
10938
|
+
{
|
|
10939
|
+
type: "uint256",
|
|
10940
|
+
name: "_relayFee"
|
|
10941
|
+
},
|
|
10942
|
+
{
|
|
10943
|
+
type: "uint256",
|
|
10944
|
+
name: "_relayGas"
|
|
10945
|
+
},
|
|
10946
|
+
{
|
|
10947
|
+
type: "uint256",
|
|
10948
|
+
name: "_maxRelayFee"
|
|
10949
|
+
}
|
|
10950
|
+
],
|
|
10951
|
+
outputs: []
|
|
10952
|
+
},
|
|
10953
|
+
{
|
|
10954
|
+
type: "function",
|
|
10955
|
+
name: "isTrustedForwarder",
|
|
10956
|
+
constant: true,
|
|
10957
|
+
stateMutability: "view",
|
|
10958
|
+
payable: false,
|
|
10959
|
+
inputs: [
|
|
10960
|
+
{
|
|
10961
|
+
type: "address",
|
|
10962
|
+
name: "forwarder"
|
|
10963
|
+
}
|
|
10964
|
+
],
|
|
10965
|
+
outputs: [
|
|
10966
|
+
{
|
|
10967
|
+
type: "bool"
|
|
10968
|
+
}
|
|
10969
|
+
]
|
|
10970
|
+
},
|
|
10971
|
+
{
|
|
10972
|
+
type: "function",
|
|
10973
|
+
name: "isUserRelayerEnabled",
|
|
10974
|
+
constant: true,
|
|
10975
|
+
stateMutability: "view",
|
|
10976
|
+
payable: false,
|
|
10977
|
+
inputs: [
|
|
10978
|
+
{
|
|
10979
|
+
type: "address",
|
|
10980
|
+
name: "account"
|
|
10981
|
+
},
|
|
10982
|
+
{
|
|
10983
|
+
type: "address",
|
|
10984
|
+
name: "relayer"
|
|
10985
|
+
}
|
|
10986
|
+
],
|
|
10987
|
+
outputs: [
|
|
10988
|
+
{
|
|
10989
|
+
type: "bool"
|
|
10990
|
+
}
|
|
10991
|
+
]
|
|
10992
|
+
},
|
|
10993
|
+
{
|
|
10994
|
+
type: "function",
|
|
10995
|
+
name: "maxRelayFee",
|
|
10996
|
+
constant: true,
|
|
10997
|
+
stateMutability: "view",
|
|
10998
|
+
payable: false,
|
|
10999
|
+
inputs: [],
|
|
11000
|
+
outputs: [
|
|
11001
|
+
{
|
|
11002
|
+
type: "uint256"
|
|
11003
|
+
}
|
|
11004
|
+
]
|
|
11005
|
+
},
|
|
11006
|
+
{
|
|
11007
|
+
type: "function",
|
|
11008
|
+
name: "nonces",
|
|
11009
|
+
constant: true,
|
|
11010
|
+
stateMutability: "view",
|
|
11011
|
+
payable: false,
|
|
11012
|
+
inputs: [
|
|
11013
|
+
{
|
|
11014
|
+
type: "address",
|
|
11015
|
+
name: "owner"
|
|
11016
|
+
}
|
|
11017
|
+
],
|
|
11018
|
+
outputs: [
|
|
11019
|
+
{
|
|
11020
|
+
type: "uint256"
|
|
11021
|
+
}
|
|
11022
|
+
]
|
|
11023
|
+
},
|
|
11024
|
+
{
|
|
11025
|
+
type: "function",
|
|
11026
|
+
name: "originAccount",
|
|
11027
|
+
constant: true,
|
|
11028
|
+
stateMutability: "view",
|
|
11029
|
+
payable: false,
|
|
11030
|
+
inputs: [
|
|
11031
|
+
{
|
|
11032
|
+
type: "address",
|
|
11033
|
+
name: "relayer"
|
|
11034
|
+
}
|
|
11035
|
+
],
|
|
11036
|
+
outputs: [
|
|
11037
|
+
{
|
|
11038
|
+
type: "address",
|
|
11039
|
+
name: "account"
|
|
11040
|
+
}
|
|
11041
|
+
]
|
|
11042
|
+
},
|
|
11043
|
+
{
|
|
11044
|
+
type: "function",
|
|
11045
|
+
name: "permitAndApproveForwarder",
|
|
11046
|
+
constant: false,
|
|
11047
|
+
payable: false,
|
|
11048
|
+
inputs: [
|
|
11049
|
+
{
|
|
11050
|
+
type: "address",
|
|
11051
|
+
name: "relayer"
|
|
11052
|
+
},
|
|
11053
|
+
{
|
|
11054
|
+
type: "bool",
|
|
11055
|
+
name: "enable"
|
|
11056
|
+
},
|
|
11057
|
+
{
|
|
11058
|
+
type: "tuple[]",
|
|
11059
|
+
name: "permitParams",
|
|
11060
|
+
components: [
|
|
11061
|
+
{
|
|
11062
|
+
type: "address",
|
|
11063
|
+
name: "token"
|
|
11064
|
+
},
|
|
11065
|
+
{
|
|
11066
|
+
type: "address",
|
|
11067
|
+
name: "owner"
|
|
11068
|
+
},
|
|
11069
|
+
{
|
|
11070
|
+
type: "address",
|
|
11071
|
+
name: "spender"
|
|
11072
|
+
},
|
|
11073
|
+
{
|
|
11074
|
+
type: "uint256",
|
|
11075
|
+
name: "value"
|
|
11076
|
+
},
|
|
11077
|
+
{
|
|
11078
|
+
type: "uint256",
|
|
11079
|
+
name: "deadline"
|
|
11080
|
+
},
|
|
11081
|
+
{
|
|
11082
|
+
type: "uint8",
|
|
11083
|
+
name: "v"
|
|
11084
|
+
},
|
|
11085
|
+
{
|
|
11086
|
+
type: "bytes32",
|
|
11087
|
+
name: "r"
|
|
11088
|
+
},
|
|
11089
|
+
{
|
|
11090
|
+
type: "bytes32",
|
|
11091
|
+
name: "s"
|
|
11092
|
+
}
|
|
11093
|
+
]
|
|
11094
|
+
}
|
|
11095
|
+
],
|
|
11096
|
+
outputs: []
|
|
11097
|
+
},
|
|
11098
|
+
{
|
|
11099
|
+
type: "function",
|
|
11100
|
+
name: "proxiableUUID",
|
|
11101
|
+
constant: true,
|
|
11102
|
+
stateMutability: "view",
|
|
11103
|
+
payable: false,
|
|
11104
|
+
inputs: [],
|
|
11105
|
+
outputs: [
|
|
11106
|
+
{
|
|
11107
|
+
type: "bytes32"
|
|
11108
|
+
}
|
|
11109
|
+
]
|
|
11110
|
+
},
|
|
11111
|
+
{
|
|
11112
|
+
type: "function",
|
|
11113
|
+
name: "relayFee",
|
|
11114
|
+
constant: true,
|
|
11115
|
+
stateMutability: "view",
|
|
11116
|
+
payable: false,
|
|
11117
|
+
inputs: [],
|
|
11118
|
+
outputs: [
|
|
11119
|
+
{
|
|
11120
|
+
type: "uint256"
|
|
11121
|
+
}
|
|
11122
|
+
]
|
|
11123
|
+
},
|
|
11124
|
+
{
|
|
11125
|
+
type: "function",
|
|
11126
|
+
name: "relayGas",
|
|
11127
|
+
constant: true,
|
|
11128
|
+
stateMutability: "view",
|
|
11129
|
+
payable: false,
|
|
11130
|
+
inputs: [],
|
|
11131
|
+
outputs: [
|
|
11132
|
+
{
|
|
11133
|
+
type: "uint256"
|
|
11134
|
+
}
|
|
11135
|
+
]
|
|
11136
|
+
},
|
|
11137
|
+
{
|
|
11138
|
+
type: "function",
|
|
11139
|
+
name: "removeAllowedTarget",
|
|
11140
|
+
constant: false,
|
|
11141
|
+
payable: false,
|
|
11142
|
+
inputs: [
|
|
11143
|
+
{
|
|
11144
|
+
type: "address",
|
|
11145
|
+
name: "target"
|
|
11146
|
+
}
|
|
11147
|
+
],
|
|
11148
|
+
outputs: []
|
|
11149
|
+
},
|
|
11150
|
+
{
|
|
11151
|
+
type: "function",
|
|
11152
|
+
name: "trustedForwarder",
|
|
11153
|
+
constant: true,
|
|
11154
|
+
stateMutability: "view",
|
|
11155
|
+
payable: false,
|
|
11156
|
+
inputs: [],
|
|
11157
|
+
outputs: [
|
|
11158
|
+
{
|
|
11159
|
+
type: "address"
|
|
11160
|
+
}
|
|
11161
|
+
]
|
|
11162
|
+
},
|
|
11163
|
+
{
|
|
11164
|
+
type: "function",
|
|
11165
|
+
name: "updateMaxRelayFee",
|
|
11166
|
+
constant: false,
|
|
11167
|
+
payable: false,
|
|
11168
|
+
inputs: [
|
|
11169
|
+
{
|
|
11170
|
+
type: "uint256",
|
|
11171
|
+
name: "_maxRelayFee"
|
|
11172
|
+
}
|
|
11173
|
+
],
|
|
11174
|
+
outputs: []
|
|
9937
11175
|
},
|
|
9938
11176
|
{
|
|
9939
11177
|
type: "function",
|
|
9940
|
-
name: "
|
|
9941
|
-
constant:
|
|
9942
|
-
stateMutability: "view",
|
|
11178
|
+
name: "updateRelayInfo",
|
|
11179
|
+
constant: false,
|
|
9943
11180
|
payable: false,
|
|
9944
11181
|
inputs: [
|
|
9945
11182
|
{
|
|
9946
|
-
type: "
|
|
9947
|
-
name: "
|
|
9948
|
-
},
|
|
9949
|
-
{
|
|
9950
|
-
type: "address",
|
|
9951
|
-
name: "broker"
|
|
11183
|
+
type: "uint256",
|
|
11184
|
+
name: "_relayFee"
|
|
9952
11185
|
},
|
|
9953
11186
|
{
|
|
9954
11187
|
type: "uint256",
|
|
9955
|
-
name: "
|
|
11188
|
+
name: "_relayGas"
|
|
9956
11189
|
}
|
|
9957
11190
|
],
|
|
9958
|
-
outputs: [
|
|
9959
|
-
|
|
9960
|
-
|
|
9961
|
-
|
|
9962
|
-
|
|
9963
|
-
|
|
9964
|
-
|
|
9965
|
-
|
|
9966
|
-
|
|
11191
|
+
outputs: []
|
|
11192
|
+
},
|
|
11193
|
+
{
|
|
11194
|
+
type: "function",
|
|
11195
|
+
name: "upgradeTo",
|
|
11196
|
+
constant: false,
|
|
11197
|
+
stateMutability: "payable",
|
|
11198
|
+
payable: true,
|
|
11199
|
+
inputs: [
|
|
9967
11200
|
{
|
|
9968
|
-
type: "
|
|
9969
|
-
name: "
|
|
11201
|
+
type: "address",
|
|
11202
|
+
name: "newImplementation"
|
|
9970
11203
|
},
|
|
9971
11204
|
{
|
|
9972
|
-
type: "
|
|
9973
|
-
name: "
|
|
11205
|
+
type: "bytes",
|
|
11206
|
+
name: "data"
|
|
9974
11207
|
}
|
|
9975
|
-
]
|
|
11208
|
+
],
|
|
11209
|
+
outputs: []
|
|
9976
11210
|
},
|
|
9977
11211
|
{
|
|
9978
11212
|
type: "function",
|
|
9979
|
-
name: "
|
|
9980
|
-
constant:
|
|
9981
|
-
stateMutability: "
|
|
9982
|
-
payable:
|
|
11213
|
+
name: "upgradeToAndCall",
|
|
11214
|
+
constant: false,
|
|
11215
|
+
stateMutability: "payable",
|
|
11216
|
+
payable: true,
|
|
9983
11217
|
inputs: [
|
|
9984
11218
|
{
|
|
9985
11219
|
type: "address",
|
|
9986
|
-
name: "
|
|
11220
|
+
name: "newImplementation"
|
|
9987
11221
|
},
|
|
9988
11222
|
{
|
|
9989
|
-
type: "
|
|
9990
|
-
name: "
|
|
11223
|
+
type: "bytes",
|
|
11224
|
+
name: "data"
|
|
9991
11225
|
}
|
|
9992
11226
|
],
|
|
9993
|
-
outputs: [
|
|
11227
|
+
outputs: []
|
|
11228
|
+
},
|
|
11229
|
+
{
|
|
11230
|
+
type: "function",
|
|
11231
|
+
name: "verify",
|
|
11232
|
+
constant: true,
|
|
11233
|
+
stateMutability: "view",
|
|
11234
|
+
payable: false,
|
|
11235
|
+
inputs: [
|
|
9994
11236
|
{
|
|
9995
|
-
type: "tuple
|
|
9996
|
-
name: "
|
|
11237
|
+
type: "tuple",
|
|
11238
|
+
name: "request",
|
|
9997
11239
|
components: [
|
|
9998
11240
|
{
|
|
9999
|
-
type: "
|
|
10000
|
-
name: "
|
|
10001
|
-
},
|
|
10002
|
-
{
|
|
10003
|
-
type: "bytes32",
|
|
10004
|
-
name: "poolId"
|
|
11241
|
+
type: "address",
|
|
11242
|
+
name: "from"
|
|
10005
11243
|
},
|
|
10006
11244
|
{
|
|
10007
|
-
type: "
|
|
10008
|
-
name: "
|
|
11245
|
+
type: "address",
|
|
11246
|
+
name: "to"
|
|
10009
11247
|
},
|
|
10010
11248
|
{
|
|
10011
11249
|
type: "uint256",
|
|
10012
|
-
name: "
|
|
10013
|
-
},
|
|
10014
|
-
{
|
|
10015
|
-
type: "int256",
|
|
10016
|
-
name: "fundingRateIndex"
|
|
11250
|
+
name: "value"
|
|
10017
11251
|
},
|
|
10018
11252
|
{
|
|
10019
11253
|
type: "uint256",
|
|
10020
|
-
name: "
|
|
10021
|
-
},
|
|
10022
|
-
{
|
|
10023
|
-
type: "uint8",
|
|
10024
|
-
name: "direction"
|
|
11254
|
+
name: "gas"
|
|
10025
11255
|
},
|
|
10026
11256
|
{
|
|
10027
|
-
type: "
|
|
10028
|
-
name: "
|
|
11257
|
+
type: "uint48",
|
|
11258
|
+
name: "deadline"
|
|
10029
11259
|
},
|
|
10030
11260
|
{
|
|
10031
|
-
type: "
|
|
10032
|
-
name: "
|
|
11261
|
+
type: "bytes",
|
|
11262
|
+
name: "data"
|
|
10033
11263
|
},
|
|
10034
11264
|
{
|
|
10035
|
-
type: "
|
|
10036
|
-
name: "
|
|
11265
|
+
type: "bytes",
|
|
11266
|
+
name: "signature"
|
|
10037
11267
|
}
|
|
10038
11268
|
]
|
|
10039
11269
|
}
|
|
11270
|
+
],
|
|
11271
|
+
outputs: [
|
|
11272
|
+
{
|
|
11273
|
+
type: "bool"
|
|
11274
|
+
}
|
|
10040
11275
|
]
|
|
10041
11276
|
}
|
|
10042
11277
|
];
|
|
@@ -10109,6 +11344,12 @@ var getDataProviderContract = async (chainId, type = 0 /* JSON */) => {
|
|
|
10109
11344
|
const provider = type === 0 /* JSON */ ? getJSONProvider(chainId) : await getSignerProvider(chainId);
|
|
10110
11345
|
return getContract(address, DataProvider_default, provider);
|
|
10111
11346
|
};
|
|
11347
|
+
var getForwarderContract = async (chainId, type = 0 /* JSON */) => {
|
|
11348
|
+
const addresses = address_default[chainId];
|
|
11349
|
+
const address = addresses.FORWARDER;
|
|
11350
|
+
const provider = type === 0 /* JSON */ ? getJSONProvider(chainId) : await getSignerProvider(chainId);
|
|
11351
|
+
return getContract(address, Forwarder_default, provider);
|
|
11352
|
+
};
|
|
10112
11353
|
|
|
10113
11354
|
// src/config/error.ts
|
|
10114
11355
|
var import_ethers_decode_error = require("ethers-decode-error");
|
|
@@ -13203,8 +14444,6 @@ var Order = class {
|
|
|
13203
14444
|
useAccountBalance: false
|
|
13204
14445
|
};
|
|
13205
14446
|
});
|
|
13206
|
-
this.logger.info("closeAllPositions positionIds--->", positionIds);
|
|
13207
|
-
this.logger.info("closeAllPositions dataMap--->", dataMap);
|
|
13208
14447
|
const gasLimit = await brokerContract.placeOrdersWithPosition.estimateGas(positionIds, dataMap);
|
|
13209
14448
|
const transaction = await brokerContract.placeOrdersWithPosition(positionIds, dataMap, {
|
|
13210
14449
|
gasLimit: gasLimit * 120n / 100n
|
|
@@ -19114,6 +20353,465 @@ var Account = class {
|
|
|
19114
20353
|
}
|
|
19115
20354
|
};
|
|
19116
20355
|
|
|
20356
|
+
// src/manager/seamless/index.ts
|
|
20357
|
+
var import_crypto_js = __toESM(require("crypto-js"));
|
|
20358
|
+
var import_ethers27 = require("ethers");
|
|
20359
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
20360
|
+
|
|
20361
|
+
// src/utils/index.ts
|
|
20362
|
+
function getChainDomainConfig(chainId, address) {
|
|
20363
|
+
return CHAIN_DOMAIN?.[chainId]?.[address];
|
|
20364
|
+
}
|
|
20365
|
+
var CHAIN_DOMAIN = {
|
|
20366
|
+
[421614 /* ARB_TESTNET */]: {
|
|
20367
|
+
[getContractAddressByChainId(421614 /* ARB_TESTNET */).USDC]: {
|
|
20368
|
+
name: "USDC",
|
|
20369
|
+
version: "2",
|
|
20370
|
+
chainId: 421614 /* ARB_TESTNET */.toString(),
|
|
20371
|
+
verifyingContract: getContractAddressByChainId(421614 /* ARB_TESTNET */).USDC
|
|
20372
|
+
}
|
|
20373
|
+
}
|
|
20374
|
+
};
|
|
20375
|
+
var getEIP712Domain = async (contract) => {
|
|
20376
|
+
try {
|
|
20377
|
+
const eip712Domain = await contract.eip712Domain();
|
|
20378
|
+
return {
|
|
20379
|
+
name: eip712Domain.name,
|
|
20380
|
+
version: eip712Domain.version,
|
|
20381
|
+
chainId: BigInt(eip712Domain.chainId),
|
|
20382
|
+
// 确保 chainId 是ForwarderGetStatus bigint 类型
|
|
20383
|
+
verifyingContract: eip712Domain.verifyingContract
|
|
20384
|
+
};
|
|
20385
|
+
} catch (error) {
|
|
20386
|
+
throw new Error(`Error fetching EIP712 domain: ${error}`);
|
|
20387
|
+
}
|
|
20388
|
+
};
|
|
20389
|
+
function wait(ms) {
|
|
20390
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
20391
|
+
}
|
|
20392
|
+
function waitRandom(min, max) {
|
|
20393
|
+
return wait(min + Math.round(Math.random() * Math.max(0, max - min)));
|
|
20394
|
+
}
|
|
20395
|
+
var CanceledError = class extends Error {
|
|
20396
|
+
constructor() {
|
|
20397
|
+
super();
|
|
20398
|
+
this.name = "CanceledError";
|
|
20399
|
+
this.message = "Retryable was canceled";
|
|
20400
|
+
this.name = "CanceledError";
|
|
20401
|
+
}
|
|
20402
|
+
};
|
|
20403
|
+
var RetryableError = class extends Error {
|
|
20404
|
+
constructor() {
|
|
20405
|
+
super();
|
|
20406
|
+
this.name = "RetryableError";
|
|
20407
|
+
this.name = "RetryableError";
|
|
20408
|
+
}
|
|
20409
|
+
};
|
|
20410
|
+
var TimeoutError = class extends Error {
|
|
20411
|
+
constructor() {
|
|
20412
|
+
super();
|
|
20413
|
+
this.name = "TimeoutError";
|
|
20414
|
+
this.message = "Retryable was Timeout";
|
|
20415
|
+
this.name = "TimeoutError";
|
|
20416
|
+
}
|
|
20417
|
+
};
|
|
20418
|
+
function retry(fn, { n, minWait, maxWait }) {
|
|
20419
|
+
let completed = false;
|
|
20420
|
+
let rejectCancelled;
|
|
20421
|
+
const promise = new Promise(async (resolve, reject) => {
|
|
20422
|
+
rejectCancelled = reject;
|
|
20423
|
+
while (true) {
|
|
20424
|
+
let result;
|
|
20425
|
+
try {
|
|
20426
|
+
result = await fn();
|
|
20427
|
+
if (!completed) {
|
|
20428
|
+
resolve(result);
|
|
20429
|
+
completed = true;
|
|
20430
|
+
}
|
|
20431
|
+
break;
|
|
20432
|
+
} catch (error) {
|
|
20433
|
+
if (completed) {
|
|
20434
|
+
break;
|
|
20435
|
+
}
|
|
20436
|
+
if (n <= 0 || !(error instanceof RetryableError)) {
|
|
20437
|
+
if (error instanceof RetryableError) {
|
|
20438
|
+
reject(new TimeoutError());
|
|
20439
|
+
} else {
|
|
20440
|
+
reject(error);
|
|
20441
|
+
}
|
|
20442
|
+
completed = true;
|
|
20443
|
+
break;
|
|
20444
|
+
}
|
|
20445
|
+
n--;
|
|
20446
|
+
}
|
|
20447
|
+
await waitRandom(minWait, maxWait);
|
|
20448
|
+
}
|
|
20449
|
+
});
|
|
20450
|
+
return {
|
|
20451
|
+
promise,
|
|
20452
|
+
cancel: () => {
|
|
20453
|
+
if (completed) return;
|
|
20454
|
+
completed = true;
|
|
20455
|
+
rejectCancelled(new CanceledError());
|
|
20456
|
+
}
|
|
20457
|
+
};
|
|
20458
|
+
}
|
|
20459
|
+
|
|
20460
|
+
// src/manager/seamless/index.ts
|
|
20461
|
+
var import_bytes = require("@ethersproject/bytes");
|
|
20462
|
+
var contractTypes = {
|
|
20463
|
+
ForwardRequest: [
|
|
20464
|
+
{ name: "from", type: "address" },
|
|
20465
|
+
{ name: "to", type: "address" },
|
|
20466
|
+
{ name: "value", type: "uint256" },
|
|
20467
|
+
{ name: "gas", type: "uint256" },
|
|
20468
|
+
{ name: "nonce", type: "uint256" },
|
|
20469
|
+
{ name: "deadline", type: "uint48" },
|
|
20470
|
+
{ name: "data", type: "bytes" }
|
|
20471
|
+
]
|
|
20472
|
+
};
|
|
20473
|
+
var FORWARD_PLEDGE_FEE_RADIO = 2;
|
|
20474
|
+
var calculateSignature = async (message) => {
|
|
20475
|
+
const encoder = new TextEncoder();
|
|
20476
|
+
const data = encoder.encode(message);
|
|
20477
|
+
const hashBuffer = await window.crypto.subtle.digest("SHA-256", data);
|
|
20478
|
+
const hashArray = Array.from(new Uint8Array(hashBuffer));
|
|
20479
|
+
return hashArray.map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
20480
|
+
};
|
|
20481
|
+
var seamlessNonceString = "jAkBlC4~5!6@#$%^";
|
|
20482
|
+
var generateEthWalletFromHashedSignature = (hashedSignature) => {
|
|
20483
|
+
const seedStringToUtf8Bytes = (0, import_ethers27.toUtf8Bytes)(hashedSignature);
|
|
20484
|
+
const seedStringToKeccak256 = (0, import_ethers27.keccak256)(seedStringToUtf8Bytes);
|
|
20485
|
+
const seedStringToKeccak256Array = (0, import_ethers27.getBytes)(seedStringToKeccak256);
|
|
20486
|
+
const privateKey = (0, import_ethers27.hexlify)(seedStringToKeccak256Array);
|
|
20487
|
+
if (!(0, import_ethers27.isHexString)(privateKey, 32)) {
|
|
20488
|
+
throw new MyxSDKError("INVALID_PRIVATE_KEY" /* InvalidPrivateKey */, "Invalid private key generated");
|
|
20489
|
+
}
|
|
20490
|
+
const wallet = new import_ethers27.ethers.Wallet(privateKey);
|
|
20491
|
+
return {
|
|
20492
|
+
privateKey,
|
|
20493
|
+
wallet
|
|
20494
|
+
};
|
|
20495
|
+
};
|
|
20496
|
+
var charFill = (ping) => {
|
|
20497
|
+
const targetLength = 16;
|
|
20498
|
+
if (ping.length >= targetLength) {
|
|
20499
|
+
return ping;
|
|
20500
|
+
}
|
|
20501
|
+
const remainingLength = targetLength - ping.length;
|
|
20502
|
+
const repeatTimes = Math.ceil(remainingLength / ping.length);
|
|
20503
|
+
const paddedString = ping.repeat(repeatTimes).slice(0, remainingLength);
|
|
20504
|
+
return ping + paddedString;
|
|
20505
|
+
};
|
|
20506
|
+
var getIvMapString = () => import_crypto_js.default.enc.Utf8.parse(seamlessNonceString);
|
|
20507
|
+
async function signPermit(provider, contract, owner, spender, value, nonce, deadline, chainId) {
|
|
20508
|
+
const chainDomainConfig = getChainDomainConfig(chainId, contract.target);
|
|
20509
|
+
const domain = chainDomainConfig ?? await getEIP712Domain(contract);
|
|
20510
|
+
const types = {
|
|
20511
|
+
Permit: [
|
|
20512
|
+
{ name: "owner", type: "address" },
|
|
20513
|
+
{ name: "spender", type: "address" },
|
|
20514
|
+
{ name: "value", type: "uint256" },
|
|
20515
|
+
{ name: "nonce", type: "uint256" },
|
|
20516
|
+
{ name: "deadline", type: "uint256" }
|
|
20517
|
+
]
|
|
20518
|
+
};
|
|
20519
|
+
const message = {
|
|
20520
|
+
owner,
|
|
20521
|
+
spender,
|
|
20522
|
+
value,
|
|
20523
|
+
nonce,
|
|
20524
|
+
deadline
|
|
20525
|
+
};
|
|
20526
|
+
const signature = await provider.signTypedData(domain, types, message);
|
|
20527
|
+
const { v, r, s } = (0, import_bytes.splitSignature)(signature);
|
|
20528
|
+
return { v, r, s };
|
|
20529
|
+
}
|
|
20530
|
+
var Seamless = class {
|
|
20531
|
+
constructor(configManager, logger, utils, account) {
|
|
20532
|
+
this.configManager = configManager;
|
|
20533
|
+
this.logger = logger;
|
|
20534
|
+
this.utils = utils;
|
|
20535
|
+
this.account = account;
|
|
20536
|
+
this.seamlessWallet = null;
|
|
20537
|
+
this.seamlessWalletAuthorized = false;
|
|
20538
|
+
this.seamlessWalletApikey = "";
|
|
20539
|
+
}
|
|
20540
|
+
async onCheckRelayer(account, relayer) {
|
|
20541
|
+
const config = this.configManager.getConfig();
|
|
20542
|
+
const forwarderContract = await getForwarderContract(config.chainId);
|
|
20543
|
+
const checkRelayerResult = await forwarderContract.isUserRelayerEnabled(account, relayer);
|
|
20544
|
+
console.log("checkRelayerResult-->", checkRelayerResult);
|
|
20545
|
+
return checkRelayerResult;
|
|
20546
|
+
}
|
|
20547
|
+
async getUSDPermitParams(deadline) {
|
|
20548
|
+
const config = this.configManager.getConfig();
|
|
20549
|
+
const chainId = config.chainId;
|
|
20550
|
+
const masterAddress = config.signer?.getAddress();
|
|
20551
|
+
const brokerAddress = config.brokerAddress;
|
|
20552
|
+
const contractAddress = getContractAddressByChainId(config.chainId);
|
|
20553
|
+
const erc20Contract = new import_ethers27.ethers.Contract(
|
|
20554
|
+
contractAddress.ERC20,
|
|
20555
|
+
ERC20Token_default,
|
|
20556
|
+
config.signer
|
|
20557
|
+
);
|
|
20558
|
+
const walletProvider = await getWalletProvider(chainId);
|
|
20559
|
+
try {
|
|
20560
|
+
const nonces = await erc20Contract.nonces(masterAddress);
|
|
20561
|
+
const brokerSignPermit = await signPermit(
|
|
20562
|
+
// @ts-ignore
|
|
20563
|
+
walletProvider,
|
|
20564
|
+
erc20Contract,
|
|
20565
|
+
masterAddress,
|
|
20566
|
+
brokerAddress,
|
|
20567
|
+
import_ethers27.ethers.MaxUint256,
|
|
20568
|
+
nonces,
|
|
20569
|
+
deadline.toString(),
|
|
20570
|
+
chainId
|
|
20571
|
+
);
|
|
20572
|
+
const brokerSeamlessUSDPermitParams = {
|
|
20573
|
+
token: erc20Contract.target,
|
|
20574
|
+
owner: masterAddress,
|
|
20575
|
+
spender: brokerAddress,
|
|
20576
|
+
value: import_ethers27.ethers.MaxUint256,
|
|
20577
|
+
deadline,
|
|
20578
|
+
v: brokerSignPermit.v,
|
|
20579
|
+
r: brokerSignPermit.r,
|
|
20580
|
+
s: brokerSignPermit.s
|
|
20581
|
+
};
|
|
20582
|
+
return [brokerSeamlessUSDPermitParams];
|
|
20583
|
+
} catch (error) {
|
|
20584
|
+
throw new MyxSDKError("INVALID_PRIVATE_KEY" /* InvalidPrivateKey */, "Invalid private key generated");
|
|
20585
|
+
}
|
|
20586
|
+
return;
|
|
20587
|
+
}
|
|
20588
|
+
async forwarderTx({
|
|
20589
|
+
from,
|
|
20590
|
+
to,
|
|
20591
|
+
value,
|
|
20592
|
+
gas,
|
|
20593
|
+
deadline,
|
|
20594
|
+
data,
|
|
20595
|
+
nonce
|
|
20596
|
+
}) {
|
|
20597
|
+
const config = this.configManager.getConfig();
|
|
20598
|
+
const forwarderContract = await getForwarderContract(config.chainId);
|
|
20599
|
+
const forwarderJsonRpcContractDomain = await forwarderContract.eip712Domain();
|
|
20600
|
+
const domain = {
|
|
20601
|
+
name: forwarderJsonRpcContractDomain.name,
|
|
20602
|
+
version: forwarderJsonRpcContractDomain.version,
|
|
20603
|
+
chainId: forwarderJsonRpcContractDomain.chainId,
|
|
20604
|
+
verifyingContract: forwarderJsonRpcContractDomain.verifyingContract
|
|
20605
|
+
};
|
|
20606
|
+
const walletProvider = await getSignerProvider(config.chainId);
|
|
20607
|
+
const signature = await walletProvider.signTypedData(domain, contractTypes, {
|
|
20608
|
+
from,
|
|
20609
|
+
to,
|
|
20610
|
+
value,
|
|
20611
|
+
gas,
|
|
20612
|
+
nonce,
|
|
20613
|
+
deadline,
|
|
20614
|
+
data
|
|
20615
|
+
});
|
|
20616
|
+
const txRs = await forwarderTxApi({ from, to, value, gas, nonce, data, deadline, signature }, config.chainId);
|
|
20617
|
+
return txRs;
|
|
20618
|
+
}
|
|
20619
|
+
async authorizeSeamlessAccount({ approve: approve2, seamlessAddress }) {
|
|
20620
|
+
console.log("authorizeSeamlessAccount-->", approve2, seamlessAddress);
|
|
20621
|
+
const config = this.configManager.getConfig();
|
|
20622
|
+
const accessToken = await this.configManager.getAccessToken();
|
|
20623
|
+
if (!accessToken) {
|
|
20624
|
+
throw new MyxSDKError("INVALID_ACCESS_TOKEN" /* InvalidAccessToken */, "Invalid access token");
|
|
20625
|
+
}
|
|
20626
|
+
const masterAddress = await config.signer?.getAddress() ?? "";
|
|
20627
|
+
if (approve2) {
|
|
20628
|
+
const balanceRes = await this.account.getWalletQuoteTokenBalance();
|
|
20629
|
+
const balance = balanceRes.data;
|
|
20630
|
+
const forwarderContract2 = await getForwarderContract(config.chainId);
|
|
20631
|
+
const pledgeFee = await forwarderContract2.getRelayFee();
|
|
20632
|
+
const gasFee = BigInt(pledgeFee) * BigInt(FORWARD_PLEDGE_FEE_RADIO);
|
|
20633
|
+
if (gasFee > 0 && gasFee > BigInt(balance)) {
|
|
20634
|
+
throw new MyxSDKError("INSUFFICIENT_BALANCE" /* InsufficientBalance */, "Insufficient balance");
|
|
20635
|
+
}
|
|
20636
|
+
}
|
|
20637
|
+
const deadline = (0, import_dayjs.default)().add(60, "minute").unix();
|
|
20638
|
+
let permitParams = [];
|
|
20639
|
+
if (approve2) {
|
|
20640
|
+
try {
|
|
20641
|
+
permitParams = await this.getUSDPermitParams(deadline);
|
|
20642
|
+
} catch (error) {
|
|
20643
|
+
console.warn("Failed to get USD permit params, proceeding without permit:", error);
|
|
20644
|
+
permitParams = [];
|
|
20645
|
+
}
|
|
20646
|
+
}
|
|
20647
|
+
const forwarderContract = await getForwarderContract(config.chainId);
|
|
20648
|
+
const nonce = await forwarderContract.nonces(masterAddress);
|
|
20649
|
+
const gasLimit = SEAMLESS_ACCOUNT_GAS_LIMIT;
|
|
20650
|
+
const provider = await getJSONProvider(config.chainId);
|
|
20651
|
+
const { gasPrice } = await provider.getFeeData();
|
|
20652
|
+
const gas = BigInt(gasLimit) * BigInt(120) * BigInt(gasPrice ?? 0) / BigInt(100);
|
|
20653
|
+
const functionHash = forwarderContract.interface.encodeFunctionData("permitAndApproveForwarder", [
|
|
20654
|
+
seamlessAddress,
|
|
20655
|
+
approve2,
|
|
20656
|
+
permitParams
|
|
20657
|
+
]);
|
|
20658
|
+
const txRs = await this.forwarderTx({
|
|
20659
|
+
from: masterAddress ?? "",
|
|
20660
|
+
to: forwarderContract?.target,
|
|
20661
|
+
value: "0",
|
|
20662
|
+
gas: "350000",
|
|
20663
|
+
//gas.toString(),
|
|
20664
|
+
nonce: nonce.toString(),
|
|
20665
|
+
data: functionHash,
|
|
20666
|
+
deadline
|
|
20667
|
+
});
|
|
20668
|
+
if (!txRs.data?.txHash) {
|
|
20669
|
+
const retryOptions = { n: 10, minWait: 250, maxWait: 1e3 };
|
|
20670
|
+
const { promise } = retry(async () => {
|
|
20671
|
+
const getRs = await fetchForwarderGetApi({
|
|
20672
|
+
requestId: txRs.data?.requestId
|
|
20673
|
+
});
|
|
20674
|
+
console.log("getRs-->", getRs);
|
|
20675
|
+
if (getRs.data?.status === 9 /* EXECUTED */) {
|
|
20676
|
+
if (getRs.data?.txHash) {
|
|
20677
|
+
txRs.data.txHash = getRs.data.txHash;
|
|
20678
|
+
return;
|
|
20679
|
+
} else {
|
|
20680
|
+
throw new MyxSDKError("OPERATION_FAILED" /* OperationFailed */, "Operation failed, please try again later");
|
|
20681
|
+
}
|
|
20682
|
+
} else if ([2 /* BROADCAST_FAILED */, 3 /* TIMEOUT_CANCEL */].includes(getRs?.data?.status)) {
|
|
20683
|
+
throw new MyxSDKError("OPERATION_FAILED" /* OperationFailed */, "Operation failed, please try again later");
|
|
20684
|
+
}
|
|
20685
|
+
throw new RetryableError();
|
|
20686
|
+
}, retryOptions);
|
|
20687
|
+
try {
|
|
20688
|
+
await promise;
|
|
20689
|
+
} catch (err) {
|
|
20690
|
+
if (err instanceof TimeoutError) {
|
|
20691
|
+
throw new MyxSDKError("TIMEOUT" /* Timeout */, "Your request timed out, please try again");
|
|
20692
|
+
} else {
|
|
20693
|
+
throw err;
|
|
20694
|
+
}
|
|
20695
|
+
}
|
|
20696
|
+
}
|
|
20697
|
+
return txRs;
|
|
20698
|
+
}
|
|
20699
|
+
async unLockSeamlessWallet({ masterAddress, password, apiKey }) {
|
|
20700
|
+
const key = import_crypto_js.default.enc.Utf8.parse(charFill(password));
|
|
20701
|
+
const iv = getIvMapString();
|
|
20702
|
+
const decrypted = import_crypto_js.default.AES.decrypt(apiKey, key, {
|
|
20703
|
+
iv,
|
|
20704
|
+
mode: import_crypto_js.default.mode.CBC,
|
|
20705
|
+
padding: import_crypto_js.default.pad.Pkcs7
|
|
20706
|
+
});
|
|
20707
|
+
const privateKey = decrypted.toString(import_crypto_js.default.enc.Utf8);
|
|
20708
|
+
const wallet = new import_ethers27.ethers.Wallet(privateKey);
|
|
20709
|
+
this.seamlessWallet = wallet;
|
|
20710
|
+
const isAuthorized = await this.onCheckRelayer(masterAddress, wallet.address);
|
|
20711
|
+
this.seamlessWalletAuthorized = isAuthorized;
|
|
20712
|
+
return {
|
|
20713
|
+
code: 0,
|
|
20714
|
+
data: {
|
|
20715
|
+
masterAddress,
|
|
20716
|
+
seamlessAccount: wallet.address,
|
|
20717
|
+
authorized: isAuthorized
|
|
20718
|
+
}
|
|
20719
|
+
};
|
|
20720
|
+
}
|
|
20721
|
+
async exportSeamlessPrivateKey({ password, apiKey }) {
|
|
20722
|
+
const key = import_crypto_js.default.enc.Utf8.parse(charFill(password));
|
|
20723
|
+
const iv = getIvMapString();
|
|
20724
|
+
const decrypted = import_crypto_js.default.AES.decrypt(apiKey, key, {
|
|
20725
|
+
iv,
|
|
20726
|
+
mode: import_crypto_js.default.mode.CBC,
|
|
20727
|
+
padding: import_crypto_js.default.pad.Pkcs7
|
|
20728
|
+
});
|
|
20729
|
+
const privateKey = decrypted.toString(import_crypto_js.default.enc.Utf8);
|
|
20730
|
+
const wallet = new import_ethers27.ethers.Wallet(privateKey);
|
|
20731
|
+
if (wallet.address !== this.seamlessWallet?.address) {
|
|
20732
|
+
throw new MyxSDKError("INVALID_PRIVATE_KEY" /* InvalidPrivateKey */, "Invalid private key");
|
|
20733
|
+
}
|
|
20734
|
+
return {
|
|
20735
|
+
code: 0,
|
|
20736
|
+
data: {
|
|
20737
|
+
privateKey
|
|
20738
|
+
}
|
|
20739
|
+
};
|
|
20740
|
+
}
|
|
20741
|
+
async importSeamlessPrivateKey({ privateKey, password }) {
|
|
20742
|
+
const config = this.configManager.getConfig();
|
|
20743
|
+
if (!import_ethers27.ethers.isHexString(privateKey, 32)) {
|
|
20744
|
+
throw new MyxSDKError("INVALID_PRIVATE_KEY" /* InvalidPrivateKey */, "Invalid private key");
|
|
20745
|
+
}
|
|
20746
|
+
const wallet = new import_ethers27.ethers.Wallet(privateKey);
|
|
20747
|
+
const forwarderContract = await getForwarderContract(config.chainId);
|
|
20748
|
+
const masterAddress = await forwarderContract.originAccount(wallet.address);
|
|
20749
|
+
if (masterAddress === import_ethers27.ZeroAddress) {
|
|
20750
|
+
throw new MyxSDKError("INVALID_PRIVATE_KEY" /* InvalidPrivateKey */, "The private key is not a senseless account");
|
|
20751
|
+
}
|
|
20752
|
+
const isAuthorized = await this.onCheckRelayer(masterAddress, wallet.address);
|
|
20753
|
+
const key = import_crypto_js.default.enc.Utf8.parse(charFill(password));
|
|
20754
|
+
const iv = getIvMapString();
|
|
20755
|
+
const encrypted = import_crypto_js.default.AES.encrypt(privateKey, key, {
|
|
20756
|
+
iv,
|
|
20757
|
+
mode: import_crypto_js.default.mode.CBC,
|
|
20758
|
+
padding: import_crypto_js.default.pad.Pkcs7
|
|
20759
|
+
});
|
|
20760
|
+
const apiKey = encrypted.toString();
|
|
20761
|
+
this.seamlessWallet = wallet;
|
|
20762
|
+
this.seamlessWalletAuthorized = isAuthorized;
|
|
20763
|
+
this.seamlessWalletApikey = apiKey;
|
|
20764
|
+
return {
|
|
20765
|
+
code: 0,
|
|
20766
|
+
data: {
|
|
20767
|
+
masterAddress,
|
|
20768
|
+
seamlessAccount: wallet.address,
|
|
20769
|
+
authorized: isAuthorized,
|
|
20770
|
+
apiKey
|
|
20771
|
+
}
|
|
20772
|
+
};
|
|
20773
|
+
}
|
|
20774
|
+
async createSeamless({ password }) {
|
|
20775
|
+
const config = this.configManager.getConfig();
|
|
20776
|
+
const signer = config.signer;
|
|
20777
|
+
const account = await signer?.getAddress() ?? "";
|
|
20778
|
+
if (!signer) {
|
|
20779
|
+
throw new MyxSDKError("INVALID_SIGNER" /* InvalidSigner */, "Invalid signer");
|
|
20780
|
+
}
|
|
20781
|
+
try {
|
|
20782
|
+
const createAccountSignature = await signer.signMessage(`${account}_${password}`);
|
|
20783
|
+
const hashedSignature = await calculateSignature(createAccountSignature);
|
|
20784
|
+
const { privateKey, wallet } = generateEthWalletFromHashedSignature(hashedSignature);
|
|
20785
|
+
const key = import_crypto_js.default.enc.Utf8.parse(charFill(password));
|
|
20786
|
+
const iv = getIvMapString();
|
|
20787
|
+
const encrypted = import_crypto_js.default.AES.encrypt(privateKey, key, {
|
|
20788
|
+
iv,
|
|
20789
|
+
mode: import_crypto_js.default.mode.CBC,
|
|
20790
|
+
padding: import_crypto_js.default.pad.Pkcs7
|
|
20791
|
+
});
|
|
20792
|
+
const apiKey = encrypted.toString();
|
|
20793
|
+
const isAuthorized = await this.onCheckRelayer(account, wallet.address);
|
|
20794
|
+
this.seamlessWallet = wallet;
|
|
20795
|
+
this.seamlessWalletAuthorized = isAuthorized;
|
|
20796
|
+
this.seamlessWalletApikey = apiKey;
|
|
20797
|
+
return {
|
|
20798
|
+
code: 0,
|
|
20799
|
+
data: {
|
|
20800
|
+
masterAddress: account,
|
|
20801
|
+
seamlessAccount: wallet.address,
|
|
20802
|
+
authorized: isAuthorized,
|
|
20803
|
+
apiKey
|
|
20804
|
+
}
|
|
20805
|
+
};
|
|
20806
|
+
} catch (error) {
|
|
20807
|
+
return {
|
|
20808
|
+
code: -1,
|
|
20809
|
+
message: error.message
|
|
20810
|
+
};
|
|
20811
|
+
}
|
|
20812
|
+
}
|
|
20813
|
+
};
|
|
20814
|
+
|
|
19117
20815
|
// src/manager/index.ts
|
|
19118
20816
|
var MyxClient = class {
|
|
19119
20817
|
/**
|
|
@@ -19133,6 +20831,7 @@ var MyxClient = class {
|
|
|
19133
20831
|
this.position = new Position(this.configManager, this.logger, this.utils);
|
|
19134
20832
|
this.order = new Order(this.configManager, this.logger, this.utils, this.account);
|
|
19135
20833
|
this.subscription = new SubScription(this.configManager, this.logger);
|
|
20834
|
+
this.seamless = new Seamless(this.configManager, this.logger, this.utils, this.account);
|
|
19136
20835
|
const lp = MxSDK.getInstance();
|
|
19137
20836
|
lp.setConfigManager(this.configManager);
|
|
19138
20837
|
}
|
|
@@ -19166,6 +20865,7 @@ var MyxClient = class {
|
|
|
19166
20865
|
DirectionEnum,
|
|
19167
20866
|
ErrorCode,
|
|
19168
20867
|
ExecTypeEnum,
|
|
20868
|
+
ForwarderGetStatus,
|
|
19169
20869
|
HttpKlineIntervalEnum,
|
|
19170
20870
|
MarketCapType,
|
|
19171
20871
|
MarketPoolState,
|
|
@@ -19190,7 +20890,10 @@ var MyxClient = class {
|
|
|
19190
20890
|
bigintAmountSlipperCalculator,
|
|
19191
20891
|
bigintTradingGasPriceWithRatio,
|
|
19192
20892
|
bigintTradingGasToRatioCalculator,
|
|
20893
|
+
fetchForwarderGetApi,
|
|
19193
20894
|
formatUnits,
|
|
20895
|
+
forwardUrl,
|
|
20896
|
+
forwarderTxApi,
|
|
19194
20897
|
getAllTickers,
|
|
19195
20898
|
getAllowanceApproved,
|
|
19196
20899
|
getBalanceOf,
|