@metamask-previews/transaction-controller 17.0.0-preview.5736db0 → 17.0.0-preview.eb58a59
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.d.ts +1 -23
- package/dist/TransactionController.d.ts.map +1 -1
- package/dist/TransactionController.js +7 -56
- package/dist/TransactionController.js.map +1 -1
- package/dist/helpers/PendingTransactionTracker.d.ts +1 -1
- package/dist/helpers/PendingTransactionTracker.d.ts.map +1 -1
- package/dist/helpers/PendingTransactionTracker.js.map +1 -1
- package/dist/types.d.ts +0 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/utils.d.ts +1 -1
- package/dist/utils/utils.d.ts.map +1 -1
- package/dist/utils/utils.js.map +1 -1
- package/package.json +3 -3
|
@@ -8,7 +8,7 @@ import type { GasFeeState } from '@metamask/gas-fee-controller';
|
|
|
8
8
|
import type { BlockTracker, NetworkState, Provider } from '@metamask/network-controller';
|
|
9
9
|
import type { Hex } from '@metamask/utils';
|
|
10
10
|
import { EventEmitter } from 'events';
|
|
11
|
-
import type { NonceLock } from 'nonce-tracker';
|
|
11
|
+
import type { NonceLock } from 'nonce-tracker/dist/NonceTracker';
|
|
12
12
|
import type { Events, SavedGasFees, SecurityProviderRequest, SendFlowHistoryEntry, TransactionParams, TransactionMeta, TransactionReceipt, WalletDevice, SecurityAlertResponse } from './types';
|
|
13
13
|
import { TransactionType, TransactionStatus } from './types';
|
|
14
14
|
export declare const HARDFORK = Hardfork.London;
|
|
@@ -402,27 +402,6 @@ export declare class TransactionController extends BaseController<TransactionCon
|
|
|
402
402
|
* @returns object with the `nextNonce` `nonceDetails`, and the releaseLock.
|
|
403
403
|
*/
|
|
404
404
|
getNonceLock(address: string): Promise<NonceLock>;
|
|
405
|
-
/**
|
|
406
|
-
* Updates the editable parameters of a transaction.
|
|
407
|
-
*
|
|
408
|
-
* @param txId - The ID of the transaction to update.
|
|
409
|
-
* @param params - The editable parameters to update.
|
|
410
|
-
* @param params.data - Data to pass with the transaction.
|
|
411
|
-
* @param params.gas - Maximum number of units of gas to use for the transaction.
|
|
412
|
-
* @param params.gasPrice - Price per gas for legacy transactions.
|
|
413
|
-
* @param params.from - Address to send the transaction from.
|
|
414
|
-
* @param params.to - Address to send the transaction to.
|
|
415
|
-
* @param params.value - Value associated with the transaction.
|
|
416
|
-
* @returns The updated transaction metadata.
|
|
417
|
-
*/
|
|
418
|
-
updateEditableParams(txId: string, { data, gas, gasPrice, from, to, value, }: {
|
|
419
|
-
data?: string;
|
|
420
|
-
gas?: string;
|
|
421
|
-
gasPrice?: string;
|
|
422
|
-
from?: string;
|
|
423
|
-
to?: string;
|
|
424
|
-
value?: string;
|
|
425
|
-
}): Promise<TransactionMeta | undefined>;
|
|
426
405
|
/**
|
|
427
406
|
* Signs and returns the raw transaction data for provided transaction params list.
|
|
428
407
|
*
|
|
@@ -572,7 +551,6 @@ export declare class TransactionController extends BaseController<TransactionCon
|
|
|
572
551
|
private getEIP1559Compatibility;
|
|
573
552
|
private addPendingTransactionTrackerListeners;
|
|
574
553
|
private signTransaction;
|
|
575
|
-
private onTransactionStatusChange;
|
|
576
554
|
}
|
|
577
555
|
export default TransactionController;
|
|
578
556
|
//# sourceMappingURL=TransactionController.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransactionController.d.ts","sourceRoot":"","sources":["../src/TransactionController.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAA4B,MAAM,oBAAoB,CAAC;AACxE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,OAAO,KAAK,EAEV,kBAAkB,EAEnB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EACV,UAAU,EACV,SAAS,EACT,6BAA6B,EAC9B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAU3D,OAAO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;;;;;OAaG;IACH,OAAO,CAAC,wBAAwB;IAiChC;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IAQpB;;;;;OAKG;IACH,OAAO,CAAC,iBAAiB;YASX,eAAe;IAsB7B,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,sBAAsB;IAe9B,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,oBAAoB;IAO5B;;;;;;;;OAQG;IACH,OAAO,CAAC,sBAAsB;IAsB9B,OAAO,CAAC,sBAAsB;IAyB9B,OAAO,CAAC,gCAAgC;IAaxC,OAAO,CAAC,4BAA4B;IAsCpC;;;;OAIG;YACW,sBAAsB;IAmCpC;;;;;OAKG;IACH,OAAO,CAAC,0BAA0B;IA8BlC;;;;OAIG;IACH,OAAO,CAAC,2BAA2B;IAWnC;;;;;OAKG;IACH,OAAO,CAAC,0BAA0B;YAMpB,0BAA0B;IAUxC;;;;;;OAMG;YACW,wBAAwB;YAiBxB,uBAAuB;IAWrC,OAAO,CAAC,qCAAqC;YAyB/B,eAAe;CAsC9B;AAED,eAAe,qBAAqB,CAAC"}
|
|
@@ -24,7 +24,7 @@ const eth_method_registry_1 = __importDefault(require("eth-method-registry"));
|
|
|
24
24
|
const ethereumjs_util_1 = require("ethereumjs-util");
|
|
25
25
|
const events_1 = require("events");
|
|
26
26
|
const lodash_1 = require("lodash");
|
|
27
|
-
const nonce_tracker_1 = require("nonce-tracker");
|
|
27
|
+
const nonce_tracker_1 = __importDefault(require("nonce-tracker"));
|
|
28
28
|
const uuid_1 = require("uuid");
|
|
29
29
|
const EtherscanRemoteTransactionSource_1 = require("./helpers/EtherscanRemoteTransactionSource");
|
|
30
30
|
const IncomingTransactionHelper_1 = require("./helpers/IncomingTransactionHelper");
|
|
@@ -140,8 +140,7 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
140
140
|
this.beforePublish = (_d = hooks === null || hooks === void 0 ? void 0 : hooks.beforePublish) !== null && _d !== void 0 ? _d : (() => true);
|
|
141
141
|
this.getAdditionalSignArguments =
|
|
142
142
|
(_e = hooks === null || hooks === void 0 ? void 0 : hooks.getAdditionalSignArguments) !== null && _e !== void 0 ? _e : (() => []);
|
|
143
|
-
this.nonceTracker = new nonce_tracker_1.
|
|
144
|
-
// @ts-expect-error provider types misaligned: SafeEventEmitterProvider vs Record<string,string>
|
|
143
|
+
this.nonceTracker = new nonce_tracker_1.default({
|
|
145
144
|
provider,
|
|
146
145
|
blockTracker,
|
|
147
146
|
getPendingTransactions: (address) => (0, utils_1.getAndFormatTransactionsForNonceTracker)(address, types_1.TransactionStatus.submitted, this.state.transactions),
|
|
@@ -193,7 +192,6 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
193
192
|
transactionMeta: newTransactionMeta,
|
|
194
193
|
});
|
|
195
194
|
this.updateTransaction(newTransactionMeta, 'TransactionController#failTransaction - Add error message and set status to failed');
|
|
196
|
-
this.onTransactionStatusChange(newTransactionMeta);
|
|
197
195
|
this.hub.emit(`${transactionMeta.id}:finished`, newTransactionMeta);
|
|
198
196
|
}
|
|
199
197
|
registryLookup(fourBytePrefix) {
|
|
@@ -608,7 +606,6 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
608
606
|
this.markNonceDuplicatesDropped(transactionId);
|
|
609
607
|
// Update external provided transaction with updated gas values and confirmed status.
|
|
610
608
|
this.updateTransaction(transactionMeta, 'TransactionController:confirmExternalTransaction - Add external transaction');
|
|
611
|
-
this.onTransactionStatusChange(transactionMeta);
|
|
612
609
|
if (transactionMeta.type === types_1.TransactionType.swap) {
|
|
613
610
|
(0, swaps_1.updatePostTransactionBalance)(transactionMeta, {
|
|
614
611
|
ethQuery: this.ethQuery,
|
|
@@ -752,44 +749,6 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
752
749
|
return this.nonceTracker.getNonceLock(address);
|
|
753
750
|
});
|
|
754
751
|
}
|
|
755
|
-
/**
|
|
756
|
-
* Updates the editable parameters of a transaction.
|
|
757
|
-
*
|
|
758
|
-
* @param txId - The ID of the transaction to update.
|
|
759
|
-
* @param params - The editable parameters to update.
|
|
760
|
-
* @param params.data - Data to pass with the transaction.
|
|
761
|
-
* @param params.gas - Maximum number of units of gas to use for the transaction.
|
|
762
|
-
* @param params.gasPrice - Price per gas for legacy transactions.
|
|
763
|
-
* @param params.from - Address to send the transaction from.
|
|
764
|
-
* @param params.to - Address to send the transaction to.
|
|
765
|
-
* @param params.value - Value associated with the transaction.
|
|
766
|
-
* @returns The updated transaction metadata.
|
|
767
|
-
*/
|
|
768
|
-
updateEditableParams(txId, { data, gas, gasPrice, from, to, value, }) {
|
|
769
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
770
|
-
const transactionMeta = this.getTransaction(txId);
|
|
771
|
-
if (!transactionMeta) {
|
|
772
|
-
throw new Error(`Cannot update editable params as no transaction metadata found`);
|
|
773
|
-
}
|
|
774
|
-
(0, utils_1.validateIfTransactionUnapproved)(transactionMeta, 'updateEditableParams');
|
|
775
|
-
const editableParams = {
|
|
776
|
-
txParams: {
|
|
777
|
-
data,
|
|
778
|
-
from,
|
|
779
|
-
to,
|
|
780
|
-
value,
|
|
781
|
-
gas,
|
|
782
|
-
gasPrice,
|
|
783
|
-
},
|
|
784
|
-
};
|
|
785
|
-
editableParams.txParams = (0, lodash_1.pickBy)(editableParams.txParams);
|
|
786
|
-
const updatedTransaction = (0, lodash_1.merge)(transactionMeta, editableParams);
|
|
787
|
-
const { type } = yield (0, transaction_type_1.determineTransactionType)(updatedTransaction.txParams, this.ethQuery);
|
|
788
|
-
updatedTransaction.type = type;
|
|
789
|
-
this.updateTransaction(updatedTransaction, `Update Editable Params for ${txId}`);
|
|
790
|
-
return this.getTransaction(txId);
|
|
791
|
-
});
|
|
792
|
-
}
|
|
793
752
|
/**
|
|
794
753
|
* Signs and returns the raw transaction data for provided transaction params list.
|
|
795
754
|
*
|
|
@@ -1077,6 +1036,7 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
1077
1036
|
(0, logger_1.projectLogger)('Skipping approval as signing in progress', transactionId);
|
|
1078
1037
|
return;
|
|
1079
1038
|
}
|
|
1039
|
+
const { approved: status } = types_1.TransactionStatus;
|
|
1080
1040
|
let nonceToUse = nonce;
|
|
1081
1041
|
// if a nonce already exists on the transactionMeta it means this is a speedup or cancel transaction
|
|
1082
1042
|
// so we want to reuse that nonce and hope that it beats the previous attempt to chain. Otherwise use a new locked nonce
|
|
@@ -1084,12 +1044,11 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
1084
1044
|
nonceLock = yield this.nonceTracker.getNonceLock(from);
|
|
1085
1045
|
nonceToUse = (0, ethereumjs_util_1.addHexPrefix)(nonceLock.nextNonce.toString(16));
|
|
1086
1046
|
}
|
|
1087
|
-
transactionMeta.status =
|
|
1047
|
+
transactionMeta.status = status;
|
|
1088
1048
|
transactionMeta.txParams.nonce = nonceToUse;
|
|
1089
1049
|
transactionMeta.txParams.chainId = chainId;
|
|
1090
1050
|
const baseTxParams = Object.assign(Object.assign({}, transactionMeta.txParams), { gasLimit: transactionMeta.txParams.gas });
|
|
1091
1051
|
this.updateTransaction(transactionMeta, 'TransactionController#approveTransaction - Transaction approved');
|
|
1092
|
-
this.onTransactionStatusChange(transactionMeta);
|
|
1093
1052
|
const isEIP1559 = (0, utils_1.isEIP1559Transaction)(transactionMeta.txParams);
|
|
1094
1053
|
const txParams = isEIP1559
|
|
1095
1054
|
? Object.assign(Object.assign({}, baseTxParams), { maxFeePerGas: transactionMeta.txParams.maxFeePerGas, maxPriorityFeePerGas: transactionMeta.txParams.maxPriorityFeePerGas, estimatedBaseFee: transactionMeta.txParams.estimatedBaseFee,
|
|
@@ -1111,12 +1070,11 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
1111
1070
|
transactionMeta.hash = hash;
|
|
1112
1071
|
transactionMeta.status = types_1.TransactionStatus.submitted;
|
|
1113
1072
|
transactionMeta.submittedTime = new Date().getTime();
|
|
1114
|
-
this.updateTransaction(transactionMeta, 'TransactionController#approveTransaction - Transaction submitted');
|
|
1115
1073
|
this.hub.emit('transaction-submitted', {
|
|
1116
1074
|
transactionMeta,
|
|
1117
1075
|
});
|
|
1076
|
+
this.updateTransaction(transactionMeta, 'TransactionController#approveTransaction - Transaction submitted');
|
|
1118
1077
|
this.hub.emit(`${transactionMeta.id}:finished`, transactionMeta);
|
|
1119
|
-
this.onTransactionStatusChange(transactionMeta);
|
|
1120
1078
|
}
|
|
1121
1079
|
catch (error) {
|
|
1122
1080
|
this.failTransaction(transactionMeta, error);
|
|
@@ -1149,14 +1107,13 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
1149
1107
|
return;
|
|
1150
1108
|
}
|
|
1151
1109
|
transactionMeta.status = types_1.TransactionStatus.rejected;
|
|
1152
|
-
const transactions = this.state.transactions.filter(({ id }) => id !== transactionId);
|
|
1153
|
-
this.update({ transactions: this.trimTransactionsForState(transactions) });
|
|
1154
1110
|
this.hub.emit(`${transactionMeta.id}:finished`, transactionMeta);
|
|
1155
1111
|
this.hub.emit('transaction-rejected', {
|
|
1156
1112
|
transactionMeta,
|
|
1157
1113
|
actionId,
|
|
1158
1114
|
});
|
|
1159
|
-
this.
|
|
1115
|
+
const transactions = this.state.transactions.filter(({ id }) => id !== transactionId);
|
|
1116
|
+
this.update({ transactions: this.trimTransactionsForState(transactions) });
|
|
1160
1117
|
}
|
|
1161
1118
|
/**
|
|
1162
1119
|
* Trim the amount of transactions that are set on the state. Checks
|
|
@@ -1394,7 +1351,6 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
1394
1351
|
transactionMeta,
|
|
1395
1352
|
});
|
|
1396
1353
|
this.updateTransaction(transactionMeta, 'TransactionController#setTransactionStatusDropped - Transaction dropped');
|
|
1397
|
-
this.onTransactionStatusChange(transactionMeta);
|
|
1398
1354
|
}
|
|
1399
1355
|
/**
|
|
1400
1356
|
* Get transaction with provided actionId.
|
|
@@ -1446,7 +1402,6 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
1446
1402
|
this.pendingTransactionTracker.hub.on('transaction-confirmed', (transactionMeta) => {
|
|
1447
1403
|
this.hub.emit('transaction-confirmed', { transactionMeta });
|
|
1448
1404
|
this.hub.emit(`${transactionMeta.id}:confirmed`, transactionMeta);
|
|
1449
|
-
this.onTransactionStatusChange(transactionMeta);
|
|
1450
1405
|
});
|
|
1451
1406
|
this.pendingTransactionTracker.hub.on('transaction-dropped', this.setTransactionStatusDropped.bind(this));
|
|
1452
1407
|
this.pendingTransactionTracker.hub.on('transaction-failed', this.failTransaction.bind(this));
|
|
@@ -1470,16 +1425,12 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
1470
1425
|
yield this.updateTransactionMetaRSV(transactionMeta, signedTx);
|
|
1471
1426
|
transactionMeta.status = types_1.TransactionStatus.signed;
|
|
1472
1427
|
this.updateTransaction(transactionMeta, 'TransactionController#approveTransaction - Transaction signed');
|
|
1473
|
-
this.onTransactionStatusChange(transactionMeta);
|
|
1474
1428
|
const rawTx = (0, ethereumjs_util_1.bufferToHex)(signedTx.serialize());
|
|
1475
1429
|
transactionMeta.rawTx = rawTx;
|
|
1476
1430
|
this.updateTransaction(transactionMeta, 'TransactionController#approveTransaction - RawTransaction added');
|
|
1477
1431
|
return rawTx;
|
|
1478
1432
|
});
|
|
1479
1433
|
}
|
|
1480
|
-
onTransactionStatusChange(transactionMeta) {
|
|
1481
|
-
this.hub.emit('transaction-status-update', { transactionMeta });
|
|
1482
|
-
}
|
|
1483
1434
|
}
|
|
1484
1435
|
exports.TransactionController = TransactionController;
|
|
1485
1436
|
exports.default = TransactionController;
|