@metamask/transaction-controller 35.1.1 → 36.0.0
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 +31 -1
- package/dist/TransactionController.js +12 -11
- package/dist/TransactionController.mjs +11 -10
- package/dist/{chunk-GPS6RX64.js → chunk-4OYPDGHO.js} +6 -6
- package/dist/{chunk-2EU6346V.js → chunk-5HYWLTVQ.js} +3 -3
- package/dist/chunk-5QVDIVJH.js +68 -0
- package/dist/chunk-5QVDIVJH.js.map +1 -0
- package/dist/{chunk-H2KZOK3J.mjs → chunk-AWIJZAW3.mjs} +3 -3
- package/dist/{chunk-C3WC4OJ3.js → chunk-BZV72SCF.js} +5 -5
- package/dist/{chunk-QTKXIDGE.js → chunk-EHWAY6XU.js} +9 -9
- package/dist/{chunk-GNAL5HC2.mjs → chunk-JIFPK37W.mjs} +2 -2
- package/dist/chunk-JOQK7A5G.mjs +68 -0
- package/dist/chunk-JOQK7A5G.mjs.map +1 -0
- package/dist/{chunk-OZ6UB42C.js → chunk-KTGMNUTQ.js} +2 -23
- package/dist/chunk-KTGMNUTQ.js.map +1 -0
- package/dist/{chunk-UHG2LLVV.mjs → chunk-KYRW4BLA.mjs} +3 -3
- package/dist/{chunk-6SJYXSF3.mjs → chunk-LFFYCDHB.mjs} +1 -1
- package/dist/{chunk-6SJYXSF3.mjs.map → chunk-LFFYCDHB.mjs.map} +1 -1
- package/dist/{chunk-JXXTNVU4.mjs → chunk-NNHSNPT2.mjs} +2 -2
- package/dist/{chunk-AYTU4HU5.js → chunk-PSZ34BI5.js} +1 -1
- package/dist/{chunk-AYTU4HU5.js.map → chunk-PSZ34BI5.js.map} +1 -1
- package/dist/{chunk-QH2H4W3N.js → chunk-QKV7E5BO.js} +5 -5
- package/dist/{chunk-VXNPVIYL.mjs → chunk-SFFOC25Q.mjs} +3 -3
- package/dist/{chunk-ARZHJFVG.js → chunk-UHAFIPSL.js} +6 -6
- package/dist/{chunk-Q56I5ONX.mjs → chunk-UHSRHP55.mjs} +1 -22
- package/dist/chunk-UHSRHP55.mjs.map +1 -0
- package/dist/{chunk-SFFTNB2X.mjs → chunk-VGFPVAKX.mjs} +2 -2
- package/dist/{chunk-S3RZBMF7.js → chunk-VKWOHNDO.js} +214 -284
- package/dist/chunk-VKWOHNDO.js.map +1 -0
- package/dist/{chunk-LTPS73D7.mjs → chunk-X4XSEYPL.mjs} +3 -3
- package/dist/{chunk-T3GOPPVF.mjs → chunk-XTMJ25EF.mjs} +195 -265
- package/dist/chunk-XTMJ25EF.mjs.map +1 -0
- package/dist/{chunk-76FONEDA.js → chunk-YWLMT7XH.js} +4 -4
- package/dist/errors.js +1 -1
- package/dist/errors.mjs +1 -1
- package/dist/gas-flows/DefaultGasFeeFlow.js +7 -7
- package/dist/gas-flows/DefaultGasFeeFlow.mjs +6 -6
- package/dist/gas-flows/LineaGasFeeFlow.js +8 -8
- package/dist/gas-flows/LineaGasFeeFlow.mjs +7 -7
- package/dist/gas-flows/TestGasFeeFlow.js +1 -1
- package/dist/gas-flows/TestGasFeeFlow.mjs +1 -1
- 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 +12 -11
- package/dist/index.mjs +11 -10
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/TransactionController.d.ts +8 -10
- package/dist/types/TransactionController.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 +40 -0
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils/retry.d.ts +11 -0
- package/dist/types/utils/retry.d.ts.map +1 -0
- package/dist/types/utils/utils.d.ts +1 -15
- package/dist/types/utils/utils.d.ts.map +1 -1
- package/dist/types.js +2 -2
- package/dist/types.mjs +1 -1
- package/dist/utils/external-transactions.js +1 -1
- package/dist/utils/external-transactions.mjs +1 -1
- package/dist/utils/gas-fees.js +6 -6
- package/dist/utils/gas-fees.mjs +5 -5
- package/dist/utils/gas-flow.js +3 -3
- package/dist/utils/gas-flow.mjs +2 -2
- package/dist/utils/retry.js +8 -0
- package/dist/utils/retry.js.map +1 -0
- package/dist/utils/retry.mjs +8 -0
- package/dist/utils/retry.mjs.map +1 -0
- 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 +4 -4
- package/dist/utils/swaps.mjs +3 -3
- package/dist/utils/transaction-type.js +1 -1
- package/dist/utils/transaction-type.mjs +1 -1
- package/dist/utils/utils.js +3 -13
- package/dist/utils/utils.mjs +4 -14
- package/dist/utils/validation.js +4 -4
- package/dist/utils/validation.mjs +3 -3
- package/package.json +11 -10
- package/dist/chunk-OZ6UB42C.js.map +0 -1
- package/dist/chunk-Q56I5ONX.mjs.map +0 -1
- package/dist/chunk-S3RZBMF7.js.map +0 -1
- package/dist/chunk-T3GOPPVF.mjs.map +0 -1
- /package/dist/{chunk-GPS6RX64.js.map → chunk-4OYPDGHO.js.map} +0 -0
- /package/dist/{chunk-2EU6346V.js.map → chunk-5HYWLTVQ.js.map} +0 -0
- /package/dist/{chunk-H2KZOK3J.mjs.map → chunk-AWIJZAW3.mjs.map} +0 -0
- /package/dist/{chunk-C3WC4OJ3.js.map → chunk-BZV72SCF.js.map} +0 -0
- /package/dist/{chunk-QTKXIDGE.js.map → chunk-EHWAY6XU.js.map} +0 -0
- /package/dist/{chunk-GNAL5HC2.mjs.map → chunk-JIFPK37W.mjs.map} +0 -0
- /package/dist/{chunk-UHG2LLVV.mjs.map → chunk-KYRW4BLA.mjs.map} +0 -0
- /package/dist/{chunk-JXXTNVU4.mjs.map → chunk-NNHSNPT2.mjs.map} +0 -0
- /package/dist/{chunk-QH2H4W3N.js.map → chunk-QKV7E5BO.js.map} +0 -0
- /package/dist/{chunk-VXNPVIYL.mjs.map → chunk-SFFOC25Q.mjs.map} +0 -0
- /package/dist/{chunk-ARZHJFVG.js.map → chunk-UHAFIPSL.js.map} +0 -0
- /package/dist/{chunk-SFFTNB2X.mjs.map → chunk-VGFPVAKX.mjs.map} +0 -0
- /package/dist/{chunk-LTPS73D7.mjs.map → chunk-X4XSEYPL.mjs.map} +0 -0
- /package/dist/{chunk-76FONEDA.js.map → chunk-YWLMT7XH.js.map} +0 -0
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
var _chunkPRUNMTRDjs = require('./chunk-PRUNMTRD.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
+
var _chunk5QVDIVJHjs = require('./chunk-5QVDIVJH.js');
|
|
8
|
+
|
|
9
|
+
|
|
7
10
|
var _chunkNNCUD3QFjs = require('./chunk-NNCUD3QF.js');
|
|
8
11
|
|
|
9
12
|
|
|
@@ -11,7 +14,7 @@ var _chunkSD6CWFDFjs = require('./chunk-SD6CWFDF.js');
|
|
|
11
14
|
|
|
12
15
|
|
|
13
16
|
|
|
14
|
-
var
|
|
17
|
+
var _chunk4OYPDGHOjs = require('./chunk-4OYPDGHO.js');
|
|
15
18
|
|
|
16
19
|
|
|
17
20
|
var _chunkULD4JC3Qjs = require('./chunk-ULD4JC3Q.js');
|
|
@@ -38,7 +41,7 @@ var _chunkWR5F34OWjs = require('./chunk-WR5F34OW.js');
|
|
|
38
41
|
var _chunkTJMQEH57js = require('./chunk-TJMQEH57.js');
|
|
39
42
|
|
|
40
43
|
|
|
41
|
-
var
|
|
44
|
+
var _chunk5HYWLTVQjs = require('./chunk-5HYWLTVQ.js');
|
|
42
45
|
|
|
43
46
|
|
|
44
47
|
|
|
@@ -54,20 +57,17 @@ var _chunk6OLJWLKKjs = require('./chunk-6OLJWLKK.js');
|
|
|
54
57
|
var _chunk7NMV2NPMjs = require('./chunk-7NMV2NPM.js');
|
|
55
58
|
|
|
56
59
|
|
|
57
|
-
var
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
var _chunkQTKXIDGEjs = require('./chunk-QTKXIDGE.js');
|
|
61
|
-
|
|
60
|
+
var _chunkUHAFIPSLjs = require('./chunk-UHAFIPSL.js');
|
|
62
61
|
|
|
63
|
-
var _chunkC3WC4OJ3js = require('./chunk-C3WC4OJ3.js');
|
|
64
62
|
|
|
63
|
+
var _chunkEHWAY6XUjs = require('./chunk-EHWAY6XU.js');
|
|
65
64
|
|
|
66
65
|
|
|
67
|
-
var
|
|
66
|
+
var _chunkBZV72SCFjs = require('./chunk-BZV72SCF.js');
|
|
68
67
|
|
|
69
68
|
|
|
70
69
|
|
|
70
|
+
var _chunkQKV7E5BOjs = require('./chunk-QKV7E5BO.js');
|
|
71
71
|
|
|
72
72
|
|
|
73
73
|
|
|
@@ -75,11 +75,10 @@ var _chunkQH2H4W3Njs = require('./chunk-QH2H4W3N.js');
|
|
|
75
75
|
|
|
76
76
|
|
|
77
77
|
|
|
78
|
+
var _chunkKTGMNUTQjs = require('./chunk-KTGMNUTQ.js');
|
|
78
79
|
|
|
79
|
-
var _chunkOZ6UB42Cjs = require('./chunk-OZ6UB42C.js');
|
|
80
80
|
|
|
81
|
-
|
|
82
|
-
var _chunk76FONEDAjs = require('./chunk-76FONEDA.js');
|
|
81
|
+
var _chunkYWLMT7XHjs = require('./chunk-YWLMT7XH.js');
|
|
83
82
|
|
|
84
83
|
|
|
85
84
|
var _chunkS6VGOPUYjs = require('./chunk-S6VGOPUY.js');
|
|
@@ -143,7 +142,7 @@ function getDefaultTransactionControllerState() {
|
|
|
143
142
|
lastFetchedBlockNumbers: {}
|
|
144
143
|
};
|
|
145
144
|
}
|
|
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, _getSelectedAccount, getSelectedAccount_fn;
|
|
145
|
+
var _internalEvents, _incomingTransactionOptions, _pendingTransactionOptions, _trace, _transactionHistoryLimit, _isSimulationEnabled, _testGasFeeFlows, _multichainTrackingHelper, _retryTransaction, retryTransaction_fn, _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, _getSelectedAccount, getSelectedAccount_fn;
|
|
147
146
|
var TransactionController = class extends _basecontroller.BaseController {
|
|
148
147
|
/**
|
|
149
148
|
* Constructs a TransactionController.
|
|
@@ -172,6 +171,7 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
172
171
|
* @param options.sign - Function used to sign transactions.
|
|
173
172
|
* @param options.state - Initial state to set on this controller.
|
|
174
173
|
* @param options.testGasFeeFlows - Whether to use the test gas fee flow.
|
|
174
|
+
* @param options.trace - Callback to generate trace information.
|
|
175
175
|
* @param options.transactionHistoryLimit - Transaction history limit.
|
|
176
176
|
* @param options.hooks - The controller hooks.
|
|
177
177
|
*/
|
|
@@ -199,6 +199,7 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
199
199
|
sign,
|
|
200
200
|
state,
|
|
201
201
|
testGasFeeFlows,
|
|
202
|
+
trace,
|
|
202
203
|
transactionHistoryLimit = 40,
|
|
203
204
|
hooks
|
|
204
205
|
}) {
|
|
@@ -211,6 +212,7 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
211
212
|
...state
|
|
212
213
|
}
|
|
213
214
|
});
|
|
215
|
+
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _retryTransaction);
|
|
214
216
|
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _createNonceTracker);
|
|
215
217
|
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _createIncomingTransactionHelper);
|
|
216
218
|
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _createPendingTransactionTracker);
|
|
@@ -238,6 +240,7 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
238
240
|
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _incomingTransactionOptions, void 0);
|
|
239
241
|
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _pendingTransactionOptions, void 0);
|
|
240
242
|
this.signAbortCallbacks = /* @__PURE__ */ new Map();
|
|
243
|
+
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _trace, void 0);
|
|
241
244
|
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _transactionHistoryLimit, void 0);
|
|
242
245
|
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _isSimulationEnabled, void 0);
|
|
243
246
|
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _testGasFeeFlows, void 0);
|
|
@@ -265,6 +268,7 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
265
268
|
_chunkZ4BLTVTBjs.__privateSet.call(void 0, this, _transactionHistoryLimit, transactionHistoryLimit);
|
|
266
269
|
this.sign = sign;
|
|
267
270
|
_chunkZ4BLTVTBjs.__privateSet.call(void 0, this, _testGasFeeFlows, testGasFeeFlows === true);
|
|
271
|
+
_chunkZ4BLTVTBjs.__privateSet.call(void 0, this, _trace, trace ?? ((_request, fn) => fn?.()));
|
|
268
272
|
this.afterSign = hooks?.afterSign ?? (() => true);
|
|
269
273
|
this.beforeApproveOnInit = hooks?.beforeApproveOnInit ?? (() => true);
|
|
270
274
|
this.beforeCheckPendingTransaction = hooks?.beforeCheckPendingTransaction ?? /* istanbul ignore next */
|
|
@@ -321,7 +325,7 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
321
325
|
});
|
|
322
326
|
this.gasFeeFlows = _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _getGasFeeFlows, getGasFeeFlows_fn).call(this);
|
|
323
327
|
this.layer1GasFeeFlows = _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _getLayer1GasFeeFlows, getLayer1GasFeeFlows_fn).call(this);
|
|
324
|
-
const gasFeePoller = new (0,
|
|
328
|
+
const gasFeePoller = new (0, _chunk5HYWLTVQjs.GasFeePoller)({
|
|
325
329
|
findNetworkClientIdByChainId,
|
|
326
330
|
gasFeeFlows: this.gasFeeFlows,
|
|
327
331
|
getGasFeeControllerEstimates: this.getGasFeeEstimates,
|
|
@@ -356,7 +360,7 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
356
360
|
}
|
|
357
361
|
failTransaction(transactionMeta, error, actionId) {
|
|
358
362
|
const newTransactionMeta = _lodash.merge.call(void 0, {}, transactionMeta, {
|
|
359
|
-
error:
|
|
363
|
+
error: _chunkKTGMNUTQjs.normalizeTxError.call(void 0, error),
|
|
360
364
|
status: "failed" /* failed */
|
|
361
365
|
});
|
|
362
366
|
this.messagingSystem.publish(`${controllerName}:transactionFailed`, {
|
|
@@ -439,6 +443,7 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
439
443
|
* @param opts.swaps.hasApproveTx - Whether the transaction has an approval transaction.
|
|
440
444
|
* @param opts.swaps.meta - Metadata for swap transaction.
|
|
441
445
|
* @param opts.networkClientId - The id of the network client for this transaction.
|
|
446
|
+
* @param opts.traceContext - The parent context for any new traces.
|
|
442
447
|
* @returns Object containing a promise resolving to the transaction hash if approved.
|
|
443
448
|
*/
|
|
444
449
|
async addTransaction(txParams, {
|
|
@@ -450,11 +455,12 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
450
455
|
securityAlertResponse,
|
|
451
456
|
sendFlowHistory,
|
|
452
457
|
swaps = {},
|
|
458
|
+
traceContext,
|
|
453
459
|
type,
|
|
454
460
|
networkClientId: requestNetworkClientId
|
|
455
461
|
} = {}) {
|
|
456
462
|
_chunkS6VGOPUYjs.projectLogger.call(void 0, "Adding transaction", txParams);
|
|
457
|
-
txParams =
|
|
463
|
+
txParams = _chunkKTGMNUTQjs.normalizeTransactionParams.call(void 0, txParams);
|
|
458
464
|
if (requestNetworkClientId && !_chunkZ4BLTVTBjs.__privateGet.call(void 0, this, _multichainTrackingHelper).has(requestNetworkClientId)) {
|
|
459
465
|
throw new Error(
|
|
460
466
|
"The networkClientId for this transaction could not be found"
|
|
@@ -464,9 +470,9 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
464
470
|
const isEIP1559Compatible = await this.getEIP1559Compatibility(
|
|
465
471
|
networkClientId
|
|
466
472
|
);
|
|
467
|
-
|
|
473
|
+
_chunk4OYPDGHOjs.validateTxParams.call(void 0, txParams, isEIP1559Compatible);
|
|
468
474
|
if (origin) {
|
|
469
|
-
await
|
|
475
|
+
await _chunk4OYPDGHOjs.validateTransactionOrigin.call(void 0,
|
|
470
476
|
await this.getPermittedAccounts(origin),
|
|
471
477
|
_chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _getSelectedAccount, getSelectedAccount_fn).call(this).address,
|
|
472
478
|
txParams.from,
|
|
@@ -501,7 +507,9 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
501
507
|
type: transactionType,
|
|
502
508
|
networkClientId
|
|
503
509
|
};
|
|
504
|
-
await this.updateGasProperties(addedTransactionMeta
|
|
510
|
+
await _chunkZ4BLTVTBjs.__privateGet.call(void 0, this, _trace).call(this, { name: "Estimate Gas Properties", parentContext: traceContext }, (context) => this.updateGasProperties(addedTransactionMeta, {
|
|
511
|
+
traceContext: context
|
|
512
|
+
}));
|
|
505
513
|
if (!existingTransactionMeta) {
|
|
506
514
|
if (method && this.securityProviderRequest) {
|
|
507
515
|
const securityProviderResponse = await this.securityProviderRequest(
|
|
@@ -516,7 +524,7 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
516
524
|
if (!this.isHistoryDisabled) {
|
|
517
525
|
addedTransactionMeta = _chunkTIE3CPF7js.addInitialHistorySnapshot.call(void 0, addedTransactionMeta);
|
|
518
526
|
}
|
|
519
|
-
addedTransactionMeta =
|
|
527
|
+
addedTransactionMeta = _chunkQKV7E5BOjs.updateSwapsTransaction.call(void 0,
|
|
520
528
|
addedTransactionMeta,
|
|
521
529
|
transactionType,
|
|
522
530
|
swaps,
|
|
@@ -528,7 +536,9 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
528
536
|
);
|
|
529
537
|
this.addMetadata(addedTransactionMeta);
|
|
530
538
|
if (requireApproval !== false) {
|
|
531
|
-
_chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _updateSimulationData, updateSimulationData_fn).call(this, addedTransactionMeta
|
|
539
|
+
_chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _updateSimulationData, updateSimulationData_fn).call(this, addedTransactionMeta, {
|
|
540
|
+
traceContext
|
|
541
|
+
}).catch((error) => {
|
|
532
542
|
_chunkS6VGOPUYjs.projectLogger.call(void 0, "Error while updating simulation data", error);
|
|
533
543
|
throw error;
|
|
534
544
|
});
|
|
@@ -544,7 +554,8 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
544
554
|
result: this.processApproval(addedTransactionMeta, {
|
|
545
555
|
isExisting: Boolean(existingTransactionMeta),
|
|
546
556
|
requireApproval,
|
|
547
|
-
actionId
|
|
557
|
+
actionId,
|
|
558
|
+
traceContext
|
|
548
559
|
}),
|
|
549
560
|
transactionMeta: addedTransactionMeta
|
|
550
561
|
};
|
|
@@ -594,116 +605,30 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
594
605
|
estimatedBaseFee,
|
|
595
606
|
actionId
|
|
596
607
|
} = {}) {
|
|
597
|
-
|
|
598
|
-
return;
|
|
599
|
-
}
|
|
600
|
-
if (gasValues) {
|
|
601
|
-
gasValues = _chunkOZ6UB42Cjs.normalizeGasFeeValues.call(void 0, gasValues);
|
|
602
|
-
_chunkOZ6UB42Cjs.validateGasValues.call(void 0, gasValues);
|
|
603
|
-
}
|
|
604
|
-
_chunkS6VGOPUYjs.projectLogger.call(void 0, "Creating cancel transaction", transactionId, gasValues);
|
|
605
|
-
const transactionMeta = this.getTransaction(transactionId);
|
|
606
|
-
if (!transactionMeta) {
|
|
607
|
-
return;
|
|
608
|
-
}
|
|
609
|
-
if (!this.sign) {
|
|
610
|
-
throw new Error("No sign method defined.");
|
|
611
|
-
}
|
|
612
|
-
const minGasPrice = _chunkOZ6UB42Cjs.getIncreasedPriceFromExisting.call(void 0,
|
|
613
|
-
transactionMeta.txParams.gasPrice,
|
|
614
|
-
CANCEL_RATE
|
|
615
|
-
);
|
|
616
|
-
const gasPriceFromValues = _chunkOZ6UB42Cjs.isGasPriceValue.call(void 0, gasValues) && gasValues.gasPrice;
|
|
617
|
-
const newGasPrice = gasPriceFromValues && _chunkOZ6UB42Cjs.validateMinimumIncrease.call(void 0, gasPriceFromValues, minGasPrice) || minGasPrice;
|
|
618
|
-
const existingMaxFeePerGas = transactionMeta.txParams?.maxFeePerGas;
|
|
619
|
-
const minMaxFeePerGas = _chunkOZ6UB42Cjs.getIncreasedPriceFromExisting.call(void 0,
|
|
620
|
-
existingMaxFeePerGas,
|
|
621
|
-
CANCEL_RATE
|
|
622
|
-
);
|
|
623
|
-
const maxFeePerGasValues = _chunkOZ6UB42Cjs.isFeeMarketEIP1559Values.call(void 0, gasValues) && gasValues.maxFeePerGas;
|
|
624
|
-
const newMaxFeePerGas = maxFeePerGasValues && _chunkOZ6UB42Cjs.validateMinimumIncrease.call(void 0, maxFeePerGasValues, minMaxFeePerGas) || existingMaxFeePerGas && minMaxFeePerGas;
|
|
625
|
-
const existingMaxPriorityFeePerGas = transactionMeta.txParams?.maxPriorityFeePerGas;
|
|
626
|
-
const minMaxPriorityFeePerGas = _chunkOZ6UB42Cjs.getIncreasedPriceFromExisting.call(void 0,
|
|
627
|
-
existingMaxPriorityFeePerGas,
|
|
628
|
-
CANCEL_RATE
|
|
629
|
-
);
|
|
630
|
-
const maxPriorityFeePerGasValues = _chunkOZ6UB42Cjs.isFeeMarketEIP1559Values.call(void 0, gasValues) && gasValues.maxPriorityFeePerGas;
|
|
631
|
-
const newMaxPriorityFeePerGas = maxPriorityFeePerGasValues && _chunkOZ6UB42Cjs.validateMinimumIncrease.call(void 0,
|
|
632
|
-
maxPriorityFeePerGasValues,
|
|
633
|
-
minMaxPriorityFeePerGas
|
|
634
|
-
) || existingMaxPriorityFeePerGas && minMaxPriorityFeePerGas;
|
|
635
|
-
const newTxParams = newMaxFeePerGas && newMaxPriorityFeePerGas ? {
|
|
636
|
-
from: transactionMeta.txParams.from,
|
|
637
|
-
gasLimit: transactionMeta.txParams.gas,
|
|
638
|
-
maxFeePerGas: newMaxFeePerGas,
|
|
639
|
-
maxPriorityFeePerGas: newMaxPriorityFeePerGas,
|
|
640
|
-
type: "0x2" /* feeMarket */,
|
|
641
|
-
nonce: transactionMeta.txParams.nonce,
|
|
642
|
-
to: transactionMeta.txParams.from,
|
|
643
|
-
value: "0x0"
|
|
644
|
-
} : {
|
|
645
|
-
from: transactionMeta.txParams.from,
|
|
646
|
-
gasLimit: transactionMeta.txParams.gas,
|
|
647
|
-
gasPrice: newGasPrice,
|
|
648
|
-
nonce: transactionMeta.txParams.nonce,
|
|
649
|
-
to: transactionMeta.txParams.from,
|
|
650
|
-
value: "0x0"
|
|
651
|
-
};
|
|
652
|
-
const unsignedEthTx = this.prepareUnsignedEthTx(
|
|
653
|
-
transactionMeta.chainId,
|
|
654
|
-
newTxParams
|
|
655
|
-
);
|
|
656
|
-
const signedTx = await this.sign(
|
|
657
|
-
unsignedEthTx,
|
|
658
|
-
transactionMeta.txParams.from
|
|
659
|
-
);
|
|
660
|
-
const rawTx = _util.bufferToHex.call(void 0, signedTx.serialize());
|
|
661
|
-
const newFee = newTxParams.maxFeePerGas ?? newTxParams.gasPrice;
|
|
662
|
-
const oldFee = newTxParams.maxFeePerGas ? transactionMeta.txParams.maxFeePerGas : transactionMeta.txParams.gasPrice;
|
|
663
|
-
_chunkS6VGOPUYjs.projectLogger.call(void 0, "Submitting cancel transaction", {
|
|
664
|
-
oldFee,
|
|
665
|
-
newFee,
|
|
666
|
-
txParams: newTxParams
|
|
667
|
-
});
|
|
668
|
-
const ethQuery = _chunkZ4BLTVTBjs.__privateGet.call(void 0, this, _multichainTrackingHelper).getEthQuery({
|
|
669
|
-
networkClientId: transactionMeta.networkClientId,
|
|
670
|
-
chainId: transactionMeta.chainId
|
|
671
|
-
});
|
|
672
|
-
const hash = await this.publishTransactionForRetry(
|
|
673
|
-
ethQuery,
|
|
674
|
-
rawTx,
|
|
675
|
-
transactionMeta
|
|
676
|
-
);
|
|
677
|
-
const cancelTransactionMeta = {
|
|
608
|
+
return await _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _retryTransaction, retryTransaction_fn).call(this, {
|
|
678
609
|
actionId,
|
|
679
|
-
chainId: transactionMeta.chainId,
|
|
680
|
-
networkClientId: transactionMeta.networkClientId,
|
|
681
610
|
estimatedBaseFee,
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
611
|
+
gasValues,
|
|
612
|
+
label: "cancel",
|
|
613
|
+
rate: CANCEL_RATE,
|
|
614
|
+
transactionId,
|
|
615
|
+
transactionType: "cancel" /* cancel */,
|
|
616
|
+
prepareTransactionParams: (txParams) => {
|
|
617
|
+
delete txParams.data;
|
|
618
|
+
txParams.to = txParams.from;
|
|
619
|
+
txParams.value = "0x0";
|
|
620
|
+
},
|
|
621
|
+
afterSubmit: (newTransactionMeta) => {
|
|
622
|
+
this.messagingSystem.publish(
|
|
623
|
+
`${controllerName}:transactionFinished`,
|
|
624
|
+
newTransactionMeta
|
|
625
|
+
);
|
|
626
|
+
_chunkZ4BLTVTBjs.__privateGet.call(void 0, this, _internalEvents).emit(
|
|
627
|
+
`${newTransactionMeta.id}:finished`,
|
|
628
|
+
newTransactionMeta
|
|
629
|
+
);
|
|
630
|
+
}
|
|
698
631
|
});
|
|
699
|
-
this.messagingSystem.publish(
|
|
700
|
-
`${controllerName}:transactionFinished`,
|
|
701
|
-
cancelTransactionMeta
|
|
702
|
-
);
|
|
703
|
-
_chunkZ4BLTVTBjs.__privateGet.call(void 0, this, _internalEvents).emit(
|
|
704
|
-
`${transactionMeta.id}:finished`,
|
|
705
|
-
cancelTransactionMeta
|
|
706
|
-
);
|
|
707
632
|
}
|
|
708
633
|
/**
|
|
709
634
|
* Attempts to speed up a transaction increasing transaction gasPrice by ten percent.
|
|
@@ -718,118 +643,21 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
718
643
|
actionId,
|
|
719
644
|
estimatedBaseFee
|
|
720
645
|
} = {}) {
|
|
721
|
-
|
|
722
|
-
return;
|
|
723
|
-
}
|
|
724
|
-
if (gasValues) {
|
|
725
|
-
gasValues = _chunkOZ6UB42Cjs.normalizeGasFeeValues.call(void 0, gasValues);
|
|
726
|
-
_chunkOZ6UB42Cjs.validateGasValues.call(void 0, gasValues);
|
|
727
|
-
}
|
|
728
|
-
_chunkS6VGOPUYjs.projectLogger.call(void 0, "Creating speed up transaction", transactionId, gasValues);
|
|
729
|
-
const transactionMeta = this.getTransaction(transactionId);
|
|
730
|
-
if (!transactionMeta) {
|
|
731
|
-
return;
|
|
732
|
-
}
|
|
733
|
-
if (!this.sign) {
|
|
734
|
-
throw new Error("No sign method defined.");
|
|
735
|
-
}
|
|
736
|
-
const minGasPrice = _chunkOZ6UB42Cjs.getIncreasedPriceFromExisting.call(void 0,
|
|
737
|
-
transactionMeta.txParams.gasPrice,
|
|
738
|
-
SPEED_UP_RATE
|
|
739
|
-
);
|
|
740
|
-
const gasPriceFromValues = _chunkOZ6UB42Cjs.isGasPriceValue.call(void 0, gasValues) && gasValues.gasPrice;
|
|
741
|
-
const newGasPrice = gasPriceFromValues && _chunkOZ6UB42Cjs.validateMinimumIncrease.call(void 0, gasPriceFromValues, minGasPrice) || minGasPrice;
|
|
742
|
-
const existingMaxFeePerGas = transactionMeta.txParams?.maxFeePerGas;
|
|
743
|
-
const minMaxFeePerGas = _chunkOZ6UB42Cjs.getIncreasedPriceFromExisting.call(void 0,
|
|
744
|
-
existingMaxFeePerGas,
|
|
745
|
-
SPEED_UP_RATE
|
|
746
|
-
);
|
|
747
|
-
const maxFeePerGasValues = _chunkOZ6UB42Cjs.isFeeMarketEIP1559Values.call(void 0, gasValues) && gasValues.maxFeePerGas;
|
|
748
|
-
const newMaxFeePerGas = maxFeePerGasValues && _chunkOZ6UB42Cjs.validateMinimumIncrease.call(void 0, maxFeePerGasValues, minMaxFeePerGas) || existingMaxFeePerGas && minMaxFeePerGas;
|
|
749
|
-
const existingMaxPriorityFeePerGas = transactionMeta.txParams?.maxPriorityFeePerGas;
|
|
750
|
-
const minMaxPriorityFeePerGas = _chunkOZ6UB42Cjs.getIncreasedPriceFromExisting.call(void 0,
|
|
751
|
-
existingMaxPriorityFeePerGas,
|
|
752
|
-
SPEED_UP_RATE
|
|
753
|
-
);
|
|
754
|
-
const maxPriorityFeePerGasValues = _chunkOZ6UB42Cjs.isFeeMarketEIP1559Values.call(void 0, gasValues) && gasValues.maxPriorityFeePerGas;
|
|
755
|
-
const newMaxPriorityFeePerGas = maxPriorityFeePerGasValues && _chunkOZ6UB42Cjs.validateMinimumIncrease.call(void 0,
|
|
756
|
-
maxPriorityFeePerGasValues,
|
|
757
|
-
minMaxPriorityFeePerGas
|
|
758
|
-
) || existingMaxPriorityFeePerGas && minMaxPriorityFeePerGas;
|
|
759
|
-
const txParams = newMaxFeePerGas && newMaxPriorityFeePerGas ? {
|
|
760
|
-
...transactionMeta.txParams,
|
|
761
|
-
gasLimit: transactionMeta.txParams.gas,
|
|
762
|
-
maxFeePerGas: newMaxFeePerGas,
|
|
763
|
-
maxPriorityFeePerGas: newMaxPriorityFeePerGas,
|
|
764
|
-
type: "0x2" /* feeMarket */
|
|
765
|
-
} : {
|
|
766
|
-
...transactionMeta.txParams,
|
|
767
|
-
gasLimit: transactionMeta.txParams.gas,
|
|
768
|
-
gasPrice: newGasPrice
|
|
769
|
-
};
|
|
770
|
-
const unsignedEthTx = this.prepareUnsignedEthTx(
|
|
771
|
-
transactionMeta.chainId,
|
|
772
|
-
txParams
|
|
773
|
-
);
|
|
774
|
-
const signedTx = await this.sign(
|
|
775
|
-
unsignedEthTx,
|
|
776
|
-
transactionMeta.txParams.from
|
|
777
|
-
);
|
|
778
|
-
const transactionMetaWithRsv = this.updateTransactionMetaRSV(
|
|
779
|
-
transactionMeta,
|
|
780
|
-
signedTx
|
|
781
|
-
);
|
|
782
|
-
const rawTx = _util.bufferToHex.call(void 0, signedTx.serialize());
|
|
783
|
-
const newFee = txParams.maxFeePerGas ?? txParams.gasPrice;
|
|
784
|
-
const oldFee = txParams.maxFeePerGas ? transactionMetaWithRsv.txParams.maxFeePerGas : transactionMetaWithRsv.txParams.gasPrice;
|
|
785
|
-
_chunkS6VGOPUYjs.projectLogger.call(void 0, "Submitting speed up transaction", { oldFee, newFee, txParams });
|
|
786
|
-
const ethQuery = _chunkZ4BLTVTBjs.__privateGet.call(void 0, this, _multichainTrackingHelper).getEthQuery({
|
|
787
|
-
networkClientId: transactionMeta.networkClientId,
|
|
788
|
-
chainId: transactionMeta.chainId
|
|
789
|
-
});
|
|
790
|
-
const hash = await this.publishTransactionForRetry(
|
|
791
|
-
ethQuery,
|
|
792
|
-
rawTx,
|
|
793
|
-
transactionMeta
|
|
794
|
-
);
|
|
795
|
-
const baseTransactionMeta = {
|
|
796
|
-
...transactionMetaWithRsv,
|
|
797
|
-
estimatedBaseFee,
|
|
798
|
-
id: _uuid.v1.call(void 0, ),
|
|
799
|
-
time: Date.now(),
|
|
800
|
-
hash,
|
|
646
|
+
return await _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _retryTransaction, retryTransaction_fn).call(this, {
|
|
801
647
|
actionId,
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
} : {
|
|
814
|
-
...baseTransactionMeta,
|
|
815
|
-
txParams: {
|
|
816
|
-
...transactionMeta.txParams,
|
|
817
|
-
gasPrice: newGasPrice
|
|
648
|
+
estimatedBaseFee,
|
|
649
|
+
gasValues,
|
|
650
|
+
label: "speed up",
|
|
651
|
+
rate: SPEED_UP_RATE,
|
|
652
|
+
transactionId,
|
|
653
|
+
transactionType: "retry" /* retry */,
|
|
654
|
+
afterSubmit: (newTransactionMeta) => {
|
|
655
|
+
this.messagingSystem.publish(
|
|
656
|
+
`${controllerName}:speedupTransactionAdded`,
|
|
657
|
+
newTransactionMeta
|
|
658
|
+
);
|
|
818
659
|
}
|
|
819
|
-
};
|
|
820
|
-
this.addMetadata(newTransactionMeta);
|
|
821
|
-
this.messagingSystem.publish(`${controllerName}:transactionApproved`, {
|
|
822
|
-
transactionMeta: newTransactionMeta,
|
|
823
|
-
actionId
|
|
824
660
|
});
|
|
825
|
-
this.messagingSystem.publish(`${controllerName}:transactionSubmitted`, {
|
|
826
|
-
transactionMeta: newTransactionMeta,
|
|
827
|
-
actionId
|
|
828
|
-
});
|
|
829
|
-
this.messagingSystem.publish(
|
|
830
|
-
`${controllerName}:speedupTransactionAdded`,
|
|
831
|
-
newTransactionMeta
|
|
832
|
-
);
|
|
833
661
|
}
|
|
834
662
|
/**
|
|
835
663
|
* Estimates required gas for a given transaction.
|
|
@@ -995,7 +823,7 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
995
823
|
`Cannot update send flow history as no transaction metadata found`
|
|
996
824
|
);
|
|
997
825
|
}
|
|
998
|
-
|
|
826
|
+
_chunkKTGMNUTQjs.validateIfTransactionUnapproved.call(void 0,
|
|
999
827
|
transactionMeta,
|
|
1000
828
|
"updateTransactionSendFlowHistory"
|
|
1001
829
|
);
|
|
@@ -1049,7 +877,7 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
1049
877
|
`Cannot update transaction as no transaction metadata found`
|
|
1050
878
|
);
|
|
1051
879
|
}
|
|
1052
|
-
|
|
880
|
+
_chunkKTGMNUTQjs.validateIfTransactionUnapproved.call(void 0,
|
|
1053
881
|
transactionMeta,
|
|
1054
882
|
"updateTransactionGasFees"
|
|
1055
883
|
);
|
|
@@ -1100,7 +928,7 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
1100
928
|
`Cannot update transaction as no transaction metadata found`
|
|
1101
929
|
);
|
|
1102
930
|
}
|
|
1103
|
-
|
|
931
|
+
_chunkKTGMNUTQjs.validateIfTransactionUnapproved.call(void 0, transactionMeta, "updatePreviousGasParams");
|
|
1104
932
|
const transactionPreviousGas = {
|
|
1105
933
|
previousGas: {
|
|
1106
934
|
gasLimit,
|
|
@@ -1153,7 +981,7 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
1153
981
|
`Cannot update editable params as no transaction metadata found`
|
|
1154
982
|
);
|
|
1155
983
|
}
|
|
1156
|
-
|
|
984
|
+
_chunkKTGMNUTQjs.validateIfTransactionUnapproved.call(void 0, transactionMeta, "updateEditableParams");
|
|
1157
985
|
const editableParams = {
|
|
1158
986
|
txParams: {
|
|
1159
987
|
data,
|
|
@@ -1288,7 +1116,7 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
1288
1116
|
updatedTransactionMeta.submittedTime = (/* @__PURE__ */ new Date()).getTime();
|
|
1289
1117
|
}
|
|
1290
1118
|
if (updatedTransactionMeta.status === "failed" /* failed */) {
|
|
1291
|
-
updatedTransactionMeta.error =
|
|
1119
|
+
updatedTransactionMeta.error = _chunkKTGMNUTQjs.normalizeTxError.call(void 0, new Error(errorMessage));
|
|
1292
1120
|
}
|
|
1293
1121
|
this.updateTransaction(
|
|
1294
1122
|
updatedTransactionMeta,
|
|
@@ -1402,7 +1230,7 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
1402
1230
|
chainId,
|
|
1403
1231
|
networkClientId
|
|
1404
1232
|
};
|
|
1405
|
-
const gasFeeFlow =
|
|
1233
|
+
const gasFeeFlow = _chunkYWLMT7XHjs.getGasFeeFlow.call(void 0,
|
|
1406
1234
|
transactionMeta,
|
|
1407
1235
|
this.gasFeeFlows
|
|
1408
1236
|
);
|
|
@@ -1449,8 +1277,8 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
1449
1277
|
if (!this.sign) {
|
|
1450
1278
|
throw new Error("No sign method defined.");
|
|
1451
1279
|
}
|
|
1452
|
-
const normalizedTransactionParams =
|
|
1453
|
-
const type =
|
|
1280
|
+
const normalizedTransactionParams = _chunkKTGMNUTQjs.normalizeTransactionParams.call(void 0, transactionParams);
|
|
1281
|
+
const type = _chunkKTGMNUTQjs.isEIP1559Transaction.call(void 0, normalizedTransactionParams) ? "0x2" /* feeMarket */ : "0x0" /* legacy */;
|
|
1454
1282
|
const updatedTransactionParams = {
|
|
1455
1283
|
...normalizedTransactionParams,
|
|
1456
1284
|
type,
|
|
@@ -1498,7 +1326,7 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
1498
1326
|
this.signAbortCallbacks.delete(transactionId);
|
|
1499
1327
|
}
|
|
1500
1328
|
addMetadata(transactionMeta) {
|
|
1501
|
-
|
|
1329
|
+
_chunk4OYPDGHOjs.validateTxParams.call(void 0, transactionMeta.txParams);
|
|
1502
1330
|
this.update((state) => {
|
|
1503
1331
|
state.transactions = this.trimTransactionsForState([
|
|
1504
1332
|
...state.transactions,
|
|
@@ -1506,7 +1334,7 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
1506
1334
|
]);
|
|
1507
1335
|
});
|
|
1508
1336
|
}
|
|
1509
|
-
async updateGasProperties(transactionMeta) {
|
|
1337
|
+
async updateGasProperties(transactionMeta, { traceContext } = {}) {
|
|
1510
1338
|
const isEIP1559Compatible = transactionMeta.txParams.type !== "0x0" /* legacy */ && await this.getEIP1559Compatibility(transactionMeta.networkClientId);
|
|
1511
1339
|
const { networkClientId, chainId } = transactionMeta;
|
|
1512
1340
|
const isCustomNetwork = _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _isCustomNetwork, isCustomNetwork_fn).call(this, networkClientId);
|
|
@@ -1518,25 +1346,27 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
1518
1346
|
networkClientId,
|
|
1519
1347
|
chainId
|
|
1520
1348
|
});
|
|
1521
|
-
await
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1349
|
+
await _chunkZ4BLTVTBjs.__privateGet.call(void 0, this, _trace).call(this, { name: "Update Gas", parentContext: traceContext }, async () => {
|
|
1350
|
+
await _chunkV72C4MCRjs.updateGas.call(void 0, {
|
|
1351
|
+
ethQuery,
|
|
1352
|
+
chainId,
|
|
1353
|
+
isCustomNetwork,
|
|
1354
|
+
txMeta: transactionMeta
|
|
1355
|
+
});
|
|
1526
1356
|
});
|
|
1527
|
-
await
|
|
1357
|
+
await _chunkZ4BLTVTBjs.__privateGet.call(void 0, this, _trace).call(this, { name: "Update Gas Fees", parentContext: traceContext }, async () => await _chunkBZV72SCFjs.updateGasFees.call(void 0, {
|
|
1528
1358
|
eip1559: isEIP1559Compatible,
|
|
1529
1359
|
ethQuery,
|
|
1530
1360
|
gasFeeFlows: this.gasFeeFlows,
|
|
1531
1361
|
getGasFeeEstimates: this.getGasFeeEstimates,
|
|
1532
1362
|
getSavedGasFees: this.getSavedGasFees.bind(this),
|
|
1533
1363
|
txMeta: transactionMeta
|
|
1534
|
-
});
|
|
1535
|
-
await _chunk2XKEAKQGjs.updateTransactionLayer1GasFee.call(void 0, {
|
|
1364
|
+
}));
|
|
1365
|
+
await _chunkZ4BLTVTBjs.__privateGet.call(void 0, this, _trace).call(this, { name: "Update Layer 1 Gas Fees", parentContext: traceContext }, async () => await _chunk2XKEAKQGjs.updateTransactionLayer1GasFee.call(void 0, {
|
|
1536
1366
|
layer1GasFeeFlows: this.layer1GasFeeFlows,
|
|
1537
1367
|
provider,
|
|
1538
1368
|
transactionMeta
|
|
1539
|
-
});
|
|
1369
|
+
}));
|
|
1540
1370
|
}
|
|
1541
1371
|
onBootCleanup() {
|
|
1542
1372
|
this.submitApprovedTransactions();
|
|
@@ -1560,7 +1390,8 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
1560
1390
|
isExisting = false,
|
|
1561
1391
|
requireApproval,
|
|
1562
1392
|
shouldShowRequest = true,
|
|
1563
|
-
actionId
|
|
1393
|
+
actionId,
|
|
1394
|
+
traceContext
|
|
1564
1395
|
}) {
|
|
1565
1396
|
const transactionId = transactionMeta.id;
|
|
1566
1397
|
let resultCallbacks;
|
|
@@ -1569,9 +1400,10 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
1569
1400
|
if (meta && !isExisting && !isCompleted) {
|
|
1570
1401
|
try {
|
|
1571
1402
|
if (requireApproval !== false) {
|
|
1572
|
-
const acceptResult = await this.requestApproval(transactionMeta, {
|
|
1573
|
-
shouldShowRequest
|
|
1574
|
-
|
|
1403
|
+
const acceptResult = await _chunkZ4BLTVTBjs.__privateGet.call(void 0, this, _trace).call(this, { name: "Await Approval", parentContext: traceContext }, (context) => this.requestApproval(transactionMeta, {
|
|
1404
|
+
shouldShowRequest,
|
|
1405
|
+
traceContext: context
|
|
1406
|
+
}));
|
|
1575
1407
|
resultCallbacks = acceptResult.resultCallbacks;
|
|
1576
1408
|
const approvalValue = acceptResult.value;
|
|
1577
1409
|
const updatedTransaction = approvalValue?.txMeta;
|
|
@@ -1588,7 +1420,10 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
1588
1420
|
}
|
|
1589
1421
|
const { isCompleted: isTxCompleted } = this.isTransactionCompleted(transactionId);
|
|
1590
1422
|
if (!isTxCompleted) {
|
|
1591
|
-
const approvalResult = await this.approveTransaction(
|
|
1423
|
+
const approvalResult = await this.approveTransaction(
|
|
1424
|
+
transactionId,
|
|
1425
|
+
traceContext
|
|
1426
|
+
);
|
|
1592
1427
|
if (approvalResult === "skipped-via-before-publish-hook" /* SkippedViaBeforePublishHook */ && resultCallbacks) {
|
|
1593
1428
|
resultCallbacks.success();
|
|
1594
1429
|
}
|
|
@@ -1642,8 +1477,9 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
1642
1477
|
* A `<tx.id>:finished` hub event is fired after success or failure.
|
|
1643
1478
|
*
|
|
1644
1479
|
* @param transactionId - The ID of the transaction to approve.
|
|
1480
|
+
* @param traceContext - The parent context for any new traces.
|
|
1645
1481
|
*/
|
|
1646
|
-
async approveTransaction(transactionId) {
|
|
1482
|
+
async approveTransaction(transactionId, traceContext) {
|
|
1647
1483
|
const cleanupTasks = new Array();
|
|
1648
1484
|
cleanupTasks.push(await this.mutex.acquire());
|
|
1649
1485
|
let transactionMeta = this.getTransactionOrThrow(transactionId);
|
|
@@ -1685,16 +1521,13 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
1685
1521
|
nonce,
|
|
1686
1522
|
chainId,
|
|
1687
1523
|
gasLimit: txParams.gas,
|
|
1688
|
-
...
|
|
1524
|
+
..._chunkKTGMNUTQjs.isEIP1559Transaction.call(void 0, txParams) && {
|
|
1689
1525
|
type: "0x2" /* feeMarket */
|
|
1690
1526
|
}
|
|
1691
1527
|
};
|
|
1692
1528
|
});
|
|
1693
1529
|
this.onTransactionStatusChange(transactionMeta);
|
|
1694
|
-
const rawTx = await this.signTransaction(
|
|
1695
|
-
transactionMeta,
|
|
1696
|
-
transactionMeta.txParams
|
|
1697
|
-
);
|
|
1530
|
+
const rawTx = await _chunkZ4BLTVTBjs.__privateGet.call(void 0, this, _trace).call(this, { name: "Sign", parentContext: traceContext }, () => this.signTransaction(transactionMeta, transactionMeta.txParams));
|
|
1698
1531
|
if (!this.beforePublish(transactionMeta)) {
|
|
1699
1532
|
_chunkS6VGOPUYjs.projectLogger.call(void 0, "Skipping publishing transaction based on hook");
|
|
1700
1533
|
this.messagingSystem.publish(
|
|
@@ -1719,13 +1552,16 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
1719
1552
|
]);
|
|
1720
1553
|
}
|
|
1721
1554
|
_chunkS6VGOPUYjs.projectLogger.call(void 0, "Publishing transaction", transactionMeta.txParams);
|
|
1722
|
-
let
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1555
|
+
let hash;
|
|
1556
|
+
await _chunkZ4BLTVTBjs.__privateGet.call(void 0, this, _trace).call(this, { name: "Publish", parentContext: traceContext }, async () => {
|
|
1557
|
+
({ transactionHash: hash } = await this.publish(
|
|
1558
|
+
transactionMeta,
|
|
1559
|
+
rawTx
|
|
1560
|
+
));
|
|
1561
|
+
if (hash === void 0) {
|
|
1562
|
+
hash = await this.publishTransaction(ethQuery, rawTx);
|
|
1563
|
+
}
|
|
1564
|
+
});
|
|
1729
1565
|
_chunkS6VGOPUYjs.projectLogger.call(void 0, "Publish successful", hash);
|
|
1730
1566
|
transactionMeta = _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _updateTransactionInternal, updateTransactionInternal_fn).call(this, {
|
|
1731
1567
|
transactionId,
|
|
@@ -1856,11 +1692,19 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
1856
1692
|
"submitted" /* submitted */
|
|
1857
1693
|
].includes(status);
|
|
1858
1694
|
}
|
|
1859
|
-
async requestApproval(txMeta, {
|
|
1695
|
+
async requestApproval(txMeta, {
|
|
1696
|
+
shouldShowRequest,
|
|
1697
|
+
traceContext
|
|
1698
|
+
}) {
|
|
1860
1699
|
const id = this.getApprovalId(txMeta);
|
|
1861
1700
|
const { origin } = txMeta;
|
|
1862
1701
|
const type = _controllerutils.ApprovalType.Transaction;
|
|
1863
1702
|
const requestData = { txId: txMeta.id };
|
|
1703
|
+
await _chunkZ4BLTVTBjs.__privateGet.call(void 0, this, _trace).call(this, {
|
|
1704
|
+
name: "Notification Display",
|
|
1705
|
+
id,
|
|
1706
|
+
parentContext: traceContext
|
|
1707
|
+
});
|
|
1864
1708
|
return await this.messagingSystem.call(
|
|
1865
1709
|
"ApprovalController:addRequest",
|
|
1866
1710
|
{
|
|
@@ -2198,7 +2042,7 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
2198
2042
|
networkClientId: transactionMeta.networkClientId,
|
|
2199
2043
|
chainId: transactionMeta.chainId
|
|
2200
2044
|
});
|
|
2201
|
-
const { updatedTransactionMeta, approvalTransactionMeta } = await
|
|
2045
|
+
const { updatedTransactionMeta, approvalTransactionMeta } = await _chunkQKV7E5BOjs.updatePostTransactionBalance.call(void 0, transactionMeta, {
|
|
2202
2046
|
ethQuery,
|
|
2203
2047
|
getTransaction: this.getTransaction.bind(this),
|
|
2204
2048
|
updateTransaction: this.updateTransaction.bind(this)
|
|
@@ -2244,10 +2088,96 @@ var TransactionController = class extends _basecontroller.BaseController {
|
|
|
2244
2088
|
_internalEvents = new WeakMap();
|
|
2245
2089
|
_incomingTransactionOptions = new WeakMap();
|
|
2246
2090
|
_pendingTransactionOptions = new WeakMap();
|
|
2091
|
+
_trace = new WeakMap();
|
|
2247
2092
|
_transactionHistoryLimit = new WeakMap();
|
|
2248
2093
|
_isSimulationEnabled = new WeakMap();
|
|
2249
2094
|
_testGasFeeFlows = new WeakMap();
|
|
2250
2095
|
_multichainTrackingHelper = new WeakMap();
|
|
2096
|
+
_retryTransaction = new WeakSet();
|
|
2097
|
+
retryTransaction_fn = async function({
|
|
2098
|
+
actionId,
|
|
2099
|
+
afterSubmit,
|
|
2100
|
+
estimatedBaseFee,
|
|
2101
|
+
gasValues,
|
|
2102
|
+
label,
|
|
2103
|
+
prepareTransactionParams,
|
|
2104
|
+
rate,
|
|
2105
|
+
transactionId,
|
|
2106
|
+
transactionType
|
|
2107
|
+
}) {
|
|
2108
|
+
if (this.getTransactionWithActionId(actionId)) {
|
|
2109
|
+
return;
|
|
2110
|
+
}
|
|
2111
|
+
if (gasValues) {
|
|
2112
|
+
gasValues = _chunkKTGMNUTQjs.normalizeGasFeeValues.call(void 0, gasValues);
|
|
2113
|
+
_chunkKTGMNUTQjs.validateGasValues.call(void 0, gasValues);
|
|
2114
|
+
}
|
|
2115
|
+
_chunkS6VGOPUYjs.projectLogger.call(void 0, `Creating ${label} transaction`, transactionId, gasValues);
|
|
2116
|
+
const transactionMeta = this.getTransaction(transactionId);
|
|
2117
|
+
if (!transactionMeta) {
|
|
2118
|
+
return;
|
|
2119
|
+
}
|
|
2120
|
+
if (!this.sign) {
|
|
2121
|
+
throw new Error("No sign method defined.");
|
|
2122
|
+
}
|
|
2123
|
+
const newTxParams = _chunk5QVDIVJHjs.getTransactionParamsWithIncreasedGasFee.call(void 0,
|
|
2124
|
+
transactionMeta.txParams,
|
|
2125
|
+
rate,
|
|
2126
|
+
gasValues
|
|
2127
|
+
);
|
|
2128
|
+
prepareTransactionParams?.(newTxParams);
|
|
2129
|
+
const unsignedEthTx = this.prepareUnsignedEthTx(
|
|
2130
|
+
transactionMeta.chainId,
|
|
2131
|
+
newTxParams
|
|
2132
|
+
);
|
|
2133
|
+
const signedTx = await this.sign(
|
|
2134
|
+
unsignedEthTx,
|
|
2135
|
+
transactionMeta.txParams.from
|
|
2136
|
+
);
|
|
2137
|
+
const transactionMetaWithRsv = this.updateTransactionMetaRSV(
|
|
2138
|
+
transactionMeta,
|
|
2139
|
+
signedTx
|
|
2140
|
+
);
|
|
2141
|
+
const rawTx = _util.bufferToHex.call(void 0, signedTx.serialize());
|
|
2142
|
+
const newFee = newTxParams.maxFeePerGas ?? newTxParams.gasPrice;
|
|
2143
|
+
const oldFee = newTxParams.maxFeePerGas ? transactionMetaWithRsv.txParams.maxFeePerGas : transactionMetaWithRsv.txParams.gasPrice;
|
|
2144
|
+
_chunkS6VGOPUYjs.projectLogger.call(void 0, `Submitting ${label} transaction`, {
|
|
2145
|
+
oldFee,
|
|
2146
|
+
newFee,
|
|
2147
|
+
txParams: newTxParams
|
|
2148
|
+
});
|
|
2149
|
+
const ethQuery = _chunkZ4BLTVTBjs.__privateGet.call(void 0, this, _multichainTrackingHelper).getEthQuery({
|
|
2150
|
+
networkClientId: transactionMeta.networkClientId,
|
|
2151
|
+
chainId: transactionMeta.chainId
|
|
2152
|
+
});
|
|
2153
|
+
const hash = await this.publishTransactionForRetry(
|
|
2154
|
+
ethQuery,
|
|
2155
|
+
rawTx,
|
|
2156
|
+
transactionMeta
|
|
2157
|
+
);
|
|
2158
|
+
const newTransactionMeta = {
|
|
2159
|
+
...transactionMetaWithRsv,
|
|
2160
|
+
estimatedBaseFee,
|
|
2161
|
+
id: _uuid.v1.call(void 0, ),
|
|
2162
|
+
time: Date.now(),
|
|
2163
|
+
hash,
|
|
2164
|
+
actionId,
|
|
2165
|
+
originalGasEstimate: transactionMeta.txParams.gas,
|
|
2166
|
+
type: transactionType,
|
|
2167
|
+
txParams: newTxParams,
|
|
2168
|
+
originalType: transactionMeta.type
|
|
2169
|
+
};
|
|
2170
|
+
this.addMetadata(newTransactionMeta);
|
|
2171
|
+
this.messagingSystem.publish(`${controllerName}:transactionApproved`, {
|
|
2172
|
+
transactionMeta: newTransactionMeta,
|
|
2173
|
+
actionId
|
|
2174
|
+
});
|
|
2175
|
+
this.messagingSystem.publish(`${controllerName}:transactionSubmitted`, {
|
|
2176
|
+
transactionMeta: newTransactionMeta,
|
|
2177
|
+
actionId
|
|
2178
|
+
});
|
|
2179
|
+
afterSubmit?.(newTransactionMeta);
|
|
2180
|
+
};
|
|
2251
2181
|
_createNonceTracker = new WeakSet();
|
|
2252
2182
|
createNonceTracker_fn = function({
|
|
2253
2183
|
provider,
|
|
@@ -2390,7 +2320,7 @@ getGasFeeFlows_fn = function() {
|
|
|
2390
2320
|
if (_chunkZ4BLTVTBjs.__privateGet.call(void 0, this, _testGasFeeFlows)) {
|
|
2391
2321
|
return [new (0, _chunkTJMQEH57js.TestGasFeeFlow)()];
|
|
2392
2322
|
}
|
|
2393
|
-
return [new (0,
|
|
2323
|
+
return [new (0, _chunkUHAFIPSLjs.LineaGasFeeFlow)(), new (0, _chunkEHWAY6XUjs.DefaultGasFeeFlow)()];
|
|
2394
2324
|
};
|
|
2395
2325
|
_getLayer1GasFeeFlows = new WeakSet();
|
|
2396
2326
|
getLayer1GasFeeFlows_fn = function() {
|
|
@@ -2409,10 +2339,10 @@ updateTransactionInternal_fn = function({
|
|
|
2409
2339
|
);
|
|
2410
2340
|
let transactionMeta2 = state.transactions[index];
|
|
2411
2341
|
transactionMeta2 = callback(transactionMeta2) ?? transactionMeta2;
|
|
2412
|
-
transactionMeta2.txParams =
|
|
2342
|
+
transactionMeta2.txParams = _chunkKTGMNUTQjs.normalizeTransactionParams.call(void 0,
|
|
2413
2343
|
transactionMeta2.txParams
|
|
2414
2344
|
);
|
|
2415
|
-
|
|
2345
|
+
_chunk4OYPDGHOjs.validateTxParams.call(void 0, transactionMeta2.txParams);
|
|
2416
2346
|
updatedTransactionParams = _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _checkIfTransactionParamsUpdated, checkIfTransactionParamsUpdated_fn).call(this, transactionMeta2);
|
|
2417
2347
|
const shouldSkipHistory = this.isHistoryDisabled || skipHistory;
|
|
2418
2348
|
if (!shouldSkipHistory) {
|
|
@@ -2464,7 +2394,7 @@ onTransactionParamsUpdated_fn = function(transactionMeta, updatedParams) {
|
|
|
2464
2394
|
}
|
|
2465
2395
|
};
|
|
2466
2396
|
_updateSimulationData = new WeakSet();
|
|
2467
|
-
updateSimulationData_fn = async function(transactionMeta) {
|
|
2397
|
+
updateSimulationData_fn = async function(transactionMeta, { traceContext } = {}) {
|
|
2468
2398
|
const { id: transactionId, chainId, txParams } = transactionMeta;
|
|
2469
2399
|
const { from, to, value, data } = txParams;
|
|
2470
2400
|
let simulationData = {
|
|
@@ -2478,13 +2408,13 @@ updateSimulationData_fn = async function(transactionMeta) {
|
|
|
2478
2408
|
_chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _updateTransactionInternal, updateTransactionInternal_fn).call(this, { transactionId, skipHistory: true }, (txMeta) => {
|
|
2479
2409
|
txMeta.simulationData = void 0;
|
|
2480
2410
|
});
|
|
2481
|
-
simulationData = await _chunkNNCUD3QFjs.getSimulationData.call(void 0, {
|
|
2411
|
+
simulationData = await _chunkZ4BLTVTBjs.__privateGet.call(void 0, this, _trace).call(this, { name: "Simulate", parentContext: traceContext }, () => _chunkNNCUD3QFjs.getSimulationData.call(void 0, {
|
|
2482
2412
|
chainId,
|
|
2483
2413
|
from,
|
|
2484
2414
|
to,
|
|
2485
2415
|
value,
|
|
2486
2416
|
data
|
|
2487
|
-
});
|
|
2417
|
+
}));
|
|
2488
2418
|
}
|
|
2489
2419
|
const finalTransactionMeta = this.getTransaction(transactionId);
|
|
2490
2420
|
if (!finalTransactionMeta) {
|
|
@@ -2576,4 +2506,4 @@ getSelectedAccount_fn = function() {
|
|
|
2576
2506
|
|
|
2577
2507
|
|
|
2578
2508
|
exports.HARDFORK = HARDFORK; exports.CANCEL_RATE = CANCEL_RATE; exports.SPEED_UP_RATE = SPEED_UP_RATE; exports.ApprovalState = ApprovalState; exports.TransactionController = TransactionController;
|
|
2579
|
-
//# sourceMappingURL=chunk-
|
|
2509
|
+
//# sourceMappingURL=chunk-VKWOHNDO.js.map
|