@metamask/transaction-controller 35.1.1 → 35.2.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 +21 -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 +6 -5
- 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
|
@@ -2,6 +2,9 @@ import {
|
|
|
2
2
|
getAndFormatTransactionsForNonceTracker,
|
|
3
3
|
getNextNonce
|
|
4
4
|
} from "./chunk-6DDVVUJC.mjs";
|
|
5
|
+
import {
|
|
6
|
+
getTransactionParamsWithIncreasedGasFee
|
|
7
|
+
} from "./chunk-JOQK7A5G.mjs";
|
|
5
8
|
import {
|
|
6
9
|
getSimulationData
|
|
7
10
|
} from "./chunk-3AVRGHUO.mjs";
|
|
@@ -11,7 +14,7 @@ import {
|
|
|
11
14
|
import {
|
|
12
15
|
validateTransactionOrigin,
|
|
13
16
|
validateTxParams
|
|
14
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-X4XSEYPL.mjs";
|
|
15
18
|
import {
|
|
16
19
|
PendingTransactionTracker
|
|
17
20
|
} from "./chunk-6B5BEO3R.mjs";
|
|
@@ -38,7 +41,7 @@ import {
|
|
|
38
41
|
} from "./chunk-FMRLPVFZ.mjs";
|
|
39
42
|
import {
|
|
40
43
|
GasFeePoller
|
|
41
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-VGFPVAKX.mjs";
|
|
42
45
|
import {
|
|
43
46
|
getTransactionLayer1GasFee,
|
|
44
47
|
updateTransactionLayer1GasFee
|
|
@@ -54,32 +57,28 @@ import {
|
|
|
54
57
|
} from "./chunk-EKJXGERC.mjs";
|
|
55
58
|
import {
|
|
56
59
|
LineaGasFeeFlow
|
|
57
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-KYRW4BLA.mjs";
|
|
58
61
|
import {
|
|
59
62
|
DefaultGasFeeFlow
|
|
60
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-AWIJZAW3.mjs";
|
|
61
64
|
import {
|
|
62
65
|
updateGasFees
|
|
63
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-SFFOC25Q.mjs";
|
|
64
67
|
import {
|
|
65
68
|
updatePostTransactionBalance,
|
|
66
69
|
updateSwapsTransaction
|
|
67
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-JIFPK37W.mjs";
|
|
68
71
|
import {
|
|
69
|
-
getIncreasedPriceFromExisting,
|
|
70
72
|
isEIP1559Transaction,
|
|
71
|
-
isFeeMarketEIP1559Values,
|
|
72
|
-
isGasPriceValue,
|
|
73
73
|
normalizeGasFeeValues,
|
|
74
74
|
normalizeTransactionParams,
|
|
75
75
|
normalizeTxError,
|
|
76
76
|
validateGasValues,
|
|
77
|
-
validateIfTransactionUnapproved
|
|
78
|
-
|
|
79
|
-
} from "./chunk-Q56I5ONX.mjs";
|
|
77
|
+
validateIfTransactionUnapproved
|
|
78
|
+
} from "./chunk-UHSRHP55.mjs";
|
|
80
79
|
import {
|
|
81
80
|
getGasFeeFlow
|
|
82
|
-
} from "./chunk-
|
|
81
|
+
} from "./chunk-NNHSNPT2.mjs";
|
|
83
82
|
import {
|
|
84
83
|
projectLogger
|
|
85
84
|
} from "./chunk-UQQWZT6C.mjs";
|
|
@@ -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 {
|
|
148
147
|
/**
|
|
149
148
|
* Constructs a TransactionController.
|
|
@@ -172,6 +171,7 @@ var TransactionController = class extends 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 {
|
|
|
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 {
|
|
|
211
212
|
...state
|
|
212
213
|
}
|
|
213
214
|
});
|
|
215
|
+
__privateAdd(this, _retryTransaction);
|
|
214
216
|
__privateAdd(this, _createNonceTracker);
|
|
215
217
|
__privateAdd(this, _createIncomingTransactionHelper);
|
|
216
218
|
__privateAdd(this, _createPendingTransactionTracker);
|
|
@@ -238,6 +240,7 @@ var TransactionController = class extends BaseController {
|
|
|
238
240
|
__privateAdd(this, _incomingTransactionOptions, void 0);
|
|
239
241
|
__privateAdd(this, _pendingTransactionOptions, void 0);
|
|
240
242
|
this.signAbortCallbacks = /* @__PURE__ */ new Map();
|
|
243
|
+
__privateAdd(this, _trace, void 0);
|
|
241
244
|
__privateAdd(this, _transactionHistoryLimit, void 0);
|
|
242
245
|
__privateAdd(this, _isSimulationEnabled, void 0);
|
|
243
246
|
__privateAdd(this, _testGasFeeFlows, void 0);
|
|
@@ -265,6 +268,7 @@ var TransactionController = class extends BaseController {
|
|
|
265
268
|
__privateSet(this, _transactionHistoryLimit, transactionHistoryLimit);
|
|
266
269
|
this.sign = sign;
|
|
267
270
|
__privateSet(this, _testGasFeeFlows, testGasFeeFlows === true);
|
|
271
|
+
__privateSet(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 */
|
|
@@ -439,6 +443,7 @@ var TransactionController = class extends 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,6 +455,7 @@ var TransactionController = class extends BaseController {
|
|
|
450
455
|
securityAlertResponse,
|
|
451
456
|
sendFlowHistory,
|
|
452
457
|
swaps = {},
|
|
458
|
+
traceContext,
|
|
453
459
|
type,
|
|
454
460
|
networkClientId: requestNetworkClientId
|
|
455
461
|
} = {}) {
|
|
@@ -501,7 +507,9 @@ var TransactionController = class extends BaseController {
|
|
|
501
507
|
type: transactionType,
|
|
502
508
|
networkClientId
|
|
503
509
|
};
|
|
504
|
-
await this.updateGasProperties(addedTransactionMeta
|
|
510
|
+
await __privateGet(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(
|
|
@@ -528,7 +536,9 @@ var TransactionController = class extends BaseController {
|
|
|
528
536
|
);
|
|
529
537
|
this.addMetadata(addedTransactionMeta);
|
|
530
538
|
if (requireApproval !== false) {
|
|
531
|
-
__privateMethod(this, _updateSimulationData, updateSimulationData_fn).call(this, addedTransactionMeta
|
|
539
|
+
__privateMethod(this, _updateSimulationData, updateSimulationData_fn).call(this, addedTransactionMeta, {
|
|
540
|
+
traceContext
|
|
541
|
+
}).catch((error) => {
|
|
532
542
|
projectLogger("Error while updating simulation data", error);
|
|
533
543
|
throw error;
|
|
534
544
|
});
|
|
@@ -544,7 +554,8 @@ var TransactionController = class extends 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 {
|
|
|
594
605
|
estimatedBaseFee,
|
|
595
606
|
actionId
|
|
596
607
|
} = {}) {
|
|
597
|
-
|
|
598
|
-
return;
|
|
599
|
-
}
|
|
600
|
-
if (gasValues) {
|
|
601
|
-
gasValues = normalizeGasFeeValues(gasValues);
|
|
602
|
-
validateGasValues(gasValues);
|
|
603
|
-
}
|
|
604
|
-
projectLogger("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 = getIncreasedPriceFromExisting(
|
|
613
|
-
transactionMeta.txParams.gasPrice,
|
|
614
|
-
CANCEL_RATE
|
|
615
|
-
);
|
|
616
|
-
const gasPriceFromValues = isGasPriceValue(gasValues) && gasValues.gasPrice;
|
|
617
|
-
const newGasPrice = gasPriceFromValues && validateMinimumIncrease(gasPriceFromValues, minGasPrice) || minGasPrice;
|
|
618
|
-
const existingMaxFeePerGas = transactionMeta.txParams?.maxFeePerGas;
|
|
619
|
-
const minMaxFeePerGas = getIncreasedPriceFromExisting(
|
|
620
|
-
existingMaxFeePerGas,
|
|
621
|
-
CANCEL_RATE
|
|
622
|
-
);
|
|
623
|
-
const maxFeePerGasValues = isFeeMarketEIP1559Values(gasValues) && gasValues.maxFeePerGas;
|
|
624
|
-
const newMaxFeePerGas = maxFeePerGasValues && validateMinimumIncrease(maxFeePerGasValues, minMaxFeePerGas) || existingMaxFeePerGas && minMaxFeePerGas;
|
|
625
|
-
const existingMaxPriorityFeePerGas = transactionMeta.txParams?.maxPriorityFeePerGas;
|
|
626
|
-
const minMaxPriorityFeePerGas = getIncreasedPriceFromExisting(
|
|
627
|
-
existingMaxPriorityFeePerGas,
|
|
628
|
-
CANCEL_RATE
|
|
629
|
-
);
|
|
630
|
-
const maxPriorityFeePerGasValues = isFeeMarketEIP1559Values(gasValues) && gasValues.maxPriorityFeePerGas;
|
|
631
|
-
const newMaxPriorityFeePerGas = maxPriorityFeePerGasValues && validateMinimumIncrease(
|
|
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 = bufferToHex(signedTx.serialize());
|
|
661
|
-
const newFee = newTxParams.maxFeePerGas ?? newTxParams.gasPrice;
|
|
662
|
-
const oldFee = newTxParams.maxFeePerGas ? transactionMeta.txParams.maxFeePerGas : transactionMeta.txParams.gasPrice;
|
|
663
|
-
projectLogger("Submitting cancel transaction", {
|
|
664
|
-
oldFee,
|
|
665
|
-
newFee,
|
|
666
|
-
txParams: newTxParams
|
|
667
|
-
});
|
|
668
|
-
const ethQuery = __privateGet(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 __privateMethod(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
|
+
__privateGet(this, _internalEvents).emit(
|
|
627
|
+
`${newTransactionMeta.id}:finished`,
|
|
628
|
+
newTransactionMeta
|
|
629
|
+
);
|
|
630
|
+
}
|
|
698
631
|
});
|
|
699
|
-
this.messagingSystem.publish(
|
|
700
|
-
`${controllerName}:transactionFinished`,
|
|
701
|
-
cancelTransactionMeta
|
|
702
|
-
);
|
|
703
|
-
__privateGet(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 {
|
|
|
718
643
|
actionId,
|
|
719
644
|
estimatedBaseFee
|
|
720
645
|
} = {}) {
|
|
721
|
-
|
|
722
|
-
return;
|
|
723
|
-
}
|
|
724
|
-
if (gasValues) {
|
|
725
|
-
gasValues = normalizeGasFeeValues(gasValues);
|
|
726
|
-
validateGasValues(gasValues);
|
|
727
|
-
}
|
|
728
|
-
projectLogger("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 = getIncreasedPriceFromExisting(
|
|
737
|
-
transactionMeta.txParams.gasPrice,
|
|
738
|
-
SPEED_UP_RATE
|
|
739
|
-
);
|
|
740
|
-
const gasPriceFromValues = isGasPriceValue(gasValues) && gasValues.gasPrice;
|
|
741
|
-
const newGasPrice = gasPriceFromValues && validateMinimumIncrease(gasPriceFromValues, minGasPrice) || minGasPrice;
|
|
742
|
-
const existingMaxFeePerGas = transactionMeta.txParams?.maxFeePerGas;
|
|
743
|
-
const minMaxFeePerGas = getIncreasedPriceFromExisting(
|
|
744
|
-
existingMaxFeePerGas,
|
|
745
|
-
SPEED_UP_RATE
|
|
746
|
-
);
|
|
747
|
-
const maxFeePerGasValues = isFeeMarketEIP1559Values(gasValues) && gasValues.maxFeePerGas;
|
|
748
|
-
const newMaxFeePerGas = maxFeePerGasValues && validateMinimumIncrease(maxFeePerGasValues, minMaxFeePerGas) || existingMaxFeePerGas && minMaxFeePerGas;
|
|
749
|
-
const existingMaxPriorityFeePerGas = transactionMeta.txParams?.maxPriorityFeePerGas;
|
|
750
|
-
const minMaxPriorityFeePerGas = getIncreasedPriceFromExisting(
|
|
751
|
-
existingMaxPriorityFeePerGas,
|
|
752
|
-
SPEED_UP_RATE
|
|
753
|
-
);
|
|
754
|
-
const maxPriorityFeePerGasValues = isFeeMarketEIP1559Values(gasValues) && gasValues.maxPriorityFeePerGas;
|
|
755
|
-
const newMaxPriorityFeePerGas = maxPriorityFeePerGasValues && validateMinimumIncrease(
|
|
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 = bufferToHex(signedTx.serialize());
|
|
783
|
-
const newFee = txParams.maxFeePerGas ?? txParams.gasPrice;
|
|
784
|
-
const oldFee = txParams.maxFeePerGas ? transactionMetaWithRsv.txParams.maxFeePerGas : transactionMetaWithRsv.txParams.gasPrice;
|
|
785
|
-
projectLogger("Submitting speed up transaction", { oldFee, newFee, txParams });
|
|
786
|
-
const ethQuery = __privateGet(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: random(),
|
|
799
|
-
time: Date.now(),
|
|
800
|
-
hash,
|
|
646
|
+
return await __privateMethod(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
|
-
});
|
|
825
|
-
this.messagingSystem.publish(`${controllerName}:transactionSubmitted`, {
|
|
826
|
-
transactionMeta: newTransactionMeta,
|
|
827
|
-
actionId
|
|
828
660
|
});
|
|
829
|
-
this.messagingSystem.publish(
|
|
830
|
-
`${controllerName}:speedupTransactionAdded`,
|
|
831
|
-
newTransactionMeta
|
|
832
|
-
);
|
|
833
661
|
}
|
|
834
662
|
/**
|
|
835
663
|
* Estimates required gas for a given transaction.
|
|
@@ -1506,7 +1334,7 @@ var TransactionController = class extends 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 = __privateMethod(this, _isCustomNetwork, isCustomNetwork_fn).call(this, networkClientId);
|
|
@@ -1518,25 +1346,27 @@ var TransactionController = class extends BaseController {
|
|
|
1518
1346
|
networkClientId,
|
|
1519
1347
|
chainId
|
|
1520
1348
|
});
|
|
1521
|
-
await
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1349
|
+
await __privateGet(this, _trace).call(this, { name: "Update Gas", parentContext: traceContext }, async () => {
|
|
1350
|
+
await updateGas({
|
|
1351
|
+
ethQuery,
|
|
1352
|
+
chainId,
|
|
1353
|
+
isCustomNetwork,
|
|
1354
|
+
txMeta: transactionMeta
|
|
1355
|
+
});
|
|
1526
1356
|
});
|
|
1527
|
-
await updateGasFees({
|
|
1357
|
+
await __privateGet(this, _trace).call(this, { name: "Update Gas Fees", parentContext: traceContext }, async () => await updateGasFees({
|
|
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 updateTransactionLayer1GasFee({
|
|
1364
|
+
}));
|
|
1365
|
+
await __privateGet(this, _trace).call(this, { name: "Update Layer 1 Gas Fees", parentContext: traceContext }, async () => await updateTransactionLayer1GasFee({
|
|
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 {
|
|
|
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 {
|
|
|
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 __privateGet(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 {
|
|
|
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 {
|
|
|
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);
|
|
@@ -1691,10 +1527,7 @@ var TransactionController = class extends BaseController {
|
|
|
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 __privateGet(this, _trace).call(this, { name: "Sign", parentContext: traceContext }, () => this.signTransaction(transactionMeta, transactionMeta.txParams));
|
|
1698
1531
|
if (!this.beforePublish(transactionMeta)) {
|
|
1699
1532
|
projectLogger("Skipping publishing transaction based on hook");
|
|
1700
1533
|
this.messagingSystem.publish(
|
|
@@ -1719,13 +1552,16 @@ var TransactionController = class extends BaseController {
|
|
|
1719
1552
|
]);
|
|
1720
1553
|
}
|
|
1721
1554
|
projectLogger("Publishing transaction", transactionMeta.txParams);
|
|
1722
|
-
let
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1555
|
+
let hash;
|
|
1556
|
+
await __privateGet(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
|
projectLogger("Publish successful", hash);
|
|
1730
1566
|
transactionMeta = __privateMethod(this, _updateTransactionInternal, updateTransactionInternal_fn).call(this, {
|
|
1731
1567
|
transactionId,
|
|
@@ -1856,11 +1692,19 @@ var TransactionController = class extends 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 = ApprovalType.Transaction;
|
|
1863
1702
|
const requestData = { txId: txMeta.id };
|
|
1703
|
+
await __privateGet(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
|
{
|
|
@@ -2244,10 +2088,96 @@ var TransactionController = class extends 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 = normalizeGasFeeValues(gasValues);
|
|
2113
|
+
validateGasValues(gasValues);
|
|
2114
|
+
}
|
|
2115
|
+
projectLogger(`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 = getTransactionParamsWithIncreasedGasFee(
|
|
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 = bufferToHex(signedTx.serialize());
|
|
2142
|
+
const newFee = newTxParams.maxFeePerGas ?? newTxParams.gasPrice;
|
|
2143
|
+
const oldFee = newTxParams.maxFeePerGas ? transactionMetaWithRsv.txParams.maxFeePerGas : transactionMetaWithRsv.txParams.gasPrice;
|
|
2144
|
+
projectLogger(`Submitting ${label} transaction`, {
|
|
2145
|
+
oldFee,
|
|
2146
|
+
newFee,
|
|
2147
|
+
txParams: newTxParams
|
|
2148
|
+
});
|
|
2149
|
+
const ethQuery = __privateGet(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: random(),
|
|
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,
|
|
@@ -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
|
__privateMethod(this, _updateTransactionInternal, updateTransactionInternal_fn).call(this, { transactionId, skipHistory: true }, (txMeta) => {
|
|
2479
2409
|
txMeta.simulationData = void 0;
|
|
2480
2410
|
});
|
|
2481
|
-
simulationData = await getSimulationData({
|
|
2411
|
+
simulationData = await __privateGet(this, _trace).call(this, { name: "Simulate", parentContext: traceContext }, () => getSimulationData({
|
|
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 @@ export {
|
|
|
2576
2506
|
ApprovalState,
|
|
2577
2507
|
TransactionController
|
|
2578
2508
|
};
|
|
2579
|
-
//# sourceMappingURL=chunk-
|
|
2509
|
+
//# sourceMappingURL=chunk-XTMJ25EF.mjs.map
|