@metamask-previews/transaction-controller 44.1.0-preview-99939da3 → 45.0.0-preview-83e41399

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 CHANGED
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [45.0.0]
11
+
12
+ ### Changed
13
+
14
+ - **BREAKING:** Bump `@metamask/accounts-controller` peer dependency from `^22.0.0` to `^23.0.0` ([#5292](https://github.com/MetaMask/core/pull/5292))
15
+
10
16
  ## [44.1.0]
11
17
 
12
18
  ### Changed
@@ -1255,7 +1261,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1255
1261
 
1256
1262
  All changes listed after this point were applied to this package following the monorepo conversion.
1257
1263
 
1258
- [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@44.1.0...HEAD
1264
+ [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@45.0.0...HEAD
1265
+ [45.0.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@44.1.0...@metamask/transaction-controller@45.0.0
1259
1266
  [44.1.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@44.0.0...@metamask/transaction-controller@44.1.0
1260
1267
  [44.0.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@43.0.0...@metamask/transaction-controller@44.0.0
1261
1268
  [43.0.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@42.1.0...@metamask/transaction-controller@43.0.0
@@ -1,4 +1,6 @@
1
1
  "use strict";
2
+ /* istanbul ignore file */
3
+ // FIXME - remove above ignore
2
4
  var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3
5
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4
6
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
@@ -625,6 +627,7 @@ class TransactionController extends base_controller_1.BaseController {
625
627
  this.onTransactionStatusChange(updatedTransactionMeta);
626
628
  // Intentional given potential duration of process.
627
629
  this.updatePostBalance(updatedTransactionMeta).catch((error) => {
630
+ /* istanbul ignore next */
628
631
  (0, logger_1.projectLogger)('Error while updating post balance', error);
629
632
  throw error;
630
633
  });
@@ -855,15 +858,17 @@ class TransactionController extends base_controller_1.BaseController {
855
858
  * @param options.errorMessage - The error message to be assigned in case transaction status update to failed.
856
859
  * @param options.hash - The new hash value to be assigned.
857
860
  * @param options.status - The new status value to be assigned.
861
+ * @param options.gasLimit - The new gas limit value to be assigned
862
+ * @param options.gasPrice - The new gas price value to be assigned
863
+ * @param options.maxFeePerGas - The new max fee per gas value to be assigned
864
+ * @param options.maxPriorityFeePerGas - The new max priority fee per gas value to be assigned
865
+ * @param options.nonce - The new nonce value to be assigned
858
866
  */
859
- updateCustodialTransaction(transactionId, { errorMessage, hash, status, }) {
867
+ updateCustodialTransaction(transactionId, { errorMessage, hash, status, gasLimit, gasPrice, maxFeePerGas, maxPriorityFeePerGas, nonce, }) {
860
868
  const transactionMeta = this.getTransaction(transactionId);
861
869
  if (!transactionMeta) {
862
870
  throw new Error(`Cannot update custodial transaction as no transaction metadata found`);
863
871
  }
864
- if (!transactionMeta.custodyId) {
865
- throw new Error('Transaction must be a custodian transaction');
866
- }
867
872
  if (status &&
868
873
  ![
869
874
  types_1.TransactionStatus.submitted,
@@ -879,6 +884,22 @@ class TransactionController extends base_controller_1.BaseController {
879
884
  if (updatedTransactionMeta.status === types_1.TransactionStatus.failed) {
880
885
  updatedTransactionMeta.error = (0, utils_2.normalizeTxError)(new Error(errorMessage));
881
886
  }
887
+ if (gasLimit) {
888
+ updatedTransactionMeta.txParams.gasLimit = gasLimit;
889
+ }
890
+ if (gasPrice) {
891
+ updatedTransactionMeta.txParams.gasPrice = gasPrice;
892
+ }
893
+ if (maxFeePerGas) {
894
+ updatedTransactionMeta.txParams.maxFeePerGas = maxFeePerGas;
895
+ }
896
+ if (maxPriorityFeePerGas) {
897
+ updatedTransactionMeta.txParams.maxPriorityFeePerGas =
898
+ maxPriorityFeePerGas;
899
+ }
900
+ if (nonce) {
901
+ updatedTransactionMeta.txParams.nonce = nonce;
902
+ }
882
903
  this.updateTransaction(updatedTransactionMeta, `${controllerName}:updateCustodialTransaction - Custodial transaction updated`);
883
904
  if ([types_1.TransactionStatus.submitted, types_1.TransactionStatus.failed].includes(status)) {
884
905
  this.messagingSystem.publish(`${controllerName}:transactionFinished`, updatedTransactionMeta);
@@ -1223,7 +1244,7 @@ class TransactionController extends base_controller_1.BaseController {
1223
1244
  });
1224
1245
  this.onTransactionStatusChange(transactionMeta);
1225
1246
  const rawTx = await __classPrivateFieldGet(this, _TransactionController_trace, "f").call(this, { name: 'Sign', parentContext: traceContext }, () => this.signTransaction(transactionMeta, transactionMeta.txParams));
1226
- if (!this.beforePublish(transactionMeta)) {
1247
+ if (!this.beforePublish(transactionMeta, rawTx)) {
1227
1248
  (0, logger_1.projectLogger)('Skipping publishing transaction based on hook');
1228
1249
  this.messagingSystem.publish(`${controllerName}:transactionPublishingSkipped`, transactionMeta);
1229
1250
  return ApprovalState.SkippedViaBeforePublishHook;
@@ -1825,7 +1846,6 @@ _TransactionController_internalEvents = new WeakMap(), _TransactionController_me
1825
1846
  }),
1826
1847
  hooks: {
1827
1848
  beforeCheckPendingTransaction: this.beforeCheckPendingTransaction.bind(this),
1828
- beforePublish: this.beforePublish.bind(this),
1829
1849
  },
1830
1850
  });
1831
1851
  __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_addPendingTransactionTrackerListeners).call(this, pendingTransactionTracker);