@metamask-previews/transaction-controller 41.0.0-preview-31564566 → 41.0.0-preview-e58ce4ab

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 (45) hide show
  1. package/CHANGELOG.md +0 -9
  2. package/README.md +0 -4
  3. package/dist/TransactionController.cjs +4 -7
  4. package/dist/TransactionController.cjs.map +1 -1
  5. package/dist/TransactionController.d.cts +1 -1
  6. package/dist/TransactionController.d.cts.map +1 -1
  7. package/dist/TransactionController.d.mts +1 -1
  8. package/dist/TransactionController.d.mts.map +1 -1
  9. package/dist/TransactionController.mjs +6 -9
  10. package/dist/TransactionController.mjs.map +1 -1
  11. package/dist/gas-flows/OracleLayer1GasFeeFlow.mjs +2 -1
  12. package/dist/gas-flows/OracleLayer1GasFeeFlow.mjs.map +1 -1
  13. package/dist/helpers/GasFeePoller.cjs +0 -2
  14. package/dist/helpers/GasFeePoller.cjs.map +1 -1
  15. package/dist/helpers/GasFeePoller.d.cts.map +1 -1
  16. package/dist/helpers/GasFeePoller.d.mts.map +1 -1
  17. package/dist/helpers/GasFeePoller.mjs +0 -2
  18. package/dist/helpers/GasFeePoller.mjs.map +1 -1
  19. package/dist/helpers/IncomingTransactionHelper.cjs +0 -2
  20. package/dist/helpers/IncomingTransactionHelper.cjs.map +1 -1
  21. package/dist/helpers/IncomingTransactionHelper.d.cts.map +1 -1
  22. package/dist/helpers/IncomingTransactionHelper.d.mts.map +1 -1
  23. package/dist/helpers/IncomingTransactionHelper.mjs +0 -2
  24. package/dist/helpers/IncomingTransactionHelper.mjs.map +1 -1
  25. package/dist/helpers/MethodDataHelper.cjs +0 -2
  26. package/dist/helpers/MethodDataHelper.cjs.map +1 -1
  27. package/dist/helpers/MethodDataHelper.d.cts.map +1 -1
  28. package/dist/helpers/MethodDataHelper.d.mts.map +1 -1
  29. package/dist/helpers/MethodDataHelper.mjs +0 -2
  30. package/dist/helpers/MethodDataHelper.mjs.map +1 -1
  31. package/dist/helpers/PendingTransactionTracker.cjs +3 -7
  32. package/dist/helpers/PendingTransactionTracker.cjs.map +1 -1
  33. package/dist/helpers/PendingTransactionTracker.d.cts +0 -1
  34. package/dist/helpers/PendingTransactionTracker.d.cts.map +1 -1
  35. package/dist/helpers/PendingTransactionTracker.d.mts +0 -1
  36. package/dist/helpers/PendingTransactionTracker.d.mts.map +1 -1
  37. package/dist/helpers/PendingTransactionTracker.mjs +3 -7
  38. package/dist/helpers/PendingTransactionTracker.mjs.map +1 -1
  39. package/dist/types.cjs.map +1 -1
  40. package/dist/types.d.cts +0 -12
  41. package/dist/types.d.cts.map +1 -1
  42. package/dist/types.d.mts +0 -12
  43. package/dist/types.d.mts.map +1 -1
  44. package/dist/types.mjs.map +1 -1
  45. package/package.json +2 -4
package/CHANGELOG.md CHANGED
@@ -7,15 +7,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
- ### Fixed
11
-
12
- - Make implicit peer dependencies explicit ([#4974](https://github.com/MetaMask/core/pull/4974))
13
- - Add the following packages as peer dependencies of this package to satisfy peer dependency requirements from other dependencies:
14
- - `@babel/runtime` `^7.0.0` (required by `@metamask/ethjs-provider-http`)
15
- - `@metamask/eth-block-tracker` `>=9` (required by `@metamask/nonce-tracker`)
16
- - These dependencies really should be present in projects that consume this package (e.g. MetaMask clients), and this change ensures that they now are.
17
- - Furthermore, we are assuming that clients already use these dependencies, since otherwise it would be impossible to consume this package in its entirety or even create a working build. Hence, the addition of these peer dependencies is really a formality and should not be breaking.
18
-
19
10
  ## [41.0.0]
20
11
 
21
12
  ### Added
package/README.md CHANGED
@@ -10,10 +10,6 @@ or
10
10
 
11
11
  `npm install @metamask/transaction-controller`
12
12
 
13
- ## Compatibility
14
-
15
- This package relies implicitly upon the `EventEmitter` module. This module is available natively in Node.js, but when using this package for the browser, make sure to use a polyfill such as `events`.
16
-
17
13
  ## Contributing
18
14
 
19
15
  This package is part of a monorepo. Instructions for contributing can be found in the [monorepo README](https://github.com/MetaMask/core#readme).
@@ -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");
@@ -27,8 +29,6 @@ const nonce_tracker_1 = require("@metamask/nonce-tracker");
27
29
  const rpc_errors_1 = require("@metamask/rpc-errors");
28
30
  const utils_1 = require("@metamask/utils");
29
31
  const async_mutex_1 = require("async-mutex");
30
- // This package purposefully relies on Node's EventEmitter module.
31
- // eslint-disable-next-line import/no-nodejs-modules
32
32
  const events_1 = require("events");
33
33
  const lodash_1 = require("lodash");
34
34
  const uuid_1 = require("uuid");
@@ -599,6 +599,7 @@ class TransactionController extends base_controller_1.BaseController {
599
599
  this.onTransactionStatusChange(updatedTransactionMeta);
600
600
  // Intentional given potential duration of process.
601
601
  this.updatePostBalance(updatedTransactionMeta).catch((error) => {
602
+ /* istanbul ignore next */
602
603
  (0, logger_1.projectLogger)('Error while updating post balance', error);
603
604
  throw error;
604
605
  });
@@ -835,9 +836,6 @@ class TransactionController extends base_controller_1.BaseController {
835
836
  if (!transactionMeta) {
836
837
  throw new Error(`Cannot update custodial transaction as no transaction metadata found`);
837
838
  }
838
- if (!transactionMeta.custodyId) {
839
- throw new Error('Transaction must be a custodian transaction');
840
- }
841
839
  if (status &&
842
840
  ![
843
841
  types_1.TransactionStatus.submitted,
@@ -1197,7 +1195,7 @@ class TransactionController extends base_controller_1.BaseController {
1197
1195
  });
1198
1196
  this.onTransactionStatusChange(transactionMeta);
1199
1197
  const rawTx = await __classPrivateFieldGet(this, _TransactionController_trace, "f").call(this, { name: 'Sign', parentContext: traceContext }, () => this.signTransaction(transactionMeta, transactionMeta.txParams));
1200
- if (!this.beforePublish(transactionMeta)) {
1198
+ if (!this.beforePublish(transactionMeta, rawTx)) {
1201
1199
  (0, logger_1.projectLogger)('Skipping publishing transaction based on hook');
1202
1200
  this.messagingSystem.publish(`${controllerName}:transactionPublishingSkipped`, transactionMeta);
1203
1201
  return ApprovalState.SkippedViaBeforePublishHook;
@@ -1817,7 +1815,6 @@ _TransactionController_internalEvents = new WeakMap(), _TransactionController_me
1817
1815
  }),
1818
1816
  hooks: {
1819
1817
  beforeCheckPendingTransaction: this.beforeCheckPendingTransaction.bind(this),
1820
- beforePublish: this.beforePublish.bind(this),
1821
1818
  },
1822
1819
  });
1823
1820
  __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_addPendingTransactionTrackerListeners).call(this, pendingTransactionTracker);