@metamask/transaction-controller 8.0.0 → 8.0.1

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 CHANGED
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [8.0.1]
10
+ ### Changed
11
+ - Replace `eth-query` ^2.1.2 with `@metamask/eth-query` ^3.0.1 ([#1546](https://github.com/MetaMask/core/pull/1546))
12
+
9
13
  ## [8.0.0]
10
14
  ### Changed
11
15
  - **BREAKING**: Change `babel-runtime` from a `dependency` to a `peerDependency` ([#1504](https://github.com/MetaMask/core/pull/1504))
@@ -94,7 +98,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
94
98
 
95
99
  All changes listed after this point were applied to this package following the monorepo conversion.
96
100
 
97
- [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@8.0.0...HEAD
101
+ [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@8.0.1...HEAD
102
+ [8.0.1]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@8.0.0...@metamask/transaction-controller@8.0.1
98
103
  [8.0.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@7.1.0...@metamask/transaction-controller@8.0.0
99
104
  [7.1.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@7.0.0...@metamask/transaction-controller@7.1.0
100
105
  [7.0.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@6.1.0...@metamask/transaction-controller@7.0.0
@@ -0,0 +1,15 @@
1
+ import type { RemoteTransactionSource, RemoteTransactionSourceRequest, TransactionMeta } from './types';
2
+ /**
3
+ * A RemoteTransactionSource that fetches transaction data from Etherscan.
4
+ */
5
+ export declare class EtherscanRemoteTransactionSource implements RemoteTransactionSource {
6
+ #private;
7
+ /**
8
+ * Retrieve transaction data from Etherscan.
9
+ *
10
+ * @param request - The configuration required to fetch Etherscan transaction data.
11
+ * @returns An array of transaction metadata.
12
+ */
13
+ fetchTransactions(request: RemoteTransactionSourceRequest): Promise<TransactionMeta[]>;
14
+ }
15
+ //# sourceMappingURL=EtherscanRemoteTransactionSource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EtherscanRemoteTransactionSource.d.ts","sourceRoot":"","sources":["../src/EtherscanRemoteTransactionSource.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EACV,uBAAuB,EACvB,8BAA8B,EAC9B,eAAe,EAChB,MAAM,SAAS,CAAC;AAGjB;;GAEG;AACH,qBAAa,gCACX,YAAW,uBAAuB;;IAElC;;;;;OAKG;IACG,iBAAiB,CACrB,OAAO,EAAE,8BAA8B,GACtC,OAAO,CAAC,eAAe,EAAE,CAAC;CAqG9B"}
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
12
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
13
+ 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");
14
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
15
+ };
16
+ var _EtherscanRemoteTransactionSource_instances, _EtherscanRemoteTransactionSource_normalizeTransaction, _EtherscanRemoteTransactionSource_normalizeTokenTransaction, _EtherscanRemoteTransactionSource_normalizeTransactionBase;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.EtherscanRemoteTransactionSource = void 0;
19
+ const controller_utils_1 = require("@metamask/controller-utils");
20
+ const ethereumjs_util_1 = require("ethereumjs-util");
21
+ const uuid_1 = require("uuid");
22
+ const etherscan_1 = require("./etherscan");
23
+ const types_1 = require("./types");
24
+ /**
25
+ * A RemoteTransactionSource that fetches transaction data from Etherscan.
26
+ */
27
+ class EtherscanRemoteTransactionSource {
28
+ constructor() {
29
+ _EtherscanRemoteTransactionSource_instances.add(this);
30
+ }
31
+ /**
32
+ * Retrieve transaction data from Etherscan.
33
+ *
34
+ * @param request - The configuration required to fetch Etherscan transaction data.
35
+ * @returns An array of transaction metadata.
36
+ */
37
+ fetchTransactions(request) {
38
+ return __awaiter(this, void 0, void 0, function* () {
39
+ const [etherscanTransactions, etherscanTokenTransactions] = yield Promise.all([
40
+ (0, etherscan_1.fetchEtherscanTransactions)(request),
41
+ (0, etherscan_1.fetchEtherscanTokenTransactions)(request),
42
+ ]);
43
+ const transactions = etherscanTransactions.result.map((tx) => __classPrivateFieldGet(this, _EtherscanRemoteTransactionSource_instances, "m", _EtherscanRemoteTransactionSource_normalizeTransaction).call(this, tx, request.currentNetworkId, request.currentChainId));
44
+ const tokenTransactions = etherscanTokenTransactions.result.map((tx) => __classPrivateFieldGet(this, _EtherscanRemoteTransactionSource_instances, "m", _EtherscanRemoteTransactionSource_normalizeTokenTransaction).call(this, tx, request.currentNetworkId, request.currentChainId));
45
+ return [...transactions, ...tokenTransactions];
46
+ });
47
+ }
48
+ }
49
+ exports.EtherscanRemoteTransactionSource = EtherscanRemoteTransactionSource;
50
+ _EtherscanRemoteTransactionSource_instances = new WeakSet(), _EtherscanRemoteTransactionSource_normalizeTransaction = function _EtherscanRemoteTransactionSource_normalizeTransaction(txMeta, currentNetworkId, currentChainId) {
51
+ const base = __classPrivateFieldGet(this, _EtherscanRemoteTransactionSource_instances, "m", _EtherscanRemoteTransactionSource_normalizeTransactionBase).call(this, txMeta, currentNetworkId, currentChainId);
52
+ return Object.assign(Object.assign(Object.assign({}, base), { transaction: Object.assign(Object.assign({}, base.transaction), { data: txMeta.input }) }), (txMeta.isError === '0'
53
+ ? { status: types_1.TransactionStatus.confirmed }
54
+ : {
55
+ error: new Error('Transaction failed'),
56
+ status: types_1.TransactionStatus.failed,
57
+ }));
58
+ }, _EtherscanRemoteTransactionSource_normalizeTokenTransaction = function _EtherscanRemoteTransactionSource_normalizeTokenTransaction(txMeta, currentNetworkId, currentChainId) {
59
+ const base = __classPrivateFieldGet(this, _EtherscanRemoteTransactionSource_instances, "m", _EtherscanRemoteTransactionSource_normalizeTransactionBase).call(this, txMeta, currentNetworkId, currentChainId);
60
+ return Object.assign(Object.assign({}, base), { isTransfer: true, transferInformation: {
61
+ contractAddress: txMeta.contractAddress,
62
+ decimals: Number(txMeta.tokenDecimal),
63
+ symbol: txMeta.tokenSymbol,
64
+ } });
65
+ }, _EtherscanRemoteTransactionSource_normalizeTransactionBase = function _EtherscanRemoteTransactionSource_normalizeTransactionBase(txMeta, currentNetworkId, currentChainId) {
66
+ const time = parseInt(txMeta.timeStamp, 10) * 1000;
67
+ return {
68
+ blockNumber: txMeta.blockNumber,
69
+ chainId: currentChainId,
70
+ id: (0, uuid_1.v1)({ msecs: time }),
71
+ networkID: currentNetworkId,
72
+ status: types_1.TransactionStatus.confirmed,
73
+ time,
74
+ transaction: {
75
+ from: txMeta.from,
76
+ gas: (0, controller_utils_1.BNToHex)(new ethereumjs_util_1.BN(txMeta.gas)),
77
+ gasPrice: (0, controller_utils_1.BNToHex)(new ethereumjs_util_1.BN(txMeta.gasPrice)),
78
+ gasUsed: (0, controller_utils_1.BNToHex)(new ethereumjs_util_1.BN(txMeta.gasUsed)),
79
+ nonce: (0, controller_utils_1.BNToHex)(new ethereumjs_util_1.BN(txMeta.nonce)),
80
+ to: txMeta.to,
81
+ value: (0, controller_utils_1.BNToHex)(new ethereumjs_util_1.BN(txMeta.value)),
82
+ },
83
+ transactionHash: txMeta.hash,
84
+ verifiedOnBlockchain: false,
85
+ };
86
+ };
87
+ //# sourceMappingURL=EtherscanRemoteTransactionSource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EtherscanRemoteTransactionSource.js","sourceRoot":"","sources":["../src/EtherscanRemoteTransactionSource.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,iEAAqD;AAErD,qDAAqC;AACrC,+BAAoC;AAOpC,2CAGqB;AAMrB,mCAA4C;AAE5C;;GAEG;AACH,MAAa,gCAAgC;IAA7C;;IAgHA,CAAC;IA7GC;;;;;OAKG;IACG,iBAAiB,CACrB,OAAuC;;YAEvC,MAAM,CAAC,qBAAqB,EAAE,0BAA0B,CAAC,GACvD,MAAM,OAAO,CAAC,GAAG,CAAC;gBAChB,IAAA,sCAA0B,EAAC,OAAO,CAAC;gBACnC,IAAA,2CAA+B,EAAC,OAAO,CAAC;aACzC,CAAC,CAAC;YAEL,MAAM,YAAY,GAAG,qBAAqB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAC3D,uBAAA,IAAI,2GAAsB,MAA1B,IAAI,EACF,EAAE,EACF,OAAO,CAAC,gBAAgB,EACxB,OAAO,CAAC,cAAc,CACvB,CACF,CAAC;YAEF,MAAM,iBAAiB,GAAG,0BAA0B,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CACrE,uBAAA,IAAI,gHAA2B,MAA/B,IAAI,EACF,EAAE,EACF,OAAO,CAAC,gBAAgB,EACxB,OAAO,CAAC,cAAc,CACvB,CACF,CAAC;YAEF,OAAO,CAAC,GAAG,YAAY,EAAE,GAAG,iBAAiB,CAAC,CAAC;QACjD,CAAC;KAAA;CA6EF;AAhHD,4EAgHC;sLA1EG,MAAgC,EAChC,gBAAwB,EACxB,cAAmB;IAEnB,MAAM,IAAI,GAAG,uBAAA,IAAI,+GAA0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AC,GAAG,CAAC,CAAC;YAChC,QAAQ,EAAE,IAAA,0BAAO,EAAC,IAAI,oBAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC1C,OAAO,EAAE,IAAA,0BAAO,EAAC,IAAI,oBAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YACxC,KAAK,EAAE,IAAA,0BAAO,EAAC,IAAI,oBAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACpC,EAAE,EAAE,MAAM,CAAC,EAAE;YACb,KAAK,EAAE,IAAA,0BAAO,EAAC,IAAI,oBAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;SACrC;QACD,eAAe,EAAE,MAAM,CAAC,IAAI;QAC5B,oBAAoB,EAAE,KAAK;KAC5B,CAAC;AACJ,CAAC","sourcesContent":["import { BNToHex } from '@metamask/controller-utils';\nimport type { Hex } from '@metamask/utils';\nimport { BN } from 'ethereumjs-util';\nimport { v1 as random } from 'uuid';\n\nimport type {\n EtherscanTokenTransactionMeta,\n EtherscanTransactionMeta,\n EtherscanTransactionMetaBase,\n} from './etherscan';\nimport {\n fetchEtherscanTokenTransactions,\n fetchEtherscanTransactions,\n} from './etherscan';\nimport type {\n RemoteTransactionSource,\n RemoteTransactionSourceRequest,\n TransactionMeta,\n} from './types';\nimport { TransactionStatus } from './types';\n\n/**\n * A RemoteTransactionSource that fetches transaction data from Etherscan.\n */\nexport class EtherscanRemoteTransactionSource\n implements RemoteTransactionSource\n{\n /**\n * Retrieve transaction data from Etherscan.\n *\n * @param request - The configuration required to fetch Etherscan transaction data.\n * @returns An array of transaction metadata.\n */\n async fetchTransactions(\n request: RemoteTransactionSourceRequest,\n ): Promise<TransactionMeta[]> {\n const [etherscanTransactions, etherscanTokenTransactions] =\n await Promise.all([\n fetchEtherscanTransactions(request),\n fetchEtherscanTokenTransactions(request),\n ]);\n\n const transactions = etherscanTransactions.result.map((tx) =>\n this.#normalizeTransaction(\n tx,\n request.currentNetworkId,\n request.currentChainId,\n ),\n );\n\n const tokenTransactions = etherscanTokenTransactions.result.map((tx) =>\n this.#normalizeTokenTransaction(\n tx,\n request.currentNetworkId,\n request.currentChainId,\n ),\n );\n\n return [...transactions, ...tokenTransactions];\n }\n\n #normalizeTransaction(\n txMeta: EtherscanTransactionMeta,\n currentNetworkId: string,\n currentChainId: Hex,\n ): TransactionMeta {\n const base = this.#normalizeTransactionBase(\n txMeta,\n currentNetworkId,\n currentChainId,\n );\n\n return {\n ...base,\n transaction: {\n ...base.transaction,\n data: txMeta.input,\n },\n ...(txMeta.isError === '0'\n ? { status: TransactionStatus.confirmed }\n : {\n error: new Error('Transaction failed'),\n status: TransactionStatus.failed,\n }),\n };\n }\n\n #normalizeTokenTransaction(\n txMeta: EtherscanTokenTransactionMeta,\n currentNetworkId: string,\n currentChainId: Hex,\n ): TransactionMeta {\n const base = this.#normalizeTransactionBase(\n txMeta,\n currentNetworkId,\n currentChainId,\n );\n\n return {\n ...base,\n isTransfer: true,\n transferInformation: {\n contractAddress: txMeta.contractAddress,\n decimals: Number(txMeta.tokenDecimal),\n symbol: txMeta.tokenSymbol,\n },\n };\n }\n\n #normalizeTransactionBase(\n txMeta: EtherscanTransactionMetaBase,\n currentNetworkId: string,\n currentChainId: Hex,\n ): TransactionMeta {\n const time = parseInt(txMeta.timeStamp, 10) * 1000;\n\n return {\n blockNumber: txMeta.blockNumber,\n chainId: currentChainId,\n id: random({ msecs: time }),\n networkID: currentNetworkId,\n status: TransactionStatus.confirmed,\n time,\n transaction: {\n from: txMeta.from,\n gas: BNToHex(new BN(txMeta.gas)),\n gasPrice: BNToHex(new BN(txMeta.gasPrice)),\n gasUsed: BNToHex(new BN(txMeta.gasUsed)),\n nonce: BNToHex(new BN(txMeta.nonce)),\n to: txMeta.to,\n value: BNToHex(new BN(txMeta.value)),\n },\n transactionHash: txMeta.hash,\n verifiedOnBlockchain: false,\n };\n }\n}\n"]}
@@ -0,0 +1,23 @@
1
+ import type EthQuery from '@metamask/eth-query';
2
+ import type { NetworkState } from '@metamask/network-controller';
3
+ import type { RemoteTransactionSource, TransactionMeta } from './types';
4
+ export declare class IncomingTransactionHelper {
5
+ #private;
6
+ constructor({ getNetworkState, getEthQuery, transactionLimit, remoteTransactionSource, }: {
7
+ getNetworkState: () => NetworkState;
8
+ getEthQuery: () => EthQuery;
9
+ transactionLimit: number;
10
+ remoteTransactionSource: RemoteTransactionSource;
11
+ });
12
+ reconcile({ address, localTransactions, fromBlock, apiKey, }: {
13
+ address: string;
14
+ localTransactions: TransactionMeta[];
15
+ fromBlock?: string;
16
+ apiKey?: string;
17
+ }): Promise<{
18
+ updateRequired: boolean;
19
+ transactions: TransactionMeta[];
20
+ latestBlockNumber?: string;
21
+ }>;
22
+ }
23
+ //# sourceMappingURL=IncomingTransactionHelper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IncomingTransactionHelper.d.ts","sourceRoot":"","sources":["../src/IncomingTransactionHelper.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAGjE,OAAO,KAAK,EACV,uBAAuB,EAEvB,eAAe,EAEhB,MAAM,SAAS,CAAC;AAQjB,qBAAa,yBAAyB;;gBASxB,EACV,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,uBAAuB,GACxB,EAAE;QACD,eAAe,EAAE,MAAM,YAAY,CAAC;QACpC,WAAW,EAAE,MAAM,QAAQ,CAAC;QAC5B,gBAAgB,EAAE,MAAM,CAAC;QACzB,uBAAuB,EAAE,uBAAuB,CAAC;KAClD;IAOK,SAAS,CAAC,EACd,OAAO,EACP,iBAAiB,EACjB,SAAS,EACT,MAAM,GACP,EAAE;QACD,OAAO,EAAE,MAAM,CAAC;QAChB,iBAAiB,EAAE,eAAe,EAAE,CAAC;QACrC,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,GAAG,OAAO,CAAC;QACV,cAAc,EAAE,OAAO,CAAC;QACxB,YAAY,EAAE,eAAe,EAAE,CAAC;QAChC,iBAAiB,CAAC,EAAE,MAAM,CAAC;KAC5B,CAAC;CAmMH"}
@@ -0,0 +1,144 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
12
+ if (kind === "m") throw new TypeError("Private method is not writable");
13
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
14
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
15
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
16
+ };
17
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
18
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
19
+ 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");
20
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
21
+ };
22
+ var _IncomingTransactionHelper_instances, _IncomingTransactionHelper_getNetworkState, _IncomingTransactionHelper_getEthQuery, _IncomingTransactionHelper_transactionLimit, _IncomingTransactionHelper_remoteTransactionSource, _IncomingTransactionHelper_updateSmartContractProperty, _IncomingTransactionHelper_getLatestBlockNumber, _IncomingTransactionHelper_isToSmartContract, _IncomingTransactionHelper_sortTransactionsByTime, _IncomingTransactionHelper_reconcileTransactions, _IncomingTransactionHelper_getNewTransactions, _IncomingTransactionHelper_getUpdatedTransactions, _IncomingTransactionHelper_isTransactionOutdated, _IncomingTransactionHelper_isStatusOutdated, _IncomingTransactionHelper_isGasDataOutdated;
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.IncomingTransactionHelper = void 0;
25
+ const controller_utils_1 = require("@metamask/controller-utils");
26
+ const SUPPORTED_NETWORK_IDS = [
27
+ '1',
28
+ '5',
29
+ '11155111', // Sepolia
30
+ ];
31
+ class IncomingTransactionHelper {
32
+ constructor({ getNetworkState, getEthQuery, transactionLimit, remoteTransactionSource, }) {
33
+ _IncomingTransactionHelper_instances.add(this);
34
+ _IncomingTransactionHelper_getNetworkState.set(this, void 0);
35
+ _IncomingTransactionHelper_getEthQuery.set(this, void 0);
36
+ _IncomingTransactionHelper_transactionLimit.set(this, void 0);
37
+ _IncomingTransactionHelper_remoteTransactionSource.set(this, void 0);
38
+ __classPrivateFieldSet(this, _IncomingTransactionHelper_getNetworkState, getNetworkState, "f");
39
+ __classPrivateFieldSet(this, _IncomingTransactionHelper_getEthQuery, getEthQuery, "f");
40
+ __classPrivateFieldSet(this, _IncomingTransactionHelper_transactionLimit, transactionLimit, "f");
41
+ __classPrivateFieldSet(this, _IncomingTransactionHelper_remoteTransactionSource, remoteTransactionSource, "f");
42
+ }
43
+ reconcile({ address, localTransactions, fromBlock, apiKey, }) {
44
+ return __awaiter(this, void 0, void 0, function* () {
45
+ const { providerConfig, networkId: currentNetworkId } = __classPrivateFieldGet(this, _IncomingTransactionHelper_getNetworkState, "f").call(this);
46
+ const { chainId: currentChainId, type: networkType } = providerConfig;
47
+ if (currentNetworkId === null ||
48
+ !SUPPORTED_NETWORK_IDS.includes(currentNetworkId)) {
49
+ return { updateRequired: false, transactions: [] };
50
+ }
51
+ const remoteTransactions = yield __classPrivateFieldGet(this, _IncomingTransactionHelper_remoteTransactionSource, "f").fetchTransactions({
52
+ address,
53
+ networkType,
54
+ limit: __classPrivateFieldGet(this, _IncomingTransactionHelper_transactionLimit, "f"),
55
+ currentChainId,
56
+ currentNetworkId,
57
+ fromBlock,
58
+ apiKey,
59
+ });
60
+ const [updateRequired, transactions] = __classPrivateFieldGet(this, _IncomingTransactionHelper_instances, "m", _IncomingTransactionHelper_reconcileTransactions).call(this, localTransactions, remoteTransactions);
61
+ __classPrivateFieldGet(this, _IncomingTransactionHelper_instances, "m", _IncomingTransactionHelper_sortTransactionsByTime).call(this, transactions);
62
+ const latestBlockNumber = __classPrivateFieldGet(this, _IncomingTransactionHelper_instances, "m", _IncomingTransactionHelper_getLatestBlockNumber).call(this, transactions, address, currentChainId, currentNetworkId);
63
+ yield __classPrivateFieldGet(this, _IncomingTransactionHelper_instances, "m", _IncomingTransactionHelper_updateSmartContractProperty).call(this, transactions);
64
+ return { updateRequired, transactions, latestBlockNumber };
65
+ });
66
+ }
67
+ }
68
+ exports.IncomingTransactionHelper = IncomingTransactionHelper;
69
+ _IncomingTransactionHelper_getNetworkState = new WeakMap(), _IncomingTransactionHelper_getEthQuery = new WeakMap(), _IncomingTransactionHelper_transactionLimit = new WeakMap(), _IncomingTransactionHelper_remoteTransactionSource = new WeakMap(), _IncomingTransactionHelper_instances = new WeakSet(), _IncomingTransactionHelper_updateSmartContractProperty = function _IncomingTransactionHelper_updateSmartContractProperty(transactions) {
70
+ return __awaiter(this, void 0, void 0, function* () {
71
+ yield Promise.all(transactions.map((tx) => __awaiter(this, void 0, void 0, function* () {
72
+ var _a;
73
+ (_a = tx.toSmartContract) !== null && _a !== void 0 ? _a : (tx.toSmartContract = yield __classPrivateFieldGet(this, _IncomingTransactionHelper_instances, "m", _IncomingTransactionHelper_isToSmartContract).call(this, tx.transaction));
74
+ })));
75
+ });
76
+ }, _IncomingTransactionHelper_getLatestBlockNumber = function _IncomingTransactionHelper_getLatestBlockNumber(transactions, address, currentChainId, currentNetworkId) {
77
+ var _a;
78
+ let latestBlockNumber;
79
+ for (const tx of transactions) {
80
+ const onCurrentChain = tx.chainId === currentChainId ||
81
+ (!tx.chainId && tx.networkID === currentNetworkId);
82
+ const toCurrentAccount = ((_a = tx.transaction.to) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === address.toLowerCase();
83
+ const currentBlockNumberValue = tx.blockNumber
84
+ ? parseInt(tx.blockNumber, 10)
85
+ : -1;
86
+ const latestBlockNumberValue = latestBlockNumber
87
+ ? parseInt(latestBlockNumber, 10)
88
+ : -1;
89
+ if (onCurrentChain &&
90
+ toCurrentAccount &&
91
+ latestBlockNumberValue < currentBlockNumberValue) {
92
+ latestBlockNumber = tx.blockNumber;
93
+ }
94
+ }
95
+ return latestBlockNumber;
96
+ }, _IncomingTransactionHelper_isToSmartContract = function _IncomingTransactionHelper_isToSmartContract(transaction) {
97
+ return __awaiter(this, void 0, void 0, function* () {
98
+ // Contract Deploy
99
+ if (!transaction.to) {
100
+ return false;
101
+ }
102
+ // Send
103
+ if (transaction.data === '0x') {
104
+ return false;
105
+ }
106
+ const ethQuery = __classPrivateFieldGet(this, _IncomingTransactionHelper_getEthQuery, "f").call(this);
107
+ const code = yield (0, controller_utils_1.query)(ethQuery, 'getCode', [transaction.to]);
108
+ return (0, controller_utils_1.isSmartContractCode)(code);
109
+ });
110
+ }, _IncomingTransactionHelper_sortTransactionsByTime = function _IncomingTransactionHelper_sortTransactionsByTime(transactions) {
111
+ transactions.sort((a, b) => (a.time < b.time ? -1 : 1));
112
+ }, _IncomingTransactionHelper_reconcileTransactions = function _IncomingTransactionHelper_reconcileTransactions(localTxs, remoteTxs) {
113
+ const updatedTxs = __classPrivateFieldGet(this, _IncomingTransactionHelper_instances, "m", _IncomingTransactionHelper_getUpdatedTransactions).call(this, remoteTxs, localTxs);
114
+ const newTxs = __classPrivateFieldGet(this, _IncomingTransactionHelper_instances, "m", _IncomingTransactionHelper_getNewTransactions).call(this, remoteTxs, localTxs);
115
+ const updatedLocalTxs = localTxs.map((tx) => {
116
+ const txIdx = updatedTxs.findIndex(({ transactionHash }) => transactionHash === tx.transactionHash);
117
+ return txIdx === -1 ? tx : updatedTxs[txIdx];
118
+ });
119
+ const updateRequired = newTxs.length > 0 || updatedTxs.length > 0;
120
+ const transactions = [...newTxs, ...updatedLocalTxs];
121
+ return [updateRequired, transactions];
122
+ }, _IncomingTransactionHelper_getNewTransactions = function _IncomingTransactionHelper_getNewTransactions(remoteTxs, localTxs) {
123
+ return remoteTxs.filter((tx) => {
124
+ const alreadyInTransactions = localTxs.find(({ transactionHash }) => transactionHash === tx.transactionHash);
125
+ return !alreadyInTransactions;
126
+ });
127
+ }, _IncomingTransactionHelper_getUpdatedTransactions = function _IncomingTransactionHelper_getUpdatedTransactions(remoteTxs, localTxs) {
128
+ return remoteTxs.filter((remoteTx) => {
129
+ const isTxOutdated = localTxs.find((localTx) => {
130
+ return (remoteTx.transactionHash === localTx.transactionHash &&
131
+ __classPrivateFieldGet(this, _IncomingTransactionHelper_instances, "m", _IncomingTransactionHelper_isTransactionOutdated).call(this, remoteTx, localTx));
132
+ });
133
+ return isTxOutdated;
134
+ });
135
+ }, _IncomingTransactionHelper_isTransactionOutdated = function _IncomingTransactionHelper_isTransactionOutdated(remoteTx, localTx) {
136
+ const statusOutdated = __classPrivateFieldGet(this, _IncomingTransactionHelper_instances, "m", _IncomingTransactionHelper_isStatusOutdated).call(this, remoteTx.transactionHash, localTx.transactionHash, remoteTx.status, localTx.status);
137
+ const gasDataOutdated = __classPrivateFieldGet(this, _IncomingTransactionHelper_instances, "m", _IncomingTransactionHelper_isGasDataOutdated).call(this, remoteTx.transaction.gasUsed, localTx.transaction.gasUsed);
138
+ return statusOutdated || gasDataOutdated;
139
+ }, _IncomingTransactionHelper_isStatusOutdated = function _IncomingTransactionHelper_isStatusOutdated(remoteTxHash, localTxHash, remoteTxStatus, localTxStatus) {
140
+ return remoteTxHash === localTxHash && remoteTxStatus !== localTxStatus;
141
+ }, _IncomingTransactionHelper_isGasDataOutdated = function _IncomingTransactionHelper_isGasDataOutdated(remoteGasUsed, localGasUsed) {
142
+ return remoteGasUsed !== localGasUsed;
143
+ };
144
+ //# sourceMappingURL=IncomingTransactionHelper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IncomingTransactionHelper.js","sourceRoot":"","sources":["../src/IncomingTransactionHelper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,iEAAwE;AAYxE,MAAM,qBAAqB,GAAG;IAC5B,GAAG;IACH,GAAG;IACH,UAAU,EAAE,UAAU;CACvB,CAAC;AAEF,MAAa,yBAAyB;IASpC,YAAY,EACV,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,uBAAuB,GAMxB;;QAlBD,6DAAqC;QAErC,yDAA6B;QAE7B,8DAA0B;QAE1B,qEAAkD;QAahD,uBAAA,IAAI,8CAAoB,eAAe,MAAA,CAAC;QACxC,uBAAA,IAAI,0CAAgB,WAAW,MAAA,CAAC;QAChC,uBAAA,IAAI,+CAAqB,gBAAgB,MAAA,CAAC;QAC1C,uBAAA,IAAI,sDAA4B,uBAAuB,MAAA,CAAC;IAC1D,CAAC;IAEK,SAAS,CAAC,EACd,OAAO,EACP,iBAAiB,EACjB,SAAS,EACT,MAAM,GAMP;;YAKC,MAAM,EAAE,cAAc,EAAE,SAAS,EAAE,gBAAgB,EAAE,GACnD,uBAAA,IAAI,kDAAiB,MAArB,IAAI,CAAmB,CAAC;YAC1B,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,cAAc,CAAC;YAEtE,IACE,gBAAgB,KAAK,IAAI;gBACzB,CAAC,qBAAqB,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EACjD;gBACA,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC;aACpD;YAED,MAAM,kBAAkB,GACtB,MAAM,uBAAA,IAAI,0DAAyB,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ACL,QAAQ,CAAC,eAAe,KAAK,OAAO,CAAC,eAAe;gBACpD,uBAAA,IAAI,8FAAuB,MAA3B,IAAI,EAAwB,QAAQ,EAAE,OAAO,CAAC,CAC/C,CAAC;QACJ,CAAC,CAAC,CAAC;QACH,OAAO,YAAY,CAAC;IACtB,CAAC,CAAC,CAAC;AACL,CAAC,+GAGC,QAAyB,EACzB,OAAwB;IAExB,MAAM,cAAc,GAAG,uBAAA,IAAI,yFAAkB,MAAtB,IAAI,EACzB,QAAQ,CAAC,eAAe,EACxB,OAAO,CAAC,eAAe,EACvB,QAAQ,CAAC,MAAM,EACf,OAAO,CAAC,MAAM,CACf,CAAC;IAEF,MAAM,eAAe,GAAG,uBAAA,IAAI,0FAAmB,MAAvB,IAAI,EAC1B,QAAQ,CAAC,WAAW,CAAC,OAAO,EAC5B,OAAO,CAAC,WAAW,CAAC,OAAO,CAC5B,CAAC;IAEF,OAAO,cAAc,IAAI,eAAe,CAAC;AAC3C,CAAC,qGAGC,YAAgC,EAChC,WAA+B,EAC/B,cAAiC,EACjC,aAAgC;IAEhC,OAAO,YAAY,KAAK,WAAW,IAAI,cAAc,KAAK,aAAa,CAAC;AAC1E,CAAC,uGAGC,aAAiC,EACjC,YAAgC;IAEhC,OAAO,aAAa,KAAK,YAAY,CAAC;AACxC,CAAC","sourcesContent":["import { isSmartContractCode, query } from '@metamask/controller-utils';\nimport type EthQuery from '@metamask/eth-query';\nimport type { NetworkState } from '@metamask/network-controller';\nimport type { Hex } from '@metamask/utils';\n\nimport type {\n RemoteTransactionSource,\n Transaction,\n TransactionMeta,\n TransactionStatus,\n} from './types';\n\nconst SUPPORTED_NETWORK_IDS = [\n '1', // Mainnet\n '5', // Goerli\n '11155111', // Sepolia\n];\n\nexport class IncomingTransactionHelper {\n #getNetworkState: () => NetworkState;\n\n #getEthQuery: () => EthQuery;\n\n #transactionLimit: number;\n\n #remoteTransactionSource: RemoteTransactionSource;\n\n constructor({\n getNetworkState,\n getEthQuery,\n transactionLimit,\n remoteTransactionSource,\n }: {\n getNetworkState: () => NetworkState;\n getEthQuery: () => EthQuery;\n transactionLimit: number;\n remoteTransactionSource: RemoteTransactionSource;\n }) {\n this.#getNetworkState = getNetworkState;\n this.#getEthQuery = getEthQuery;\n this.#transactionLimit = transactionLimit;\n this.#remoteTransactionSource = remoteTransactionSource;\n }\n\n async reconcile({\n address,\n localTransactions,\n fromBlock,\n apiKey,\n }: {\n address: string;\n localTransactions: TransactionMeta[];\n fromBlock?: string;\n apiKey?: string;\n }): Promise<{\n updateRequired: boolean;\n transactions: TransactionMeta[];\n latestBlockNumber?: string;\n }> {\n const { providerConfig, networkId: currentNetworkId } =\n this.#getNetworkState();\n const { chainId: currentChainId, type: networkType } = providerConfig;\n\n if (\n currentNetworkId === null ||\n !SUPPORTED_NETWORK_IDS.includes(currentNetworkId)\n ) {\n return { updateRequired: false, transactions: [] };\n }\n\n const remoteTransactions =\n await this.#remoteTransactionSource.fetchTransactions({\n address,\n networkType,\n limit: this.#transactionLimit,\n currentChainId,\n currentNetworkId,\n fromBlock,\n apiKey,\n });\n\n const [updateRequired, transactions] = this.#reconcileTransactions(\n localTransactions,\n remoteTransactions,\n );\n\n this.#sortTransactionsByTime(transactions);\n\n const latestBlockNumber = this.#getLatestBlockNumber(\n transactions,\n address,\n currentChainId,\n currentNetworkId,\n );\n\n await this.#updateSmartContractProperty(transactions);\n\n return { updateRequired, transactions, latestBlockNumber };\n }\n\n async #updateSmartContractProperty(transactions: TransactionMeta[]) {\n await Promise.all(\n transactions.map(async (tx) => {\n tx.toSmartContract ??= await this.#isToSmartContract(tx.transaction);\n }),\n );\n }\n\n #getLatestBlockNumber(\n transactions: TransactionMeta[],\n address: string,\n currentChainId: Hex,\n currentNetworkId: string,\n ): string | undefined {\n let latestBlockNumber: string | undefined;\n\n for (const tx of transactions) {\n const onCurrentChain =\n tx.chainId === currentChainId ||\n (!tx.chainId && tx.networkID === currentNetworkId);\n\n const toCurrentAccount =\n tx.transaction.to?.toLowerCase() === address.toLowerCase();\n\n const currentBlockNumberValue = tx.blockNumber\n ? parseInt(tx.blockNumber, 10)\n : -1;\n\n const latestBlockNumberValue = latestBlockNumber\n ? parseInt(latestBlockNumber, 10)\n : -1;\n\n if (\n onCurrentChain &&\n toCurrentAccount &&\n latestBlockNumberValue < currentBlockNumberValue\n ) {\n latestBlockNumber = tx.blockNumber;\n }\n }\n\n return latestBlockNumber;\n }\n\n async #isToSmartContract(transaction: Transaction): Promise<boolean> {\n // Contract Deploy\n if (!transaction.to) {\n return false;\n }\n\n // Send\n if (transaction.data === '0x') {\n return false;\n }\n\n const ethQuery = this.#getEthQuery();\n const code = await query(ethQuery, 'getCode', [transaction.to]);\n\n return isSmartContractCode(code);\n }\n\n #sortTransactionsByTime(transactions: TransactionMeta[]) {\n transactions.sort((a, b) => (a.time < b.time ? -1 : 1));\n }\n\n #reconcileTransactions(\n localTxs: TransactionMeta[],\n remoteTxs: TransactionMeta[],\n ): [boolean, TransactionMeta[]] {\n const updatedTxs: TransactionMeta[] = this.#getUpdatedTransactions(\n remoteTxs,\n localTxs,\n );\n\n const newTxs: TransactionMeta[] = this.#getNewTransactions(\n remoteTxs,\n localTxs,\n );\n\n const updatedLocalTxs = localTxs.map((tx: TransactionMeta) => {\n const txIdx = updatedTxs.findIndex(\n ({ transactionHash }) => transactionHash === tx.transactionHash,\n );\n return txIdx === -1 ? tx : updatedTxs[txIdx];\n });\n\n const updateRequired = newTxs.length > 0 || updatedTxs.length > 0;\n const transactions = [...newTxs, ...updatedLocalTxs];\n\n return [updateRequired, transactions];\n }\n\n #getNewTransactions(\n remoteTxs: TransactionMeta[],\n localTxs: TransactionMeta[],\n ): TransactionMeta[] {\n return remoteTxs.filter((tx) => {\n const alreadyInTransactions = localTxs.find(\n ({ transactionHash }) => transactionHash === tx.transactionHash,\n );\n return !alreadyInTransactions;\n });\n }\n\n #getUpdatedTransactions(\n remoteTxs: TransactionMeta[],\n localTxs: TransactionMeta[],\n ): TransactionMeta[] {\n return remoteTxs.filter((remoteTx) => {\n const isTxOutdated = localTxs.find((localTx) => {\n return (\n remoteTx.transactionHash === localTx.transactionHash &&\n this.#isTransactionOutdated(remoteTx, localTx)\n );\n });\n return isTxOutdated;\n });\n }\n\n #isTransactionOutdated(\n remoteTx: TransactionMeta,\n localTx: TransactionMeta,\n ): boolean {\n const statusOutdated = this.#isStatusOutdated(\n remoteTx.transactionHash,\n localTx.transactionHash,\n remoteTx.status,\n localTx.status,\n );\n\n const gasDataOutdated = this.#isGasDataOutdated(\n remoteTx.transaction.gasUsed,\n localTx.transaction.gasUsed,\n );\n\n return statusOutdated || gasDataOutdated;\n }\n\n #isStatusOutdated(\n remoteTxHash: string | undefined,\n localTxHash: string | undefined,\n remoteTxStatus: TransactionStatus,\n localTxStatus: TransactionStatus,\n ): boolean {\n return remoteTxHash === localTxHash && remoteTxStatus !== localTxStatus;\n }\n\n #isGasDataOutdated(\n remoteGasUsed: string | undefined,\n localGasUsed: string | undefined,\n ): boolean {\n return remoteGasUsed !== localGasUsed;\n }\n}\n"]}
@@ -5,8 +5,8 @@ import type { AddApprovalRequest } from '@metamask/approval-controller';
5
5
  import type { BaseConfig, BaseState, RestrictedControllerMessenger } from '@metamask/base-controller';
6
6
  import { BaseController } from '@metamask/base-controller';
7
7
  import type { BlockTracker, NetworkState, Provider } from '@metamask/network-controller';
8
- import type { Hex } from '@metamask/utils';
9
8
  import { EventEmitter } from 'events';
9
+ import type { Transaction, TransactionMeta, WalletDevice } from './types';
10
10
  export declare const HARDFORK = Hardfork.London;
11
11
  /**
12
12
  * @type Result
@@ -26,35 +26,6 @@ export interface FetchAllOptions {
26
26
  fromBlock?: string;
27
27
  etherscanApiKey?: string;
28
28
  }
29
- /**
30
- * @type Transaction
31
- *
32
- * Transaction representation
33
- * @property chainId - Network ID as per EIP-155
34
- * @property data - Data to pass with this transaction
35
- * @property from - Address to send this transaction from
36
- * @property gas - Gas to send with this transaction
37
- * @property gasPrice - Price of gas with this transaction
38
- * @property gasUsed - Gas used in the transaction
39
- * @property nonce - Unique number to prevent replay attacks
40
- * @property to - Address to send this transaction to
41
- * @property value - Value associated with this transaction
42
- */
43
- export interface Transaction {
44
- chainId?: Hex;
45
- data?: string;
46
- from: string;
47
- gas?: string;
48
- gasPrice?: string;
49
- gasUsed?: string;
50
- nonce?: string;
51
- to?: string;
52
- value?: string;
53
- maxFeePerGas?: string;
54
- maxPriorityFeePerGas?: string;
55
- estimatedBaseFee?: string;
56
- estimateGasError?: string;
57
- }
58
29
  export interface GasPriceValue {
59
30
  gasPrice: string;
60
31
  }
@@ -62,115 +33,6 @@ export interface FeeMarketEIP1559Values {
62
33
  maxFeePerGas: string;
63
34
  maxPriorityFeePerGas: string;
64
35
  }
65
- /**
66
- * The status of the transaction. Each status represents the state of the transaction internally
67
- * in the wallet. Some of these correspond with the state of the transaction on the network, but
68
- * some are wallet-specific.
69
- */
70
- export declare enum TransactionStatus {
71
- approved = "approved",
72
- cancelled = "cancelled",
73
- confirmed = "confirmed",
74
- failed = "failed",
75
- rejected = "rejected",
76
- signed = "signed",
77
- submitted = "submitted",
78
- unapproved = "unapproved"
79
- }
80
- /**
81
- * Options for wallet device.
82
- */
83
- export declare enum WalletDevice {
84
- MM_MOBILE = "metamask_mobile",
85
- MM_EXTENSION = "metamask_extension",
86
- OTHER = "other_device"
87
- }
88
- declare type TransactionMetaBase = {
89
- isTransfer?: boolean;
90
- transferInformation?: {
91
- symbol: string;
92
- contractAddress: string;
93
- decimals: number;
94
- };
95
- id: string;
96
- networkID?: string;
97
- chainId?: Hex;
98
- origin?: string;
99
- rawTransaction?: string;
100
- time: number;
101
- toSmartContract?: boolean;
102
- transaction: Transaction;
103
- transactionHash?: string;
104
- blockNumber?: string;
105
- deviceConfirmedOn?: WalletDevice;
106
- verifiedOnBlockchain?: boolean;
107
- };
108
- /**
109
- * @type TransactionMeta
110
- *
111
- * TransactionMeta representation
112
- * @property error - Synthesized error information for failed transactions
113
- * @property id - Generated UUID associated with this transaction
114
- * @property networkID - Network code as per EIP-155 for this transaction
115
- * @property origin - Origin this transaction was sent from
116
- * @property deviceConfirmedOn - string to indicate what device the transaction was confirmed
117
- * @property rawTransaction - Hex representation of the underlying transaction
118
- * @property status - String status of this transaction
119
- * @property time - Timestamp associated with this transaction
120
- * @property toSmartContract - Whether transaction recipient is a smart contract
121
- * @property transaction - Underlying Transaction object
122
- * @property transactionHash - Hash of a successful transaction
123
- * @property blockNumber - Number of the block where the transaction has been included
124
- */
125
- export declare type TransactionMeta = ({
126
- status: Exclude<TransactionStatus, TransactionStatus.failed>;
127
- } & TransactionMetaBase) | ({
128
- status: TransactionStatus.failed;
129
- error: Error;
130
- } & TransactionMetaBase);
131
- /**
132
- * @type EtherscanTransactionMeta
133
- *
134
- * EtherscanTransactionMeta representation
135
- * @property blockNumber - Number of the block where the transaction has been included
136
- * @property timeStamp - Timestamp associated with this transaction
137
- * @property hash - Hash of a successful transaction
138
- * @property nonce - Nonce of the transaction
139
- * @property blockHash - Hash of the block where the transaction has been included
140
- * @property transactionIndex - Etherscan internal index for this transaction
141
- * @property from - Address to send this transaction from
142
- * @property to - Address to send this transaction to
143
- * @property gas - Gas to send with this transaction
144
- * @property gasPrice - Price of gas with this transaction
145
- * @property isError - Synthesized error information for failed transactions
146
- * @property txreceipt_status - Receipt status for this transaction
147
- * @property input - input of the transaction
148
- * @property contractAddress - Address of the contract
149
- * @property cumulativeGasUsed - Amount of gas used
150
- * @property confirmations - Number of confirmations
151
- */
152
- export interface EtherscanTransactionMeta {
153
- blockNumber: string;
154
- timeStamp: string;
155
- hash: string;
156
- nonce: string;
157
- blockHash: string;
158
- transactionIndex: string;
159
- from: string;
160
- to: string;
161
- value: string;
162
- gas: string;
163
- gasPrice: string;
164
- cumulativeGasUsed: string;
165
- gasUsed: string;
166
- isError: string;
167
- txreceipt_status: string;
168
- input: string;
169
- contractAddress: string;
170
- confirmations: string;
171
- tokenDecimal: string;
172
- tokenSymbol: string;
173
- }
174
36
  /**
175
37
  * @type TransactionConfig
176
38
  *
@@ -240,19 +102,9 @@ export declare class TransactionController extends BaseController<TransactionCon
240
102
  private readonly mutex;
241
103
  private readonly getNetworkState;
242
104
  private readonly messagingSystem;
105
+ private readonly incomingTransactionHelper;
243
106
  private failTransaction;
244
107
  private registryLookup;
245
- /**
246
- * Normalizes the transaction information from etherscan
247
- * to be compatible with the TransactionMeta interface.
248
- *
249
- * @param txMeta - The transaction.
250
- * @param currentNetworkID - The current network ID.
251
- * @param currentChainId - The current chain ID.
252
- * @returns The normalized transaction.
253
- */
254
- private normalizeTx;
255
- private readonly normalizeTokenTx;
256
108
  /**
257
109
  * EventEmitter instance used to listen to specific transactional events
258
110
  */
@@ -440,59 +292,6 @@ export declare class TransactionController extends BaseController<TransactionCon
440
292
  * @returns Whether the transaction has failed.
441
293
  */
442
294
  private checkTxReceiptStatusIsFailed;
443
- /**
444
- * Method to verify the state of transactions using Etherscan as a source of truth.
445
- *
446
- * @param remoteTxs - Transactions to reconcile that are from a remote source.
447
- * @param localTxs - Transactions to reconcile that are local.
448
- * @returns A tuple containing a boolean indicating whether or not an update was required, and the updated transaction.
449
- */
450
- private etherscanTransactionStateReconciler;
451
- /**
452
- * Get all transactions that are in the remote transactions array
453
- * but not in the local transactions array.
454
- *
455
- * @param remoteTxs - Array of transactions from remote source.
456
- * @param localTxs - Array of transactions stored locally.
457
- * @returns The new transactions.
458
- */
459
- private getNewTransactions;
460
- /**
461
- * Get all the transactions that are locally outdated with respect
462
- * to a remote source (etherscan or blockchain). The returned array
463
- * contains the transactions with the updated data.
464
- *
465
- * @param remoteTxs - Array of transactions from remote source.
466
- * @param localTxs - Array of transactions stored locally.
467
- * @returns The updated transactions.
468
- */
469
- private getUpdatedTransactions;
470
- /**
471
- * Verifies if a local transaction is outdated with respect to the remote transaction.
472
- *
473
- * @param remoteTx - The remote transaction from Etherscan.
474
- * @param localTx - The local transaction.
475
- * @returns Whether the transaction is outdated.
476
- */
477
- private isTransactionOutdated;
478
- /**
479
- * Verifies if the status of a local transaction is outdated with respect to the remote transaction.
480
- *
481
- * @param remoteTxHash - Remote transaction hash.
482
- * @param localTxHash - Local transaction hash.
483
- * @param remoteTxStatus - Remote transaction status.
484
- * @param localTxStatus - Local transaction status.
485
- * @returns Whether the status is outdated.
486
- */
487
- private isStatusOutdated;
488
- /**
489
- * Verifies if the gas data of a local transaction is outdated with respect to the remote transaction.
490
- *
491
- * @param remoteGasUsed - Remote gas used in the transaction.
492
- * @param localGasUsed - Local gas used in the transaction.
493
- * @returns Whether the gas data is outdated.
494
- */
495
- private isGasDataOutdated;
496
295
  private requestApproval;
497
296
  private getTransaction;
498
297
  private getApprovalId;
@@ -1 +1 @@
1
- {"version":3,"file":"TransactionController.d.ts","sourceRoot":"","sources":["../src/TransactionController.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAoB,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;AAc3D,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,QAAQ,EACT,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAM3C,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAkBtC,eAAO,MAAM,QAAQ,kBAAkB,CAAC;AAExC;;;;GAIG;AACH,MAAM,WAAW,MAAM;IACrB,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACxB,eAAe,EAAE,eAAe,CAAC;CAClC;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC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