@toruslabs/ethereum-controllers 5.11.0 → 6.0.1
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/ethereumControllers.cjs.js +80 -431
- package/dist/ethereumControllers.esm.js +30 -349
- package/dist/ethereumControllers.umd.min.js +1 -1
- package/dist/ethereumControllers.umd.min.js.LICENSE.txt +7 -2
- package/dist/lib.cjs/Account/AccountTrackerController.js +160 -0
- package/dist/lib.cjs/Block/PollingBlockTracker.js +85 -0
- package/dist/lib.cjs/Currency/CurrencyController.js +111 -0
- package/dist/lib.cjs/Gas/GasFeeController.js +214 -0
- package/dist/lib.cjs/Gas/gasUtil.js +148 -0
- package/dist/lib.cjs/Keyring/KeyringController.js +93 -0
- package/dist/lib.cjs/Message/AbstractMessageController.js +107 -0
- package/dist/lib.cjs/Message/AddChainController.js +78 -0
- package/dist/lib.cjs/Message/MessageController.js +77 -0
- package/dist/lib.cjs/Message/PersonalMessageController.js +77 -0
- package/dist/lib.cjs/Message/SwitchChainController.js +78 -0
- package/dist/lib.cjs/Message/TypedMessageController.js +81 -0
- package/dist/lib.cjs/Message/utils.js +112 -0
- package/dist/lib.cjs/Network/NetworkController.js +201 -0
- package/dist/lib.cjs/Network/cacheIdentifier.js +112 -0
- package/dist/lib.cjs/Network/createEthereumMiddleware.js +302 -0
- package/dist/lib.cjs/Network/createJsonRpcClient.js +64 -0
- package/dist/lib.cjs/Nfts/NftHandler.js +180 -0
- package/dist/lib.cjs/Nfts/NftsController.js +213 -0
- package/dist/lib.cjs/Preferences/PreferencesController.js +476 -0
- package/dist/lib.cjs/Tokens/TokenHandler.js +51 -0
- package/dist/lib.cjs/Tokens/TokenRatesController.js +112 -0
- package/dist/lib.cjs/Tokens/TokensController.js +259 -0
- package/dist/lib.cjs/Transaction/NonceTracker.js +150 -0
- package/dist/lib.cjs/Transaction/PendingTransactionTracker.js +222 -0
- package/dist/lib.cjs/Transaction/TransactionController.js +515 -0
- package/dist/lib.cjs/Transaction/TransactionGasUtil.js +81 -0
- package/dist/lib.cjs/Transaction/TransactionStateHistoryHelper.js +42 -0
- package/dist/lib.cjs/Transaction/TransactionStateManager.js +296 -0
- package/dist/lib.cjs/Transaction/TransactionUtils.js +341 -0
- package/dist/lib.cjs/index.js +171 -0
- package/dist/lib.cjs/utils/abis.js +510 -0
- package/dist/lib.cjs/utils/constants.js +362 -0
- package/dist/lib.cjs/utils/contractAddresses.js +16 -0
- package/dist/lib.cjs/utils/conversionUtils.js +232 -0
- package/dist/lib.cjs/utils/helpers.js +244 -0
- package/dist/lib.cjs/utils/lodashUtils.js +25 -0
- package/dist/lib.esm/Account/AccountTrackerController.js +158 -0
- package/dist/lib.esm/Block/PollingBlockTracker.js +83 -0
- package/dist/lib.esm/Currency/CurrencyController.js +109 -0
- package/dist/lib.esm/Gas/GasFeeController.js +212 -0
- package/dist/lib.esm/Gas/gasUtil.js +141 -0
- package/dist/lib.esm/Keyring/KeyringController.js +91 -0
- package/dist/lib.esm/Message/AbstractMessageController.js +105 -0
- package/dist/lib.esm/Message/AddChainController.js +76 -0
- package/dist/lib.esm/Message/MessageController.js +75 -0
- package/dist/lib.esm/Message/PersonalMessageController.js +75 -0
- package/dist/lib.esm/Message/SwitchChainController.js +76 -0
- package/dist/lib.esm/Message/TypedMessageController.js +79 -0
- package/dist/lib.esm/Message/utils.js +105 -0
- package/dist/lib.esm/Network/NetworkController.js +199 -0
- package/dist/lib.esm/Network/cacheIdentifier.js +107 -0
- package/dist/lib.esm/Network/createEthereumMiddleware.js +289 -0
- package/dist/lib.esm/Network/createJsonRpcClient.js +60 -0
- package/dist/lib.esm/Nfts/NftHandler.js +178 -0
- package/dist/lib.esm/Nfts/NftsController.js +211 -0
- package/dist/lib.esm/Preferences/PreferencesController.js +474 -0
- package/dist/lib.esm/Tokens/TokenHandler.js +49 -0
- package/dist/lib.esm/Tokens/TokenRatesController.js +109 -0
- package/dist/lib.esm/Tokens/TokensController.js +257 -0
- package/dist/lib.esm/Transaction/NonceTracker.js +148 -0
- package/dist/lib.esm/Transaction/PendingTransactionTracker.js +220 -0
- package/dist/lib.esm/Transaction/TransactionController.js +513 -0
- package/dist/lib.esm/Transaction/TransactionGasUtil.js +79 -0
- package/dist/lib.esm/Transaction/TransactionStateHistoryHelper.js +38 -0
- package/dist/lib.esm/Transaction/TransactionStateManager.js +294 -0
- package/dist/lib.esm/Transaction/TransactionUtils.js +326 -0
- package/dist/lib.esm/index.js +33 -0
- package/dist/lib.esm/utils/abis.js +505 -0
- package/dist/lib.esm/utils/constants.js +323 -0
- package/dist/lib.esm/utils/contractAddresses.js +14 -0
- package/dist/lib.esm/utils/conversionUtils.js +218 -0
- package/dist/lib.esm/utils/helpers.js +227 -0
- package/dist/lib.esm/utils/lodashUtils.js +21 -0
- package/dist/types/Account/AccountTrackerController.d.ts +5 -5
- package/dist/types/Block/PollingBlockTracker.d.ts +1 -2
- package/dist/types/Currency/CurrencyController.d.ts +1 -1
- package/dist/types/Gas/GasFeeController.d.ts +3 -3
- package/dist/types/Gas/gasUtil.d.ts +1 -1
- package/dist/types/Keyring/KeyringController.d.ts +3 -5
- package/dist/types/Message/AbstractMessageController.d.ts +5 -6
- package/dist/types/Message/AddChainController.d.ts +4 -4
- package/dist/types/Message/MessageController.d.ts +4 -4
- package/dist/types/Message/PersonalMessageController.d.ts +4 -4
- package/dist/types/Message/SwitchChainController.d.ts +4 -4
- package/dist/types/Message/TypedMessageController.d.ts +6 -7
- package/dist/types/Message/utils.d.ts +2 -7
- package/dist/types/Network/NetworkController.d.ts +4 -4
- package/dist/types/Network/cacheIdentifier.d.ts +1 -1
- package/dist/types/Network/createEthereumMiddleware.d.ts +2 -18
- package/dist/types/Network/createJsonRpcClient.d.ts +2 -2
- package/dist/types/Nfts/NftsController.d.ts +2 -2
- package/dist/types/Preferences/PreferencesController.d.ts +4 -4
- package/dist/types/Tokens/TokensController.d.ts +3 -3
- package/dist/types/Transaction/NonceTracker.d.ts +5 -5
- package/dist/types/Transaction/PendingTransactionTracker.d.ts +5 -5
- package/dist/types/Transaction/TransactionController.d.ts +12 -12
- package/dist/types/Transaction/TransactionGasUtil.d.ts +4 -4
- package/dist/types/Transaction/TransactionStateManager.d.ts +3 -3
- package/dist/types/Transaction/TransactionUtils.d.ts +1 -1
- package/dist/types/index.d.ts +12 -14
- package/dist/types/utils/constants.d.ts +1 -5
- package/dist/types/utils/helpers.d.ts +4 -4
- package/dist/types/utils/interfaces.d.ts +43 -23
- package/package.json +10 -9
- package/dist/types/Message/DecryptMessageController.d.ts +0 -20
- package/dist/types/Message/EncryptionPublicKeyController.d.ts +0 -20
|
@@ -14,13 +14,6 @@ module.exports = require("@ethereumjs/common");
|
|
|
14
14
|
|
|
15
15
|
module.exports = require("@ethereumjs/tx");
|
|
16
16
|
|
|
17
|
-
/***/ }),
|
|
18
|
-
|
|
19
|
-
/***/ 731:
|
|
20
|
-
/***/ ((module) => {
|
|
21
|
-
|
|
22
|
-
module.exports = require("jsonschema");
|
|
23
|
-
|
|
24
17
|
/***/ })
|
|
25
18
|
|
|
26
19
|
/******/ });
|
|
@@ -131,7 +124,8 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
131
124
|
ARBITRUM_TESTNET_CHAIN_ID: () => (/* reexport */ ARBITRUM_TESTNET_CHAIN_ID),
|
|
132
125
|
AVALANCHE_MAINNET_CHAIN_ID: () => (/* reexport */ AVALANCHE_MAINNET_CHAIN_ID),
|
|
133
126
|
AVALANCHE_TESTNET_CHAIN_ID: () => (/* reexport */ AVALANCHE_TESTNET_CHAIN_ID),
|
|
134
|
-
|
|
127
|
+
AbstractMessageController: () => (/* reexport */ AbstractMessageController),
|
|
128
|
+
AccountTrackerController: () => (/* reexport */ AccountTrackerController),
|
|
135
129
|
AddChainController: () => (/* reexport */ AddChainController),
|
|
136
130
|
BASE_CHAIN_ID: () => (/* reexport */ BASE_CHAIN_ID),
|
|
137
131
|
BASE_TESTNET_CHAIN_ID: () => (/* reexport */ BASE_TESTNET_CHAIN_ID),
|
|
@@ -148,13 +142,11 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
148
142
|
CONTRACT_TYPE_ETH: () => (/* reexport */ CONTRACT_TYPE_ETH),
|
|
149
143
|
CurrencyController: () => (/* reexport */ CurrencyController),
|
|
150
144
|
DEFAULT_CURRENCY: () => (/* reexport */ DEFAULT_CURRENCY),
|
|
151
|
-
DecryptMessageController: () => (/* reexport */ DecryptMessageController),
|
|
152
145
|
ERC1155_INTERFACE_ID: () => (/* reexport */ ERC1155_INTERFACE_ID),
|
|
153
146
|
ERC721_ENUMERABLE_INTERFACE_ID: () => (/* reexport */ ERC721_ENUMERABLE_INTERFACE_ID),
|
|
154
147
|
ERC721_INTERFACE_ID: () => (/* reexport */ ERC721_INTERFACE_ID),
|
|
155
148
|
ERC721_METADATA_INTERFACE_ID: () => (/* reexport */ ERC721_METADATA_INTERFACE_ID),
|
|
156
149
|
ETHERSCAN_SUPPORTED_CHAINS: () => (/* reexport */ ETHERSCAN_SUPPORTED_CHAINS),
|
|
157
|
-
EncryptionPublicKeyController: () => (/* reexport */ EncryptionPublicKeyController),
|
|
158
150
|
GAS_ESTIMATE_TYPES: () => (/* reexport */ GAS_ESTIMATE_TYPES),
|
|
159
151
|
GAS_LIMITS: () => (/* reexport */ GAS_LIMITS),
|
|
160
152
|
GasFeeController: () => (/* reexport */ GasFeeController),
|
|
@@ -168,7 +160,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
168
160
|
NetworkController: () => (/* reexport */ NetworkController),
|
|
169
161
|
NftHandler: () => (/* reexport */ NftHandler),
|
|
170
162
|
NftsController: () => (/* reexport */ NftsController),
|
|
171
|
-
NonceTracker: () => (/* reexport */
|
|
163
|
+
NonceTracker: () => (/* reexport */ NonceTracker),
|
|
172
164
|
OLD_ERC721_LIST: () => (/* reexport */ OLD_ERC721_LIST),
|
|
173
165
|
OPTIMISM_MAINNET_CHAIN_ID: () => (/* reexport */ OPTIMISM_MAINNET_CHAIN_ID),
|
|
174
166
|
OPTIMISM_TESTNET_CHAIN_ID: () => (/* reexport */ OPTIMISM_TESTNET_CHAIN_ID),
|
|
@@ -176,7 +168,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
176
168
|
POLYGON_CHAIN_ID: () => (/* reexport */ POLYGON_CHAIN_ID),
|
|
177
169
|
PendingTransactionTracker: () => (/* reexport */ PendingTransactionTracker),
|
|
178
170
|
PersonalMessageController: () => (/* reexport */ PersonalMessageController),
|
|
179
|
-
PollingBlockTracker: () => (/* reexport */
|
|
171
|
+
PollingBlockTracker: () => (/* reexport */ PollingBlockTracker),
|
|
180
172
|
PreferencesController: () => (/* reexport */ PreferencesController),
|
|
181
173
|
SEPOLIA_CHAIN_ID: () => (/* reexport */ SEPOLIA_CHAIN_ID),
|
|
182
174
|
SIMPLEHASH_SUPPORTED_CHAINS: () => (/* reexport */ SIMPLEHASH_SUPPORTED_CHAINS),
|
|
@@ -208,14 +200,10 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
208
200
|
createPendingNonceMiddleware: () => (/* reexport */ createPendingNonceMiddleware),
|
|
209
201
|
createPendingTxMiddleware: () => (/* reexport */ createPendingTxMiddleware),
|
|
210
202
|
createProcessAddEthereumChain: () => (/* reexport */ createProcessAddEthereumChain),
|
|
211
|
-
createProcessDecryptMessageMiddleware: () => (/* reexport */ createProcessDecryptMessageMiddleware),
|
|
212
|
-
createProcessEncryptionPublicKeyMiddleware: () => (/* reexport */ createProcessEncryptionPublicKeyMiddleware),
|
|
213
203
|
createProcessEthSignMessage: () => (/* reexport */ createProcessEthSignMessage),
|
|
214
204
|
createProcessPersonalMessage: () => (/* reexport */ createProcessPersonalMessage),
|
|
215
205
|
createProcessSwitchEthereumChain: () => (/* reexport */ createProcessSwitchEthereumChain),
|
|
216
206
|
createProcessTransactionMiddleware: () => (/* reexport */ createProcessTransactionMiddleware),
|
|
217
|
-
createProcessTypedMessage: () => (/* reexport */ createProcessTypedMessage),
|
|
218
|
-
createProcessTypedMessageV3: () => (/* reexport */ createProcessTypedMessageV3),
|
|
219
207
|
createProcessTypedMessageV4: () => (/* reexport */ createProcessTypedMessageV4),
|
|
220
208
|
createProviderConfigMiddleware: () => (/* reexport */ createProviderConfigMiddleware),
|
|
221
209
|
createRequestAccountsMiddleware: () => (/* reexport */ createRequestAccountsMiddleware),
|
|
@@ -247,7 +235,6 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
247
235
|
normalizeAndValidateTxParams: () => (/* reexport */ normalizeAndValidateTxParams),
|
|
248
236
|
normalizeMessageData: () => (/* reexport */ normalizeMessageData),
|
|
249
237
|
normalizeTxParameters: () => (/* reexport */ normalizeTxParameters),
|
|
250
|
-
parseDecryptMessageData: () => (/* reexport */ parseDecryptMessageData),
|
|
251
238
|
parseStandardTokenTransactionData: () => (/* reexport */ parseStandardTokenTransactionData),
|
|
252
239
|
readAddressAsContract: () => (/* reexport */ readAddressAsContract),
|
|
253
240
|
replayHistory: () => (/* reexport */ replayHistory),
|
|
@@ -260,15 +247,12 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
260
247
|
transactionMatchesNetwork: () => (/* reexport */ transactionMatchesNetwork),
|
|
261
248
|
validateAddChainData: () => (/* reexport */ validateAddChainData),
|
|
262
249
|
validateAddress: () => (/* reexport */ validateAddress),
|
|
263
|
-
validateDecryptedMessageData: () => (/* reexport */ validateDecryptedMessageData),
|
|
264
|
-
validateEncryptionPublicKeyMessageData: () => (/* reexport */ validateEncryptionPublicKeyMessageData),
|
|
265
250
|
validateFrom: () => (/* reexport */ validateFrom),
|
|
266
251
|
validateRecipient: () => (/* reexport */ validateRecipient),
|
|
267
252
|
validateSignMessageData: () => (/* reexport */ validateSignMessageData),
|
|
268
253
|
validateSwitchChainData: () => (/* reexport */ validateSwitchChainData),
|
|
269
254
|
validateTxParameters: () => (/* reexport */ validateTxParameters),
|
|
270
|
-
|
|
271
|
-
validateTypedSignMessageDataV3V4: () => (/* reexport */ validateTypedSignMessageDataV3V4)
|
|
255
|
+
validateTypedSignMessageDataV4: () => (/* reexport */ validateTypedSignMessageDataV4)
|
|
272
256
|
});
|
|
273
257
|
|
|
274
258
|
;// CONCATENATED MODULE: external "@babel/runtime/helpers/objectSpread2"
|
|
@@ -1009,14 +993,10 @@ const METHOD_TYPES = {
|
|
|
1009
993
|
ETH_REQUEST_ACCOUNTS: "eth_requestAccounts",
|
|
1010
994
|
ETH_SEND_RAW_TRANSACTION: "eth_sendRawTransaction",
|
|
1011
995
|
ETH_SIGN: "eth_sign",
|
|
1012
|
-
ETH_SIGN_TYPED_DATA: "eth_signTypedData",
|
|
1013
|
-
ETH_SIGN_TYPED_DATA_V3: "eth_signTypedData_v3",
|
|
1014
996
|
ETH_SIGN_TYPED_DATA_V4: "eth_signTypedData_v4",
|
|
1015
997
|
PERSONAL_SIGN: "personal_sign",
|
|
1016
998
|
ETH_GET_TRANSACTION_COUNT: "eth_getTransactionCount",
|
|
1017
999
|
ETH_GET_TRANSACTION_BY_HASH: "eth_getTransactionByHash",
|
|
1018
|
-
ETH_GET_ENCRYPTION_PUBLIC_KEY: "eth_getEncryptionPublicKey",
|
|
1019
|
-
ETH_DECRYPT: "eth_decrypt",
|
|
1020
1000
|
ETH_GET_TRANSACTION_RECEIPT: "eth_getTransactionReceipt",
|
|
1021
1001
|
WATCH_ASSET: "wallet_watchAsset",
|
|
1022
1002
|
ETH_GET_BLOCK_BY_HASH: "eth_getBlockByHash",
|
|
@@ -1283,14 +1263,13 @@ class AccountTrackerController extends base_controllers_namespaceObject.BaseCont
|
|
|
1283
1263
|
}
|
|
1284
1264
|
}
|
|
1285
1265
|
}
|
|
1286
|
-
/* harmony default export */ const Account_AccountTrackerController = (AccountTrackerController);
|
|
1287
1266
|
;// CONCATENATED MODULE: external "@ethereumjs/util"
|
|
1288
1267
|
const util_namespaceObject = require("@ethereumjs/util");
|
|
1289
1268
|
;// CONCATENATED MODULE: external "bignumber.js"
|
|
1290
1269
|
const external_bignumber_js_namespaceObject = require("bignumber.js");
|
|
1291
1270
|
var external_bignumber_js_default = /*#__PURE__*/__webpack_require__.n(external_bignumber_js_namespaceObject);
|
|
1292
|
-
;// CONCATENATED MODULE: external "@
|
|
1293
|
-
const
|
|
1271
|
+
;// CONCATENATED MODULE: external "@web3auth/auth"
|
|
1272
|
+
const auth_namespaceObject = require("@web3auth/auth");
|
|
1294
1273
|
;// CONCATENATED MODULE: ./src/Transaction/TransactionUtils.ts
|
|
1295
1274
|
|
|
1296
1275
|
|
|
@@ -1373,7 +1352,7 @@ function isLegacyTransaction(transaction) {
|
|
|
1373
1352
|
*/
|
|
1374
1353
|
function ensureMutuallyExclusiveFieldsNotProvided(txParams, fieldBeingValidated, mutuallyExclusiveField) {
|
|
1375
1354
|
if (typeof txParams[mutuallyExclusiveField] !== "undefined") {
|
|
1376
|
-
throw
|
|
1355
|
+
throw auth_namespaceObject.rpcErrors.invalidParams(`Invalid transaction params: specified ${fieldBeingValidated} but also included ${mutuallyExclusiveField}, these cannot be mixed`);
|
|
1377
1356
|
}
|
|
1378
1357
|
}
|
|
1379
1358
|
|
|
@@ -1383,7 +1362,7 @@ function ensureMutuallyExclusiveFieldsNotProvided(txParams, fieldBeingValidated,
|
|
|
1383
1362
|
*/
|
|
1384
1363
|
function ensureFieldIsString(txParams, field) {
|
|
1385
1364
|
if (typeof txParams[field] !== "string") {
|
|
1386
|
-
throw
|
|
1365
|
+
throw auth_namespaceObject.rpcErrors.invalidParams(`Invalid transaction params: ${field} is not a string. got: (${txParams[field]})`);
|
|
1387
1366
|
}
|
|
1388
1367
|
}
|
|
1389
1368
|
|
|
@@ -1397,13 +1376,13 @@ function ensureProperTransactionEnvelopeTypeProvided(txParams, field) {
|
|
|
1397
1376
|
case "maxFeePerGas":
|
|
1398
1377
|
case "maxPriorityFeePerGas":
|
|
1399
1378
|
if (txParams.type && txParams.type !== TRANSACTION_ENVELOPE_TYPES.FEE_MARKET) {
|
|
1400
|
-
throw
|
|
1379
|
+
throw auth_namespaceObject.rpcErrors.invalidParams(`Invalid transaction envelope type: specified type "${txParams.type}" but ` + `including maxFeePerGas and maxPriorityFeePerGas requires type: "${TRANSACTION_ENVELOPE_TYPES.FEE_MARKET}"`);
|
|
1401
1380
|
}
|
|
1402
1381
|
break;
|
|
1403
1382
|
case "gasPrice":
|
|
1404
1383
|
default:
|
|
1405
1384
|
if (txParams.type && txParams.type === TRANSACTION_ENVELOPE_TYPES.FEE_MARKET) {
|
|
1406
|
-
throw
|
|
1385
|
+
throw auth_namespaceObject.rpcErrors.invalidParams(`Invalid transaction envelope type: specified type "${txParams.type}" but ` + "included a gasPrice instead of maxFeePerGas and maxPriorityFeePerGas");
|
|
1407
1386
|
}
|
|
1408
1387
|
}
|
|
1409
1388
|
}
|
|
@@ -1413,10 +1392,10 @@ function ensureProperTransactionEnvelopeTypeProvided(txParams, field) {
|
|
|
1413
1392
|
*/
|
|
1414
1393
|
function validateFrom(txParams) {
|
|
1415
1394
|
if (!(typeof txParams.from === "string")) {
|
|
1416
|
-
throw
|
|
1395
|
+
throw auth_namespaceObject.rpcErrors.invalidParams(`Invalid "from" address "${txParams.from}": not a string.`);
|
|
1417
1396
|
}
|
|
1418
1397
|
if (!(0,util_namespaceObject.isValidAddress)(txParams.from)) {
|
|
1419
|
-
throw
|
|
1398
|
+
throw auth_namespaceObject.rpcErrors.invalidParams('Invalid "from" address.');
|
|
1420
1399
|
}
|
|
1421
1400
|
}
|
|
1422
1401
|
|
|
@@ -1428,10 +1407,10 @@ function validateRecipient(txParameters) {
|
|
|
1428
1407
|
if (txParameters.data) {
|
|
1429
1408
|
delete txParameters.to;
|
|
1430
1409
|
} else {
|
|
1431
|
-
throw
|
|
1410
|
+
throw auth_namespaceObject.rpcErrors.invalidParams('Invalid "to" address.');
|
|
1432
1411
|
}
|
|
1433
1412
|
} else if (txParameters.to !== undefined && !(0,util_namespaceObject.isValidAddress)(txParameters.to)) {
|
|
1434
|
-
throw
|
|
1413
|
+
throw auth_namespaceObject.rpcErrors.invalidParams('Invalid "to" address.');
|
|
1435
1414
|
}
|
|
1436
1415
|
return txParameters;
|
|
1437
1416
|
}
|
|
@@ -1442,15 +1421,15 @@ function validateRecipient(txParameters) {
|
|
|
1442
1421
|
*/
|
|
1443
1422
|
function validateTxParameters(txParams, eip1559Compatibility = true) {
|
|
1444
1423
|
if (!txParams || typeof txParams !== "object" || Array.isArray(txParams)) {
|
|
1445
|
-
throw
|
|
1424
|
+
throw auth_namespaceObject.rpcErrors.invalidParams("Invalid transaction params: must be an object.");
|
|
1446
1425
|
}
|
|
1447
1426
|
if (!txParams.to && !txParams.data) {
|
|
1448
|
-
throw
|
|
1427
|
+
throw auth_namespaceObject.rpcErrors.invalidParams('Invalid transaction params: must specify "data" for contract deployments, or "to" (and optionally "data") for all other types of transactions.');
|
|
1449
1428
|
}
|
|
1450
1429
|
if (isEIP1559Transaction({
|
|
1451
1430
|
transaction: txParams
|
|
1452
1431
|
}) && !eip1559Compatibility) {
|
|
1453
|
-
throw
|
|
1432
|
+
throw auth_namespaceObject.rpcErrors.invalidParams("Invalid transaction params: params specify an EIP-1559 transaction but the current network does not support EIP-1559");
|
|
1454
1433
|
}
|
|
1455
1434
|
Object.entries(txParams).forEach(([key, value]) => {
|
|
1456
1435
|
// validate types
|
|
@@ -1480,15 +1459,15 @@ function validateTxParameters(txParams, eip1559Compatibility = true) {
|
|
|
1480
1459
|
case "value":
|
|
1481
1460
|
ensureFieldIsString(txParams, "value");
|
|
1482
1461
|
if (value.toString().includes("-")) {
|
|
1483
|
-
throw
|
|
1462
|
+
throw auth_namespaceObject.rpcErrors.invalidParams(`Invalid transaction value "${value}": not a positive number.`);
|
|
1484
1463
|
}
|
|
1485
1464
|
if (value.toString().includes(".")) {
|
|
1486
|
-
throw
|
|
1465
|
+
throw auth_namespaceObject.rpcErrors.invalidParams(`Invalid transaction value of "${value}": number must be in wei.`);
|
|
1487
1466
|
}
|
|
1488
1467
|
break;
|
|
1489
1468
|
case "chainId":
|
|
1490
1469
|
if (typeof value !== "number" && typeof value !== "string") {
|
|
1491
|
-
throw
|
|
1470
|
+
throw auth_namespaceObject.rpcErrors.invalidParams(`Invalid transaction params: ${key} is not a Number or hex string. got: (${value})`);
|
|
1492
1471
|
}
|
|
1493
1472
|
break;
|
|
1494
1473
|
default:
|
|
@@ -1921,7 +1900,6 @@ class PollingBlockTracker extends base_controllers_namespaceObject.BaseBlockTrac
|
|
|
1921
1900
|
}
|
|
1922
1901
|
}
|
|
1923
1902
|
}
|
|
1924
|
-
/* harmony default export */ const Block_PollingBlockTracker = (PollingBlockTracker);
|
|
1925
1903
|
;// CONCATENATED MODULE: external "@toruslabs/http-helpers"
|
|
1926
1904
|
const http_helpers_namespaceObject = require("@toruslabs/http-helpers");
|
|
1927
1905
|
;// CONCATENATED MODULE: ./src/Currency/CurrencyController.ts
|
|
@@ -2630,8 +2608,6 @@ class GasFeeController extends base_controllers_namespaceObject.BaseController {
|
|
|
2630
2608
|
return calculateTimeEstimate(maxPriorityFeePerGas, maxFeePerGas, this.state.gasFeeEstimates);
|
|
2631
2609
|
}
|
|
2632
2610
|
}
|
|
2633
|
-
;// CONCATENATED MODULE: external "@metamask/eth-sig-util"
|
|
2634
|
-
const eth_sig_util_namespaceObject = require("@metamask/eth-sig-util");
|
|
2635
2611
|
;// CONCATENATED MODULE: ./src/Keyring/KeyringController.ts
|
|
2636
2612
|
|
|
2637
2613
|
|
|
@@ -2697,41 +2673,22 @@ class KeyringController extends base_controllers_namespaceObject.BaseKeyringCont
|
|
|
2697
2673
|
const wallet = this._getWalletForAccount(address);
|
|
2698
2674
|
const privKey = this.getBufferPrivateKey(wallet.privateKey);
|
|
2699
2675
|
const messageSig = (0,util_namespaceObject.ecsign)(Buffer.from((0,util_namespaceObject.stripHexPrefix)(data), "hex"), privKey);
|
|
2700
|
-
const sig = (0,
|
|
2676
|
+
const sig = (0,base_controllers_namespaceObject.concatSig)(Buffer.from((0,util_namespaceObject.bigIntToBytes)(messageSig.v)), Buffer.from(messageSig.r), Buffer.from(messageSig.s));
|
|
2701
2677
|
return sig;
|
|
2702
2678
|
}
|
|
2703
|
-
|
|
2704
|
-
// For personal_sign, we need to prefix the message: ensure input is hashed and not buffer of utf-8
|
|
2705
2679
|
async signPersonalMessage(data, address) {
|
|
2706
2680
|
const wallet = this._getWalletForAccount(address);
|
|
2707
|
-
const privKey =
|
|
2708
|
-
const
|
|
2709
|
-
|
|
2710
|
-
data
|
|
2711
|
-
});
|
|
2712
|
-
return sig;
|
|
2681
|
+
const privKey = new external_ethers_namespaceObject.SigningKey((0,util_namespaceObject.addHexPrefix)(wallet.privateKey));
|
|
2682
|
+
const signature = privKey.sign((0,external_ethers_namespaceObject.hashMessage)(data)).serialized;
|
|
2683
|
+
return signature;
|
|
2713
2684
|
}
|
|
2714
2685
|
|
|
2715
2686
|
// personal_signTypedData, signs data along with the schema
|
|
2716
|
-
async signTypedData(typedData, address
|
|
2717
|
-
const wallet = this._getWalletForAccount(address);
|
|
2718
|
-
const privKey = this.getBufferPrivateKey(wallet.privateKey);
|
|
2719
|
-
return (0,eth_sig_util_namespaceObject.signTypedData)({
|
|
2720
|
-
privateKey: privKey,
|
|
2721
|
-
data: typedData,
|
|
2722
|
-
version
|
|
2723
|
-
});
|
|
2724
|
-
}
|
|
2725
|
-
signEncryptionPublicKey(address) {
|
|
2726
|
-
const wallet = this._getWalletForAccount(address);
|
|
2727
|
-
return (0,eth_sig_util_namespaceObject.getEncryptionPublicKey)((0,util_namespaceObject.stripHexPrefix)(wallet.privateKey));
|
|
2728
|
-
}
|
|
2729
|
-
decryptMessage(data, address) {
|
|
2687
|
+
async signTypedData(typedData, address) {
|
|
2730
2688
|
const wallet = this._getWalletForAccount(address);
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
});
|
|
2689
|
+
const privKey = new external_ethers_namespaceObject.SigningKey((0,util_namespaceObject.addHexPrefix)(wallet.privateKey));
|
|
2690
|
+
const signature = privKey.sign(external_ethers_namespaceObject.TypedDataEncoder.hash(typedData.domain, typedData.types, typedData.message)).serialized;
|
|
2691
|
+
return signature;
|
|
2735
2692
|
}
|
|
2736
2693
|
_getWalletForAccount(account) {
|
|
2737
2694
|
const address = account.toLowerCase();
|
|
@@ -2814,15 +2771,15 @@ class AbstractMessageController extends base_controllers_namespaceObject.BaseCon
|
|
|
2814
2771
|
return new Promise((resolve, reject) => {
|
|
2815
2772
|
const handleFinished = msg => {
|
|
2816
2773
|
if (msg.status === MessageStatus.REJECTED) {
|
|
2817
|
-
return reject(
|
|
2774
|
+
return reject(auth_namespaceObject.providerErrors.userRejectedRequest(`${messageName} Signature: User denied message signature`));
|
|
2818
2775
|
}
|
|
2819
2776
|
if (msg.status === MessageStatus.FAILED) {
|
|
2820
|
-
return reject(
|
|
2777
|
+
return reject(auth_namespaceObject.rpcErrors.internal(`${messageName} Signature: failed to sign message ${msg.error}`));
|
|
2821
2778
|
}
|
|
2822
2779
|
if (msg.status === MessageStatus.SIGNED) {
|
|
2823
2780
|
return resolve(msg.rawSig);
|
|
2824
2781
|
}
|
|
2825
|
-
return reject(
|
|
2782
|
+
return reject(auth_namespaceObject.rpcErrors.internal(`${messageName} Signature: Unknown problem: ${JSON.stringify(msgParams)}`));
|
|
2826
2783
|
};
|
|
2827
2784
|
this.once(`${msgParams.id}:finished`, handleFinished);
|
|
2828
2785
|
});
|
|
@@ -2846,7 +2803,6 @@ class AbstractMessageController extends base_controllers_namespaceObject.BaseCon
|
|
|
2846
2803
|
;// CONCATENATED MODULE: ./src/Message/utils.ts
|
|
2847
2804
|
|
|
2848
2805
|
|
|
2849
|
-
|
|
2850
2806
|
const hexRe = /^[0-9A-Fa-f]+$/gu;
|
|
2851
2807
|
function validateAddress(address, propertyName) {
|
|
2852
2808
|
if (!address || typeof address !== "string" || !(0,util_namespaceObject.isValidAddress)(address)) {
|
|
@@ -2872,19 +2828,7 @@ function normalizeMessageData(data) {
|
|
|
2872
2828
|
} catch (e) {}
|
|
2873
2829
|
return (0,util_namespaceObject.bytesToHex)(Buffer.from(data, "utf8"));
|
|
2874
2830
|
}
|
|
2875
|
-
function
|
|
2876
|
-
validateAddress(messageData.from, "from");
|
|
2877
|
-
if (!messageData.data || !Array.isArray(messageData.data)) {
|
|
2878
|
-
throw new Error(`Invalid message "data": ${messageData.data} must be a valid array.`);
|
|
2879
|
-
}
|
|
2880
|
-
try {
|
|
2881
|
-
// typedSignatureHash will throw if the data is invalid.
|
|
2882
|
-
(0,eth_sig_util_namespaceObject.typedSignatureHash)(messageData.data);
|
|
2883
|
-
} catch (e) {
|
|
2884
|
-
throw new Error(`Expected EIP712 typed data.`);
|
|
2885
|
-
}
|
|
2886
|
-
}
|
|
2887
|
-
async function validateTypedSignMessageDataV3V4(messageData, currentChainId) {
|
|
2831
|
+
async function validateTypedSignMessageDataV4(messageData, currentChainId) {
|
|
2888
2832
|
validateAddress(messageData.from, "from");
|
|
2889
2833
|
if (!messageData.data || Array.isArray(messageData.data) || typeof messageData.data !== "object" && typeof messageData.data !== "string") {
|
|
2890
2834
|
throw new Error(`Invalid message "data": Must be a valid string or object.`);
|
|
@@ -2899,13 +2843,6 @@ async function validateTypedSignMessageDataV3V4(messageData, currentChainId) {
|
|
|
2899
2843
|
throw new Error("Data must be passed as a valid JSON string.");
|
|
2900
2844
|
}
|
|
2901
2845
|
}
|
|
2902
|
-
const {
|
|
2903
|
-
validate
|
|
2904
|
-
} = await Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 731, 23));
|
|
2905
|
-
const validation = validate(data, eth_sig_util_namespaceObject.TYPED_MESSAGE_SCHEMA);
|
|
2906
|
-
if (validation.errors.length > 0) {
|
|
2907
|
-
throw new Error("Data must conform to EIP-712 schema. See https://git.io/fNtcx.");
|
|
2908
|
-
}
|
|
2909
2846
|
if (!currentChainId) {
|
|
2910
2847
|
throw new Error("Current chainId cannot be null or undefined.");
|
|
2911
2848
|
}
|
|
@@ -2925,23 +2862,6 @@ async function validateTypedSignMessageDataV3V4(messageData, currentChainId) {
|
|
|
2925
2862
|
}
|
|
2926
2863
|
}
|
|
2927
2864
|
}
|
|
2928
|
-
function validateEncryptionPublicKeyMessageData(messageData) {
|
|
2929
|
-
const {
|
|
2930
|
-
from
|
|
2931
|
-
} = messageData;
|
|
2932
|
-
validateAddress(from, "from");
|
|
2933
|
-
}
|
|
2934
|
-
function validateDecryptedMessageData(messageData) {
|
|
2935
|
-
const {
|
|
2936
|
-
from
|
|
2937
|
-
} = messageData;
|
|
2938
|
-
validateAddress(from, "from");
|
|
2939
|
-
}
|
|
2940
|
-
function parseDecryptMessageData(data) {
|
|
2941
|
-
const stripped = (0,util_namespaceObject.stripHexPrefix)(data);
|
|
2942
|
-
const buffer = Buffer.from(stripped, "hex");
|
|
2943
|
-
return JSON.parse(buffer.toString("utf8"));
|
|
2944
|
-
}
|
|
2945
2865
|
async function validateAddChainData(data) {
|
|
2946
2866
|
const {
|
|
2947
2867
|
chainId,
|
|
@@ -3057,157 +2977,6 @@ class AddChainController extends AbstractMessageController {
|
|
|
3057
2977
|
return Promise.resolve(messageParams);
|
|
3058
2978
|
}
|
|
3059
2979
|
}
|
|
3060
|
-
;// CONCATENATED MODULE: ./src/Message/DecryptMessageController.ts
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
// import { isValidAddress } from "@ethereumjs/util";
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
class DecryptMessageController extends AbstractMessageController {
|
|
3070
|
-
constructor({
|
|
3071
|
-
config,
|
|
3072
|
-
state,
|
|
3073
|
-
decryptMessage,
|
|
3074
|
-
getNetworkIdentifier
|
|
3075
|
-
}) {
|
|
3076
|
-
super({
|
|
3077
|
-
config,
|
|
3078
|
-
state,
|
|
3079
|
-
getNetworkIdentifier
|
|
3080
|
-
});
|
|
3081
|
-
defineProperty_default()(this, "name", "DecryptMessageController");
|
|
3082
|
-
defineProperty_default()(this, "decryptMessage", void 0);
|
|
3083
|
-
this.decryptMessage = decryptMessage;
|
|
3084
|
-
this.initialize();
|
|
3085
|
-
}
|
|
3086
|
-
async processDecryptMessage(messageId) {
|
|
3087
|
-
const msgObject = this.getMessage(messageId);
|
|
3088
|
-
if (!msgObject) {
|
|
3089
|
-
throw new Error("Message not found");
|
|
3090
|
-
}
|
|
3091
|
-
try {
|
|
3092
|
-
const cleanMsgParams = await this.approveMessage(messageId, msgObject.messageParams);
|
|
3093
|
-
const parsedData = parseDecryptMessageData(cleanMsgParams.data);
|
|
3094
|
-
const rawSig = this.decryptMessage(parsedData, cleanMsgParams.from);
|
|
3095
|
-
this.updateMessage(objectSpread2_default()(objectSpread2_default()({}, msgObject), {}, {
|
|
3096
|
-
rawSig
|
|
3097
|
-
}));
|
|
3098
|
-
this.setMessageStatus(messageId, MessageStatus.SIGNED);
|
|
3099
|
-
return rawSig;
|
|
3100
|
-
} catch (error) {
|
|
3101
|
-
external_loglevel_default().error(error);
|
|
3102
|
-
msgObject.error = (error === null || error === void 0 ? void 0 : error.message) || (error === null || error === void 0 ? void 0 : error.toString());
|
|
3103
|
-
this.setMessageStatus(messageId, MessageStatus.FAILED);
|
|
3104
|
-
}
|
|
3105
|
-
}
|
|
3106
|
-
async addNewUnapprovedMessage(messageParams, req) {
|
|
3107
|
-
await this.addUnapprovedMessage(messageParams, req);
|
|
3108
|
-
return this.waitForFinishStatus(messageParams, this.name);
|
|
3109
|
-
}
|
|
3110
|
-
async addUnapprovedMessage(messageParams, req) {
|
|
3111
|
-
validateDecryptedMessageData(messageParams);
|
|
3112
|
-
if (req) {
|
|
3113
|
-
messageParams.origin = req.origin;
|
|
3114
|
-
}
|
|
3115
|
-
messageParams.data = normalizeMessageData(messageParams.data);
|
|
3116
|
-
const messageId = messageParams.id || (0,base_controllers_namespaceObject.randomId)();
|
|
3117
|
-
const messageData = {
|
|
3118
|
-
id: messageId,
|
|
3119
|
-
messageParams,
|
|
3120
|
-
status: MessageStatus.UNAPPROVED,
|
|
3121
|
-
time: Date.now(),
|
|
3122
|
-
type: METHOD_TYPES.ETH_DECRYPT
|
|
3123
|
-
};
|
|
3124
|
-
await this.addMessage(messageData);
|
|
3125
|
-
this.emit(MESSAGE_EVENTS.UNAPPROVED_MESSAGE, {
|
|
3126
|
-
messageData,
|
|
3127
|
-
req
|
|
3128
|
-
});
|
|
3129
|
-
return messageId;
|
|
3130
|
-
}
|
|
3131
|
-
prepMessageForSigning(messageParams) {
|
|
3132
|
-
return Promise.resolve(objectSpread2_default()({}, messageParams));
|
|
3133
|
-
}
|
|
3134
|
-
}
|
|
3135
|
-
;// CONCATENATED MODULE: ./src/Message/EncryptionPublicKeyController.ts
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
// import { isValidAddress } from "@ethereumjs/util";
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
class EncryptionPublicKeyController extends AbstractMessageController {
|
|
3145
|
-
constructor({
|
|
3146
|
-
config,
|
|
3147
|
-
state,
|
|
3148
|
-
signEncryptionPublicKey,
|
|
3149
|
-
getNetworkIdentifier
|
|
3150
|
-
}) {
|
|
3151
|
-
super({
|
|
3152
|
-
config,
|
|
3153
|
-
state,
|
|
3154
|
-
getNetworkIdentifier
|
|
3155
|
-
});
|
|
3156
|
-
defineProperty_default()(this, "name", "EncryptionPublicKeyController");
|
|
3157
|
-
defineProperty_default()(this, "signEncryptionPublicKey", void 0);
|
|
3158
|
-
this.signEncryptionPublicKey = signEncryptionPublicKey;
|
|
3159
|
-
this.initialize();
|
|
3160
|
-
}
|
|
3161
|
-
async processGetEncryptionPublicKey(messageId) {
|
|
3162
|
-
const msgObject = this.getMessage(messageId);
|
|
3163
|
-
if (!msgObject) {
|
|
3164
|
-
throw new Error(`Message not found`);
|
|
3165
|
-
}
|
|
3166
|
-
try {
|
|
3167
|
-
const cleanMsgParams = await this.approveMessage(messageId, msgObject.messageParams);
|
|
3168
|
-
const publicKey = this.signEncryptionPublicKey(cleanMsgParams.from);
|
|
3169
|
-
this.updateMessage(objectSpread2_default()(objectSpread2_default()({}, msgObject), {}, {
|
|
3170
|
-
rawSig: publicKey
|
|
3171
|
-
}));
|
|
3172
|
-
this.setMessageStatus(messageId, MessageStatus.SIGNED);
|
|
3173
|
-
return publicKey;
|
|
3174
|
-
} catch (error) {
|
|
3175
|
-
external_loglevel_default().error(error);
|
|
3176
|
-
msgObject.error = (error === null || error === void 0 ? void 0 : error.message) || (error === null || error === void 0 ? void 0 : error.toString());
|
|
3177
|
-
this.setMessageStatus(messageId, MessageStatus.FAILED);
|
|
3178
|
-
}
|
|
3179
|
-
}
|
|
3180
|
-
async addNewUnapprovedMessage(messageParams, req) {
|
|
3181
|
-
await this.addUnapprovedMessage(messageParams, req);
|
|
3182
|
-
return this.waitForFinishStatus(messageParams, this.name);
|
|
3183
|
-
}
|
|
3184
|
-
async addUnapprovedMessage(messageParams, req) {
|
|
3185
|
-
validateEncryptionPublicKeyMessageData(messageParams);
|
|
3186
|
-
if (req) {
|
|
3187
|
-
messageParams.origin = req.origin;
|
|
3188
|
-
}
|
|
3189
|
-
const messageId = messageParams.id || (0,base_controllers_namespaceObject.randomId)();
|
|
3190
|
-
const messageData = {
|
|
3191
|
-
id: messageId,
|
|
3192
|
-
messageParams,
|
|
3193
|
-
status: MessageStatus.UNAPPROVED,
|
|
3194
|
-
time: Date.now(),
|
|
3195
|
-
type: METHOD_TYPES.ETH_GET_ENCRYPTION_PUBLIC_KEY
|
|
3196
|
-
};
|
|
3197
|
-
await this.addMessage(messageData);
|
|
3198
|
-
this.emit(MESSAGE_EVENTS.UNAPPROVED_MESSAGE, {
|
|
3199
|
-
messageData,
|
|
3200
|
-
req
|
|
3201
|
-
});
|
|
3202
|
-
return messageId;
|
|
3203
|
-
}
|
|
3204
|
-
prepMessageForSigning(messageParams) {
|
|
3205
|
-
// From should be the public key for the encryption
|
|
3206
|
-
return Promise.resolve(objectSpread2_default()(objectSpread2_default()({}, messageParams), {}, {
|
|
3207
|
-
from: messageParams.data
|
|
3208
|
-
}));
|
|
3209
|
-
}
|
|
3210
|
-
}
|
|
3211
2980
|
;// CONCATENATED MODULE: ./src/Message/MessageController.ts
|
|
3212
2981
|
|
|
3213
2982
|
|
|
@@ -3436,19 +3205,6 @@ class SwitchChainController extends AbstractMessageController {
|
|
|
3436
3205
|
|
|
3437
3206
|
|
|
3438
3207
|
|
|
3439
|
-
|
|
3440
|
-
function getMessageType(version) {
|
|
3441
|
-
switch (version) {
|
|
3442
|
-
case eth_sig_util_namespaceObject.SignTypedDataVersion.V1:
|
|
3443
|
-
return METHOD_TYPES.ETH_SIGN_TYPED_DATA;
|
|
3444
|
-
case eth_sig_util_namespaceObject.SignTypedDataVersion.V3:
|
|
3445
|
-
return METHOD_TYPES.ETH_SIGN_TYPED_DATA_V3;
|
|
3446
|
-
case eth_sig_util_namespaceObject.SignTypedDataVersion.V4:
|
|
3447
|
-
return METHOD_TYPES.ETH_SIGN_TYPED_DATA_V4;
|
|
3448
|
-
default:
|
|
3449
|
-
return METHOD_TYPES.ETH_SIGN_TYPED_DATA;
|
|
3450
|
-
}
|
|
3451
|
-
}
|
|
3452
3208
|
class TypedMessageController extends AbstractMessageController {
|
|
3453
3209
|
constructor({
|
|
3454
3210
|
config,
|
|
@@ -3473,8 +3229,8 @@ class TypedMessageController extends AbstractMessageController {
|
|
|
3473
3229
|
}
|
|
3474
3230
|
try {
|
|
3475
3231
|
const cleanMsgParams = await this.approveMessage(messageId, msgObject.messageParams);
|
|
3476
|
-
const msgData =
|
|
3477
|
-
const rawSig = await this.signTypedData(msgData, cleanMsgParams.from
|
|
3232
|
+
const msgData = JSON.parse(cleanMsgParams.data);
|
|
3233
|
+
const rawSig = await this.signTypedData(msgData, cleanMsgParams.from);
|
|
3478
3234
|
this.updateMessage(objectSpread2_default()(objectSpread2_default()({}, msgObject), {}, {
|
|
3479
3235
|
rawSig
|
|
3480
3236
|
}));
|
|
@@ -3486,32 +3242,26 @@ class TypedMessageController extends AbstractMessageController {
|
|
|
3486
3242
|
this.setMessageStatus(messageId, MessageStatus.FAILED);
|
|
3487
3243
|
}
|
|
3488
3244
|
}
|
|
3489
|
-
async addNewUnapprovedMessage(messageParams, req
|
|
3490
|
-
await this.addUnapprovedMessage(messageParams, req
|
|
3245
|
+
async addNewUnapprovedMessage(messageParams, req) {
|
|
3246
|
+
await this.addUnapprovedMessage(messageParams, req);
|
|
3491
3247
|
return this.waitForFinishStatus(messageParams, this.name);
|
|
3492
3248
|
}
|
|
3493
|
-
async addUnapprovedMessage(messageParams, req
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
if (version === eth_sig_util_namespaceObject.SignTypedDataVersion.V3 || version === eth_sig_util_namespaceObject.SignTypedDataVersion.V4) {
|
|
3498
|
-
const currentChainId = this.getNetworkIdentifier();
|
|
3499
|
-
await validateTypedSignMessageDataV3V4(messageParams, currentChainId);
|
|
3500
|
-
}
|
|
3501
|
-
if (typeof messageParams.data !== "string" && (version === eth_sig_util_namespaceObject.SignTypedDataVersion.V3 || version === eth_sig_util_namespaceObject.SignTypedDataVersion.V4)) {
|
|
3249
|
+
async addUnapprovedMessage(messageParams, req) {
|
|
3250
|
+
const currentChainId = this.getNetworkIdentifier();
|
|
3251
|
+
await validateTypedSignMessageDataV4(messageParams, currentChainId);
|
|
3252
|
+
if (typeof messageParams.data !== "string") {
|
|
3502
3253
|
messageParams.data = JSON.stringify(messageParams.data);
|
|
3503
3254
|
}
|
|
3504
3255
|
if (req) {
|
|
3505
3256
|
messageParams.origin = req.origin;
|
|
3506
3257
|
}
|
|
3507
|
-
messageParams.version = version;
|
|
3508
3258
|
const messageId = messageParams.id || (0,base_controllers_namespaceObject.randomId)();
|
|
3509
3259
|
const messageData = {
|
|
3510
3260
|
id: messageId,
|
|
3511
3261
|
messageParams,
|
|
3512
3262
|
status: MessageStatus.UNAPPROVED,
|
|
3513
3263
|
time: Date.now(),
|
|
3514
|
-
type:
|
|
3264
|
+
type: METHOD_TYPES.ETH_SIGN_TYPED_DATA_V4
|
|
3515
3265
|
};
|
|
3516
3266
|
await this.addMessage(messageData);
|
|
3517
3267
|
this.emit(MESSAGE_EVENTS.UNAPPROVED_MESSAGE, {
|
|
@@ -3528,11 +3278,10 @@ class TypedMessageController extends AbstractMessageController {
|
|
|
3528
3278
|
|
|
3529
3279
|
|
|
3530
3280
|
|
|
3531
|
-
|
|
3532
3281
|
function createGetAccountsMiddleware({
|
|
3533
3282
|
getAccounts
|
|
3534
3283
|
}) {
|
|
3535
|
-
return (0,
|
|
3284
|
+
return (0,auth_namespaceObject.createAsyncMiddleware)(async (request, response, next) => {
|
|
3536
3285
|
const {
|
|
3537
3286
|
method
|
|
3538
3287
|
} = request;
|
|
@@ -3545,7 +3294,7 @@ function createGetAccountsMiddleware({
|
|
|
3545
3294
|
function createProcessTransactionMiddleware({
|
|
3546
3295
|
processTransaction
|
|
3547
3296
|
}) {
|
|
3548
|
-
return (0,
|
|
3297
|
+
return (0,auth_namespaceObject.createAsyncMiddleware)(async (request, response, next) => {
|
|
3549
3298
|
const {
|
|
3550
3299
|
method
|
|
3551
3300
|
} = request;
|
|
@@ -3557,7 +3306,7 @@ function createProcessTransactionMiddleware({
|
|
|
3557
3306
|
function createProcessEthSignMessage({
|
|
3558
3307
|
processEthSignMessage
|
|
3559
3308
|
}) {
|
|
3560
|
-
return (0,
|
|
3309
|
+
return (0,auth_namespaceObject.createAsyncMiddleware)(async (request, response, next) => {
|
|
3561
3310
|
const {
|
|
3562
3311
|
method
|
|
3563
3312
|
} = request;
|
|
@@ -3578,60 +3327,10 @@ function createProcessEthSignMessage({
|
|
|
3578
3327
|
response.result = await processEthSignMessage(msgParams, request);
|
|
3579
3328
|
});
|
|
3580
3329
|
}
|
|
3581
|
-
function createProcessTypedMessage({
|
|
3582
|
-
processTypedMessage
|
|
3583
|
-
}) {
|
|
3584
|
-
return (0,openlogin_jrpc_namespaceObject.createAsyncMiddleware)(async (request, response, next) => {
|
|
3585
|
-
const {
|
|
3586
|
-
method
|
|
3587
|
-
} = request;
|
|
3588
|
-
if (method !== METHOD_TYPES.ETH_SIGN_TYPED_DATA) return next();
|
|
3589
|
-
if (!processTypedMessage) throw new Error("WalletMiddleware - opts.processTypedMessage not provided");
|
|
3590
|
-
if (!(request !== null && request !== void 0 && request.params)) throw new Error("WalletMiddleware - missing params");
|
|
3591
|
-
let msgParams = request.params;
|
|
3592
|
-
if (Array.isArray(request.params)) {
|
|
3593
|
-
if (!(request.params.length === 2)) throw new Error(`WalletMiddleware - incorrect params for ${method} method. expected [typedData, address]`);
|
|
3594
|
-
const params = request.params;
|
|
3595
|
-
const message = typeof params[0] === "string" ? JSON.parse(params[0]) : params[0];
|
|
3596
|
-
const address = params[1];
|
|
3597
|
-
msgParams = {
|
|
3598
|
-
from: address,
|
|
3599
|
-
data: message,
|
|
3600
|
-
version: eth_sig_util_namespaceObject.SignTypedDataVersion.V1
|
|
3601
|
-
};
|
|
3602
|
-
}
|
|
3603
|
-
response.result = await processTypedMessage(msgParams, request);
|
|
3604
|
-
});
|
|
3605
|
-
}
|
|
3606
|
-
function createProcessTypedMessageV3({
|
|
3607
|
-
processTypedMessageV3
|
|
3608
|
-
}) {
|
|
3609
|
-
return (0,openlogin_jrpc_namespaceObject.createAsyncMiddleware)(async (request, response, next) => {
|
|
3610
|
-
const {
|
|
3611
|
-
method
|
|
3612
|
-
} = request;
|
|
3613
|
-
if (method !== METHOD_TYPES.ETH_SIGN_TYPED_DATA_V3) return next();
|
|
3614
|
-
if (!processTypedMessageV3) throw new Error("WalletMiddleware - opts.processTypedMessageV3 is not provided");
|
|
3615
|
-
if (!(request !== null && request !== void 0 && request.params)) throw new Error("WalletMiddleware - missing params");
|
|
3616
|
-
let msgParams = request.params;
|
|
3617
|
-
if (Array.isArray(request.params)) {
|
|
3618
|
-
if (!(request.params.length === 2)) throw new Error(`WalletMiddleware - incorrect params for ${method} method. expected [address, typedData]`);
|
|
3619
|
-
const params = request.params;
|
|
3620
|
-
const address = params[0];
|
|
3621
|
-
const message = params[1];
|
|
3622
|
-
msgParams = {
|
|
3623
|
-
from: address,
|
|
3624
|
-
data: message,
|
|
3625
|
-
version: eth_sig_util_namespaceObject.SignTypedDataVersion.V3
|
|
3626
|
-
};
|
|
3627
|
-
}
|
|
3628
|
-
response.result = await processTypedMessageV3(msgParams, request);
|
|
3629
|
-
});
|
|
3630
|
-
}
|
|
3631
3330
|
function createProcessTypedMessageV4({
|
|
3632
3331
|
processTypedMessageV4
|
|
3633
3332
|
}) {
|
|
3634
|
-
return (0,
|
|
3333
|
+
return (0,auth_namespaceObject.createAsyncMiddleware)(async (request, response, next) => {
|
|
3635
3334
|
const {
|
|
3636
3335
|
method
|
|
3637
3336
|
} = request;
|
|
@@ -3646,8 +3345,7 @@ function createProcessTypedMessageV4({
|
|
|
3646
3345
|
const message = params[1];
|
|
3647
3346
|
msgParams = {
|
|
3648
3347
|
from: address,
|
|
3649
|
-
data: message
|
|
3650
|
-
version: eth_sig_util_namespaceObject.SignTypedDataVersion.V4
|
|
3348
|
+
data: message
|
|
3651
3349
|
};
|
|
3652
3350
|
}
|
|
3653
3351
|
response.result = await processTypedMessageV4(msgParams, request);
|
|
@@ -3656,7 +3354,7 @@ function createProcessTypedMessageV4({
|
|
|
3656
3354
|
function createProcessPersonalMessage({
|
|
3657
3355
|
processPersonalMessage
|
|
3658
3356
|
}) {
|
|
3659
|
-
return (0,
|
|
3357
|
+
return (0,auth_namespaceObject.createAsyncMiddleware)(async (request, response, next) => {
|
|
3660
3358
|
const {
|
|
3661
3359
|
method
|
|
3662
3360
|
} = request;
|
|
@@ -3691,7 +3389,7 @@ function createProcessPersonalMessage({
|
|
|
3691
3389
|
function createPendingNonceMiddleware({
|
|
3692
3390
|
getPendingNonce
|
|
3693
3391
|
}) {
|
|
3694
|
-
return (0,
|
|
3392
|
+
return (0,auth_namespaceObject.createAsyncMiddleware)(async (request, response, next) => {
|
|
3695
3393
|
const {
|
|
3696
3394
|
params,
|
|
3697
3395
|
method
|
|
@@ -3755,7 +3453,7 @@ function formatTxMetaForRpcResult(txMeta) {
|
|
|
3755
3453
|
function createPendingTxMiddleware({
|
|
3756
3454
|
getPendingTransactionByHash
|
|
3757
3455
|
}) {
|
|
3758
|
-
return (0,
|
|
3456
|
+
return (0,auth_namespaceObject.createAsyncMiddleware)(async (request, response, next) => {
|
|
3759
3457
|
const {
|
|
3760
3458
|
params,
|
|
3761
3459
|
method
|
|
@@ -3770,54 +3468,10 @@ function createPendingTxMiddleware({
|
|
|
3770
3468
|
return undefined;
|
|
3771
3469
|
});
|
|
3772
3470
|
}
|
|
3773
|
-
function createProcessEncryptionPublicKeyMiddleware({
|
|
3774
|
-
processEncryptionPublicKey
|
|
3775
|
-
}) {
|
|
3776
|
-
return (0,openlogin_jrpc_namespaceObject.createAsyncMiddleware)(async (request, response, next) => {
|
|
3777
|
-
const {
|
|
3778
|
-
method
|
|
3779
|
-
} = request;
|
|
3780
|
-
if (method !== METHOD_TYPES.ETH_GET_ENCRYPTION_PUBLIC_KEY) return next();
|
|
3781
|
-
if (!processEncryptionPublicKey) throw new Error("WalletMiddleware - opts.processEncryptionPublicKey not provided");
|
|
3782
|
-
if (!(request !== null && request !== void 0 && request.params)) throw new Error("WalletMiddleware - missing params");
|
|
3783
|
-
let msgParams = request.params;
|
|
3784
|
-
if (Array.isArray(request.params)) {
|
|
3785
|
-
if (!(request.params.length === 1)) throw new Error(`WalletMiddleware - incorrect params for ${method} method. expected [address]`);
|
|
3786
|
-
const [address] = request.params;
|
|
3787
|
-
msgParams = {
|
|
3788
|
-
data: address,
|
|
3789
|
-
from: address
|
|
3790
|
-
};
|
|
3791
|
-
}
|
|
3792
|
-
response.result = await processEncryptionPublicKey(msgParams, request);
|
|
3793
|
-
});
|
|
3794
|
-
}
|
|
3795
|
-
function createProcessDecryptMessageMiddleware({
|
|
3796
|
-
processDecryptMessage
|
|
3797
|
-
}) {
|
|
3798
|
-
return (0,openlogin_jrpc_namespaceObject.createAsyncMiddleware)(async (request, response, next) => {
|
|
3799
|
-
const {
|
|
3800
|
-
method
|
|
3801
|
-
} = request;
|
|
3802
|
-
if (method !== METHOD_TYPES.ETH_DECRYPT) return next();
|
|
3803
|
-
if (!processDecryptMessage) throw new Error("WalletMiddleware - opts.processDecryptMessage not provided");
|
|
3804
|
-
if (!(request !== null && request !== void 0 && request.params)) throw new Error("WalletMiddleware - missing params");
|
|
3805
|
-
let msgParams = request.params;
|
|
3806
|
-
if (Array.isArray(request.params)) {
|
|
3807
|
-
if (!(request.params.length === 2)) throw new Error(`WalletMiddleware - incorrect params for ${method} method. expected [message, address]`);
|
|
3808
|
-
const [message, address] = request.params;
|
|
3809
|
-
msgParams = {
|
|
3810
|
-
data: message,
|
|
3811
|
-
from: address
|
|
3812
|
-
};
|
|
3813
|
-
}
|
|
3814
|
-
response.result = await processDecryptMessage(msgParams, request);
|
|
3815
|
-
});
|
|
3816
|
-
}
|
|
3817
3471
|
function createProcessSwitchEthereumChain({
|
|
3818
3472
|
processSwitchEthereumChain
|
|
3819
3473
|
}) {
|
|
3820
|
-
return (0,
|
|
3474
|
+
return (0,auth_namespaceObject.createAsyncMiddleware)(async (request, response, next) => {
|
|
3821
3475
|
const {
|
|
3822
3476
|
method
|
|
3823
3477
|
} = request;
|
|
@@ -3836,7 +3490,7 @@ function createProcessSwitchEthereumChain({
|
|
|
3836
3490
|
function createProcessAddEthereumChain({
|
|
3837
3491
|
processAddEthereumChain
|
|
3838
3492
|
}) {
|
|
3839
|
-
return (0,
|
|
3493
|
+
return (0,auth_namespaceObject.createAsyncMiddleware)(async (request, response, next) => {
|
|
3840
3494
|
const {
|
|
3841
3495
|
method
|
|
3842
3496
|
} = request;
|
|
@@ -3855,7 +3509,7 @@ function createProcessAddEthereumChain({
|
|
|
3855
3509
|
function createRequestAccountsMiddleware({
|
|
3856
3510
|
requestAccounts
|
|
3857
3511
|
}) {
|
|
3858
|
-
return (0,
|
|
3512
|
+
return (0,auth_namespaceObject.createAsyncMiddleware)(async (request, response, next) => {
|
|
3859
3513
|
const {
|
|
3860
3514
|
method
|
|
3861
3515
|
} = request;
|
|
@@ -3873,20 +3527,16 @@ function createEthereumMiddleware(providerHandlers) {
|
|
|
3873
3527
|
getAccounts,
|
|
3874
3528
|
processTransaction,
|
|
3875
3529
|
processEthSignMessage,
|
|
3876
|
-
processTypedMessage,
|
|
3877
|
-
processTypedMessageV3,
|
|
3878
3530
|
processTypedMessageV4,
|
|
3879
3531
|
processPersonalMessage,
|
|
3880
3532
|
getPendingNonce,
|
|
3881
3533
|
getPendingTransactionByHash,
|
|
3882
|
-
processEncryptionPublicKey,
|
|
3883
|
-
processDecryptMessage,
|
|
3884
3534
|
processSwitchEthereumChain,
|
|
3885
3535
|
processAddEthereumChain,
|
|
3886
3536
|
getProviderState,
|
|
3887
3537
|
version
|
|
3888
3538
|
} = providerHandlers;
|
|
3889
|
-
return (0,
|
|
3539
|
+
return (0,auth_namespaceObject.mergeMiddleware)([(0,auth_namespaceObject.createScaffoldMiddleware)({
|
|
3890
3540
|
version,
|
|
3891
3541
|
[base_controllers_namespaceObject.PROVIDER_JRPC_METHODS.GET_PROVIDER_STATE]: getProviderState
|
|
3892
3542
|
}), createRequestAccountsMiddleware({
|
|
@@ -3897,10 +3547,6 @@ function createEthereumMiddleware(providerHandlers) {
|
|
|
3897
3547
|
processTransaction
|
|
3898
3548
|
}), createProcessEthSignMessage({
|
|
3899
3549
|
processEthSignMessage
|
|
3900
|
-
}), createProcessTypedMessage({
|
|
3901
|
-
processTypedMessage
|
|
3902
|
-
}), createProcessTypedMessageV3({
|
|
3903
|
-
processTypedMessageV3
|
|
3904
3550
|
}), createProcessTypedMessageV4({
|
|
3905
3551
|
processTypedMessageV4
|
|
3906
3552
|
}), createProcessPersonalMessage({
|
|
@@ -3909,10 +3555,6 @@ function createEthereumMiddleware(providerHandlers) {
|
|
|
3909
3555
|
getPendingNonce
|
|
3910
3556
|
}), createPendingTxMiddleware({
|
|
3911
3557
|
getPendingTransactionByHash
|
|
3912
|
-
}), createProcessEncryptionPublicKeyMiddleware({
|
|
3913
|
-
processEncryptionPublicKey
|
|
3914
|
-
}), createProcessDecryptMessageMiddleware({
|
|
3915
|
-
processDecryptMessage
|
|
3916
3558
|
}), createProcessSwitchEthereumChain({
|
|
3917
3559
|
processSwitchEthereumChain
|
|
3918
3560
|
}), createProcessAddEthereumChain({
|
|
@@ -4064,14 +3706,14 @@ function createJsonRpcClient(providerConfig, networkConfig) {
|
|
|
4064
3706
|
const fetchMiddleware = (0,base_controllers_namespaceObject.createFetchMiddleware)({
|
|
4065
3707
|
rpcTarget
|
|
4066
3708
|
});
|
|
4067
|
-
const blockProvider = (0,
|
|
4068
|
-
const blockTracker = new
|
|
3709
|
+
const blockProvider = (0,auth_namespaceObject.providerFromMiddleware)(fetchMiddleware);
|
|
3710
|
+
const blockTracker = new PollingBlockTracker({
|
|
4069
3711
|
config: objectSpread2_default()(objectSpread2_default()({}, networkConfig), {}, {
|
|
4070
3712
|
provider: blockProvider
|
|
4071
3713
|
}),
|
|
4072
3714
|
state: {}
|
|
4073
3715
|
});
|
|
4074
|
-
const networkMiddleware = (0,
|
|
3716
|
+
const networkMiddleware = (0,auth_namespaceObject.mergeMiddleware)([createChainIdMiddleware(chainId), createProviderConfigMiddleware(providerConfig),
|
|
4075
3717
|
// No need for the following middlewares for web because all browser sessions are quite short lived and each session is limited to scope of a window/tab
|
|
4076
3718
|
// createBlockRefRewriteMiddleware({ blockTracker }),
|
|
4077
3719
|
// createBlockCacheMiddleware({ blockTracker }),
|
|
@@ -4233,10 +3875,10 @@ class NetworkController extends base_controllers_namespaceObject.BaseController
|
|
|
4233
3875
|
blockTracker
|
|
4234
3876
|
}) {
|
|
4235
3877
|
const ethereumMiddleware = createEthereumMiddleware(this.baseProviderHandlers);
|
|
4236
|
-
const engine = new
|
|
3878
|
+
const engine = new auth_namespaceObject.JRPCEngine();
|
|
4237
3879
|
engine.push(ethereumMiddleware);
|
|
4238
3880
|
engine.push(networkMiddleware);
|
|
4239
|
-
const provider = (0,
|
|
3881
|
+
const provider = (0,auth_namespaceObject.providerFromEngine)(engine);
|
|
4240
3882
|
this.setProvider({
|
|
4241
3883
|
provider,
|
|
4242
3884
|
blockTracker
|
|
@@ -5699,14 +5341,13 @@ class NonceTracker {
|
|
|
5699
5341
|
};
|
|
5700
5342
|
}
|
|
5701
5343
|
}
|
|
5702
|
-
/* harmony default export */ const Transaction_NonceTracker = (NonceTracker);
|
|
5703
5344
|
;// CONCATENATED MODULE: ./src/Transaction/PendingTransactionTracker.ts
|
|
5704
5345
|
|
|
5705
5346
|
|
|
5706
5347
|
|
|
5707
5348
|
|
|
5708
5349
|
|
|
5709
|
-
class PendingTransactionTracker extends
|
|
5350
|
+
class PendingTransactionTracker extends auth_namespaceObject.SafeEventEmitter {
|
|
5710
5351
|
constructor({
|
|
5711
5352
|
provider,
|
|
5712
5353
|
nonceTracker,
|
|
@@ -5782,7 +5423,6 @@ class PendingTransactionTracker extends openlogin_jrpc_namespaceObject.SafeEvent
|
|
|
5782
5423
|
};
|
|
5783
5424
|
this.emit(base_controllers_namespaceObject.TX_EVENTS.TX_WARNING, {
|
|
5784
5425
|
txMeta,
|
|
5785
|
-
error,
|
|
5786
5426
|
txId: txMeta.id
|
|
5787
5427
|
});
|
|
5788
5428
|
}
|
|
@@ -5872,7 +5512,8 @@ class PendingTransactionTracker extends openlogin_jrpc_namespaceObject.SafeEvent
|
|
|
5872
5512
|
message: "There was a problem loading this transaction."
|
|
5873
5513
|
};
|
|
5874
5514
|
this.emit(base_controllers_namespaceObject.TX_EVENTS.TX_WARNING, {
|
|
5875
|
-
txMeta
|
|
5515
|
+
txMeta,
|
|
5516
|
+
txId
|
|
5876
5517
|
});
|
|
5877
5518
|
}
|
|
5878
5519
|
if (await this._checkIfTxWasDropped(txMeta)) {
|
|
@@ -6406,7 +6047,7 @@ class TransactionController extends TransactionStateManager {
|
|
|
6406
6047
|
this.signEthTx = signEthTx;
|
|
6407
6048
|
this.provider = provider;
|
|
6408
6049
|
this.txGasUtil = new TransactionGasUtil(this.provider, this.blockTracker);
|
|
6409
|
-
this.nonceTracker = new
|
|
6050
|
+
this.nonceTracker = new NonceTracker({
|
|
6410
6051
|
provider,
|
|
6411
6052
|
blockTracker,
|
|
6412
6053
|
getConfirmedTransactions: this.getConfirmedTransactions.bind(this),
|
|
@@ -6438,15 +6079,15 @@ class TransactionController extends TransactionStateManager {
|
|
|
6438
6079
|
return new Promise((resolve, reject) => {
|
|
6439
6080
|
const handleFinished = msg => {
|
|
6440
6081
|
if (msg.status === base_controllers_namespaceObject.TransactionStatus.rejected) {
|
|
6441
|
-
return reject(
|
|
6082
|
+
return reject(auth_namespaceObject.providerErrors.userRejectedRequest(`Transaction Signature: User denied message signature`));
|
|
6442
6083
|
}
|
|
6443
6084
|
if (msg.status === base_controllers_namespaceObject.TransactionStatus.failed) {
|
|
6444
|
-
return reject(
|
|
6085
|
+
return reject(auth_namespaceObject.rpcErrors.internal(`Transaction Signature: failed to sign message ${msg.error}`));
|
|
6445
6086
|
}
|
|
6446
6087
|
if (msg.status === base_controllers_namespaceObject.TransactionStatus.submitted) {
|
|
6447
6088
|
return resolve(msg.transactionHash);
|
|
6448
6089
|
}
|
|
6449
|
-
return reject(
|
|
6090
|
+
return reject(auth_namespaceObject.rpcErrors.internal(`Transaction Signature: Unknown problem: ${JSON.stringify(txMeta.transaction)}`));
|
|
6450
6091
|
};
|
|
6451
6092
|
this.once(`${txMeta.id}:finished`, handleFinished);
|
|
6452
6093
|
});
|
|
@@ -6509,6 +6150,7 @@ class TransactionController extends TransactionStateManager {
|
|
|
6509
6150
|
const {
|
|
6510
6151
|
TransactionFactory
|
|
6511
6152
|
} = await Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 81, 23));
|
|
6153
|
+
// TODO: fix this when @ethereumjs/tx is updated.
|
|
6512
6154
|
const unsignedEthTx = TransactionFactory.fromTxData(txParams, {
|
|
6513
6155
|
common
|
|
6514
6156
|
});
|
|
@@ -6781,12 +6423,12 @@ class TransactionController extends TransactionStateManager {
|
|
|
6781
6423
|
this.updateTransactionInState(txMeta);
|
|
6782
6424
|
}
|
|
6783
6425
|
});
|
|
6784
|
-
this.pendingTxTracker.on(base_controllers_namespaceObject.TX_EVENTS.TX_RETRY,
|
|
6785
|
-
if (!("retryCount" in txMeta)) {
|
|
6786
|
-
txMeta.retryCount = 0;
|
|
6426
|
+
this.pendingTxTracker.on(base_controllers_namespaceObject.TX_EVENTS.TX_RETRY, data => {
|
|
6427
|
+
if (!("retryCount" in data.txMeta)) {
|
|
6428
|
+
data.txMeta.retryCount = 0;
|
|
6787
6429
|
}
|
|
6788
|
-
txMeta.retryCount += 1;
|
|
6789
|
-
this.updateTransactionInState(txMeta);
|
|
6430
|
+
data.txMeta.retryCount += 1;
|
|
6431
|
+
this.updateTransactionInState(data.txMeta);
|
|
6790
6432
|
});
|
|
6791
6433
|
this.pendingTxTracker.on(base_controllers_namespaceObject.TX_EVENTS.TX_FAILED, data => {
|
|
6792
6434
|
this.setTxStatusFailed(data.txId, data.error);
|
|
@@ -6857,9 +6499,16 @@ class TransactionController extends TransactionStateManager {
|
|
|
6857
6499
|
});
|
|
6858
6500
|
}
|
|
6859
6501
|
}
|
|
6860
|
-
;// CONCATENATED MODULE: ./src/
|
|
6502
|
+
;// CONCATENATED MODULE: ./src/utils/interfaces.ts
|
|
6503
|
+
|
|
6861
6504
|
|
|
6862
6505
|
|
|
6506
|
+
/**
|
|
6507
|
+
* Ref - https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_gettransactionreceipt
|
|
6508
|
+
*/
|
|
6509
|
+
|
|
6510
|
+
// TODO:// mark fields which will be optional.
|
|
6511
|
+
;// CONCATENATED MODULE: ./src/index.ts
|
|
6863
6512
|
|
|
6864
6513
|
|
|
6865
6514
|
|