@metamask-previews/transaction-controller 42.0.0-preview-a283708e → 42.0.0-preview-e335bd17

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.
@@ -1,6 +1,4 @@
1
1
  "use strict";
2
- /* istanbul ignore file */
3
- // FIXME - remove above ignore
4
2
  var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
5
3
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
6
4
  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");
@@ -627,7 +625,6 @@ class TransactionController extends base_controller_1.BaseController {
627
625
  this.onTransactionStatusChange(updatedTransactionMeta);
628
626
  // Intentional given potential duration of process.
629
627
  this.updatePostBalance(updatedTransactionMeta).catch((error) => {
630
- /* istanbul ignore next */
631
628
  (0, logger_1.projectLogger)('Error while updating post balance', error);
632
629
  throw error;
633
630
  });
@@ -864,6 +861,9 @@ class TransactionController extends base_controller_1.BaseController {
864
861
  if (!transactionMeta) {
865
862
  throw new Error(`Cannot update custodial transaction as no transaction metadata found`);
866
863
  }
864
+ if (!transactionMeta.custodyId) {
865
+ throw new Error('Transaction must be a custodian transaction');
866
+ }
867
867
  if (status &&
868
868
  ![
869
869
  types_1.TransactionStatus.submitted,
@@ -1223,7 +1223,7 @@ class TransactionController extends base_controller_1.BaseController {
1223
1223
  });
1224
1224
  this.onTransactionStatusChange(transactionMeta);
1225
1225
  const rawTx = await __classPrivateFieldGet(this, _TransactionController_trace, "f").call(this, { name: 'Sign', parentContext: traceContext }, () => this.signTransaction(transactionMeta, transactionMeta.txParams));
1226
- if (!this.beforePublish(transactionMeta, rawTx)) {
1226
+ if (!this.beforePublish(transactionMeta)) {
1227
1227
  (0, logger_1.projectLogger)('Skipping publishing transaction based on hook');
1228
1228
  this.messagingSystem.publish(`${controllerName}:transactionPublishingSkipped`, transactionMeta);
1229
1229
  return ApprovalState.SkippedViaBeforePublishHook;
@@ -1824,6 +1824,7 @@ _TransactionController_internalEvents = new WeakMap(), _TransactionController_me
1824
1824
  }),
1825
1825
  hooks: {
1826
1826
  beforeCheckPendingTransaction: this.beforeCheckPendingTransaction.bind(this),
1827
+ beforePublish: this.beforePublish.bind(this),
1827
1828
  },
1828
1829
  });
1829
1830
  __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_addPendingTransactionTrackerListeners).call(this, pendingTransactionTracker);