@metamask-previews/transaction-controller 44.1.0-preview-99939da3 → 45.0.0-preview-224dff25
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 +8 -1
- package/dist/TransactionController.cjs +28 -9
- package/dist/TransactionController.cjs.map +1 -1
- package/dist/TransactionController.d.cts +65 -30
- package/dist/TransactionController.d.cts.map +1 -1
- package/dist/TransactionController.d.mts +65 -30
- package/dist/TransactionController.d.mts.map +1 -1
- package/dist/TransactionController.mjs +28 -9
- package/dist/TransactionController.mjs.map +1 -1
- package/dist/helpers/PendingTransactionTracker.cjs +3 -5
- package/dist/helpers/PendingTransactionTracker.cjs.map +1 -1
- package/dist/helpers/PendingTransactionTracker.d.cts +0 -1
- package/dist/helpers/PendingTransactionTracker.d.cts.map +1 -1
- package/dist/helpers/PendingTransactionTracker.d.mts +0 -1
- package/dist/helpers/PendingTransactionTracker.d.mts.map +1 -1
- package/dist/helpers/PendingTransactionTracker.mjs +3 -5
- package/dist/helpers/PendingTransactionTracker.mjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +0 -8
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +0 -8
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/package.json +6 -6
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@
|
|
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");
|
|
@@ -237,7 +239,7 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
237
239
|
hooks?.beforeCheckPendingTransaction ??
|
|
238
240
|
/* istanbul ignore next */
|
|
239
241
|
(() => true);
|
|
240
|
-
this.beforePublish = hooks?.beforePublish ?? (() => true);
|
|
242
|
+
this.beforePublish = hooks?.beforePublish ?? (() => Promise.resolve(true));
|
|
241
243
|
this.getAdditionalSignArguments =
|
|
242
244
|
hooks?.getAdditionalSignArguments ?? (() => []);
|
|
243
245
|
this.publish =
|
|
@@ -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);
|
|
@@ -1043,6 +1064,7 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
1043
1064
|
/**
|
|
1044
1065
|
* Stop the signing process for a specific transaction.
|
|
1045
1066
|
* Throws an error causing the transaction status to be set to failed.
|
|
1067
|
+
*
|
|
1046
1068
|
* @param transactionId - The ID of the transaction to stop signing.
|
|
1047
1069
|
*/
|
|
1048
1070
|
abortTransactionSigning(transactionId) {
|
|
@@ -1223,7 +1245,7 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
1223
1245
|
});
|
|
1224
1246
|
this.onTransactionStatusChange(transactionMeta);
|
|
1225
1247
|
const rawTx = await __classPrivateFieldGet(this, _TransactionController_trace, "f").call(this, { name: 'Sign', parentContext: traceContext }, () => this.signTransaction(transactionMeta, transactionMeta.txParams));
|
|
1226
|
-
if (!this.beforePublish(transactionMeta)) {
|
|
1248
|
+
if (!(await this.beforePublish(transactionMeta))) {
|
|
1227
1249
|
(0, logger_1.projectLogger)('Skipping publishing transaction based on hook');
|
|
1228
1250
|
this.messagingSystem.publish(`${controllerName}:transactionPublishingSkipped`, transactionMeta);
|
|
1229
1251
|
return ApprovalState.SkippedViaBeforePublishHook;
|
|
@@ -1315,7 +1337,6 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
1315
1337
|
this.messagingSystem.publish(`${controllerName}:transactionFinished`, updatedTransactionMeta);
|
|
1316
1338
|
__classPrivateFieldGet(this, _TransactionController_internalEvents, "f").emit(
|
|
1317
1339
|
// TODO: Either fix this lint violation or explain why it's necessary to ignore.
|
|
1318
|
-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
1319
1340
|
`${transactionMeta.id}:finished`, updatedTransactionMeta);
|
|
1320
1341
|
this.messagingSystem.publish(`${controllerName}:transactionRejected`, {
|
|
1321
1342
|
transactionMeta: updatedTransactionMeta,
|
|
@@ -1345,7 +1366,6 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
1345
1366
|
const { chainId, status, txParams, time } = tx;
|
|
1346
1367
|
if (txParams) {
|
|
1347
1368
|
// TODO: Either fix this lint violation or explain why it's necessary to ignore.
|
|
1348
|
-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
1349
1369
|
const key = `${String(txParams.nonce)}-${(0, controller_utils_1.convertHexToDecimal)(chainId)}-${new Date(time).toDateString()}`;
|
|
1350
1370
|
if (nonceNetworkSet.has(key)) {
|
|
1351
1371
|
return true;
|
|
@@ -1825,7 +1845,6 @@ _TransactionController_internalEvents = new WeakMap(), _TransactionController_me
|
|
|
1825
1845
|
}),
|
|
1826
1846
|
hooks: {
|
|
1827
1847
|
beforeCheckPendingTransaction: this.beforeCheckPendingTransaction.bind(this),
|
|
1828
|
-
beforePublish: this.beforePublish.bind(this),
|
|
1829
1848
|
},
|
|
1830
1849
|
});
|
|
1831
1850
|
__classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_addPendingTransactionTrackerListeners).call(this, pendingTransactionTracker);
|