@metamask-previews/transaction-controller 45.0.0-preview-83e41399 → 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/dist/TransactionController.cjs +3 -4
- package/dist/TransactionController.cjs.map +1 -1
- package/dist/TransactionController.d.cts +54 -29
- package/dist/TransactionController.d.cts.map +1 -1
- package/dist/TransactionController.d.mts +54 -29
- package/dist/TransactionController.d.mts.map +1 -1
- package/dist/TransactionController.mjs +3 -4
- package/dist/TransactionController.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -239,7 +239,7 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
239
239
|
hooks?.beforeCheckPendingTransaction ??
|
|
240
240
|
/* istanbul ignore next */
|
|
241
241
|
(() => true);
|
|
242
|
-
this.beforePublish = hooks?.beforePublish ?? (() => true);
|
|
242
|
+
this.beforePublish = hooks?.beforePublish ?? (() => Promise.resolve(true));
|
|
243
243
|
this.getAdditionalSignArguments =
|
|
244
244
|
hooks?.getAdditionalSignArguments ?? (() => []);
|
|
245
245
|
this.publish =
|
|
@@ -1064,6 +1064,7 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
1064
1064
|
/**
|
|
1065
1065
|
* Stop the signing process for a specific transaction.
|
|
1066
1066
|
* Throws an error causing the transaction status to be set to failed.
|
|
1067
|
+
*
|
|
1067
1068
|
* @param transactionId - The ID of the transaction to stop signing.
|
|
1068
1069
|
*/
|
|
1069
1070
|
abortTransactionSigning(transactionId) {
|
|
@@ -1244,7 +1245,7 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
1244
1245
|
});
|
|
1245
1246
|
this.onTransactionStatusChange(transactionMeta);
|
|
1246
1247
|
const rawTx = await __classPrivateFieldGet(this, _TransactionController_trace, "f").call(this, { name: 'Sign', parentContext: traceContext }, () => this.signTransaction(transactionMeta, transactionMeta.txParams));
|
|
1247
|
-
if (!this.beforePublish(transactionMeta
|
|
1248
|
+
if (!(await this.beforePublish(transactionMeta))) {
|
|
1248
1249
|
(0, logger_1.projectLogger)('Skipping publishing transaction based on hook');
|
|
1249
1250
|
this.messagingSystem.publish(`${controllerName}:transactionPublishingSkipped`, transactionMeta);
|
|
1250
1251
|
return ApprovalState.SkippedViaBeforePublishHook;
|
|
@@ -1336,7 +1337,6 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
1336
1337
|
this.messagingSystem.publish(`${controllerName}:transactionFinished`, updatedTransactionMeta);
|
|
1337
1338
|
__classPrivateFieldGet(this, _TransactionController_internalEvents, "f").emit(
|
|
1338
1339
|
// TODO: Either fix this lint violation or explain why it's necessary to ignore.
|
|
1339
|
-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
1340
1340
|
`${transactionMeta.id}:finished`, updatedTransactionMeta);
|
|
1341
1341
|
this.messagingSystem.publish(`${controllerName}:transactionRejected`, {
|
|
1342
1342
|
transactionMeta: updatedTransactionMeta,
|
|
@@ -1366,7 +1366,6 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
1366
1366
|
const { chainId, status, txParams, time } = tx;
|
|
1367
1367
|
if (txParams) {
|
|
1368
1368
|
// TODO: Either fix this lint violation or explain why it's necessary to ignore.
|
|
1369
|
-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
1370
1369
|
const key = `${String(txParams.nonce)}-${(0, controller_utils_1.convertHexToDecimal)(chainId)}-${new Date(time).toDateString()}`;
|
|
1371
1370
|
if (nonceNetworkSet.has(key)) {
|
|
1372
1371
|
return true;
|