@metamask-previews/transaction-controller 18.3.0-preview.3fbb6b41 → 19.0.1-preview.353ee83b
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 +28 -1
- package/dist/TransactionController.d.ts +2 -6
- package/dist/TransactionController.d.ts.map +1 -1
- package/dist/TransactionController.js +38 -37
- package/dist/TransactionController.js.map +1 -1
- package/dist/constants.js +1 -1
- package/dist/constants.js.map +1 -1
- package/dist/helpers/IncomingTransactionHelper.d.ts.map +1 -1
- package/dist/helpers/IncomingTransactionHelper.js +4 -0
- package/dist/helpers/IncomingTransactionHelper.js.map +1 -1
- package/dist/helpers/PendingTransactionTracker.d.ts +1 -2
- package/dist/helpers/PendingTransactionTracker.d.ts.map +1 -1
- package/dist/helpers/PendingTransactionTracker.js +24 -12
- package/dist/helpers/PendingTransactionTracker.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +5 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/gas.d.ts.map +1 -1
- package/dist/utils/gas.js +4 -5
- package/dist/utils/gas.js.map +1 -1
- package/dist/utils/history.js +8 -2
- package/dist/utils/history.js.map +1 -1
- package/dist/utils/nonce.d.ts.map +1 -1
- package/dist/utils/nonce.js +2 -1
- package/dist/utils/nonce.js.map +1 -1
- package/dist/utils/swaps.js +4 -0
- package/dist/utils/swaps.js.map +1 -1
- package/dist/utils/utils.d.ts.map +1 -1
- package/dist/utils/utils.js +6 -0
- package/dist/utils/utils.js.map +1 -1
- package/dist/utils/validation.js +2 -0
- package/dist/utils/validation.js.map +1 -1
- package/package.json +12 -11
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [19.0.1]
|
|
10
|
+
### Changed
|
|
11
|
+
- Bump `eth-method-registry` from `^1.1.0` to `^3.0.0` ([#3688](https://github.com/MetaMask/core/pull/3688))
|
|
12
|
+
|
|
13
|
+
## [19.0.0]
|
|
14
|
+
### Changed
|
|
15
|
+
- **BREAKING:** Bump `@metamask/approval-controller` dependency and peer dependency from `^5.1.0` to `^5.1.1` ([#3695](https://github.com/MetaMask/core/pull/3695))
|
|
16
|
+
- **BREAKING:** Bump `@metamask/gas-fee-controller` dependency and peer dependency from `^11.0.0` to `^12.0.0` ([#3695](https://github.com/MetaMask/core/pull/3695))
|
|
17
|
+
- **BREAKING:** Bump `@metamask/network-controller` dependency and peer dependency from `^17.0.0` to `^17.1.0` ([#3695](https://github.com/MetaMask/core/pull/3695))
|
|
18
|
+
- Bump `@metamask/base-controller` to `^4.0.1` ([#3695](https://github.com/MetaMask/core/pull/3695))
|
|
19
|
+
- Bump `@metamask/controller-utils` to `^8.0.1` ([#3695](https://github.com/MetaMask/core/pull/3695))
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
- Use estimate gas instead of fixed gas (21k) when a contract is deployed and the gas is not specified ([#3694](https://github.com/MetaMask/core/pull/3694))
|
|
23
|
+
|
|
24
|
+
## [18.3.1]
|
|
25
|
+
### Fixed
|
|
26
|
+
- Fix incorrect transaction statuses ([#3676](https://github.com/MetaMask/core/pull/3676))
|
|
27
|
+
- Fix `dropped` status detection by ignoring transactions on other chains.
|
|
28
|
+
- Start polling if network changes and associated transactions are pending.
|
|
29
|
+
- Record `r`, `s`, and `v` values even if zero.
|
|
30
|
+
- Only fail transactions if receipt `status` is explicitly `0x0`.
|
|
31
|
+
- Fix incoming transactions on Linea Goerli ([#3674](https://github.com/MetaMask/core/pull/3674))
|
|
32
|
+
|
|
9
33
|
## [18.3.0]
|
|
10
34
|
### Added
|
|
11
35
|
- Add optional `getExternalPendingTransactions` callback argument to constructor ([#3587](https://github.com/MetaMask/core/pull/3587))
|
|
@@ -331,7 +355,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
331
355
|
|
|
332
356
|
All changes listed after this point were applied to this package following the monorepo conversion.
|
|
333
357
|
|
|
334
|
-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@
|
|
358
|
+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@19.0.1...HEAD
|
|
359
|
+
[19.0.1]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@19.0.0...@metamask/transaction-controller@19.0.1
|
|
360
|
+
[19.0.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@18.3.1...@metamask/transaction-controller@19.0.0
|
|
361
|
+
[18.3.1]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@18.3.0...@metamask/transaction-controller@18.3.1
|
|
335
362
|
[18.3.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@18.2.0...@metamask/transaction-controller@18.3.0
|
|
336
363
|
[18.2.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@18.1.0...@metamask/transaction-controller@18.2.0
|
|
337
364
|
[18.1.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@18.0.0...@metamask/transaction-controller@18.1.0
|
|
@@ -94,13 +94,13 @@ export interface TransactionControllerEventEmitter extends EventEmitter {
|
|
|
94
94
|
* Controller responsible for submitting and managing transactions.
|
|
95
95
|
*/
|
|
96
96
|
export declare class TransactionController extends BaseControllerV1<TransactionConfig, TransactionState> {
|
|
97
|
-
private ethQuery;
|
|
97
|
+
private readonly ethQuery;
|
|
98
98
|
private readonly isHistoryDisabled;
|
|
99
99
|
private readonly isSwapsDisabled;
|
|
100
100
|
private readonly isSendFlowHistoryDisabled;
|
|
101
101
|
private readonly inProcessOfSigning;
|
|
102
102
|
private readonly nonceTracker;
|
|
103
|
-
private registry;
|
|
103
|
+
private readonly registry;
|
|
104
104
|
private readonly provider;
|
|
105
105
|
private readonly mutex;
|
|
106
106
|
private readonly getSavedGasFees;
|
|
@@ -482,10 +482,6 @@ export declare class TransactionController extends BaseControllerV1<TransactionC
|
|
|
482
482
|
private updateGasProperties;
|
|
483
483
|
private getCurrentChainTransactionsByStatus;
|
|
484
484
|
private onBootCleanup;
|
|
485
|
-
/**
|
|
486
|
-
* Create approvals for all unapproved transactions on current chain.
|
|
487
|
-
*/
|
|
488
|
-
private createApprovalsForUnapprovedTransactions;
|
|
489
485
|
/**
|
|
490
486
|
* Force to submit approved transactions on current chain.
|
|
491
487
|
*/
|
|
@@ -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,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAU7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,QAAQ,EACT,MAAM,8BAA8B,CAAC;AAEtC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAI3C,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAGtC,OAAO,KAAK,EACV,SAAS,EACT,WAAW,IAAI,uBAAuB,EACvC,MAAM,eAAe,CAAC;AAOvB,OAAO,KAAK,EACV,MAAM,EAEN,YAAY,EACZ,uBAAuB,EACvB,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,YAAY,EACZ,qBAAqB,EACtB,MAAM,SAAS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;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;IACH,OAAO,CAAC,sBAAsB;IAmC9B;;;;;OAKG;IACH,OAAO,CAAC,0BAA0B;IA8BlC;;;;OAIG;IACH,OAAO,CAAC,2BAA2B;IAYnC;;;;;OAKG;IACH,OAAO,CAAC,0BAA0B;YAMpB,0BAA0B;IAUxC;;;;;;OAMG;YACW,wBAAwB;YAexB,uBAAuB;IAYrC,OAAO,CAAC,qCAAqC;YAsB/B,eAAe;IAuD7B,OAAO,CAAC,yBAAyB;IAIjC,OAAO,CAAC,kCAAkC;IAY1C,OAAO,CAAC,2BAA2B;IAcnC,OAAO,CAAC,sBAAsB;YAehB,iBAAiB;CAsBhC"}
|
|
@@ -20,7 +20,7 @@ const controller_utils_1 = require("@metamask/controller-utils");
|
|
|
20
20
|
const eth_query_1 = __importDefault(require("@metamask/eth-query"));
|
|
21
21
|
const rpc_errors_1 = require("@metamask/rpc-errors");
|
|
22
22
|
const async_mutex_1 = require("async-mutex");
|
|
23
|
-
const eth_method_registry_1 =
|
|
23
|
+
const eth_method_registry_1 = 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");
|
|
@@ -124,7 +124,8 @@ class TransactionController extends base_controller_1.BaseControllerV1 {
|
|
|
124
124
|
this.isSendFlowHistoryDisabled = disableSendFlowHistory !== null && disableSendFlowHistory !== void 0 ? disableSendFlowHistory : false;
|
|
125
125
|
this.isHistoryDisabled = disableHistory !== null && disableHistory !== void 0 ? disableHistory : false;
|
|
126
126
|
this.isSwapsDisabled = disableSwaps !== null && disableSwaps !== void 0 ? disableSwaps : false;
|
|
127
|
-
|
|
127
|
+
// @ts-expect-error the type in eth-method-registry is inappropriate and should be changed
|
|
128
|
+
this.registry = new eth_method_registry_1.MethodRegistry({ provider });
|
|
128
129
|
this.getSavedGasFees = getSavedGasFees !== null && getSavedGasFees !== void 0 ? getSavedGasFees : ((_chainId) => undefined);
|
|
129
130
|
this.getCurrentAccountEIP1559Compatibility =
|
|
130
131
|
getCurrentAccountEIP1559Compatibility !== null && getCurrentAccountEIP1559Compatibility !== void 0 ? getCurrentAccountEIP1559Compatibility : (() => Promise.resolve(true));
|
|
@@ -178,7 +179,11 @@ class TransactionController extends base_controller_1.BaseControllerV1 {
|
|
|
178
179
|
getTransactions: () => this.state.transactions,
|
|
179
180
|
isResubmitEnabled: pendingTransactions.isResubmitEnabled,
|
|
180
181
|
nonceTracker: this.nonceTracker,
|
|
181
|
-
onStateChange:
|
|
182
|
+
onStateChange: (listener) => {
|
|
183
|
+
this.subscribe(listener);
|
|
184
|
+
onNetworkStateChange(listener);
|
|
185
|
+
listener();
|
|
186
|
+
},
|
|
182
187
|
publishTransaction: this.publishTransaction.bind(this),
|
|
183
188
|
hooks: {
|
|
184
189
|
beforeCheckPendingTransaction: this.beforeCheckPendingTransaction.bind(this),
|
|
@@ -187,8 +192,7 @@ class TransactionController extends base_controller_1.BaseControllerV1 {
|
|
|
187
192
|
});
|
|
188
193
|
this.addPendingTransactionTrackerListeners();
|
|
189
194
|
onNetworkStateChange(() => {
|
|
190
|
-
|
|
191
|
-
this.registry = new eth_method_registry_1.default({ provider: this.provider });
|
|
195
|
+
(0, logger_1.projectLogger)('Detected network change', this.getChainId());
|
|
192
196
|
this.onBootCleanup();
|
|
193
197
|
});
|
|
194
198
|
this.onBootCleanup();
|
|
@@ -305,6 +309,8 @@ class TransactionController extends base_controller_1.BaseControllerV1 {
|
|
|
305
309
|
yield (0, swaps_1.updateSwapsTransaction)(transactionMeta, transactionType, swaps, {
|
|
306
310
|
isSwapsDisabled: this.isSwapsDisabled,
|
|
307
311
|
cancelTransaction: this.cancelTransaction.bind(this),
|
|
312
|
+
// TODO: Replace `any` with type
|
|
313
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
308
314
|
controllerHubEmitter: this.hub.emit.bind(this.hub),
|
|
309
315
|
});
|
|
310
316
|
this.addMetadata(transactionMeta);
|
|
@@ -716,6 +722,8 @@ class TransactionController extends base_controller_1.BaseControllerV1 {
|
|
|
716
722
|
originalGasEstimate,
|
|
717
723
|
userEditedGasLimit,
|
|
718
724
|
userFeeLevel,
|
|
725
|
+
// TODO: Replace `any` with type
|
|
726
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
719
727
|
};
|
|
720
728
|
// only update what is defined
|
|
721
729
|
transactionGasFees.txParams = (0, lodash_1.pickBy)(transactionGasFees.txParams);
|
|
@@ -747,6 +755,8 @@ class TransactionController extends base_controller_1.BaseControllerV1 {
|
|
|
747
755
|
maxFeePerGas,
|
|
748
756
|
maxPriorityFeePerGas,
|
|
749
757
|
},
|
|
758
|
+
// TODO: Replace `any` with type
|
|
759
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
750
760
|
};
|
|
751
761
|
// only update what is defined
|
|
752
762
|
transactionPreviousGas.previousGas = (0, lodash_1.pickBy)(transactionPreviousGas.previousGas);
|
|
@@ -896,7 +906,8 @@ class TransactionController extends base_controller_1.BaseControllerV1 {
|
|
|
896
906
|
initApprovals() {
|
|
897
907
|
const chainId = this.getChainId();
|
|
898
908
|
const unapprovedTxs = this.state.transactions.filter((transaction) => transaction.status === types_1.TransactionStatus.unapproved &&
|
|
899
|
-
transaction.chainId === chainId
|
|
909
|
+
transaction.chainId === chainId &&
|
|
910
|
+
!transaction.isUserOperation);
|
|
900
911
|
for (const txMeta of unapprovedTxs) {
|
|
901
912
|
this.processApproval(txMeta, {
|
|
902
913
|
shouldShowRequest: false,
|
|
@@ -929,7 +940,9 @@ class TransactionController extends base_controller_1.BaseControllerV1 {
|
|
|
929
940
|
const predicateMethods = (0, lodash_1.mapValues)(searchCriteria, (predicate) => {
|
|
930
941
|
return typeof predicate === 'function'
|
|
931
942
|
? predicate
|
|
932
|
-
:
|
|
943
|
+
: // TODO: Replace `any` with type
|
|
944
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
945
|
+
(v) => v === predicate;
|
|
933
946
|
});
|
|
934
947
|
const transactionsToFilter = initialList !== null && initialList !== void 0 ? initialList : this.state.transactions;
|
|
935
948
|
// Combine sortBy and pickBy to transform our state object into an array of
|
|
@@ -947,9 +960,13 @@ class TransactionController extends base_controller_1.BaseControllerV1 {
|
|
|
947
960
|
// are not fully satisfied. We check both txParams and the base
|
|
948
961
|
// object as predicate keys can be either.
|
|
949
962
|
if (key in transaction.txParams) {
|
|
963
|
+
// TODO: Replace `any` with type
|
|
964
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
950
965
|
if (predicate(transaction.txParams[key]) === false) {
|
|
951
966
|
return false;
|
|
952
967
|
}
|
|
968
|
+
// TODO: Replace `any` with type
|
|
969
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
953
970
|
}
|
|
954
971
|
else if (predicate(transaction[key]) === false) {
|
|
955
972
|
return false;
|
|
@@ -1045,23 +1062,6 @@ class TransactionController extends base_controller_1.BaseControllerV1 {
|
|
|
1045
1062
|
onBootCleanup() {
|
|
1046
1063
|
this.submitApprovedTransactions();
|
|
1047
1064
|
}
|
|
1048
|
-
/**
|
|
1049
|
-
* Create approvals for all unapproved transactions on current chain.
|
|
1050
|
-
*/
|
|
1051
|
-
createApprovalsForUnapprovedTransactions() {
|
|
1052
|
-
const unapprovedTransactions = this.getCurrentChainTransactionsByStatus(types_1.TransactionStatus.unapproved);
|
|
1053
|
-
for (const transactionMeta of unapprovedTransactions) {
|
|
1054
|
-
this.processApproval(transactionMeta, {
|
|
1055
|
-
shouldShowRequest: false,
|
|
1056
|
-
}).catch((error) => {
|
|
1057
|
-
if ((error === null || error === void 0 ? void 0 : error.code) === rpc_errors_1.errorCodes.provider.userRejectedRequest) {
|
|
1058
|
-
return;
|
|
1059
|
-
}
|
|
1060
|
-
/* istanbul ignore next */
|
|
1061
|
-
console.error('Error during persisted transaction approval', error);
|
|
1062
|
-
});
|
|
1063
|
-
}
|
|
1064
|
-
}
|
|
1065
1065
|
/**
|
|
1066
1066
|
* Force to submit approved transactions on current chain.
|
|
1067
1067
|
*/
|
|
@@ -1117,6 +1117,8 @@ class TransactionController extends base_controller_1.BaseControllerV1 {
|
|
|
1117
1117
|
actionId,
|
|
1118
1118
|
});
|
|
1119
1119
|
}
|
|
1120
|
+
// TODO: Replace `any` with type
|
|
1121
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1120
1122
|
}
|
|
1121
1123
|
catch (error) {
|
|
1122
1124
|
const { isCompleted: isTxCompleted } = this.isTransactionCompleted(transactionId);
|
|
@@ -1216,6 +1218,8 @@ class TransactionController extends base_controller_1.BaseControllerV1 {
|
|
|
1216
1218
|
});
|
|
1217
1219
|
this.hub.emit(`${transactionMeta.id}:finished`, transactionMeta);
|
|
1218
1220
|
this.onTransactionStatusChange(transactionMeta);
|
|
1221
|
+
// TODO: Replace `any` with type
|
|
1222
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1219
1223
|
}
|
|
1220
1224
|
catch (error) {
|
|
1221
1225
|
this.failTransaction(transactionMeta, error);
|
|
@@ -1459,17 +1463,16 @@ class TransactionController extends base_controller_1.BaseControllerV1 {
|
|
|
1459
1463
|
const transactionMeta = this.getTransaction(transactionId);
|
|
1460
1464
|
const nonce = (_a = transactionMeta === null || transactionMeta === void 0 ? void 0 : transactionMeta.txParams) === null || _a === void 0 ? void 0 : _a.nonce;
|
|
1461
1465
|
const from = (_b = transactionMeta === null || transactionMeta === void 0 ? void 0 : transactionMeta.txParams) === null || _b === void 0 ? void 0 : _b.from;
|
|
1462
|
-
const sameNonceTxs = this.state.transactions.filter((transaction) => transaction.
|
|
1466
|
+
const sameNonceTxs = this.state.transactions.filter((transaction) => transaction.id !== transactionId &&
|
|
1467
|
+
transaction.txParams.from === from &&
|
|
1463
1468
|
transaction.txParams.nonce === nonce &&
|
|
1464
|
-
transaction.chainId === chainId
|
|
1469
|
+
transaction.chainId === chainId &&
|
|
1470
|
+
transaction.type !== types_1.TransactionType.incoming);
|
|
1465
1471
|
if (!sameNonceTxs.length) {
|
|
1466
1472
|
return;
|
|
1467
1473
|
}
|
|
1468
1474
|
// Mark all same nonce transactions as dropped and give it a replacedBy hash
|
|
1469
1475
|
for (const transaction of sameNonceTxs) {
|
|
1470
|
-
if (transaction.id === transactionId) {
|
|
1471
|
-
continue;
|
|
1472
|
-
}
|
|
1473
1476
|
transaction.replacedBy = transactionMeta === null || transactionMeta === void 0 ? void 0 : transactionMeta.hash;
|
|
1474
1477
|
transaction.replacedById = transactionMeta === null || transactionMeta === void 0 ? void 0 : transactionMeta.id;
|
|
1475
1478
|
// Drop any transaction that wasn't previously failed (off chain failure)
|
|
@@ -1518,14 +1521,12 @@ class TransactionController extends base_controller_1.BaseControllerV1 {
|
|
|
1518
1521
|
*/
|
|
1519
1522
|
updateTransactionMetaRSV(transactionMeta, signedTx) {
|
|
1520
1523
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
if (signedTx.v) {
|
|
1528
|
-
transactionMeta.v = (0, ethereumjs_util_1.addHexPrefix)(signedTx.v.toString(16));
|
|
1524
|
+
for (const key of ['r', 's', 'v']) {
|
|
1525
|
+
const value = signedTx[key];
|
|
1526
|
+
if (value === undefined || value === null) {
|
|
1527
|
+
continue;
|
|
1528
|
+
}
|
|
1529
|
+
transactionMeta[key] = (0, ethereumjs_util_1.addHexPrefix)(value.toString(16));
|
|
1529
1530
|
}
|
|
1530
1531
|
});
|
|
1531
1532
|
}
|