@metamask-previews/transaction-controller 10.0.0-preview.2f7e793 → 10.0.0-preview.76bc0ab

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.
Files changed (37) hide show
  1. package/dist/EtherscanRemoteTransactionSource.d.ts +3 -3
  2. package/dist/EtherscanRemoteTransactionSource.d.ts.map +1 -1
  3. package/dist/EtherscanRemoteTransactionSource.js +47 -24
  4. package/dist/EtherscanRemoteTransactionSource.js.map +1 -1
  5. package/dist/IncomingTransactionHelper.d.ts.map +1 -1
  6. package/dist/IncomingTransactionHelper.js +24 -18
  7. package/dist/IncomingTransactionHelper.js.map +1 -1
  8. package/dist/TransactionController.d.ts +71 -25
  9. package/dist/TransactionController.d.ts.map +1 -1
  10. package/dist/TransactionController.js +217 -106
  11. package/dist/TransactionController.js.map +1 -1
  12. package/dist/constants.d.ts +0 -19
  13. package/dist/constants.d.ts.map +1 -1
  14. package/dist/constants.js +0 -19
  15. package/dist/constants.js.map +1 -1
  16. package/dist/etherscan.d.ts +5 -6
  17. package/dist/etherscan.d.ts.map +1 -1
  18. package/dist/etherscan.js +6 -17
  19. package/dist/etherscan.js.map +1 -1
  20. package/dist/external-transactions.js +5 -5
  21. package/dist/external-transactions.js.map +1 -1
  22. package/dist/history.d.ts +15 -0
  23. package/dist/history.d.ts.map +1 -0
  24. package/dist/history.js +75 -0
  25. package/dist/history.js.map +1 -0
  26. package/dist/logger.d.ts +6 -0
  27. package/dist/logger.d.ts.map +1 -0
  28. package/dist/logger.js +8 -0
  29. package/dist/logger.js.map +1 -0
  30. package/dist/types.d.ts +108 -23
  31. package/dist/types.d.ts.map +1 -1
  32. package/dist/types.js.map +1 -1
  33. package/dist/utils.d.ts +16 -18
  34. package/dist/utils.d.ts.map +1 -1
  35. package/dist/utils.js +44 -48
  36. package/dist/utils.js.map +1 -1
  37. package/package.json +3 -1
@@ -23,10 +23,12 @@ const eth_method_registry_1 = __importDefault(require("eth-method-registry"));
23
23
  const eth_rpc_errors_1 = require("eth-rpc-errors");
24
24
  const ethereumjs_util_1 = require("ethereumjs-util");
25
25
  const events_1 = require("events");
26
+ const lodash_1 = require("lodash");
26
27
  const nonce_tracker_1 = __importDefault(require("nonce-tracker"));
27
28
  const uuid_1 = require("uuid");
28
29
  const EtherscanRemoteTransactionSource_1 = require("./EtherscanRemoteTransactionSource");
29
30
  const external_transactions_1 = require("./external-transactions");
31
+ const history_1 = require("./history");
30
32
  const IncomingTransactionHelper_1 = require("./IncomingTransactionHelper");
31
33
  const types_1 = require("./types");
32
34
  const utils_1 = require("./utils");
@@ -52,10 +54,11 @@ class TransactionController extends base_controller_1.BaseController {
52
54
  *
53
55
  * @param options - The controller options.
54
56
  * @param options.blockTracker - The block tracker used to poll for new blocks data.
57
+ * @param options.disableHistory - Whether to disable storing history in transaction metadata.
58
+ * @param options.disableSendFlowHistory - Explicitly disable transaction metadata history.
55
59
  * @param options.getNetworkState - Gets the state of the network controller.
56
60
  * @param options.getSelectedAddress - Gets the address of the currently selected account.
57
61
  * @param options.incomingTransactions - Configuration options for incoming transaction support.
58
- * @param options.incomingTransactions.apiKey - An optional API key to use when fetching remote transaction data.
59
62
  * @param options.incomingTransactions.includeTokenTransfers - Whether or not to include ERC20 token transfers.
60
63
  * @param options.incomingTransactions.isEnabled - Whether or not incoming transaction retrieval is enabled.
61
64
  * @param options.incomingTransactions.queryEntireHistory - Whether to initially query the entire transaction history or only recent blocks.
@@ -66,7 +69,7 @@ class TransactionController extends base_controller_1.BaseController {
66
69
  * @param config - Initial options used to configure this controller.
67
70
  * @param state - Initial state to set on this controller.
68
71
  */
69
- constructor({ blockTracker, getNetworkState, getSelectedAddress, incomingTransactions = {}, messenger, onNetworkStateChange, provider, }, config, state) {
72
+ constructor({ blockTracker, disableHistory, disableSendFlowHistory, getNetworkState, getSelectedAddress, incomingTransactions = {}, messenger, onNetworkStateChange, provider, }, config, state) {
70
73
  super(config, state);
71
74
  this.mutex = new async_mutex_1.Mutex();
72
75
  /**
@@ -91,6 +94,8 @@ class TransactionController extends base_controller_1.BaseController {
91
94
  this.messagingSystem = messenger;
92
95
  this.getNetworkState = getNetworkState;
93
96
  this.ethQuery = new eth_query_1.default(provider);
97
+ this.isSendFlowHistoryDisabled = disableSendFlowHistory !== null && disableSendFlowHistory !== void 0 ? disableSendFlowHistory : false;
98
+ this.isHistoryDisabled = disableHistory !== null && disableHistory !== void 0 ? disableHistory : false;
94
99
  this.registry = new eth_method_registry_1.default({ provider });
95
100
  this.nonceTracker = new nonce_tracker_1.default({
96
101
  provider,
@@ -106,7 +111,6 @@ class TransactionController extends base_controller_1.BaseController {
106
111
  isEnabled: incomingTransactions.isEnabled,
107
112
  queryEntireHistory: incomingTransactions.queryEntireHistory,
108
113
  remoteTransactionSource: new EtherscanRemoteTransactionSource_1.EtherscanRemoteTransactionSource({
109
- apiKey: incomingTransactions.apiKey,
110
114
  includeTokenTransfers: incomingTransactions.includeTokenTransfers,
111
115
  }),
112
116
  transactionLimit: this.config.txHistoryLimit,
@@ -122,7 +126,7 @@ class TransactionController extends base_controller_1.BaseController {
122
126
  }
123
127
  failTransaction(transactionMeta, error) {
124
128
  const newTransactionMeta = Object.assign(Object.assign({}, transactionMeta), { error, status: types_1.TransactionStatus.failed });
125
- this.updateTransaction(newTransactionMeta);
129
+ this.updateTransaction(newTransactionMeta, 'TransactionController#failTransaction - Add error message and set status to failed');
126
130
  this.hub.emit(`${transactionMeta.id}:finished`, newTransactionMeta);
127
131
  }
128
132
  registryLookup(fourBytePrefix) {
@@ -178,43 +182,44 @@ class TransactionController extends base_controller_1.BaseController {
178
182
  * unique transaction id will be generated, and gas and gasPrice will be calculated
179
183
  * if not provided. If A `<tx.id>:unapproved` hub event will be emitted once added.
180
184
  *
181
- * @param transaction - The transaction object to add.
185
+ * @param txParams - Standard parameters for an Ethereum transaction.
182
186
  * @param opts - Additional options to control how the transaction is added.
183
187
  * @param opts.actionId - Unique ID to prevent duplicate requests.
184
188
  * @param opts.deviceConfirmedOn - An enum to indicate what device confirmed the transaction.
185
189
  * @param opts.origin - The origin of the transaction request, such as a dApp hostname.
186
190
  * @param opts.requireApproval - Whether the transaction requires approval by the user, defaults to true unless explicitly disabled.
187
191
  * @param opts.securityAlertResponse - Response from security validator.
192
+ * @param opts.sendFlowHistory - The sendFlowHistory entries to add.
188
193
  * @returns Object containing a promise resolving to the transaction hash if approved.
189
194
  */
190
- addTransaction(transaction, { actionId, deviceConfirmedOn, origin, requireApproval, securityAlertResponse, } = {}) {
195
+ addTransaction(txParams, { actionId, deviceConfirmedOn, origin, requireApproval, securityAlertResponse, sendFlowHistory, } = {}) {
191
196
  return __awaiter(this, void 0, void 0, function* () {
192
- const { chainId, networkId } = this.getChainAndNetworkId();
197
+ const chainId = this.getChainId();
193
198
  const { transactions } = this.state;
194
- transaction = (0, utils_1.normalizeTransaction)(transaction);
195
- (0, utils_1.validateTransaction)(transaction);
196
- const dappSuggestedGasFees = this.generateDappSuggestedGasFees(transaction, origin);
199
+ txParams = (0, utils_1.normalizeTxParams)(txParams);
200
+ (0, utils_1.validateTxParams)(txParams);
201
+ const dappSuggestedGasFees = this.generateDappSuggestedGasFees(txParams, origin);
197
202
  const existingTransactionMeta = this.getTransactionWithActionId(actionId);
198
203
  // If a request to add a transaction with the same actionId is submitted again, a new transaction will not be created for it.
199
204
  const transactionMeta = existingTransactionMeta || {
200
- id: (0, uuid_1.v1)(),
201
- networkID: networkId !== null && networkId !== void 0 ? networkId : undefined,
205
+ // Add actionId to txMeta to check if same actionId is seen again
206
+ actionId,
202
207
  chainId,
208
+ dappSuggestedGasFees,
209
+ deviceConfirmedOn,
210
+ id: (0, uuid_1.v1)(),
203
211
  origin,
212
+ securityAlertResponse,
204
213
  status: types_1.TransactionStatus.unapproved,
205
214
  time: Date.now(),
206
- transaction,
207
- deviceConfirmedOn,
215
+ txParams,
216
+ userEditedGasLimit: false,
208
217
  verifiedOnBlockchain: false,
209
- dappSuggestedGasFees,
210
- securityAlertResponse,
211
- // Add actionId to txMeta to check if same actionId is seen again
212
- actionId,
213
218
  };
214
219
  try {
215
- const { gas, estimateGasError } = yield this.estimateGas(transaction);
216
- transaction.gas = gas;
217
- transaction.estimateGasError = estimateGasError;
220
+ const { gas, estimateGasError } = yield this.estimateGas(txParams);
221
+ txParams.gas = gas;
222
+ txParams.estimateGasError = estimateGasError;
218
223
  transactionMeta.originalGasEstimate = gas;
219
224
  }
220
225
  catch (error) {
@@ -223,6 +228,13 @@ class TransactionController extends base_controller_1.BaseController {
223
228
  }
224
229
  // Checks if a transaction already exists with a given actionId
225
230
  if (!existingTransactionMeta) {
231
+ if (!this.isSendFlowHistoryDisabled) {
232
+ transactionMeta.sendFlowHistory = sendFlowHistory !== null && sendFlowHistory !== void 0 ? sendFlowHistory : [];
233
+ }
234
+ // Initial history push
235
+ if (!this.isHistoryDisabled) {
236
+ (0, history_1.addInitialHistorySnapshot)(transactionMeta);
237
+ }
226
238
  transactions.push(transactionMeta);
227
239
  this.update({
228
240
  transactions: this.trimTransactionsForState(transactions),
@@ -253,9 +265,9 @@ class TransactionController extends base_controller_1.BaseController {
253
265
  * Creates approvals for all unapproved transactions persisted.
254
266
  */
255
267
  initApprovals() {
256
- const { networkId, chainId } = this.getChainAndNetworkId();
268
+ const chainId = this.getChainId();
257
269
  const unapprovedTxs = this.state.transactions.filter((transaction) => transaction.status === types_1.TransactionStatus.unapproved &&
258
- (0, utils_1.transactionMatchesNetwork)(transaction, chainId, networkId));
270
+ transaction.chainId === chainId);
259
271
  for (const txMeta of unapprovedTxs) {
260
272
  this.processApproval(txMeta, {
261
273
  shouldShowRequest: false,
@@ -269,18 +281,18 @@ class TransactionController extends base_controller_1.BaseController {
269
281
  * Attempts to cancel a transaction based on its ID by setting its status to "rejected"
270
282
  * and emitting a `<tx.id>:finished` hub event.
271
283
  *
272
- * @param transactionID - The ID of the transaction to cancel.
284
+ * @param transactionId - The ID of the transaction to cancel.
273
285
  * @param gasValues - The gas values to use for the cancellation transaction.
274
286
  * @param options - The options for the cancellation transaction.
275
287
  * @param options.estimatedBaseFee - The estimated base fee of the transaction.
276
288
  */
277
- stopTransaction(transactionID, gasValues, { estimatedBaseFee } = {}) {
289
+ stopTransaction(transactionId, gasValues, { estimatedBaseFee } = {}) {
278
290
  var _a, _b;
279
291
  return __awaiter(this, void 0, void 0, function* () {
280
292
  if (gasValues) {
281
293
  (0, utils_1.validateGasValues)(gasValues);
282
294
  }
283
- const transactionMeta = this.state.transactions.find(({ id }) => id === transactionID);
295
+ const transactionMeta = this.state.transactions.find(({ id }) => id === transactionId);
284
296
  if (!transactionMeta) {
285
297
  return;
286
298
  }
@@ -288,20 +300,20 @@ class TransactionController extends base_controller_1.BaseController {
288
300
  throw new Error('No sign method defined.');
289
301
  }
290
302
  // gasPrice (legacy non EIP1559)
291
- const minGasPrice = (0, utils_1.getIncreasedPriceFromExisting)(transactionMeta.transaction.gasPrice, exports.CANCEL_RATE);
303
+ const minGasPrice = (0, utils_1.getIncreasedPriceFromExisting)(transactionMeta.txParams.gasPrice, exports.CANCEL_RATE);
292
304
  const gasPriceFromValues = (0, utils_1.isGasPriceValue)(gasValues) && gasValues.gasPrice;
293
305
  const newGasPrice = (gasPriceFromValues &&
294
306
  (0, utils_1.validateMinimumIncrease)(gasPriceFromValues, minGasPrice)) ||
295
307
  minGasPrice;
296
308
  // maxFeePerGas (EIP1559)
297
- const existingMaxFeePerGas = (_a = transactionMeta.transaction) === null || _a === void 0 ? void 0 : _a.maxFeePerGas;
309
+ const existingMaxFeePerGas = (_a = transactionMeta.txParams) === null || _a === void 0 ? void 0 : _a.maxFeePerGas;
298
310
  const minMaxFeePerGas = (0, utils_1.getIncreasedPriceFromExisting)(existingMaxFeePerGas, exports.CANCEL_RATE);
299
311
  const maxFeePerGasValues = (0, utils_1.isFeeMarketEIP1559Values)(gasValues) && gasValues.maxFeePerGas;
300
312
  const newMaxFeePerGas = (maxFeePerGasValues &&
301
313
  (0, utils_1.validateMinimumIncrease)(maxFeePerGasValues, minMaxFeePerGas)) ||
302
314
  (existingMaxFeePerGas && minMaxFeePerGas);
303
315
  // maxPriorityFeePerGas (EIP1559)
304
- const existingMaxPriorityFeePerGas = (_b = transactionMeta.transaction) === null || _b === void 0 ? void 0 : _b.maxPriorityFeePerGas;
316
+ const existingMaxPriorityFeePerGas = (_b = transactionMeta.txParams) === null || _b === void 0 ? void 0 : _b.maxPriorityFeePerGas;
305
317
  const minMaxPriorityFeePerGas = (0, utils_1.getIncreasedPriceFromExisting)(existingMaxPriorityFeePerGas, exports.CANCEL_RATE);
306
318
  const maxPriorityFeePerGasValues = (0, utils_1.isFeeMarketEIP1559Values)(gasValues) && gasValues.maxPriorityFeePerGas;
307
319
  const newMaxPriorityFeePerGas = (maxPriorityFeePerGasValues &&
@@ -309,25 +321,26 @@ class TransactionController extends base_controller_1.BaseController {
309
321
  (existingMaxPriorityFeePerGas && minMaxPriorityFeePerGas);
310
322
  const txParams = newMaxFeePerGas && newMaxPriorityFeePerGas
311
323
  ? {
312
- from: transactionMeta.transaction.from,
313
- gasLimit: transactionMeta.transaction.gas,
324
+ from: transactionMeta.txParams.from,
325
+ gasLimit: transactionMeta.txParams.gas,
314
326
  maxFeePerGas: newMaxFeePerGas,
315
327
  maxPriorityFeePerGas: newMaxPriorityFeePerGas,
316
328
  type: 2,
317
- nonce: transactionMeta.transaction.nonce,
318
- to: transactionMeta.transaction.from,
329
+ nonce: transactionMeta.txParams.nonce,
330
+ to: transactionMeta.txParams.from,
319
331
  value: '0x0',
320
332
  }
321
333
  : {
322
- from: transactionMeta.transaction.from,
323
- gasLimit: transactionMeta.transaction.gas,
334
+ from: transactionMeta.txParams.from,
335
+ gasLimit: transactionMeta.txParams.gas,
324
336
  gasPrice: newGasPrice,
325
- nonce: transactionMeta.transaction.nonce,
326
- to: transactionMeta.transaction.from,
337
+ nonce: transactionMeta.txParams.nonce,
338
+ to: transactionMeta.txParams.from,
327
339
  value: '0x0',
328
340
  };
329
341
  const unsignedEthTx = this.prepareUnsignedEthTx(txParams);
330
- const signedTx = yield this.sign(unsignedEthTx, transactionMeta.transaction.from);
342
+ const signedTx = yield this.sign(unsignedEthTx, transactionMeta.txParams.from);
343
+ yield this.updateTransactionMetaRSV(transactionMeta, signedTx);
331
344
  const rawTx = (0, ethereumjs_util_1.bufferToHex)(signedTx.serialize());
332
345
  yield (0, controller_utils_1.query)(this.ethQuery, 'sendRawTransaction', [rawTx]);
333
346
  transactionMeta.estimatedBaseFee = estimatedBaseFee;
@@ -338,13 +351,13 @@ class TransactionController extends base_controller_1.BaseController {
338
351
  /**
339
352
  * Attempts to speed up a transaction increasing transaction gasPrice by ten percent.
340
353
  *
341
- * @param transactionID - The ID of the transaction to speed up.
354
+ * @param transactionId - The ID of the transaction to speed up.
342
355
  * @param gasValues - The gas values to use for the speed up transaction.
343
356
  * @param options - The options for the speed up transaction.
344
357
  * @param options.actionId - Unique ID to prevent duplicate requests
345
358
  * @param options.estimatedBaseFee - The estimated base fee of the transaction.
346
359
  */
347
- speedUpTransaction(transactionID, gasValues, { actionId, estimatedBaseFee, } = {}) {
360
+ speedUpTransaction(transactionId, gasValues, { actionId, estimatedBaseFee, } = {}) {
348
361
  var _a, _b;
349
362
  return __awaiter(this, void 0, void 0, function* () {
350
363
  // If transaction is found for same action id, do not create a new speed up transaction.
@@ -354,7 +367,7 @@ class TransactionController extends base_controller_1.BaseController {
354
367
  if (gasValues) {
355
368
  (0, utils_1.validateGasValues)(gasValues);
356
369
  }
357
- const transactionMeta = this.state.transactions.find(({ id }) => id === transactionID);
370
+ const transactionMeta = this.state.transactions.find(({ id }) => id === transactionId);
358
371
  /* istanbul ignore next */
359
372
  if (!transactionMeta) {
360
373
  return;
@@ -365,35 +378,36 @@ class TransactionController extends base_controller_1.BaseController {
365
378
  }
366
379
  const { transactions } = this.state;
367
380
  // gasPrice (legacy non EIP1559)
368
- const minGasPrice = (0, utils_1.getIncreasedPriceFromExisting)(transactionMeta.transaction.gasPrice, exports.SPEED_UP_RATE);
381
+ const minGasPrice = (0, utils_1.getIncreasedPriceFromExisting)(transactionMeta.txParams.gasPrice, exports.SPEED_UP_RATE);
369
382
  const gasPriceFromValues = (0, utils_1.isGasPriceValue)(gasValues) && gasValues.gasPrice;
370
383
  const newGasPrice = (gasPriceFromValues &&
371
384
  (0, utils_1.validateMinimumIncrease)(gasPriceFromValues, minGasPrice)) ||
372
385
  minGasPrice;
373
386
  // maxFeePerGas (EIP1559)
374
- const existingMaxFeePerGas = (_a = transactionMeta.transaction) === null || _a === void 0 ? void 0 : _a.maxFeePerGas;
387
+ const existingMaxFeePerGas = (_a = transactionMeta.txParams) === null || _a === void 0 ? void 0 : _a.maxFeePerGas;
375
388
  const minMaxFeePerGas = (0, utils_1.getIncreasedPriceFromExisting)(existingMaxFeePerGas, exports.SPEED_UP_RATE);
376
389
  const maxFeePerGasValues = (0, utils_1.isFeeMarketEIP1559Values)(gasValues) && gasValues.maxFeePerGas;
377
390
  const newMaxFeePerGas = (maxFeePerGasValues &&
378
391
  (0, utils_1.validateMinimumIncrease)(maxFeePerGasValues, minMaxFeePerGas)) ||
379
392
  (existingMaxFeePerGas && minMaxFeePerGas);
380
393
  // maxPriorityFeePerGas (EIP1559)
381
- const existingMaxPriorityFeePerGas = (_b = transactionMeta.transaction) === null || _b === void 0 ? void 0 : _b.maxPriorityFeePerGas;
394
+ const existingMaxPriorityFeePerGas = (_b = transactionMeta.txParams) === null || _b === void 0 ? void 0 : _b.maxPriorityFeePerGas;
382
395
  const minMaxPriorityFeePerGas = (0, utils_1.getIncreasedPriceFromExisting)(existingMaxPriorityFeePerGas, exports.SPEED_UP_RATE);
383
396
  const maxPriorityFeePerGasValues = (0, utils_1.isFeeMarketEIP1559Values)(gasValues) && gasValues.maxPriorityFeePerGas;
384
397
  const newMaxPriorityFeePerGas = (maxPriorityFeePerGasValues &&
385
398
  (0, utils_1.validateMinimumIncrease)(maxPriorityFeePerGasValues, minMaxPriorityFeePerGas)) ||
386
399
  (existingMaxPriorityFeePerGas && minMaxPriorityFeePerGas);
387
400
  const txParams = newMaxFeePerGas && newMaxPriorityFeePerGas
388
- ? Object.assign(Object.assign({}, transactionMeta.transaction), { gasLimit: transactionMeta.transaction.gas, maxFeePerGas: newMaxFeePerGas, maxPriorityFeePerGas: newMaxPriorityFeePerGas, type: 2 }) : Object.assign(Object.assign({}, transactionMeta.transaction), { gasLimit: transactionMeta.transaction.gas, gasPrice: newGasPrice });
401
+ ? Object.assign(Object.assign({}, transactionMeta.txParams), { gasLimit: transactionMeta.txParams.gas, maxFeePerGas: newMaxFeePerGas, maxPriorityFeePerGas: newMaxPriorityFeePerGas, type: 2 }) : Object.assign(Object.assign({}, transactionMeta.txParams), { gasLimit: transactionMeta.txParams.gas, gasPrice: newGasPrice });
389
402
  const unsignedEthTx = this.prepareUnsignedEthTx(txParams);
390
- const signedTx = yield this.sign(unsignedEthTx, transactionMeta.transaction.from);
403
+ const signedTx = yield this.sign(unsignedEthTx, transactionMeta.txParams.from);
404
+ yield this.updateTransactionMetaRSV(transactionMeta, signedTx);
391
405
  const rawTx = (0, ethereumjs_util_1.bufferToHex)(signedTx.serialize());
392
406
  const hash = yield (0, controller_utils_1.query)(this.ethQuery, 'sendRawTransaction', [rawTx]);
393
407
  const baseTransactionMeta = Object.assign(Object.assign({}, transactionMeta), { estimatedBaseFee, id: (0, uuid_1.v1)(), time: Date.now(), hash,
394
- actionId, originalGasEstimate: transactionMeta.transaction.gas });
408
+ actionId, originalGasEstimate: transactionMeta.txParams.gas });
395
409
  const newTransactionMeta = newMaxFeePerGas && newMaxPriorityFeePerGas
396
- ? Object.assign(Object.assign({}, baseTransactionMeta), { transaction: Object.assign(Object.assign({}, transactionMeta.transaction), { maxFeePerGas: newMaxFeePerGas, maxPriorityFeePerGas: newMaxPriorityFeePerGas }) }) : Object.assign(Object.assign({}, baseTransactionMeta), { transaction: Object.assign(Object.assign({}, transactionMeta.transaction), { gasPrice: newGasPrice }) });
410
+ ? Object.assign(Object.assign({}, baseTransactionMeta), { txParams: Object.assign(Object.assign({}, transactionMeta.txParams), { maxFeePerGas: newMaxFeePerGas, maxPriorityFeePerGas: newMaxPriorityFeePerGas }) }) : Object.assign(Object.assign({}, baseTransactionMeta), { txParams: Object.assign(Object.assign({}, transactionMeta.txParams), { gasPrice: newGasPrice }) });
397
411
  transactions.push(newTransactionMeta);
398
412
  this.update({ transactions: this.trimTransactionsForState(transactions) });
399
413
  this.hub.emit(`${transactionMeta.id}:speedup`, newTransactionMeta);
@@ -477,14 +491,10 @@ class TransactionController extends base_controller_1.BaseController {
477
491
  queryTransactionStatuses() {
478
492
  return __awaiter(this, void 0, void 0, function* () {
479
493
  const { transactions } = this.state;
480
- const { chainId: currentChainId, networkId: currentNetworkID } = this.getChainAndNetworkId();
494
+ const currentChainId = this.getChainId();
481
495
  let gotUpdates = false;
482
496
  yield (0, controller_utils_1.safelyExecute)(() => Promise.all(transactions.map((meta, index) => __awaiter(this, void 0, void 0, function* () {
483
- // Using fallback to networkID only when there is no chainId present.
484
- // Should be removed when networkID is completely removed.
485
- const txBelongsToCurrentChain = meta.chainId === currentChainId ||
486
- (!meta.chainId && meta.networkID === currentNetworkID);
487
- if (!meta.verifiedOnBlockchain && txBelongsToCurrentChain) {
497
+ if (!meta.verifiedOnBlockchain && meta.chainId === currentChainId) {
488
498
  const [reconciledTx, updateRequired] = yield this.blockchainTransactionStateReconciler(meta);
489
499
  if (updateRequired) {
490
500
  transactions[index] = reconciledTx;
@@ -504,11 +514,15 @@ class TransactionController extends base_controller_1.BaseController {
504
514
  * Updates an existing transaction in state.
505
515
  *
506
516
  * @param transactionMeta - The new transaction to store in state.
517
+ * @param note - A note or update reason to include in the transaction history.
507
518
  */
508
- updateTransaction(transactionMeta) {
519
+ updateTransaction(transactionMeta, note) {
509
520
  const { transactions } = this.state;
510
- transactionMeta.transaction = (0, utils_1.normalizeTransaction)(transactionMeta.transaction);
511
- (0, utils_1.validateTransaction)(transactionMeta.transaction);
521
+ transactionMeta.txParams = (0, utils_1.normalizeTxParams)(transactionMeta.txParams);
522
+ (0, utils_1.validateTxParams)(transactionMeta.txParams);
523
+ if (!this.isHistoryDisabled) {
524
+ (0, history_1.updateTransactionHistory)(transactionMeta, note);
525
+ }
512
526
  const index = transactions.findIndex(({ id }) => transactionMeta.id === id);
513
527
  transactions[index] = transactionMeta;
514
528
  this.update({ transactions: this.trimTransactionsForState(transactions) });
@@ -527,17 +541,14 @@ class TransactionController extends base_controller_1.BaseController {
527
541
  this.update({ transactions: [] });
528
542
  return;
529
543
  }
530
- const { chainId: currentChainId, networkId: currentNetworkID } = this.getChainAndNetworkId();
531
- const newTransactions = this.state.transactions.filter(({ networkID, chainId, transaction }) => {
544
+ const currentChainId = this.getChainId();
545
+ const newTransactions = this.state.transactions.filter(({ chainId, txParams }) => {
532
546
  var _a;
533
- // Using fallback to networkID only when there is no chainId present. Should be removed when networkID is completely removed.
534
- const isMatchingNetwork = ignoreNetwork ||
535
- chainId === currentChainId ||
536
- (!chainId && networkID === currentNetworkID);
547
+ const isMatchingNetwork = ignoreNetwork || chainId === currentChainId;
537
548
  if (!isMatchingNetwork) {
538
549
  return true;
539
550
  }
540
- const isMatchingAddress = !address || ((_a = transaction.from) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === address.toLowerCase();
551
+ const isMatchingAddress = !address || ((_a = txParams.from) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === address.toLowerCase();
541
552
  return !isMatchingAddress;
542
553
  });
543
554
  this.update({
@@ -572,13 +583,88 @@ class TransactionController extends base_controller_1.BaseController {
572
583
  // Update same nonce local transactions as dropped and define replacedBy properties.
573
584
  this.markNonceDuplicatesDropped(transactionId);
574
585
  // Update external provided transaction with updated gas values and confirmed status.
575
- this.updateTransaction(transactionMeta);
586
+ this.updateTransaction(transactionMeta, 'TransactionController:confirmExternalTransaction - Add external transaction');
576
587
  }
577
588
  catch (error) {
578
589
  console.error(error);
579
590
  }
580
591
  });
581
592
  }
593
+ /**
594
+ * Append new send flow history to a transaction.
595
+ *
596
+ * @param transactionID - The ID of the transaction to update.
597
+ * @param currentSendFlowHistoryLength - The length of the current sendFlowHistory array.
598
+ * @param sendFlowHistoryToAdd - The sendFlowHistory entries to add.
599
+ * @returns The updated transactionMeta.
600
+ */
601
+ updateTransactionSendFlowHistory(transactionID, currentSendFlowHistoryLength, sendFlowHistoryToAdd) {
602
+ var _a, _b;
603
+ if (this.isSendFlowHistoryDisabled) {
604
+ throw new Error('Send flow history is disabled for the current transaction controller');
605
+ }
606
+ const transactionMeta = this.getTransaction(transactionID);
607
+ if (!transactionMeta) {
608
+ throw new Error(`Cannot update send flow history as no transaction metadata found`);
609
+ }
610
+ (0, utils_1.validateIfTransactionUnapproved)(transactionMeta, 'updateTransactionSendFlowHistory');
611
+ if (currentSendFlowHistoryLength ===
612
+ (((_a = transactionMeta === null || transactionMeta === void 0 ? void 0 : transactionMeta.sendFlowHistory) === null || _a === void 0 ? void 0 : _a.length) || 0)) {
613
+ transactionMeta.sendFlowHistory = [
614
+ ...((_b = transactionMeta === null || transactionMeta === void 0 ? void 0 : transactionMeta.sendFlowHistory) !== null && _b !== void 0 ? _b : []),
615
+ ...sendFlowHistoryToAdd,
616
+ ];
617
+ this.updateTransaction(transactionMeta, 'TransactionController:updateTransactionSendFlowHistory - sendFlowHistory updated');
618
+ }
619
+ return this.getTransaction(transactionID);
620
+ }
621
+ /**
622
+ * Update the gas values of a transaction.
623
+ *
624
+ * @param transactionId - The ID of the transaction to update.
625
+ * @param gasValues - Gas values to update.
626
+ * @param gasValues.gas - Same as transaction.gasLimit.
627
+ * @param gasValues.gasLimit - Maxmimum number of units of gas to use for this transaction.
628
+ * @param gasValues.gasPrice - Price per gas for legacy transactions.
629
+ * @param gasValues.maxPriorityFeePerGas - Maximum amount per gas to give to validator as incentive.
630
+ * @param gasValues.maxFeePerGas - Maximum amount per gas to pay for the transaction, including the priority fee.
631
+ * @param gasValues.estimateUsed - Which estimate level was used.
632
+ * @param gasValues.estimateSuggested - Which estimate level that the API suggested.
633
+ * @param gasValues.defaultGasEstimates - The default estimate for gas.
634
+ * @param gasValues.originalGasEstimate - Original estimate for gas.
635
+ * @param gasValues.userEditedGasLimit - The gas limit supplied by user.
636
+ * @param gasValues.userFeeLevel - Estimate level user selected.
637
+ * @returns The updated transactionMeta.
638
+ */
639
+ updateTransactionGasFees(transactionId, { defaultGasEstimates, estimateUsed, estimateSuggested, gas, gasLimit, gasPrice, maxPriorityFeePerGas, maxFeePerGas, originalGasEstimate, userEditedGasLimit, userFeeLevel, }) {
640
+ const transactionMeta = this.getTransaction(transactionId);
641
+ if (!transactionMeta) {
642
+ throw new Error(`Cannot update transaction as no transaction metadata found`);
643
+ }
644
+ (0, utils_1.validateIfTransactionUnapproved)(transactionMeta, 'updateTransactionGasFees');
645
+ let transactionGasFees = {
646
+ txParams: {
647
+ gas,
648
+ gasLimit,
649
+ gasPrice,
650
+ maxPriorityFeePerGas,
651
+ maxFeePerGas,
652
+ },
653
+ defaultGasEstimates,
654
+ estimateUsed,
655
+ estimateSuggested,
656
+ originalGasEstimate,
657
+ userEditedGasLimit,
658
+ userFeeLevel,
659
+ };
660
+ // only update what is defined
661
+ transactionGasFees.txParams = (0, lodash_1.pickBy)(transactionGasFees.txParams);
662
+ transactionGasFees = (0, lodash_1.pickBy)(transactionGasFees);
663
+ // merge updated gas values with existing transaction meta
664
+ const updatedMeta = (0, lodash_1.merge)(transactionMeta, transactionGasFees);
665
+ this.updateTransaction(updatedMeta, 'TransactionController:updateTransactionGasFees - gas values updated');
666
+ return this.getTransaction(transactionId);
667
+ }
582
668
  processApproval(transactionMeta, { isExisting = false, requireApproval, shouldShowRequest = true, }) {
583
669
  return __awaiter(this, void 0, void 0, function* () {
584
670
  const transactionId = transactionMeta.id;
@@ -638,16 +724,16 @@ class TransactionController extends base_controller_1.BaseController {
638
724
  * using the sign configuration property, then published to the blockchain.
639
725
  * A `<tx.id>:finished` hub event is fired after success or failure.
640
726
  *
641
- * @param transactionID - The ID of the transaction to approve.
727
+ * @param transactionId - The ID of the transaction to approve.
642
728
  */
643
- approveTransaction(transactionID) {
729
+ approveTransaction(transactionId) {
644
730
  return __awaiter(this, void 0, void 0, function* () {
645
731
  const { transactions } = this.state;
646
732
  const releaseLock = yield this.mutex.acquire();
647
- const { chainId } = this.getChainAndNetworkId();
648
- const index = transactions.findIndex(({ id }) => transactionID === id);
733
+ const chainId = this.getChainId();
734
+ const index = transactions.findIndex(({ id }) => transactionId === id);
649
735
  const transactionMeta = transactions[index];
650
- const { transaction: { nonce, from }, } = transactionMeta;
736
+ const { txParams: { nonce, from }, } = transactionMeta;
651
737
  let nonceLock;
652
738
  try {
653
739
  if (!this.sign) {
@@ -669,12 +755,12 @@ class TransactionController extends base_controller_1.BaseController {
669
755
  nonceToUse = (0, ethereumjs_util_1.addHexPrefix)(nonceLock.nextNonce.toString(16));
670
756
  }
671
757
  transactionMeta.status = status;
672
- transactionMeta.transaction.nonce = nonceToUse;
673
- transactionMeta.transaction.chainId = chainId;
674
- const baseTxParams = Object.assign(Object.assign({}, transactionMeta.transaction), { gasLimit: transactionMeta.transaction.gas });
675
- const isEIP1559 = (0, utils_1.isEIP1559Transaction)(transactionMeta.transaction);
758
+ transactionMeta.txParams.nonce = nonceToUse;
759
+ transactionMeta.txParams.chainId = chainId;
760
+ const baseTxParams = Object.assign(Object.assign({}, transactionMeta.txParams), { gasLimit: transactionMeta.txParams.gas });
761
+ const isEIP1559 = (0, utils_1.isEIP1559Transaction)(transactionMeta.txParams);
676
762
  const txParams = isEIP1559
677
- ? Object.assign(Object.assign({}, baseTxParams), { maxFeePerGas: transactionMeta.transaction.maxFeePerGas, maxPriorityFeePerGas: transactionMeta.transaction.maxPriorityFeePerGas, estimatedBaseFee: transactionMeta.transaction.estimatedBaseFee,
763
+ ? Object.assign(Object.assign({}, baseTxParams), { maxFeePerGas: transactionMeta.txParams.maxFeePerGas, maxPriorityFeePerGas: transactionMeta.txParams.maxPriorityFeePerGas, estimatedBaseFee: transactionMeta.txParams.estimatedBaseFee,
678
764
  // specify type 2 if maxFeePerGas and maxPriorityFeePerGas are set
679
765
  type: 2 }) : baseTxParams;
680
766
  // delete gasPrice if maxFeePerGas and maxPriorityFeePerGas are set
@@ -683,16 +769,17 @@ class TransactionController extends base_controller_1.BaseController {
683
769
  }
684
770
  const unsignedEthTx = this.prepareUnsignedEthTx(txParams);
685
771
  const signedTx = yield this.sign(unsignedEthTx, from);
772
+ yield this.updateTransactionMetaRSV(transactionMeta, signedTx);
686
773
  transactionMeta.status = types_1.TransactionStatus.signed;
687
- this.updateTransaction(transactionMeta);
774
+ this.updateTransaction(transactionMeta, 'TransactionController#approveTransaction - Transaction signed');
688
775
  const rawTx = (0, ethereumjs_util_1.bufferToHex)(signedTx.serialize());
689
776
  transactionMeta.rawTx = rawTx;
690
- this.updateTransaction(transactionMeta);
777
+ this.updateTransaction(transactionMeta, 'TransactionController#approveTransaction - RawTransaction added');
691
778
  const hash = yield (0, controller_utils_1.query)(this.ethQuery, 'sendRawTransaction', [rawTx]);
692
779
  transactionMeta.hash = hash;
693
780
  transactionMeta.status = types_1.TransactionStatus.submitted;
694
781
  transactionMeta.submittedTime = new Date().getTime();
695
- this.updateTransaction(transactionMeta);
782
+ this.updateTransaction(transactionMeta, 'TransactionController#approveTransaction - Transaction submitted');
696
783
  this.hub.emit(`${transactionMeta.id}:finished`, transactionMeta);
697
784
  }
698
785
  catch (error) {
@@ -711,16 +798,16 @@ class TransactionController extends base_controller_1.BaseController {
711
798
  * Cancels a transaction based on its ID by setting its status to "rejected"
712
799
  * and emitting a `<tx.id>:finished` hub event.
713
800
  *
714
- * @param transactionID - The ID of the transaction to cancel.
801
+ * @param transactionId - The ID of the transaction to cancel.
715
802
  */
716
- cancelTransaction(transactionID) {
717
- const transactionMeta = this.state.transactions.find(({ id }) => id === transactionID);
803
+ cancelTransaction(transactionId) {
804
+ const transactionMeta = this.state.transactions.find(({ id }) => id === transactionId);
718
805
  if (!transactionMeta) {
719
806
  return;
720
807
  }
721
808
  transactionMeta.status = types_1.TransactionStatus.rejected;
722
809
  this.hub.emit(`${transactionMeta.id}:finished`, transactionMeta);
723
- const transactions = this.state.transactions.filter(({ id }) => id !== transactionID);
810
+ const transactions = this.state.transactions.filter(({ id }) => id !== transactionId);
724
811
  this.update({ transactions: this.trimTransactionsForState(transactions) });
725
812
  }
726
813
  /**
@@ -742,9 +829,9 @@ class TransactionController extends base_controller_1.BaseController {
742
829
  const txsToKeep = transactions
743
830
  .sort((a, b) => (a.time > b.time ? -1 : 1)) // Descending time order
744
831
  .filter((tx) => {
745
- const { chainId, networkID, status, transaction, time } = tx;
746
- if (transaction) {
747
- const key = `${transaction.nonce}-${chainId ? (0, controller_utils_1.convertHexToDecimal)(chainId) : networkID}-${new Date(time).toDateString()}`;
832
+ const { chainId, status, txParams, time } = tx;
833
+ if (txParams) {
834
+ const key = `${txParams.nonce}-${(0, controller_utils_1.convertHexToDecimal)(chainId)}-${new Date(time).toDateString()}`;
748
835
  if (nonceNetworkSet.has(key)) {
749
836
  return true;
750
837
  }
@@ -807,7 +894,7 @@ class TransactionController extends base_controller_1.BaseController {
807
894
  txReceipt.blockHash,
808
895
  ]);
809
896
  meta.verifiedOnBlockchain = true;
810
- meta.transaction.gasUsed = txReceipt.gasUsed;
897
+ meta.txParams.gasUsed = txReceipt.gasUsed;
811
898
  meta.txReceipt = txReceipt;
812
899
  meta.baseFeePerGas = txBlock === null || txBlock === void 0 ? void 0 : txBlock.baseFeePerGas;
813
900
  meta.blockTimestamp = txBlock === null || txBlock === void 0 ? void 0 : txBlock.timestamp;
@@ -895,10 +982,9 @@ class TransactionController extends base_controller_1.BaseController {
895
982
  const isCompleted = this.isLocalFinalState(transaction.status);
896
983
  return { meta: transaction, isCompleted };
897
984
  }
898
- getChainAndNetworkId() {
899
- const { networkId, providerConfig } = this.getNetworkState();
900
- const chainId = providerConfig === null || providerConfig === void 0 ? void 0 : providerConfig.chainId;
901
- return { networkId, chainId };
985
+ getChainId() {
986
+ const { providerConfig } = this.getNetworkState();
987
+ return providerConfig.chainId;
902
988
  }
903
989
  prepareUnsignedEthTx(txParams) {
904
990
  return tx_1.TransactionFactory.fromTxData(txParams, {
@@ -916,7 +1002,7 @@ class TransactionController extends base_controller_1.BaseController {
916
1002
  * @returns common configuration object
917
1003
  */
918
1004
  getCommonConfiguration() {
919
- const { networkId, providerConfig: { type: chain, chainId, nickname: name }, } = this.getNetworkState();
1005
+ const { providerConfig: { type: chain, chainId, nickname: name }, } = this.getNetworkState();
920
1006
  if (chain !== controller_utils_1.RPC &&
921
1007
  chain !== controller_utils_1.NetworkType['linea-goerli'] &&
922
1008
  chain !== controller_utils_1.NetworkType['linea-mainnet']) {
@@ -925,7 +1011,6 @@ class TransactionController extends base_controller_1.BaseController {
925
1011
  const customChainParams = {
926
1012
  name,
927
1013
  chainId: parseInt(chainId, 16),
928
- networkId: networkId === null ? NaN : parseInt(networkId, undefined),
929
1014
  defaultHardfork: exports.HARDFORK,
930
1015
  };
931
1016
  return common_1.Common.custom(customChainParams);
@@ -947,11 +1032,11 @@ class TransactionController extends base_controller_1.BaseController {
947
1032
  this.update({ lastFetchedBlockNumbers });
948
1033
  this.hub.emit('incomingTransactionBlock', blockNumber);
949
1034
  }
950
- generateDappSuggestedGasFees(transaction, origin) {
1035
+ generateDappSuggestedGasFees(txParams, origin) {
951
1036
  if (!origin || origin === controller_utils_1.ORIGIN_METAMASK) {
952
1037
  return undefined;
953
1038
  }
954
- const { gasPrice, maxFeePerGas, maxPriorityFeePerGas, gas } = transaction;
1039
+ const { gasPrice, maxFeePerGas, maxPriorityFeePerGas, gas } = txParams;
955
1040
  if (gasPrice === undefined &&
956
1041
  maxFeePerGas === undefined &&
957
1042
  maxPriorityFeePerGas === undefined &&
@@ -978,16 +1063,22 @@ class TransactionController extends base_controller_1.BaseController {
978
1063
  * @param transactionMeta - Nominated external transaction to be added to state.
979
1064
  */
980
1065
  addExternalTransaction(transactionMeta) {
981
- var _a;
1066
+ var _a, _b;
982
1067
  return __awaiter(this, void 0, void 0, function* () {
983
- const { networkId, chainId } = this.getChainAndNetworkId();
1068
+ const chainId = this.getChainId();
984
1069
  const { transactions } = this.state;
985
- const fromAddress = (_a = transactionMeta === null || transactionMeta === void 0 ? void 0 : transactionMeta.transaction) === null || _a === void 0 ? void 0 : _a.from;
986
- const sameFromAndNetworkTransactions = transactions.filter((transaction) => transaction.transaction.from === fromAddress &&
987
- (0, utils_1.transactionMatchesNetwork)(transaction, chainId, networkId));
1070
+ const fromAddress = (_a = transactionMeta === null || transactionMeta === void 0 ? void 0 : transactionMeta.txParams) === null || _a === void 0 ? void 0 : _a.from;
1071
+ const sameFromAndNetworkTransactions = transactions.filter((transaction) => transaction.txParams.from === fromAddress &&
1072
+ transaction.chainId === chainId);
988
1073
  const confirmedTxs = sameFromAndNetworkTransactions.filter((transaction) => transaction.status === types_1.TransactionStatus.confirmed);
989
1074
  const pendingTxs = sameFromAndNetworkTransactions.filter((transaction) => transaction.status === types_1.TransactionStatus.submitted);
990
1075
  (0, external_transactions_1.validateConfirmedExternalTransaction)(transactionMeta, confirmedTxs, pendingTxs);
1076
+ // Make sure provided external transaction has non empty history array
1077
+ if (!((_b = transactionMeta.history) !== null && _b !== void 0 ? _b : []).length) {
1078
+ if (!this.isHistoryDisabled) {
1079
+ (0, history_1.addInitialHistorySnapshot)(transactionMeta);
1080
+ }
1081
+ }
991
1082
  const updatedTransactions = [...transactions, transactionMeta];
992
1083
  this.update({
993
1084
  transactions: this.trimTransactionsForState(updatedTransactions),
@@ -1002,13 +1093,13 @@ class TransactionController extends base_controller_1.BaseController {
1002
1093
  */
1003
1094
  markNonceDuplicatesDropped(transactionId) {
1004
1095
  var _a, _b;
1005
- const { networkId, chainId } = this.getChainAndNetworkId();
1096
+ const chainId = this.getChainId();
1006
1097
  const transactionMeta = this.getTransaction(transactionId);
1007
- const nonce = (_a = transactionMeta === null || transactionMeta === void 0 ? void 0 : transactionMeta.transaction) === null || _a === void 0 ? void 0 : _a.nonce;
1008
- const from = (_b = transactionMeta === null || transactionMeta === void 0 ? void 0 : transactionMeta.transaction) === null || _b === void 0 ? void 0 : _b.from;
1009
- const sameNonceTxs = this.state.transactions.filter((transaction) => transaction.transaction.from === from &&
1010
- transaction.transaction.nonce === nonce &&
1011
- (0, utils_1.transactionMatchesNetwork)(transaction, chainId, networkId));
1098
+ const nonce = (_a = transactionMeta === null || transactionMeta === void 0 ? void 0 : transactionMeta.txParams) === null || _a === void 0 ? void 0 : _a.nonce;
1099
+ const from = (_b = transactionMeta === null || transactionMeta === void 0 ? void 0 : transactionMeta.txParams) === null || _b === void 0 ? void 0 : _b.from;
1100
+ const sameNonceTxs = this.state.transactions.filter((transaction) => transaction.txParams.from === from &&
1101
+ transaction.txParams.nonce === nonce &&
1102
+ transaction.chainId === chainId);
1012
1103
  if (!sameNonceTxs.length) {
1013
1104
  return;
1014
1105
  }
@@ -1032,7 +1123,7 @@ class TransactionController extends base_controller_1.BaseController {
1032
1123
  */
1033
1124
  setTransactionStatusDropped(transactionMeta) {
1034
1125
  transactionMeta.status = types_1.TransactionStatus.dropped;
1035
- this.updateTransaction(transactionMeta);
1126
+ this.updateTransaction(transactionMeta, 'TransactionController#setTransactionStatusDropped - Transaction dropped');
1036
1127
  }
1037
1128
  /**
1038
1129
  * Get transaction with provided actionId.
@@ -1052,6 +1143,26 @@ class TransactionController extends base_controller_1.BaseController {
1052
1143
  });
1053
1144
  });
1054
1145
  }
1146
+ /**
1147
+ * Updates the r, s, and v properties of a TransactionMeta object
1148
+ * with values from a signed transaction.
1149
+ *
1150
+ * @param transactionMeta - The TransactionMeta object to update.
1151
+ * @param signedTx - The encompassing type for all transaction types containing r, s, and v values.
1152
+ */
1153
+ updateTransactionMetaRSV(transactionMeta, signedTx) {
1154
+ return __awaiter(this, void 0, void 0, function* () {
1155
+ if (signedTx.r) {
1156
+ transactionMeta.r = (0, ethereumjs_util_1.addHexPrefix)(signedTx.r.toString(16));
1157
+ }
1158
+ if (signedTx.s) {
1159
+ transactionMeta.s = (0, ethereumjs_util_1.addHexPrefix)(signedTx.s.toString(16));
1160
+ }
1161
+ if (signedTx.v) {
1162
+ transactionMeta.v = (0, ethereumjs_util_1.addHexPrefix)(signedTx.v.toString(16));
1163
+ }
1164
+ });
1165
+ }
1055
1166
  }
1056
1167
  exports.TransactionController = TransactionController;
1057
1168
  exports.default = TransactionController;