@metamask/transaction-controller 28.1.1 → 29.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/CHANGELOG.md +40 -1
- package/dist/TransactionController.js +11 -10
- package/dist/TransactionController.mjs +10 -9
- package/dist/{chunk-HQAADNXH.mjs → chunk-26BABWPE.mjs} +201 -113
- package/dist/chunk-26BABWPE.mjs.map +1 -0
- package/dist/{chunk-LDXTSESK.mjs → chunk-4M7FHI4S.mjs} +20 -4
- package/dist/chunk-4M7FHI4S.mjs.map +1 -0
- package/dist/{chunk-FK7AP6SH.js → chunk-5C3CSQAD.js} +12 -5
- package/dist/{chunk-YEJJKWT2.mjs.map → chunk-5C3CSQAD.js.map} +1 -1
- package/dist/{chunk-V6UIRCOF.js → chunk-7DJO6UZA.js} +48 -13
- package/dist/chunk-7DJO6UZA.js.map +1 -0
- package/dist/{chunk-TWND5SFD.mjs → chunk-AGJNOOBN.mjs} +17 -12
- package/dist/chunk-AGJNOOBN.mjs.map +1 -0
- package/dist/{chunk-LNX4JTOL.js → chunk-DUFOYA4D.js} +7 -7
- package/dist/chunk-DUFOYA4D.js.map +1 -0
- package/dist/{chunk-UH7FNVKS.js → chunk-EMDU4XLM.js} +19 -14
- package/dist/chunk-EMDU4XLM.js.map +1 -0
- package/dist/chunk-FMRLPVFZ.mjs +66 -0
- package/dist/chunk-FMRLPVFZ.mjs.map +1 -0
- package/dist/{chunk-EQNKFFTM.js → chunk-KNYSD4JP.js} +21 -5
- package/dist/chunk-KNYSD4JP.js.map +1 -0
- package/dist/{chunk-FMCTVRU2.js → chunk-KT3F6CZP.js} +204 -116
- package/dist/chunk-KT3F6CZP.js.map +1 -0
- package/dist/{chunk-YEJJKWT2.mjs → chunk-N6JXPWLY.mjs} +11 -4
- package/dist/chunk-N6JXPWLY.mjs.map +1 -0
- package/dist/chunk-REOG6YD4.mjs +112 -0
- package/dist/chunk-REOG6YD4.mjs.map +1 -0
- package/dist/{chunk-HHK4QSNF.mjs → chunk-SL3GHHKG.mjs} +47 -12
- package/dist/chunk-SL3GHHKG.mjs.map +1 -0
- package/dist/chunk-TJMQEH57.js +66 -0
- package/dist/chunk-TJMQEH57.js.map +1 -0
- package/dist/chunk-VJYFB7BM.js +112 -0
- package/dist/chunk-VJYFB7BM.js.map +1 -0
- package/dist/{chunk-NCRWKI6Y.mjs → chunk-XL3HBKDE.mjs} +4 -4
- package/dist/chunk-XL3HBKDE.mjs.map +1 -0
- package/dist/errors.js +1 -1
- package/dist/errors.mjs +1 -1
- package/dist/gas-flows/DefaultGasFeeFlow.js +5 -5
- package/dist/gas-flows/DefaultGasFeeFlow.mjs +4 -4
- package/dist/gas-flows/LineaGasFeeFlow.js +6 -6
- package/dist/gas-flows/LineaGasFeeFlow.mjs +5 -5
- package/dist/gas-flows/TestGasFeeFlow.js +9 -0
- package/dist/gas-flows/TestGasFeeFlow.js.map +1 -0
- package/dist/gas-flows/TestGasFeeFlow.mjs +9 -0
- package/dist/gas-flows/TestGasFeeFlow.mjs.map +1 -0
- package/dist/helpers/EtherscanRemoteTransactionSource.js +1 -1
- package/dist/helpers/EtherscanRemoteTransactionSource.mjs +1 -1
- package/dist/helpers/GasFeePoller.js +4 -4
- package/dist/helpers/GasFeePoller.mjs +3 -3
- package/dist/helpers/MultichainTrackingHelper.js +1 -1
- package/dist/helpers/MultichainTrackingHelper.mjs +1 -1
- package/dist/helpers/PendingTransactionTracker.js +1 -1
- package/dist/helpers/PendingTransactionTracker.mjs +1 -1
- package/dist/index.js +15 -10
- package/dist/index.mjs +14 -9
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/TransactionController.d.ts +16 -7
- package/dist/types/TransactionController.d.ts.map +1 -1
- package/dist/types/gas-flows/DefaultGasFeeFlow.d.ts.map +1 -1
- package/dist/types/gas-flows/TestGasFeeFlow.d.ts +12 -0
- package/dist/types/gas-flows/TestGasFeeFlow.d.ts.map +1 -0
- package/dist/types/helpers/GasFeePoller.d.ts +5 -3
- package/dist/types/helpers/GasFeePoller.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/types.d.ts +36 -18
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils/gas-flow.d.ts +8 -14
- package/dist/types/utils/gas-flow.d.ts.map +1 -1
- package/dist/types.js +4 -2
- package/dist/types.mjs +3 -1
- package/dist/utils/external-transactions.js +1 -1
- package/dist/utils/external-transactions.mjs +1 -1
- package/dist/utils/gas-fees.js +4 -4
- package/dist/utils/gas-fees.mjs +3 -3
- package/dist/utils/gas-flow.js +3 -3
- package/dist/utils/gas-flow.mjs +2 -2
- package/dist/utils/simulation-api.js +1 -1
- package/dist/utils/simulation-api.mjs +1 -1
- package/dist/utils/simulation.js +1 -1
- package/dist/utils/simulation.mjs +1 -1
- package/dist/utils/swaps.js +1 -1
- package/dist/utils/swaps.mjs +1 -1
- package/dist/utils/transaction-type.js +1 -1
- package/dist/utils/transaction-type.mjs +1 -1
- package/dist/utils/utils.js +1 -1
- package/dist/utils/utils.mjs +1 -1
- package/dist/utils/validation.js +1 -1
- package/dist/utils/validation.mjs +1 -1
- package/package.json +5 -5
- package/dist/chunk-4RJXBKSR.js +0 -90
- package/dist/chunk-4RJXBKSR.js.map +0 -1
- package/dist/chunk-EQNKFFTM.js.map +0 -1
- package/dist/chunk-FK7AP6SH.js.map +0 -1
- package/dist/chunk-FMCTVRU2.js.map +0 -1
- package/dist/chunk-HHK4QSNF.mjs.map +0 -1
- package/dist/chunk-HQAADNXH.mjs.map +0 -1
- package/dist/chunk-LDXTSESK.mjs.map +0 -1
- package/dist/chunk-LNX4JTOL.js.map +0 -1
- package/dist/chunk-NCRWKI6Y.mjs.map +0 -1
- package/dist/chunk-NPEXNXSY.mjs +0 -90
- package/dist/chunk-NPEXNXSY.mjs.map +0 -1
- package/dist/chunk-TWND5SFD.mjs.map +0 -1
- package/dist/chunk-UH7FNVKS.js.map +0 -1
- package/dist/chunk-V6UIRCOF.js.map +0 -1
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2
2
|
|
|
3
|
+
|
|
4
|
+
var _chunkZNZEJDOEjs = require('./chunk-ZNZEJDOE.js');
|
|
5
|
+
|
|
6
|
+
|
|
3
7
|
var _chunkX3KACH5Pjs = require('./chunk-X3KACH5P.js');
|
|
4
8
|
|
|
5
9
|
|
|
@@ -10,6 +14,9 @@ var _chunkSD6CWFDFjs = require('./chunk-SD6CWFDF.js');
|
|
|
10
14
|
var _chunkVH47Q6TSjs = require('./chunk-VH47Q6TS.js');
|
|
11
15
|
|
|
12
16
|
|
|
17
|
+
var _chunk5KMU2IATjs = require('./chunk-5KMU2IAT.js');
|
|
18
|
+
|
|
19
|
+
|
|
13
20
|
var _chunk7LXE4KHVjs = require('./chunk-7LXE4KHV.js');
|
|
14
21
|
|
|
15
22
|
|
|
@@ -22,17 +29,16 @@ var _chunkV72C4MCRjs = require('./chunk-V72C4MCR.js');
|
|
|
22
29
|
var _chunkQP75SWIQjs = require('./chunk-QP75SWIQ.js');
|
|
23
30
|
|
|
24
31
|
|
|
25
|
-
|
|
26
|
-
var _chunkZNZEJDOEjs = require('./chunk-ZNZEJDOE.js');
|
|
27
|
-
|
|
28
|
-
|
|
29
32
|
var _chunkNYKRCWBGjs = require('./chunk-NYKRCWBG.js');
|
|
30
33
|
|
|
31
34
|
|
|
32
35
|
var _chunkWR5F34OWjs = require('./chunk-WR5F34OW.js');
|
|
33
36
|
|
|
34
37
|
|
|
35
|
-
var
|
|
38
|
+
var _chunkTJMQEH57js = require('./chunk-TJMQEH57.js');
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
var _chunk7DJO6UZAjs = require('./chunk-7DJO6UZA.js');
|
|
36
42
|
|
|
37
43
|
|
|
38
44
|
|
|
@@ -48,16 +54,13 @@ var _chunk5XQ2KRYLjs = require('./chunk-5XQ2KRYL.js');
|
|
|
48
54
|
var _chunkEQT25RSPjs = require('./chunk-EQT25RSP.js');
|
|
49
55
|
|
|
50
56
|
|
|
51
|
-
var
|
|
57
|
+
var _chunkDUFOYA4Djs = require('./chunk-DUFOYA4D.js');
|
|
52
58
|
|
|
53
59
|
|
|
54
|
-
var
|
|
60
|
+
var _chunkVJYFB7BMjs = require('./chunk-VJYFB7BM.js');
|
|
55
61
|
|
|
56
62
|
|
|
57
|
-
var
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
var _chunkEQNKFFTMjs = require('./chunk-EQNKFFTM.js');
|
|
63
|
+
var _chunkKNYSD4JPjs = require('./chunk-KNYSD4JP.js');
|
|
61
64
|
|
|
62
65
|
|
|
63
66
|
|
|
@@ -76,6 +79,9 @@ var _chunkC2LNDHP4js = require('./chunk-C2LNDHP4.js');
|
|
|
76
79
|
var _chunkUGFBA4GVjs = require('./chunk-UGFBA4GV.js');
|
|
77
80
|
|
|
78
81
|
|
|
82
|
+
var _chunkEMDU4XLMjs = require('./chunk-EMDU4XLM.js');
|
|
83
|
+
|
|
84
|
+
|
|
79
85
|
var _chunkS6VGOPUYjs = require('./chunk-S6VGOPUY.js');
|
|
80
86
|
|
|
81
87
|
|
|
@@ -137,7 +143,7 @@ function getDefaultTransactionControllerState() {
|
|
|
137
143
|
lastFetchedBlockNumbers: {}
|
|
138
144
|
};
|
|
139
145
|
}
|
|
140
|
-
var _internalEvents, _incomingTransactionOptions, _pendingTransactionOptions, _transactionHistoryLimit, _isSimulationEnabled, _multichainTrackingHelper, _createNonceTracker, createNonceTracker_fn, _createIncomingTransactionHelper, createIncomingTransactionHelper_fn, _createPendingTransactionTracker, createPendingTransactionTracker_fn, _checkForPendingTransactionAndStartPolling, _stopAllTracking, stopAllTracking_fn, _removeIncomingTransactionHelperListeners, removeIncomingTransactionHelperListeners_fn, _addIncomingTransactionHelperListeners, addIncomingTransactionHelperListeners_fn, _removePendingTransactionTrackerListeners, removePendingTransactionTrackerListeners_fn, _addPendingTransactionTrackerListeners, addPendingTransactionTrackerListeners_fn, _getNonceTrackerPendingTransactions, getNonceTrackerPendingTransactions_fn, _getGasFeeFlows, getGasFeeFlows_fn, _getLayer1GasFeeFlows, getLayer1GasFeeFlows_fn, _updateTransactionInternal, updateTransactionInternal_fn, _checkIfTransactionParamsUpdated, checkIfTransactionParamsUpdated_fn, _onTransactionParamsUpdated, onTransactionParamsUpdated_fn, _updateSimulationData, updateSimulationData_fn, _onGasFeePollerTransactionUpdate, onGasFeePollerTransactionUpdate_fn;
|
|
146
|
+
var _internalEvents, _incomingTransactionOptions, _pendingTransactionOptions, _transactionHistoryLimit, _isSimulationEnabled, _testGasFeeFlows, _multichainTrackingHelper, _createNonceTracker, createNonceTracker_fn, _createIncomingTransactionHelper, createIncomingTransactionHelper_fn, _createPendingTransactionTracker, createPendingTransactionTracker_fn, _checkForPendingTransactionAndStartPolling, _stopAllTracking, stopAllTracking_fn, _removeIncomingTransactionHelperListeners, removeIncomingTransactionHelperListeners_fn, _addIncomingTransactionHelperListeners, addIncomingTransactionHelperListeners_fn, _removePendingTransactionTrackerListeners, removePendingTransactionTrackerListeners_fn, _addPendingTransactionTrackerListeners, addPendingTransactionTrackerListeners_fn, _getNonceTrackerPendingTransactions, getNonceTrackerPendingTransactions_fn, _getGasFeeFlows, getGasFeeFlows_fn, _getLayer1GasFeeFlows, getLayer1GasFeeFlows_fn, _updateTransactionInternal, updateTransactionInternal_fn, _checkIfTransactionParamsUpdated, checkIfTransactionParamsUpdated_fn, _onTransactionParamsUpdated, onTransactionParamsUpdated_fn, _updateSimulationData, updateSimulationData_fn, _onGasFeePollerTransactionUpdate, onGasFeePollerTransactionUpdate_fn, _getNetworkClientId, getNetworkClientId_fn, _getGlobalNetworkClientId, getGlobalNetworkClientId_fn, _getGlobalChainId, getGlobalChainId_fn, _isCustomNetwork, isCustomNetwork_fn;
|
|
141
147
|
var TransactionController = class extends _basecontroller.BaseController {
|
|
142
148
|
/**
|
|
143
149
|
* Constructs a TransactionController.
|
|
@@ -166,6 +172,7 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
166
172
|
* @param options.securityProviderRequest - A function for verifying a transaction, whether it is malicious or not.
|
|
167
173
|
* @param options.sign - Function used to sign transactions.
|
|
168
174
|
* @param options.state - Initial state to set on this controller.
|
|
175
|
+
* @param options.testGasFeeFlows - Whether to use the test gas fee flow.
|
|
169
176
|
* @param options.transactionHistoryLimit - Transaction history limit.
|
|
170
177
|
* @param options.hooks - The controller hooks.
|
|
171
178
|
*/
|
|
@@ -193,6 +200,7 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
193
200
|
securityProviderRequest,
|
|
194
201
|
sign,
|
|
195
202
|
state,
|
|
203
|
+
testGasFeeFlows,
|
|
196
204
|
transactionHistoryLimit = 40,
|
|
197
205
|
hooks
|
|
198
206
|
}) {
|
|
@@ -221,14 +229,19 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
221
229
|
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _onTransactionParamsUpdated);
|
|
222
230
|
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _updateSimulationData);
|
|
223
231
|
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _onGasFeePollerTransactionUpdate);
|
|
232
|
+
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _getNetworkClientId);
|
|
233
|
+
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _getGlobalNetworkClientId);
|
|
234
|
+
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _getGlobalChainId);
|
|
235
|
+
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _isCustomNetwork);
|
|
224
236
|
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _internalEvents, new (0, _events.EventEmitter)());
|
|
225
|
-
this.
|
|
237
|
+
this.approvingTransactionIds = /* @__PURE__ */ new Set();
|
|
226
238
|
this.mutex = new (0, _asyncmutex.Mutex)();
|
|
227
239
|
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _incomingTransactionOptions, void 0);
|
|
228
240
|
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _pendingTransactionOptions, void 0);
|
|
229
241
|
this.signAbortCallbacks = /* @__PURE__ */ new Map();
|
|
230
242
|
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _transactionHistoryLimit, void 0);
|
|
231
243
|
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _isSimulationEnabled, void 0);
|
|
244
|
+
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _testGasFeeFlows, void 0);
|
|
232
245
|
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _multichainTrackingHelper, void 0);
|
|
233
246
|
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _checkForPendingTransactionAndStartPolling, () => {
|
|
234
247
|
this.pendingTransactionTracker.startIfPendingTransactions();
|
|
@@ -253,6 +266,7 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
253
266
|
_chunkZ4BLTVTBjs.__privateSet.call(void 0, this, _pendingTransactionOptions, pendingTransactions);
|
|
254
267
|
_chunkZ4BLTVTBjs.__privateSet.call(void 0, this, _transactionHistoryLimit, transactionHistoryLimit);
|
|
255
268
|
this.sign = sign;
|
|
269
|
+
_chunkZ4BLTVTBjs.__privateSet.call(void 0, this, _testGasFeeFlows, testGasFeeFlows === true);
|
|
256
270
|
this.afterSign = hooks?.afterSign ?? (() => true);
|
|
257
271
|
this.beforeApproveOnInit = hooks?.beforeApproveOnInit ?? (() => true);
|
|
258
272
|
this.beforeCheckPendingTransaction = hooks?.beforeCheckPendingTransaction ?? /* istanbul ignore next */
|
|
@@ -264,17 +278,18 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
264
278
|
provider,
|
|
265
279
|
blockTracker
|
|
266
280
|
});
|
|
281
|
+
const findNetworkClientIdByChainId = (chainId) => {
|
|
282
|
+
return this.messagingSystem.call(
|
|
283
|
+
`NetworkController:findNetworkClientIdByChainId`,
|
|
284
|
+
chainId
|
|
285
|
+
);
|
|
286
|
+
};
|
|
267
287
|
_chunkZ4BLTVTBjs.__privateSet.call(void 0, this, _multichainTrackingHelper, new (0, _chunk5XQ2KRYLjs.MultichainTrackingHelper)({
|
|
268
288
|
isMultichainEnabled,
|
|
269
289
|
provider,
|
|
270
290
|
nonceTracker: this.nonceTracker,
|
|
271
291
|
incomingTransactionOptions: incomingTransactions,
|
|
272
|
-
findNetworkClientIdByChainId
|
|
273
|
-
return this.messagingSystem.call(
|
|
274
|
-
`NetworkController:findNetworkClientIdByChainId`,
|
|
275
|
-
chainId
|
|
276
|
-
);
|
|
277
|
-
},
|
|
292
|
+
findNetworkClientIdByChainId,
|
|
278
293
|
getNetworkClientById: (networkClientId) => {
|
|
279
294
|
return this.messagingSystem.call(
|
|
280
295
|
`NetworkController:getNetworkClientById`,
|
|
@@ -308,9 +323,9 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
308
323
|
});
|
|
309
324
|
this.gasFeeFlows = _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _getGasFeeFlows, getGasFeeFlows_fn).call(this);
|
|
310
325
|
this.layer1GasFeeFlows = _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _getLayer1GasFeeFlows, getLayer1GasFeeFlows_fn).call(this);
|
|
311
|
-
const gasFeePoller = new (0,
|
|
312
|
-
|
|
313
|
-
gasFeeFlows: this.gasFeeFlows
|
|
326
|
+
const gasFeePoller = new (0, _chunk7DJO6UZAjs.GasFeePoller)({
|
|
327
|
+
findNetworkClientIdByChainId,
|
|
328
|
+
gasFeeFlows: this.gasFeeFlows,
|
|
314
329
|
getGasFeeControllerEstimates: this.getGasFeeEstimates,
|
|
315
330
|
getProvider: (chainId, networkClientId) => _chunkZ4BLTVTBjs.__privateGet.call(void 0, this, _multichainTrackingHelper).getProvider({
|
|
316
331
|
networkClientId,
|
|
@@ -438,15 +453,16 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
438
453
|
sendFlowHistory,
|
|
439
454
|
swaps = {},
|
|
440
455
|
type,
|
|
441
|
-
networkClientId
|
|
456
|
+
networkClientId: requestNetworkClientId
|
|
442
457
|
} = {}) {
|
|
443
458
|
_chunkS6VGOPUYjs.projectLogger.call(void 0, "Adding transaction", txParams);
|
|
444
459
|
txParams = _chunkUGFBA4GVjs.normalizeTransactionParams.call(void 0, txParams);
|
|
445
|
-
if (
|
|
460
|
+
if (requestNetworkClientId && !_chunkZ4BLTVTBjs.__privateGet.call(void 0, this, _multichainTrackingHelper).has(requestNetworkClientId)) {
|
|
446
461
|
throw new Error(
|
|
447
462
|
"The networkClientId for this transaction could not be found"
|
|
448
463
|
);
|
|
449
464
|
}
|
|
465
|
+
const networkClientId = requestNetworkClientId ?? _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _getGlobalNetworkClientId, getGlobalNetworkClientId_fn).call(this);
|
|
450
466
|
const isEIP1559Compatible = await this.getEIP1559Compatibility(
|
|
451
467
|
networkClientId
|
|
452
468
|
);
|
|
@@ -709,9 +725,7 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
709
725
|
_chunkUGFBA4GVjs.validateGasValues.call(void 0, gasValues);
|
|
710
726
|
}
|
|
711
727
|
_chunkS6VGOPUYjs.projectLogger.call(void 0, "Creating speed up transaction", transactionId, gasValues);
|
|
712
|
-
const transactionMeta = this.
|
|
713
|
-
({ id }) => id === transactionId
|
|
714
|
-
);
|
|
728
|
+
const transactionMeta = this.getTransaction(transactionId);
|
|
715
729
|
if (!transactionMeta) {
|
|
716
730
|
return;
|
|
717
731
|
}
|
|
@@ -760,7 +774,7 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
760
774
|
unsignedEthTx,
|
|
761
775
|
transactionMeta.txParams.from
|
|
762
776
|
);
|
|
763
|
-
const transactionMetaWithRsv =
|
|
777
|
+
const transactionMetaWithRsv = this.updateTransactionMetaRSV(
|
|
764
778
|
transactionMeta,
|
|
765
779
|
signedTx
|
|
766
780
|
);
|
|
@@ -1199,10 +1213,10 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
1199
1213
|
common
|
|
1200
1214
|
});
|
|
1201
1215
|
const initialTxAsSerializedHex = _util.bufferToHex.call(void 0, initialTxAsEthTx.serialize());
|
|
1202
|
-
if (this.
|
|
1216
|
+
if (this.approvingTransactionIds.has(initialTxAsSerializedHex)) {
|
|
1203
1217
|
return "";
|
|
1204
1218
|
}
|
|
1205
|
-
this.
|
|
1219
|
+
this.approvingTransactionIds.add(initialTxAsSerializedHex);
|
|
1206
1220
|
let rawTransactions, nonceLock;
|
|
1207
1221
|
try {
|
|
1208
1222
|
const fromAddress = initialTx.from;
|
|
@@ -1223,7 +1237,7 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
1223
1237
|
throw err;
|
|
1224
1238
|
} finally {
|
|
1225
1239
|
nonceLock?.releaseLock();
|
|
1226
|
-
this.
|
|
1240
|
+
this.approvingTransactionIds.delete(initialTxAsSerializedHex);
|
|
1227
1241
|
}
|
|
1228
1242
|
return rawTransactions;
|
|
1229
1243
|
}
|
|
@@ -1264,10 +1278,10 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
1264
1278
|
transactionMeta,
|
|
1265
1279
|
_lodash.pickBy.call(void 0, { hash, status })
|
|
1266
1280
|
);
|
|
1267
|
-
if (status === "submitted" /* submitted */) {
|
|
1281
|
+
if (updatedTransactionMeta.status === "submitted" /* submitted */) {
|
|
1268
1282
|
updatedTransactionMeta.submittedTime = (/* @__PURE__ */ new Date()).getTime();
|
|
1269
1283
|
}
|
|
1270
|
-
if (status === "failed" /* failed */) {
|
|
1284
|
+
if (updatedTransactionMeta.status === "failed" /* failed */) {
|
|
1271
1285
|
updatedTransactionMeta.error = _chunkUGFBA4GVjs.normalizeTxError.call(void 0, new Error(errorMessage));
|
|
1272
1286
|
}
|
|
1273
1287
|
this.updateTransaction(
|
|
@@ -1368,6 +1382,37 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
1368
1382
|
}
|
|
1369
1383
|
return filteredTransactions;
|
|
1370
1384
|
}
|
|
1385
|
+
async estimateGasFee({
|
|
1386
|
+
transactionParams,
|
|
1387
|
+
chainId,
|
|
1388
|
+
networkClientId: requestNetworkClientId
|
|
1389
|
+
}) {
|
|
1390
|
+
const networkClientId = _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _getNetworkClientId, getNetworkClientId_fn).call(this, {
|
|
1391
|
+
networkClientId: requestNetworkClientId,
|
|
1392
|
+
chainId
|
|
1393
|
+
});
|
|
1394
|
+
const transactionMeta = {
|
|
1395
|
+
txParams: transactionParams,
|
|
1396
|
+
chainId,
|
|
1397
|
+
networkClientId
|
|
1398
|
+
};
|
|
1399
|
+
const gasFeeFlow = _chunkEMDU4XLMjs.getGasFeeFlow.call(void 0,
|
|
1400
|
+
transactionMeta,
|
|
1401
|
+
this.gasFeeFlows
|
|
1402
|
+
);
|
|
1403
|
+
const ethQuery = _chunkZ4BLTVTBjs.__privateGet.call(void 0, this, _multichainTrackingHelper).getEthQuery({
|
|
1404
|
+
networkClientId,
|
|
1405
|
+
chainId
|
|
1406
|
+
});
|
|
1407
|
+
const gasFeeControllerData = await this.getGasFeeEstimates({
|
|
1408
|
+
networkClientId
|
|
1409
|
+
});
|
|
1410
|
+
return gasFeeFlow.getGasFees({
|
|
1411
|
+
ethQuery,
|
|
1412
|
+
gasFeeControllerData,
|
|
1413
|
+
transactionMeta
|
|
1414
|
+
});
|
|
1415
|
+
}
|
|
1371
1416
|
/**
|
|
1372
1417
|
* Determine the layer 1 gas fee for the given transaction parameters.
|
|
1373
1418
|
*
|
|
@@ -1457,10 +1502,7 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
1457
1502
|
async updateGasProperties(transactionMeta) {
|
|
1458
1503
|
const isEIP1559Compatible = await this.getEIP1559Compatibility(transactionMeta.networkClientId) && transactionMeta.txParams.type !== "0x0" /* legacy */;
|
|
1459
1504
|
const { networkClientId, chainId } = transactionMeta;
|
|
1460
|
-
const isCustomNetwork =
|
|
1461
|
-
`NetworkController:getNetworkClientById`,
|
|
1462
|
-
networkClientId
|
|
1463
|
-
).configuration.type === _networkcontroller.NetworkClientType.Custom : this.getNetworkState().providerConfig.type === _controllerutils.NetworkType.rpc;
|
|
1505
|
+
const isCustomNetwork = _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _isCustomNetwork, isCustomNetwork_fn).call(this, networkClientId);
|
|
1464
1506
|
const ethQuery = _chunkZ4BLTVTBjs.__privateGet.call(void 0, this, _multichainTrackingHelper).getEthQuery({
|
|
1465
1507
|
networkClientId,
|
|
1466
1508
|
chainId
|
|
@@ -1475,7 +1517,7 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
1475
1517
|
isCustomNetwork,
|
|
1476
1518
|
txMeta: transactionMeta
|
|
1477
1519
|
});
|
|
1478
|
-
await
|
|
1520
|
+
await _chunkKNYSD4JPjs.updateGasFees.call(void 0, {
|
|
1479
1521
|
eip1559: isEIP1559Compatible,
|
|
1480
1522
|
ethQuery,
|
|
1481
1523
|
gasFeeFlows: this.gasFeeFlows,
|
|
@@ -1595,68 +1637,62 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
1595
1637
|
* @param transactionId - The ID of the transaction to approve.
|
|
1596
1638
|
*/
|
|
1597
1639
|
async approveTransaction(transactionId) {
|
|
1598
|
-
const
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
const transactionMeta = transactions[index];
|
|
1602
|
-
const updatedTransactionMeta = _lodash.cloneDeep.call(void 0, transactionMeta);
|
|
1603
|
-
const {
|
|
1604
|
-
txParams: { from },
|
|
1605
|
-
networkClientId
|
|
1606
|
-
} = transactionMeta;
|
|
1607
|
-
let releaseNonceLock;
|
|
1640
|
+
const cleanupTasks = new Array();
|
|
1641
|
+
cleanupTasks.push(await this.mutex.acquire());
|
|
1642
|
+
let transactionMeta = this.getTransactionOrThrow(transactionId);
|
|
1608
1643
|
try {
|
|
1609
1644
|
if (!this.sign) {
|
|
1610
|
-
releaseLock();
|
|
1611
1645
|
this.failTransaction(
|
|
1612
1646
|
transactionMeta,
|
|
1613
1647
|
new Error("No sign method defined.")
|
|
1614
1648
|
);
|
|
1615
1649
|
return "not-approved" /* NotApproved */;
|
|
1616
1650
|
} else if (!transactionMeta.chainId) {
|
|
1617
|
-
releaseLock();
|
|
1618
1651
|
this.failTransaction(transactionMeta, new Error("No chainId defined."));
|
|
1619
1652
|
return "not-approved" /* NotApproved */;
|
|
1620
1653
|
}
|
|
1621
|
-
if (this.
|
|
1654
|
+
if (this.approvingTransactionIds.has(transactionId)) {
|
|
1622
1655
|
_chunkS6VGOPUYjs.projectLogger.call(void 0, "Skipping approval as signing in progress", transactionId);
|
|
1623
1656
|
return "not-approved" /* NotApproved */;
|
|
1624
1657
|
}
|
|
1658
|
+
this.approvingTransactionIds.add(transactionId);
|
|
1659
|
+
cleanupTasks.push(
|
|
1660
|
+
() => this.approvingTransactionIds.delete(transactionId)
|
|
1661
|
+
);
|
|
1625
1662
|
const [nonce, releaseNonce] = await _chunkZNZEJDOEjs.getNextNonce.call(void 0,
|
|
1626
1663
|
transactionMeta,
|
|
1627
|
-
(address) => _chunkZ4BLTVTBjs.__privateGet.call(void 0, this, _multichainTrackingHelper).getNonceLock(
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
updatedTransactionMeta.txParams = {
|
|
1632
|
-
...updatedTransactionMeta.txParams,
|
|
1633
|
-
nonce,
|
|
1634
|
-
chainId: transactionMeta.chainId
|
|
1635
|
-
};
|
|
1636
|
-
const baseTxParams = {
|
|
1637
|
-
...updatedTransactionMeta.txParams,
|
|
1638
|
-
gasLimit: updatedTransactionMeta.txParams.gas
|
|
1639
|
-
};
|
|
1640
|
-
this.updateTransaction(
|
|
1641
|
-
updatedTransactionMeta,
|
|
1642
|
-
"TransactionController#approveTransaction - Transaction approved"
|
|
1664
|
+
(address) => _chunkZ4BLTVTBjs.__privateGet.call(void 0, this, _multichainTrackingHelper).getNonceLock(
|
|
1665
|
+
address,
|
|
1666
|
+
transactionMeta.networkClientId
|
|
1667
|
+
)
|
|
1643
1668
|
);
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1669
|
+
releaseNonce && cleanupTasks.push(releaseNonce);
|
|
1670
|
+
transactionMeta = _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _updateTransactionInternal, updateTransactionInternal_fn).call(this, {
|
|
1671
|
+
transactionId,
|
|
1672
|
+
note: "TransactionController#approveTransaction - Transaction approved"
|
|
1673
|
+
}, (draftTxMeta) => {
|
|
1674
|
+
const { txParams, chainId } = draftTxMeta;
|
|
1675
|
+
draftTxMeta.status = "approved" /* approved */;
|
|
1676
|
+
draftTxMeta.txParams = {
|
|
1677
|
+
...txParams,
|
|
1678
|
+
nonce,
|
|
1679
|
+
chainId,
|
|
1680
|
+
gasLimit: txParams.gas,
|
|
1681
|
+
..._chunkUGFBA4GVjs.isEIP1559Transaction.call(void 0, txParams) && {
|
|
1682
|
+
type: "0x2" /* feeMarket */
|
|
1683
|
+
}
|
|
1684
|
+
};
|
|
1685
|
+
});
|
|
1686
|
+
this.onTransactionStatusChange(transactionMeta);
|
|
1651
1687
|
const rawTx = await this.signTransaction(
|
|
1652
|
-
|
|
1653
|
-
txParams
|
|
1688
|
+
transactionMeta,
|
|
1689
|
+
transactionMeta.txParams
|
|
1654
1690
|
);
|
|
1655
|
-
if (!this.beforePublish(
|
|
1691
|
+
if (!this.beforePublish(transactionMeta)) {
|
|
1656
1692
|
_chunkS6VGOPUYjs.projectLogger.call(void 0, "Skipping publishing transaction based on hook");
|
|
1657
1693
|
this.messagingSystem.publish(
|
|
1658
1694
|
`${controllerName}:transactionPublishingSkipped`,
|
|
1659
|
-
|
|
1695
|
+
transactionMeta
|
|
1660
1696
|
);
|
|
1661
1697
|
return "skipped-via-before-publish-hook" /* SkippedViaBeforePublishHook */;
|
|
1662
1698
|
}
|
|
@@ -1667,51 +1703,50 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
1667
1703
|
networkClientId: transactionMeta.networkClientId,
|
|
1668
1704
|
chainId: transactionMeta.chainId
|
|
1669
1705
|
});
|
|
1670
|
-
|
|
1706
|
+
let preTxBalance;
|
|
1707
|
+
const shouldUpdatePreTxBalance = transactionMeta.type === "swap" /* swap */;
|
|
1708
|
+
if (shouldUpdatePreTxBalance) {
|
|
1671
1709
|
_chunkS6VGOPUYjs.projectLogger.call(void 0, "Determining pre-transaction balance");
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
"Updated pre-transaction balance",
|
|
1676
|
-
updatedTransactionMeta.preTxBalance
|
|
1677
|
-
);
|
|
1710
|
+
preTxBalance = await _controllerutils.query.call(void 0, ethQuery, "getBalance", [
|
|
1711
|
+
transactionMeta.txParams.from
|
|
1712
|
+
]);
|
|
1678
1713
|
}
|
|
1679
|
-
_chunkS6VGOPUYjs.projectLogger.call(void 0, "Publishing transaction", txParams);
|
|
1714
|
+
_chunkS6VGOPUYjs.projectLogger.call(void 0, "Publishing transaction", transactionMeta.txParams);
|
|
1680
1715
|
let { transactionHash: hash } = await this.publish(
|
|
1681
|
-
|
|
1716
|
+
transactionMeta,
|
|
1682
1717
|
rawTx
|
|
1683
1718
|
);
|
|
1684
1719
|
if (hash === void 0) {
|
|
1685
1720
|
hash = await this.publishTransaction(ethQuery, rawTx);
|
|
1686
1721
|
}
|
|
1687
1722
|
_chunkS6VGOPUYjs.projectLogger.call(void 0, "Publish successful", hash);
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
"
|
|
1694
|
-
|
|
1723
|
+
transactionMeta = _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _updateTransactionInternal, updateTransactionInternal_fn).call(this, {
|
|
1724
|
+
transactionId,
|
|
1725
|
+
note: "TransactionController#approveTransaction - Transaction submitted"
|
|
1726
|
+
}, (draftTxMeta) => {
|
|
1727
|
+
draftTxMeta.hash = hash;
|
|
1728
|
+
draftTxMeta.status = "submitted" /* submitted */;
|
|
1729
|
+
draftTxMeta.submittedTime = (/* @__PURE__ */ new Date()).getTime();
|
|
1730
|
+
if (shouldUpdatePreTxBalance) {
|
|
1731
|
+
draftTxMeta.preTxBalance = preTxBalance;
|
|
1732
|
+
_chunkS6VGOPUYjs.projectLogger.call(void 0, "Updated pre-transaction balance", preTxBalance);
|
|
1733
|
+
}
|
|
1734
|
+
});
|
|
1695
1735
|
this.messagingSystem.publish(`${controllerName}:transactionSubmitted`, {
|
|
1696
|
-
transactionMeta
|
|
1736
|
+
transactionMeta
|
|
1697
1737
|
});
|
|
1698
1738
|
this.messagingSystem.publish(
|
|
1699
1739
|
`${controllerName}:transactionFinished`,
|
|
1700
|
-
|
|
1701
|
-
);
|
|
1702
|
-
_chunkZ4BLTVTBjs.__privateGet.call(void 0, this, _internalEvents).emit(
|
|
1703
|
-
`${updatedTransactionMeta.id}:finished`,
|
|
1704
|
-
updatedTransactionMeta
|
|
1740
|
+
transactionMeta
|
|
1705
1741
|
);
|
|
1706
|
-
this.
|
|
1742
|
+
_chunkZ4BLTVTBjs.__privateGet.call(void 0, this, _internalEvents).emit(`${transactionId}:finished`, transactionMeta);
|
|
1743
|
+
this.onTransactionStatusChange(transactionMeta);
|
|
1707
1744
|
return "approved" /* Approved */;
|
|
1708
1745
|
} catch (error) {
|
|
1709
1746
|
this.failTransaction(transactionMeta, error);
|
|
1710
1747
|
return "not-approved" /* NotApproved */;
|
|
1711
1748
|
} finally {
|
|
1712
|
-
|
|
1713
|
-
releaseNonceLock?.();
|
|
1714
|
-
releaseLock();
|
|
1749
|
+
cleanupTasks.forEach((task) => task());
|
|
1715
1750
|
}
|
|
1716
1751
|
}
|
|
1717
1752
|
async publishTransaction(ethQuery, rawTransaction) {
|
|
@@ -1833,6 +1868,15 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
1833
1868
|
const { transactions } = this.state;
|
|
1834
1869
|
return transactions.find(({ id }) => id === transactionId);
|
|
1835
1870
|
}
|
|
1871
|
+
getTransactionOrThrow(transactionId, errorMessagePrefix = "TransactionController") {
|
|
1872
|
+
const txMeta = this.getTransaction(transactionId);
|
|
1873
|
+
if (!txMeta) {
|
|
1874
|
+
throw new Error(
|
|
1875
|
+
`${errorMessagePrefix}: No transaction found with id ${transactionId}`
|
|
1876
|
+
);
|
|
1877
|
+
}
|
|
1878
|
+
return txMeta;
|
|
1879
|
+
}
|
|
1836
1880
|
getApprovalId(txMeta) {
|
|
1837
1881
|
return String(txMeta.id);
|
|
1838
1882
|
}
|
|
@@ -1845,14 +1889,15 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
1845
1889
|
return { meta: transaction, isCompleted };
|
|
1846
1890
|
}
|
|
1847
1891
|
getChainId(networkClientId) {
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
).configuration.chainId;
|
|
1892
|
+
const globalChainId = _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _getGlobalChainId, getGlobalChainId_fn).call(this);
|
|
1893
|
+
const globalNetworkClientId = _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _getGlobalNetworkClientId, getGlobalNetworkClientId_fn).call(this);
|
|
1894
|
+
if (!networkClientId || networkClientId === globalNetworkClientId) {
|
|
1895
|
+
return globalChainId;
|
|
1853
1896
|
}
|
|
1854
|
-
|
|
1855
|
-
|
|
1897
|
+
return this.messagingSystem.call(
|
|
1898
|
+
`NetworkController:getNetworkClientById`,
|
|
1899
|
+
networkClientId
|
|
1900
|
+
).configuration.chainId;
|
|
1856
1901
|
}
|
|
1857
1902
|
prepareUnsignedEthTx(chainId, txParams) {
|
|
1858
1903
|
return _tx.TransactionFactory.fromTxData(txParams, {
|
|
@@ -2040,8 +2085,9 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
2040
2085
|
*
|
|
2041
2086
|
* @param transactionMeta - The TransactionMeta object to update.
|
|
2042
2087
|
* @param signedTx - The encompassing type for all transaction types containing r, s, and v values.
|
|
2088
|
+
* @returns The updated TransactionMeta object.
|
|
2043
2089
|
*/
|
|
2044
|
-
|
|
2090
|
+
updateTransactionMetaRSV(transactionMeta, signedTx) {
|
|
2045
2091
|
const transactionMetaWithRsv = _lodash.cloneDeep.call(void 0, transactionMeta);
|
|
2046
2092
|
for (const key of ["r", "s", "v"]) {
|
|
2047
2093
|
const value = signedTx[key];
|
|
@@ -2063,7 +2109,7 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
2063
2109
|
transactionMeta.chainId,
|
|
2064
2110
|
txParams
|
|
2065
2111
|
);
|
|
2066
|
-
this.
|
|
2112
|
+
this.approvingTransactionIds.add(transactionMeta.id);
|
|
2067
2113
|
const signedTx = await new Promise((resolve, reject) => {
|
|
2068
2114
|
this.sign?.(
|
|
2069
2115
|
unsignedEthTx,
|
|
@@ -2089,7 +2135,7 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
2089
2135
|
return void 0;
|
|
2090
2136
|
}
|
|
2091
2137
|
const transactionMetaWithRsv = {
|
|
2092
|
-
...
|
|
2138
|
+
...this.updateTransactionMetaRSV(transactionMeta, signedTx),
|
|
2093
2139
|
status: "signed" /* signed */
|
|
2094
2140
|
};
|
|
2095
2141
|
this.updateTransaction(
|
|
@@ -2187,6 +2233,7 @@ _incomingTransactionOptions = new WeakMap();
|
|
|
2187
2233
|
_pendingTransactionOptions = new WeakMap();
|
|
2188
2234
|
_transactionHistoryLimit = new WeakMap();
|
|
2189
2235
|
_isSimulationEnabled = new WeakMap();
|
|
2236
|
+
_testGasFeeFlows = new WeakMap();
|
|
2190
2237
|
_multichainTrackingHelper = new WeakMap();
|
|
2191
2238
|
_createNonceTracker = new WeakSet();
|
|
2192
2239
|
createNonceTracker_fn = function({
|
|
@@ -2326,7 +2373,10 @@ getNonceTrackerPendingTransactions_fn = function(chainId, address) {
|
|
|
2326
2373
|
};
|
|
2327
2374
|
_getGasFeeFlows = new WeakSet();
|
|
2328
2375
|
getGasFeeFlows_fn = function() {
|
|
2329
|
-
|
|
2376
|
+
if (_chunkZ4BLTVTBjs.__privateGet.call(void 0, this, _testGasFeeFlows)) {
|
|
2377
|
+
return [new (0, _chunkTJMQEH57js.TestGasFeeFlow)()];
|
|
2378
|
+
}
|
|
2379
|
+
return [new (0, _chunkDUFOYA4Djs.LineaGasFeeFlow)(), new (0, _chunkVJYFB7BMjs.DefaultGasFeeFlow)()];
|
|
2330
2380
|
};
|
|
2331
2381
|
_getLayer1GasFeeFlows = new WeakSet();
|
|
2332
2382
|
getLayer1GasFeeFlows_fn = function() {
|
|
@@ -2364,6 +2414,7 @@ updateTransactionInternal_fn = function({
|
|
|
2364
2414
|
if (updatedTransactionParams.length > 0) {
|
|
2365
2415
|
_chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _onTransactionParamsUpdated, onTransactionParamsUpdated_fn).call(this, transactionMeta, updatedTransactionParams);
|
|
2366
2416
|
}
|
|
2417
|
+
return transactionMeta;
|
|
2367
2418
|
};
|
|
2368
2419
|
_checkIfTransactionParamsUpdated = new WeakSet();
|
|
2369
2420
|
checkIfTransactionParamsUpdated_fn = function(newTransactionMeta) {
|
|
@@ -2453,6 +2504,43 @@ onGasFeePollerTransactionUpdate_fn = function({
|
|
|
2453
2504
|
}
|
|
2454
2505
|
});
|
|
2455
2506
|
};
|
|
2507
|
+
_getNetworkClientId = new WeakSet();
|
|
2508
|
+
getNetworkClientId_fn = function({
|
|
2509
|
+
networkClientId: requestNetworkClientId,
|
|
2510
|
+
chainId
|
|
2511
|
+
}) {
|
|
2512
|
+
const globalChainId = _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _getGlobalChainId, getGlobalChainId_fn).call(this);
|
|
2513
|
+
const globalNetworkClientId = _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _getGlobalNetworkClientId, getGlobalNetworkClientId_fn).call(this);
|
|
2514
|
+
if (requestNetworkClientId) {
|
|
2515
|
+
return requestNetworkClientId;
|
|
2516
|
+
}
|
|
2517
|
+
if (!chainId || chainId === globalChainId) {
|
|
2518
|
+
return globalNetworkClientId;
|
|
2519
|
+
}
|
|
2520
|
+
return this.messagingSystem.call(
|
|
2521
|
+
`NetworkController:findNetworkClientIdByChainId`,
|
|
2522
|
+
chainId
|
|
2523
|
+
);
|
|
2524
|
+
};
|
|
2525
|
+
_getGlobalNetworkClientId = new WeakSet();
|
|
2526
|
+
getGlobalNetworkClientId_fn = function() {
|
|
2527
|
+
return this.getNetworkState().selectedNetworkClientId;
|
|
2528
|
+
};
|
|
2529
|
+
_getGlobalChainId = new WeakSet();
|
|
2530
|
+
getGlobalChainId_fn = function() {
|
|
2531
|
+
return this.getNetworkState().providerConfig.chainId;
|
|
2532
|
+
};
|
|
2533
|
+
_isCustomNetwork = new WeakSet();
|
|
2534
|
+
isCustomNetwork_fn = function(networkClientId) {
|
|
2535
|
+
const globalNetworkClientId = _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _getGlobalNetworkClientId, getGlobalNetworkClientId_fn).call(this);
|
|
2536
|
+
if (!networkClientId || networkClientId === globalNetworkClientId) {
|
|
2537
|
+
return this.getNetworkState().providerConfig.type === _controllerutils.NetworkType.rpc;
|
|
2538
|
+
}
|
|
2539
|
+
return this.messagingSystem.call(
|
|
2540
|
+
`NetworkController:getNetworkClientById`,
|
|
2541
|
+
networkClientId
|
|
2542
|
+
).configuration.type === _networkcontroller.NetworkClientType.Custom;
|
|
2543
|
+
};
|
|
2456
2544
|
|
|
2457
2545
|
|
|
2458
2546
|
|
|
@@ -2461,4 +2549,4 @@ onGasFeePollerTransactionUpdate_fn = function({
|
|
|
2461
2549
|
|
|
2462
2550
|
|
|
2463
2551
|
exports.HARDFORK = HARDFORK; exports.CANCEL_RATE = CANCEL_RATE; exports.SPEED_UP_RATE = SPEED_UP_RATE; exports.ApprovalState = ApprovalState; exports.TransactionController = TransactionController;
|
|
2464
|
-
//# sourceMappingURL=chunk-
|
|
2552
|
+
//# sourceMappingURL=chunk-KT3F6CZP.js.map
|