@metamask/transaction-controller 14.0.0 → 16.0.0

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.
Files changed (76) hide show
  1. package/CHANGELOG.md +14 -1
  2. package/dist/TransactionController.d.ts +22 -7
  3. package/dist/TransactionController.d.ts.map +1 -1
  4. package/dist/TransactionController.js +42 -80
  5. package/dist/TransactionController.js.map +1 -1
  6. package/dist/{EtherscanRemoteTransactionSource.d.ts → helpers/EtherscanRemoteTransactionSource.d.ts} +1 -1
  7. package/dist/helpers/EtherscanRemoteTransactionSource.d.ts.map +1 -0
  8. package/dist/{EtherscanRemoteTransactionSource.js → helpers/EtherscanRemoteTransactionSource.js} +4 -4
  9. package/dist/helpers/EtherscanRemoteTransactionSource.js.map +1 -0
  10. package/dist/{IncomingTransactionHelper.d.ts → helpers/IncomingTransactionHelper.d.ts} +1 -1
  11. package/dist/helpers/IncomingTransactionHelper.d.ts.map +1 -0
  12. package/dist/{IncomingTransactionHelper.js → helpers/IncomingTransactionHelper.js} +1 -1
  13. package/dist/helpers/IncomingTransactionHelper.js.map +1 -0
  14. package/dist/{PendingTransactionTracker.d.ts → helpers/PendingTransactionTracker.d.ts} +4 -2
  15. package/dist/helpers/PendingTransactionTracker.d.ts.map +1 -0
  16. package/dist/{PendingTransactionTracker.js → helpers/PendingTransactionTracker.js} +47 -17
  17. package/dist/helpers/PendingTransactionTracker.js.map +1 -0
  18. package/dist/index.d.ts +2 -2
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +1 -1
  21. package/dist/index.js.map +1 -1
  22. package/dist/types.d.ts +71 -2
  23. package/dist/types.d.ts.map +1 -1
  24. package/dist/types.js +36 -1
  25. package/dist/types.js.map +1 -1
  26. package/dist/utils/etherscan.d.ts.map +1 -0
  27. package/dist/{etherscan.js → utils/etherscan.js} +3 -4
  28. package/dist/utils/etherscan.js.map +1 -0
  29. package/dist/{external-transactions.d.ts → utils/external-transactions.d.ts} +1 -1
  30. package/dist/utils/external-transactions.d.ts.map +1 -0
  31. package/dist/{external-transactions.js → utils/external-transactions.js} +1 -1
  32. package/dist/utils/external-transactions.js.map +1 -0
  33. package/dist/utils/gas-fees.d.ts +30 -0
  34. package/dist/utils/gas-fees.d.ts.map +1 -0
  35. package/dist/utils/gas-fees.js +194 -0
  36. package/dist/utils/gas-fees.js.map +1 -0
  37. package/dist/utils/gas.d.ts +25 -0
  38. package/dist/utils/gas.d.ts.map +1 -0
  39. package/dist/utils/gas.js +125 -0
  40. package/dist/utils/gas.js.map +1 -0
  41. package/dist/{history.d.ts → utils/history.d.ts} +1 -1
  42. package/dist/utils/history.d.ts.map +1 -0
  43. package/dist/utils/history.js.map +1 -0
  44. package/dist/{transaction-type.d.ts → utils/transaction-type.d.ts} +1 -1
  45. package/dist/utils/transaction-type.d.ts.map +1 -0
  46. package/dist/{transaction-type.js → utils/transaction-type.js} +1 -1
  47. package/dist/utils/transaction-type.js.map +1 -0
  48. package/dist/{utils.d.ts → utils/utils.d.ts} +3 -3
  49. package/dist/utils/utils.d.ts.map +1 -0
  50. package/dist/{utils.js → utils/utils.js} +3 -3
  51. package/dist/utils/utils.js.map +1 -0
  52. package/dist/{validation.d.ts → utils/validation.d.ts} +1 -1
  53. package/dist/utils/validation.d.ts.map +1 -0
  54. package/dist/utils/validation.js.map +1 -0
  55. package/package.json +9 -7
  56. package/dist/EtherscanRemoteTransactionSource.d.ts.map +0 -1
  57. package/dist/EtherscanRemoteTransactionSource.js.map +0 -1
  58. package/dist/IncomingTransactionHelper.d.ts.map +0 -1
  59. package/dist/IncomingTransactionHelper.js.map +0 -1
  60. package/dist/PendingTransactionTracker.d.ts.map +0 -1
  61. package/dist/PendingTransactionTracker.js.map +0 -1
  62. package/dist/etherscan.d.ts.map +0 -1
  63. package/dist/etherscan.js.map +0 -1
  64. package/dist/external-transactions.d.ts.map +0 -1
  65. package/dist/external-transactions.js.map +0 -1
  66. package/dist/history.d.ts.map +0 -1
  67. package/dist/history.js.map +0 -1
  68. package/dist/transaction-type.d.ts.map +0 -1
  69. package/dist/transaction-type.js.map +0 -1
  70. package/dist/utils.d.ts.map +0 -1
  71. package/dist/utils.js.map +0 -1
  72. package/dist/validation.d.ts.map +0 -1
  73. package/dist/validation.js.map +0 -1
  74. /package/dist/{etherscan.d.ts → utils/etherscan.d.ts} +0 -0
  75. /package/dist/{history.js → utils/history.js} +0 -0
  76. /package/dist/{validation.js → utils/validation.js} +0 -0
@@ -22,51 +22,72 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
22
22
  var __importDefault = (this && this.__importDefault) || function (mod) {
23
23
  return (mod && mod.__esModule) ? mod : { "default": mod };
24
24
  };
25
- var _PendingTransactionTracker_instances, _PendingTransactionTracker_blockTracker, _PendingTransactionTracker_failTransaction, _PendingTransactionTracker_getChainId, _PendingTransactionTracker_getEthQuery, _PendingTransactionTracker_getTransactions, _PendingTransactionTracker_onLatestBlock, _PendingTransactionTracker_blockchainTransactionStateReconciler, _PendingTransactionTracker_checkTxReceiptStatusIsFailed;
25
+ var _PendingTransactionTracker_instances, _PendingTransactionTracker_blockTracker, _PendingTransactionTracker_failTransaction, _PendingTransactionTracker_getChainId, _PendingTransactionTracker_getEthQuery, _PendingTransactionTracker_getTransactions, _PendingTransactionTracker_nonceTracker, _PendingTransactionTracker_onLatestBlock, _PendingTransactionTracker_blockchainTransactionStateReconciler, _PendingTransactionTracker_checkTxReceiptStatusIsFailed;
26
26
  Object.defineProperty(exports, "__esModule", { value: true });
27
27
  exports.PendingTransactionTracker = void 0;
28
28
  const controller_utils_1 = require("@metamask/controller-utils");
29
29
  const events_1 = __importDefault(require("events"));
30
- const logger_1 = require("./logger");
31
- const types_1 = require("./types");
30
+ const logger_1 = require("../logger");
31
+ const types_1 = require("../types");
32
32
  class PendingTransactionTracker {
33
- constructor({ blockTracker, failTransaction, getChainId, getEthQuery, getTransactions, }) {
33
+ constructor({ blockTracker, failTransaction, getChainId, getEthQuery, getTransactions, nonceTracker, }) {
34
34
  _PendingTransactionTracker_instances.add(this);
35
35
  _PendingTransactionTracker_blockTracker.set(this, void 0);
36
36
  _PendingTransactionTracker_failTransaction.set(this, void 0);
37
37
  _PendingTransactionTracker_getChainId.set(this, void 0);
38
38
  _PendingTransactionTracker_getEthQuery.set(this, void 0);
39
39
  _PendingTransactionTracker_getTransactions.set(this, void 0);
40
+ _PendingTransactionTracker_nonceTracker.set(this, void 0);
40
41
  this.hub = new events_1.default();
41
42
  __classPrivateFieldSet(this, _PendingTransactionTracker_blockTracker, blockTracker, "f");
42
43
  __classPrivateFieldSet(this, _PendingTransactionTracker_failTransaction, failTransaction, "f");
43
44
  __classPrivateFieldSet(this, _PendingTransactionTracker_getChainId, getChainId, "f");
44
45
  __classPrivateFieldSet(this, _PendingTransactionTracker_getEthQuery, getEthQuery, "f");
45
46
  __classPrivateFieldSet(this, _PendingTransactionTracker_getTransactions, getTransactions, "f");
47
+ __classPrivateFieldSet(this, _PendingTransactionTracker_nonceTracker, nonceTracker, "f");
46
48
  }
47
49
  start() {
48
50
  // eslint-disable-next-line @typescript-eslint/no-misused-promises
49
51
  __classPrivateFieldGet(this, _PendingTransactionTracker_blockTracker, "f").addListener('latest', () => __awaiter(this, void 0, void 0, function* () {
50
- yield (0, controller_utils_1.safelyExecute)(() => __classPrivateFieldGet(this, _PendingTransactionTracker_instances, "m", _PendingTransactionTracker_onLatestBlock).call(this));
52
+ const nonceGlobalLock = yield __classPrivateFieldGet(this, _PendingTransactionTracker_nonceTracker, "f").getGlobalLock();
53
+ try {
54
+ yield __classPrivateFieldGet(this, _PendingTransactionTracker_instances, "m", _PendingTransactionTracker_onLatestBlock).call(this);
55
+ }
56
+ catch (error) {
57
+ /* istanbul ignore next */
58
+ (0, logger_1.pendingTransactionsLogger)('Error checking the status of submitted transactions', error);
59
+ }
60
+ finally {
61
+ nonceGlobalLock.releaseLock();
62
+ }
51
63
  }));
52
64
  }
53
65
  }
54
66
  exports.PendingTransactionTracker = PendingTransactionTracker;
55
- _PendingTransactionTracker_blockTracker = new WeakMap(), _PendingTransactionTracker_failTransaction = new WeakMap(), _PendingTransactionTracker_getChainId = new WeakMap(), _PendingTransactionTracker_getEthQuery = new WeakMap(), _PendingTransactionTracker_getTransactions = new WeakMap(), _PendingTransactionTracker_instances = new WeakSet(), _PendingTransactionTracker_onLatestBlock = function _PendingTransactionTracker_onLatestBlock() {
67
+ _PendingTransactionTracker_blockTracker = new WeakMap(), _PendingTransactionTracker_failTransaction = new WeakMap(), _PendingTransactionTracker_getChainId = new WeakMap(), _PendingTransactionTracker_getEthQuery = new WeakMap(), _PendingTransactionTracker_getTransactions = new WeakMap(), _PendingTransactionTracker_nonceTracker = new WeakMap(), _PendingTransactionTracker_instances = new WeakSet(), _PendingTransactionTracker_onLatestBlock = function _PendingTransactionTracker_onLatestBlock() {
56
68
  return __awaiter(this, void 0, void 0, function* () {
57
69
  (0, logger_1.pendingTransactionsLogger)('Checking transactions');
58
70
  const transactions = __classPrivateFieldGet(this, _PendingTransactionTracker_getTransactions, "f").call(this);
59
71
  const currentChainId = __classPrivateFieldGet(this, _PendingTransactionTracker_getChainId, "f").call(this);
72
+ (0, logger_1.pendingTransactionsLogger)('Current state', {
73
+ transactionCount: transactions.length,
74
+ currentChainId,
75
+ });
60
76
  let gotUpdates = false;
61
- yield (0, controller_utils_1.safelyExecute)(() => Promise.all(transactions.map((meta, index) => __awaiter(this, void 0, void 0, function* () {
62
- if (!meta.verifiedOnBlockchain && meta.chainId === currentChainId) {
63
- const [reconciledTx, updateRequired] = yield __classPrivateFieldGet(this, _PendingTransactionTracker_instances, "m", _PendingTransactionTracker_blockchainTransactionStateReconciler).call(this, meta);
64
- if (updateRequired) {
65
- transactions[index] = reconciledTx;
66
- gotUpdates = updateRequired;
77
+ try {
78
+ yield Promise.all(transactions.map((meta, index) => __awaiter(this, void 0, void 0, function* () {
79
+ if (!meta.verifiedOnBlockchain && meta.chainId === currentChainId) {
80
+ const [reconciledTx, updateRequired] = yield __classPrivateFieldGet(this, _PendingTransactionTracker_instances, "m", _PendingTransactionTracker_blockchainTransactionStateReconciler).call(this, meta);
81
+ if (updateRequired) {
82
+ transactions[index] = reconciledTx;
83
+ gotUpdates = updateRequired;
84
+ }
67
85
  }
68
- }
69
- }))));
86
+ })));
87
+ }
88
+ catch (error) {
89
+ (0, logger_1.pendingTransactionsLogger)('Error checking pending transactions', error);
90
+ }
70
91
  /* istanbul ignore else */
71
92
  if (gotUpdates) {
72
93
  this.hub.emit('transactions', transactions);
@@ -122,9 +143,18 @@ _PendingTransactionTracker_blockTracker = new WeakMap(), _PendingTransactionTrac
122
143
  }
123
144
  /* istanbul ignore next */
124
145
  if (txObj === null || txObj === void 0 ? void 0 : txObj.blockNumber) {
125
- meta.status = types_1.TransactionStatus.confirmed;
126
- this.hub.emit('transaction-confirmed', meta);
127
- return [meta, true];
146
+ // transactions can be added to a block and still fail,
147
+ // check the transaction status before emitting the confirmed event
148
+ const txStatusFailed = yield __classPrivateFieldGet(this, _PendingTransactionTracker_instances, "m", _PendingTransactionTracker_checkTxReceiptStatusIsFailed).call(this, hash);
149
+ if (txStatusFailed) {
150
+ const error = new Error('Transaction failed. The transaction was reversed');
151
+ __classPrivateFieldGet(this, _PendingTransactionTracker_failTransaction, "f").call(this, meta, error);
152
+ }
153
+ else {
154
+ meta.status = types_1.TransactionStatus.confirmed;
155
+ this.hub.emit('transaction-confirmed', meta);
156
+ return [meta, true];
157
+ }
128
158
  }
129
159
  return [meta, false];
130
160
  default:
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PendingTransactionTracker.js","sourceRoot":"","sources":["../../src/helpers/PendingTransactionTracker.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iEAAmD;AAGnD,oDAAkC;AAGlC,sCAA6D;AAE7D,oCAA6C;AAE7C,MAAa,yBAAyB;IAepC,YAAY,EACV,YAAY,EACZ,eAAe,EACf,UAAU,EACV,WAAW,EACX,eAAe,EACf,YAAY,GAQb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-query';\nimport type { BlockTracker } from '@metamask/network-controller';\nimport EventEmitter from 'events';\nimport type NonceTracker from 'nonce-tracker';\n\nimport { pendingTransactionsLogger as log } from '../logger';\nimport type { TransactionMeta } from '../types';\nimport { TransactionStatus } from '../types';\n\nexport class PendingTransactionTracker {\n hub: EventEmitter;\n\n #blockTracker: BlockTracker;\n\n #failTransaction: (txMeta: TransactionMeta, error: Error) => void;\n\n #getChainId: () => string;\n\n #getEthQuery: () => EthQuery;\n\n #getTransactions: () => TransactionMeta[];\n\n #nonceTracker: NonceTracker;\n\n constructor({\n blockTracker,\n failTransaction,\n getChainId,\n getEthQuery,\n getTransactions,\n nonceTracker,\n }: {\n blockTracker: BlockTracker;\n failTransaction: (txMeta: TransactionMeta, error: Error) => void;\n getChainId: () => string;\n getEthQuery: () => EthQuery;\n getTransactions: () => TransactionMeta[];\n nonceTracker: NonceTracker;\n }) {\n this.hub = new EventEmitter();\n\n this.#blockTracker = blockTracker;\n this.#failTransaction = failTransaction;\n this.#getChainId = getChainId;\n this.#getEthQuery = getEthQuery;\n this.#getTransactions = getTransactions;\n this.#nonceTracker = nonceTracker;\n }\n\n start() {\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n this.#blockTracker.addListener('latest', async () => {\n const nonceGlobalLock = await this.#nonceTracker.getGlobalLock();\n\n try {\n await this.#onLatestBlock();\n } catch (error) {\n /* istanbul ignore next */\n log('Error checking the status of submitted transactions', error);\n } finally {\n nonceGlobalLock.releaseLock();\n }\n });\n }\n\n /**\n * Check the status of submitted transactions on the network to determine whether they have\n * been included in a block. Any that have been included in a block are marked as confirmed.\n */\n async #onLatestBlock() {\n log('Checking transactions');\n\n const transactions = this.#getTransactions();\n const currentChainId = this.#getChainId();\n\n log('Current state', {\n transactionCount: transactions.length,\n currentChainId,\n });\n\n let gotUpdates = false;\n\n try {\n await Promise.all(\n transactions.map(async (meta, index) => {\n if (!meta.verifiedOnBlockchain && meta.chainId === currentChainId) {\n const [reconciledTx, updateRequired] =\n await this.#blockchainTransactionStateReconciler(meta);\n\n if (updateRequired) {\n transactions[index] = reconciledTx;\n gotUpdates = updateRequired;\n }\n }\n }),\n );\n } catch (error) {\n log('Error checking pending transactions', error);\n }\n\n /* istanbul ignore else */\n if (gotUpdates) {\n this.hub.emit('transactions', transactions);\n }\n }\n\n /**\n * Method to verify the state of a transaction using the Blockchain as a source of truth.\n *\n * @param meta - The local transaction to verify on the blockchain.\n * @returns A tuple containing the updated transaction, and whether or not an update was required.\n */\n async #blockchainTransactionStateReconciler(\n meta: TransactionMeta,\n ): Promise<[TransactionMeta, boolean]> {\n const {\n status,\n hash,\n id,\n chainId,\n txParams: { to },\n } = meta;\n\n switch (status) {\n case TransactionStatus.confirmed:\n log('Checking confirmed transaction', {\n id,\n chainId,\n to,\n });\n\n const txReceipt = await query(\n this.#getEthQuery(),\n 'getTransactionReceipt',\n [hash],\n );\n\n if (!txReceipt) {\n return [meta, false];\n }\n\n const txBlock = await query(this.#getEthQuery(), 'getBlockByHash', [\n txReceipt.blockHash,\n ]);\n\n meta.verifiedOnBlockchain = true;\n meta.txParams.gasUsed = txReceipt.gasUsed;\n meta.txReceipt = txReceipt;\n meta.baseFeePerGas = txBlock?.baseFeePerGas;\n meta.blockTimestamp = txBlock?.timestamp;\n\n // According to the Web3 docs:\n // TRUE if the transaction was successful, FALSE if the EVM reverted the transaction.\n if (Number(txReceipt.status) === 0) {\n const error: Error = new Error(\n 'Transaction failed. The transaction was reversed',\n );\n this.#failTransaction(meta, error);\n return [meta, false];\n }\n\n return [meta, true];\n case TransactionStatus.submitted:\n log('Checking submitted transaction', {\n id,\n chainId,\n to,\n });\n\n const txObj = await query(this.#getEthQuery(), 'getTransactionByHash', [\n hash,\n ]);\n\n if (!txObj) {\n const receiptShowsFailedStatus =\n await this.#checkTxReceiptStatusIsFailed(hash);\n\n // Case the txObj is evaluated as false, a second check will\n // determine if the tx failed or it is pending or confirmed\n if (receiptShowsFailedStatus) {\n const error: Error = new Error(\n 'Transaction failed. The transaction was dropped or replaced by a new one',\n );\n this.#failTransaction(meta, error);\n }\n }\n\n /* istanbul ignore next */\n if (txObj?.blockNumber) {\n // transactions can be added to a block and still fail,\n // check the transaction status before emitting the confirmed event\n const txStatusFailed = await this.#checkTxReceiptStatusIsFailed(hash);\n if (txStatusFailed) {\n const error = new Error(\n 'Transaction failed. The transaction was reversed',\n );\n this.#failTransaction(meta, error);\n } else {\n meta.status = TransactionStatus.confirmed;\n this.hub.emit('transaction-confirmed', meta);\n return [meta, true];\n }\n }\n\n return [meta, false];\n default:\n return [meta, false];\n }\n }\n\n /**\n * Method to check if a tx has failed according to their receipt\n * According to the Web3 docs:\n * TRUE if the transaction was successful, FALSE if the EVM reverted the transaction.\n * The receipt is not available for pending transactions and returns null.\n *\n * @param txHash - The transaction hash.\n * @returns Whether the transaction has failed.\n */\n async #checkTxReceiptStatusIsFailed(\n txHash: string | undefined,\n ): Promise<boolean> {\n const txReceipt = await query(\n this.#getEthQuery(),\n 'getTransactionReceipt',\n [txHash],\n );\n if (!txReceipt) {\n // Transaction is pending\n return false;\n }\n return Number(txReceipt.status) === 0;\n }\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from './TransactionController';
2
- export type { EtherscanTransactionMeta } from './etherscan';
3
- export { isEIP1559Transaction } from './utils';
2
+ export type { EtherscanTransactionMeta } from './utils/etherscan';
3
+ export { isEIP1559Transaction } from './utils/utils';
4
4
  export * from './types';
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,YAAY,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC/C,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,YAAY,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,cAAc,SAAS,CAAC"}
package/dist/index.js CHANGED
@@ -16,7 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.isEIP1559Transaction = void 0;
18
18
  __exportStar(require("./TransactionController"), exports);
19
- var utils_1 = require("./utils");
19
+ var utils_1 = require("./utils/utils");
20
20
  Object.defineProperty(exports, "isEIP1559Transaction", { enumerable: true, get: function () { return utils_1.isEIP1559Transaction; } });
21
21
  __exportStar(require("./types"), exports);
22
22
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,0DAAwC;AAExC,iCAA+C;AAAtC,6GAAA,oBAAoB,OAAA;AAC7B,0CAAwB","sourcesContent":["export * from './TransactionController';\nexport type { EtherscanTransactionMeta } from './etherscan';\nexport { isEIP1559Transaction } from './utils';\nexport * from './types';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,0DAAwC;AAExC,uCAAqD;AAA5C,6GAAA,oBAAoB,OAAA;AAC7B,0CAAwB","sourcesContent":["export * from './TransactionController';\nexport type { EtherscanTransactionMeta } from './utils/etherscan';\nexport { isEIP1559Transaction } from './utils/utils';\nexport * from './types';\n"]}
package/dist/types.d.ts CHANGED
@@ -38,9 +38,9 @@ declare type TransactionMetaBase = {
38
38
  */
39
39
  dappSuggestedGasFees?: DappSuggestedGasFees;
40
40
  /**
41
- * The default estimate for gas.
41
+ * The initial gas values set when the transaction was first created.
42
42
  */
43
- defaultGasEstimates?: string;
43
+ defaultGasEstimates?: DefaultGasEstimates;
44
44
  /**
45
45
  * String to indicate what device the transaction was confirmed on.
46
46
  */
@@ -120,6 +120,17 @@ declare type TransactionMetaBase = {
120
120
  * This is purely attached to state logs for troubleshooting and support.
121
121
  */
122
122
  sendFlowHistory?: SendFlowHistoryEntry[];
123
+ /**
124
+ * If the gas estimation fails, an object containing error and block information.
125
+ */
126
+ simulationFails?: {
127
+ reason?: string;
128
+ errorKey?: string;
129
+ debug: {
130
+ blockNumber?: string;
131
+ blockGasLimit?: string;
132
+ };
133
+ };
123
134
  /**
124
135
  * The time the transaction was submitted to the network, in Unix epoch time (ms).
125
136
  */
@@ -507,5 +518,63 @@ export declare type InferTransactionTypeResult = {
507
518
  * A function for verifying a transaction, whether it is malicious or not
508
519
  */
509
520
  export declare type SecurityProviderRequest = (requestData: TransactionMeta, messageType: string) => Promise<any>;
521
+ /**
522
+ * Specifies the shape of the base transaction parameters.
523
+ * Added in EIP-2718.
524
+ */
525
+ export declare enum TransactionEnvelopeType {
526
+ /**
527
+ * A legacy transaction, the very first type.
528
+ */
529
+ legacy = "0x0",
530
+ /**
531
+ * EIP-2930 defined the access list transaction type that allowed for
532
+ * specifying the state that a transaction would act upon in advance and
533
+ * theoretically save on gas fees.
534
+ */
535
+ accessList = "0x1",
536
+ /**
537
+ * The type introduced comes from EIP-1559, Fee Market describes the addition
538
+ * of a baseFee to blocks that will be burned instead of distributed to
539
+ * miners. Transactions of this type have both a maxFeePerGas (maximum total
540
+ * amount in gwei per gas to spend on the transaction) which is inclusive of
541
+ * the maxPriorityFeePerGas (maximum amount of gwei per gas from the
542
+ * transaction fee to distribute to miner).
543
+ */
544
+ feeMarket = "0x2"
545
+ }
546
+ /**
547
+ * The source of the gas fee parameters on a transaction.
548
+ */
549
+ export declare enum UserFeeLevel {
550
+ CUSTOM = "custom",
551
+ DAPP_SUGGESTED = "dappSuggested",
552
+ MEDIUM = "medium"
553
+ }
554
+ /**
555
+ * Initial gas values set when the transaction was first created.
556
+ */
557
+ export declare type DefaultGasEstimates = {
558
+ /**
559
+ * Source of the gas fee values, such as `dappSuggested` or `medium`.
560
+ */
561
+ estimateType?: string;
562
+ /**
563
+ * Maxmimum number of units of gas to use for this transaction.
564
+ */
565
+ gas?: string;
566
+ /**
567
+ * Price per gas for legacy transactions.
568
+ */
569
+ gasPrice?: string;
570
+ /**
571
+ * Maximum amount per gas to pay for the transaction, including the priority fee.
572
+ */
573
+ maxFeePerGas?: string;
574
+ /**
575
+ * Maximum amount per gas to give to validator as incentive.
576
+ */
577
+ maxPriorityFeePerGas?: string;
578
+ };
510
579
  export {};
511
580
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD;;GAEG;AACH,oBAAY,eAAe,GACvB,CAAC;IACC,MAAM,EAAE,OAAO,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;CAC9D,GAAG,mBAAmB,CAAC,GACxB,CAAC;IAAE,MAAM,EAAE,iBAAiB,CAAC,MAAM,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,GAAG,mBAAmB,CAAC,CAAC;AAE/E;;GAEG;AACH,aAAK,mBAAmB,GAAG;IACzB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,aAAa,CAAC,EAAE,GAAG,CAAC;IAEpB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,OAAO,EAAE,GAAG,CAAC;IAEb;;OAEG;IACH,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAE5C;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM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CAAC;IAEb;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC"}
package/dist/types.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TransactionType = exports.WalletDevice = exports.TransactionStatus = void 0;
3
+ exports.UserFeeLevel = exports.TransactionEnvelopeType = exports.TransactionType = exports.WalletDevice = exports.TransactionStatus = void 0;
4
4
  /**
5
5
  * The status of the transaction. Each status represents the state of the transaction internally
6
6
  * in the wallet. Some of these correspond with the state of the transaction on the network, but
@@ -125,4 +125,39 @@ var TransactionType;
125
125
  */
126
126
  TransactionType["tokenMethodSetApprovalForAll"] = "setapprovalforall";
127
127
  })(TransactionType = exports.TransactionType || (exports.TransactionType = {}));
128
+ /**
129
+ * Specifies the shape of the base transaction parameters.
130
+ * Added in EIP-2718.
131
+ */
132
+ var TransactionEnvelopeType;
133
+ (function (TransactionEnvelopeType) {
134
+ /**
135
+ * A legacy transaction, the very first type.
136
+ */
137
+ TransactionEnvelopeType["legacy"] = "0x0";
138
+ /**
139
+ * EIP-2930 defined the access list transaction type that allowed for
140
+ * specifying the state that a transaction would act upon in advance and
141
+ * theoretically save on gas fees.
142
+ */
143
+ TransactionEnvelopeType["accessList"] = "0x1";
144
+ /**
145
+ * The type introduced comes from EIP-1559, Fee Market describes the addition
146
+ * of a baseFee to blocks that will be burned instead of distributed to
147
+ * miners. Transactions of this type have both a maxFeePerGas (maximum total
148
+ * amount in gwei per gas to spend on the transaction) which is inclusive of
149
+ * the maxPriorityFeePerGas (maximum amount of gwei per gas from the
150
+ * transaction fee to distribute to miner).
151
+ */
152
+ TransactionEnvelopeType["feeMarket"] = "0x2";
153
+ })(TransactionEnvelopeType = exports.TransactionEnvelopeType || (exports.TransactionEnvelopeType = {}));
154
+ /**
155
+ * The source of the gas fee parameters on a transaction.
156
+ */
157
+ var UserFeeLevel;
158
+ (function (UserFeeLevel) {
159
+ UserFeeLevel["CUSTOM"] = "custom";
160
+ UserFeeLevel["DAPP_SUGGESTED"] = "dappSuggested";
161
+ UserFeeLevel["MEDIUM"] = "medium";
162
+ })(UserFeeLevel = exports.UserFeeLevel || (exports.UserFeeLevel = {}));
128
163
  //# sourceMappingURL=types.js.map
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AA6NA;;;;GAIG;AACH,IAAY,iBAUX;AAVD,WAAY,iBAAiB;IAC3B,0CAAqB,CAAA;IACrB,4CAAuB,CAAA;IACvB,4CAAuB,CAAA;IACvB,wCAAmB,CAAA;IACnB,sCAAiB,CAAA;IACjB,0CAAqB,CAAA;IACrB,sCAAiB,CAAA;IACjB,4CAAuB,CAAA;IACvB,8CAAyB,CAAA;AAC3B,CAAC,EAVW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAU5B;AAED;;GAEG;AACH,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,6CAA6B,CAAA;IAC7B,mDAAmC,CAAA;IACnC,sCAAsB,CAAA;AACxB,CAAC,EAJW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAIvB;AAED;;GAEG;AACH,IAAY,eA+GX;AA/GD,WAAY,eAAe;IACzB;;OAEG;IACH,oCAAiB,CAAA;IAEjB;;;;OAIG;IACH,8DAA2C,CAAA;IAE3C;;OAEG;IACH,wDAAqC,CAAA;IAErC;;OAEG;IACH,6CAA0B,CAAA;IAE1B;;OAEG;IACH,2EAAwD,CAAA;IAExD;;OAEG;IACH,wCAAqB,CAAA;IAErB;;OAEG;IACH,iDAA8B,CAAA;IAE9B;;;;;OAKG;IACH,kCAAe,CAAA;IAEf;;OAEG;IACH,4CAAyB,CAAA;IAEzB;;OAEG;IACH,oCAAiB,CAAA;IAEjB;;OAEG;IACH,sDAAmC,CAAA;IAEnC;;OAEG;IACH,kCAAe,CAAA;IAEf;;OAEG;IACH,gCAAa,CAAA;IAEb;;;;;OAKG;IACH,gDAA6B,CAAA;IAE7B;;;OAGG;IACH,iDAA8B,CAAA;IAE9B;;;;;OAKG;IACH,mEAAgD,CAAA;IAEhD;;;OAGG;IACH,mDAAgC,CAAA;IAEhC;;;;OAIG;IACH,2DAAwC,CAAA;IAExC;;;OAGG;IACH,qEAAkD,CAAA;AACpD,CAAC,EA/GW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QA+G1B","sourcesContent":["import type { Hex } from '@metamask/utils';\nimport type { Operation } from 'fast-json-patch';\n\n/**\n * Representation of transaction metadata.\n */\nexport type TransactionMeta =\n | ({\n status: Exclude<TransactionStatus, TransactionStatus.failed>;\n } & TransactionMetaBase)\n | ({ status: TransactionStatus.failed; error: Error } & TransactionMetaBase);\n\n/**\n * Information about a single transaction such as status and block number.\n */\ntype TransactionMetaBase = {\n /**\n * Unique ID to prevent duplicate requests.\n */\n actionId?: string;\n\n /**\n * Base fee of the block as a hex value, introduced in EIP-1559.\n */\n baseFeePerGas?: Hex;\n\n /**\n * Number of the block where the transaction has been included.\n */\n blockNumber?: string;\n\n /**\n * The timestamp for when the block was collated.\n */\n blockTimestamp?: string;\n\n /**\n * Network code as per EIP-155 for this transaction.\n */\n chainId: Hex;\n\n /**\n * Gas values provided by the dApp.\n */\n dappSuggestedGasFees?: DappSuggestedGasFees;\n\n /**\n * The default estimate for gas.\n */\n defaultGasEstimates?: string;\n\n /**\n * String to indicate what device the transaction was confirmed on.\n */\n deviceConfirmedOn?: WalletDevice;\n\n /**\n * The estimated base fee of the transaction.\n */\n estimatedBaseFee?: string;\n\n /**\n * Which estimate level that the API suggested.\n */\n estimateSuggested?: string;\n\n /**\n * Which estimate level was used\n */\n estimateUsed?: string;\n\n /**\n * A hex string of the transaction hash, used to identify the transaction on the network.\n */\n hash?: string;\n\n /**\n * A history of mutations to TransactionMeta.\n */\n history?: TransactionHistory;\n\n /**\n * Generated UUID associated with this transaction.\n */\n id: string;\n\n /**\n * Whether the transaction is a transfer.\n */\n isTransfer?: boolean;\n\n /**\n * Network code as per EIP-155 for this transaction\n *\n * @deprecated Use `chainId` instead.\n */\n readonly networkID?: string;\n\n /**\n * Origin this transaction was sent from.\n */\n origin?: string;\n\n /**\n * The original gas estimation of the transaction.\n */\n originalGasEstimate?: string;\n\n /**\n * The transaction's 'r' value as a hex string.\n */\n r?: string;\n\n /**\n * Hex representation of the underlying transaction.\n */\n rawTx?: string;\n\n /**\n * When the transaction is dropped, this is the replacement transaction hash.\n */\n replacedBy?: string;\n\n /**\n * When the transaction is dropped, this is the replacement transaction ID.\n */\n replacedById?: string;\n\n /**\n * The transaction's 's' value as a hex string.\n */\n s?: string;\n\n /**\n * Response from security validator.\n */\n securityAlertResponse?: Record<string, unknown>;\n\n /**\n * Response from security provider.\n */\n securityProviderResponse?: Record<string, any>;\n\n /**\n * An array of entries that describe the user's journey through the send flow.\n * This is purely attached to state logs for troubleshooting and support.\n */\n sendFlowHistory?: SendFlowHistoryEntry[];\n\n /**\n * The time the transaction was submitted to the network, in Unix epoch time (ms).\n */\n submittedTime?: number;\n\n /**\n * Timestamp associated with this transaction.\n */\n time: number;\n\n /**\n * Whether transaction recipient is a smart contract.\n */\n toSmartContract?: boolean;\n\n /**\n * Additional transfer information.\n */\n transferInformation?: {\n contractAddress: string;\n decimals: number;\n symbol: string;\n };\n\n /**\n * Underlying Transaction object.\n */\n txParams: TransactionParams;\n\n /**\n * Transaction receipt.\n */\n txReceipt?: TransactionReceipt;\n\n /**\n * The type of transaction such as `cancel` or `swap`.\n */\n type?: TransactionType;\n\n /**\n * The gas limit supplied by user.\n */\n userEditedGasLimit?: boolean;\n\n /**\n * Estimate level user selected.\n */\n userFeeLevel?: string;\n\n /**\n * The transaction's 'v' value as a hex string.\n */\n v?: string;\n\n /**\n * Whether the transaction is verified on the blockchain.\n */\n verifiedOnBlockchain?: boolean;\n};\n\nexport type SendFlowHistoryEntry = {\n /**\n * String to indicate user interaction information.\n */\n entry: string;\n\n /**\n * Timestamp associated with this entry.\n */\n timestamp: number;\n};\n\n/**\n * The status of the transaction. Each status represents the state of the transaction internally\n * in the wallet. Some of these correspond with the state of the transaction on the network, but\n * some are wallet-specific.\n */\nexport enum TransactionStatus {\n approved = 'approved',\n cancelled = 'cancelled',\n confirmed = 'confirmed',\n dropped = 'dropped',\n failed = 'failed',\n rejected = 'rejected',\n signed = 'signed',\n submitted = 'submitted',\n unapproved = 'unapproved',\n}\n\n/**\n * Options for wallet device.\n */\nexport enum WalletDevice {\n MM_MOBILE = 'metamask_mobile',\n MM_EXTENSION = 'metamask_extension',\n OTHER = 'other_device',\n}\n\n/**\n * The type of the transaction.\n */\nexport enum TransactionType {\n /**\n * A transaction sending a network's native asset to a recipient.\n */\n cancel = 'cancel',\n\n /**\n * A transaction that is interacting with a smart contract's methods that we\n * have not treated as a special case, such as approve, transfer, and\n * transferfrom.\n */\n contractInteraction = 'contractInteraction',\n\n /**\n * A transaction that deployed a smart contract.\n */\n deployContract = 'contractDeployment',\n\n /**\n * A transaction for Ethereum decryption.\n */\n ethDecrypt = 'eth_decrypt',\n\n /**\n * A transaction for getting an encryption public key.\n */\n ethGetEncryptionPublicKey = 'eth_getEncryptionPublicKey',\n\n /**\n * An incoming (deposit) transaction.\n */\n incoming = 'incoming',\n\n /**\n * A transaction for personal sign.\n */\n personalSign = 'personal_sign',\n\n /**\n * When a transaction is failed it can be retried by\n * resubmitting the same transaction with a higher gas fee. This type is also used\n * to speed up pending transactions. This is accomplished by creating a new tx with\n * the same nonce and higher gas fees.\n */\n retry = 'retry',\n\n /**\n * A transaction sending a network's native asset to a recipient.\n */\n simpleSend = 'simpleSend',\n\n /**\n * A transaction that is signing a message.\n */\n sign = 'eth_sign',\n\n /**\n * A transaction that is signing typed data.\n */\n signTypedData = 'eth_signTypedData',\n\n /**\n * A transaction sending a network's native asset to a recipient.\n */\n smart = 'smart',\n\n /**\n * A transaction swapping one token for another through MetaMask Swaps.\n */\n swap = 'swap',\n\n /**\n * Similar to the approve type, a swap approval is a special case of ERC20\n * approve method that requests an allowance of the token to spend on behalf\n * of the user for the MetaMask Swaps contract. The first swap for any token\n * will have an accompanying swapApproval transaction.\n */\n swapApproval = 'swapApproval',\n\n /**\n * A token transaction requesting an allowance of the token to spend on\n * behalf of the user.\n */\n tokenMethodApprove = 'approve',\n\n /**\n * A token transaction transferring tokens from an account that the sender\n * has an allowance of. The method is prefixed with safe because when calling\n * this method the contract checks to ensure that the receiver is an address\n * capable of handling the token being sent.\n */\n tokenMethodSafeTransferFrom = 'safetransferfrom',\n\n /**\n * A token transaction where the user is sending tokens that they own to\n * another address.\n */\n tokenMethodTransfer = 'transfer',\n\n /**\n * A token transaction transferring tokens from an account that the sender\n * has an allowance of. For more information on allowances, see the approve\n * type.\n */\n tokenMethodTransferFrom = 'transferfrom',\n\n /**\n * A token transaction requesting an allowance of all of a user's tokens to\n * spend on behalf of the user.\n */\n tokenMethodSetApprovalForAll = 'setapprovalforall',\n}\n\n/**\n * Standard data concerning a transaction to be processed by the blockchain.\n */\nexport interface TransactionParams {\n /**\n * Network ID as per EIP-155.\n */\n chainId?: Hex;\n\n /**\n * Data to pass with this transaction.\n */\n data?: string;\n\n /**\n * Error message for gas estimation failure.\n */\n estimateGasError?: string;\n\n /**\n * Estimated base fee for this transaction.\n */\n estimatedBaseFee?: string;\n\n /**\n * Address to send this transaction from.\n */\n from: string;\n\n /**\n * same as gasLimit?\n */\n gas?: string;\n\n /**\n * Maxmimum number of units of gas to use for this transaction.\n */\n gasLimit?: string;\n\n /**\n * Price per gas for legacy txs\n */\n gasPrice?: string;\n\n /**\n * Gas used in the transaction.\n */\n gasUsed?: string;\n\n /**\n * Maximum amount per gas to pay for the transaction, including the priority\n * fee.\n */\n maxFeePerGas?: string;\n\n /**\n * Maximum amount per gas to give to validator as incentive.\n */\n maxPriorityFeePerGas?: string;\n\n /**\n * Unique number to prevent replay attacks.\n */\n nonce?: string;\n\n /**\n * Address to send this transaction to.\n */\n to?: string;\n\n /**\n * Value associated with this transaction.\n */\n value?: string;\n\n /**\n * Type of transaction.\n * 0x0 indicates a legacy transaction.\n */\n type?: string;\n}\n\n/**\n * Standard data concerning a transaction processed by the blockchain.\n */\nexport interface TransactionReceipt {\n /**\n * The block hash of the block that this transaction was included in.\n */\n blockHash?: string;\n\n /**\n * The block number of the block that this transaction was included in.\n */\n blockNumber?: string;\n\n /**\n * Effective gas price the transaction was charged at.\n */\n effectiveGasPrice?: string;\n\n /**\n * Gas used in the transaction.\n */\n gasUsed?: string;\n\n /**\n * Total used gas in hex.\n */\n l1Fee?: string;\n\n /**\n * All the logs emitted by this transaction.\n */\n logs?: Log[];\n\n /**\n * The status of the transaction.\n */\n status?: string;\n\n /**\n * The index of this transaction in the list of transactions included in the block this transaction was mined in.\n */\n transactionIndex?: number;\n}\n\n/**\n * Represents an event that has been included in a transaction using the EVM `LOG` opcode.\n */\nexport interface Log {\n /**\n * Address of the contract that generated log.\n */\n address?: string;\n /**\n * List of topics for log.\n */\n topics?: string;\n}\n\n/**\n * The configuration required to fetch transaction data from a RemoteTransactionSource.\n */\nexport interface RemoteTransactionSourceRequest {\n /**\n * The address of the account to fetch transactions for.\n */\n address: string;\n\n /**\n * The chainId of the current network.\n */\n currentChainId: Hex;\n\n /**\n * Block number to start fetching transactions from.\n */\n fromBlock?: number;\n\n /**\n * Maximum number of transactions to retrieve.\n */\n limit?: number;\n}\n\n/**\n * An object capable of fetching transaction data from a remote source.\n * Used by the IncomingTransactionHelper to retrieve remote transaction data.\n */\nexport interface RemoteTransactionSource {\n /**\n * @param chainId - The chainId of the current network.\n * @returns Whether the remote transaction source supports the specified network.\n */\n isSupportedNetwork: (chainId: Hex) => boolean;\n\n /**\n * @returns An array of additional keys to use when caching the last fetched block number.\n */\n getLastBlockVariations?: () => string[];\n\n /**\n * @param request - A request object containing data such as the address and chain ID.\n * @returns An array of transaction metadata for the retrieved transactions.\n */\n fetchTransactions: (\n request: RemoteTransactionSourceRequest,\n ) => Promise<TransactionMeta[]>;\n}\n\n/**\n * Gas values initially suggested by the dApp.\n */\nexport interface DappSuggestedGasFees {\n gas?: string;\n gasPrice?: string;\n maxFeePerGas?: string;\n maxPriorityFeePerGas?: string;\n}\n\n/**\n * A transaction history operation that includes a note and timestamp.\n */\ntype ExtendedHistoryOperation = Operation & {\n note?: string;\n timestamp?: number;\n};\n\n/**\n * A transaction history entry that includes the ExtendedHistoryOperation as the first element.\n */\nexport type TransactionHistoryEntry = [\n ExtendedHistoryOperation,\n ...Operation[],\n];\n\n/**\n * A transaction history that includes the transaction meta as the first element.\n * And the rest of the elements are the operation arrays that were applied to the transaction meta.\n */\nexport type TransactionHistory = [\n TransactionMeta,\n ...TransactionHistoryEntry[],\n];\n\n/**\n * Result of inferring the transaction type.\n */\nexport type InferTransactionTypeResult = {\n /**\n * The contract code, in hex format if it exists. '0x0' or\n * '0x' are also indicators of non-existent contract code.\n */\n getCodeResponse?: string | null;\n\n /**\n * The type of transaction\n */\n type: TransactionType;\n};\n\n/**\n * A function for verifying a transaction, whether it is malicious or not\n */\nexport type SecurityProviderRequest = (\n requestData: TransactionMeta,\n messageType: string,\n) => Promise<any>;\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAyOA;;;;GAIG;AACH,IAAY,iBAUX;AAVD,WAAY,iBAAiB;IAC3B,0CAAqB,CAAA;IACrB,4CAAuB,CAAA;IACvB,4CAAuB,CAAA;IACvB,wCAAmB,CAAA;IACnB,sCAAiB,CAAA;IACjB,0CAAqB,CAAA;IACrB,sCAAiB,CAAA;IACjB,4CAAuB,CAAA;IACvB,8CAAyB,CAAA;AAC3B,CAAC,EAVW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAU5B;AAED;;GAEG;AACH,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,6CAA6B,CAAA;IAC7B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,oBAAY,QAIvB","sourcesContent":["import type { Hex } from '@metamask/utils';\nimport type { Operation } from 'fast-json-patch';\n\n/**\n * Representation of transaction metadata.\n */\nexport type TransactionMeta =\n | ({\n status: Exclude<TransactionStatus, TransactionStatus.failed>;\n } & TransactionMetaBase)\n | ({ status: TransactionStatus.failed; error: Error } & TransactionMetaBase);\n\n/**\n * Information about a single transaction such as status and block number.\n */\ntype TransactionMetaBase = {\n /**\n * Unique ID to prevent duplicate requests.\n */\n actionId?: string;\n\n /**\n * Base fee of the block as a hex value, introduced in EIP-1559.\n */\n baseFeePerGas?: Hex;\n\n /**\n * Number of the block where the transaction has been included.\n */\n blockNumber?: string;\n\n /**\n * The timestamp for when the block was collated.\n */\n blockTimestamp?: string;\n\n /**\n * Network code as per EIP-155 for this transaction.\n */\n chainId: Hex;\n\n /**\n * Gas values provided by the dApp.\n */\n dappSuggestedGasFees?: DappSuggestedGasFees;\n\n /**\n * The initial gas values set when the transaction was first created.\n */\n defaultGasEstimates?: DefaultGasEstimates;\n\n /**\n * String to indicate what device the transaction was confirmed on.\n */\n deviceConfirmedOn?: WalletDevice;\n\n /**\n * The estimated base fee of the transaction.\n */\n estimatedBaseFee?: string;\n\n /**\n * Which estimate level that the API suggested.\n */\n estimateSuggested?: string;\n\n /**\n * Which estimate level was used\n */\n estimateUsed?: string;\n\n /**\n * A hex string of the transaction hash, used to identify the transaction on the network.\n */\n hash?: string;\n\n /**\n * A history of mutations to TransactionMeta.\n */\n history?: TransactionHistory;\n\n /**\n * Generated UUID associated with this transaction.\n */\n id: string;\n\n /**\n * Whether the transaction is a transfer.\n */\n isTransfer?: boolean;\n\n /**\n * Network code as per EIP-155 for this transaction\n *\n * @deprecated Use `chainId` instead.\n */\n readonly networkID?: string;\n\n /**\n * Origin this transaction was sent from.\n */\n origin?: string;\n\n /**\n * The original gas estimation of the transaction.\n */\n originalGasEstimate?: string;\n\n /**\n * The transaction's 'r' value as a hex string.\n */\n r?: string;\n\n /**\n * Hex representation of the underlying transaction.\n */\n rawTx?: string;\n\n /**\n * When the transaction is dropped, this is the replacement transaction hash.\n */\n replacedBy?: string;\n\n /**\n * When the transaction is dropped, this is the replacement transaction ID.\n */\n replacedById?: string;\n\n /**\n * The transaction's 's' value as a hex string.\n */\n s?: string;\n\n /**\n * Response from security validator.\n */\n securityAlertResponse?: Record<string, unknown>;\n\n /**\n * Response from security provider.\n */\n securityProviderResponse?: Record<string, any>;\n\n /**\n * An array of entries that describe the user's journey through the send flow.\n * This is purely attached to state logs for troubleshooting and support.\n */\n sendFlowHistory?: SendFlowHistoryEntry[];\n\n /**\n * If the gas estimation fails, an object containing error and block information.\n */\n simulationFails?: {\n reason?: string;\n errorKey?: string;\n debug: {\n blockNumber?: string;\n blockGasLimit?: string;\n };\n };\n\n /**\n * The time the transaction was submitted to the network, in Unix epoch time (ms).\n */\n submittedTime?: number;\n\n /**\n * Timestamp associated with this transaction.\n */\n time: number;\n\n /**\n * Whether transaction recipient is a smart contract.\n */\n toSmartContract?: boolean;\n\n /**\n * Additional transfer information.\n */\n transferInformation?: {\n contractAddress: string;\n decimals: number;\n symbol: string;\n };\n\n /**\n * Underlying Transaction object.\n */\n txParams: TransactionParams;\n\n /**\n * Transaction receipt.\n */\n txReceipt?: TransactionReceipt;\n\n /**\n * The type of transaction such as `cancel` or `swap`.\n */\n type?: TransactionType;\n\n /**\n * The gas limit supplied by user.\n */\n userEditedGasLimit?: boolean;\n\n /**\n * Estimate level user selected.\n */\n userFeeLevel?: string;\n\n /**\n * The transaction's 'v' value as a hex string.\n */\n v?: string;\n\n /**\n * Whether the transaction is verified on the blockchain.\n */\n verifiedOnBlockchain?: boolean;\n};\n\nexport type SendFlowHistoryEntry = {\n /**\n * String to indicate user interaction information.\n */\n entry: string;\n\n /**\n * Timestamp associated with this entry.\n */\n timestamp: number;\n};\n\n/**\n * The status of the transaction. Each status represents the state of the transaction internally\n * in the wallet. Some of these correspond with the state of the transaction on the network, but\n * some are wallet-specific.\n */\nexport enum TransactionStatus {\n approved = 'approved',\n cancelled = 'cancelled',\n confirmed = 'confirmed',\n dropped = 'dropped',\n failed = 'failed',\n rejected = 'rejected',\n signed = 'signed',\n submitted = 'submitted',\n unapproved = 'unapproved',\n}\n\n/**\n * Options for wallet device.\n */\nexport enum WalletDevice {\n MM_MOBILE = 'metamask_mobile',\n MM_EXTENSION = 'metamask_extension',\n OTHER = 'other_device',\n}\n\n/**\n * The type of the transaction.\n */\nexport enum TransactionType {\n /**\n * A transaction sending a network's native asset to a recipient.\n */\n cancel = 'cancel',\n\n /**\n * A transaction that is interacting with a smart contract's methods that we\n * have not treated as a special case, such as approve, transfer, and\n * transferfrom.\n */\n contractInteraction = 'contractInteraction',\n\n /**\n * A transaction that deployed a smart contract.\n */\n deployContract = 'contractDeployment',\n\n /**\n * A transaction for Ethereum decryption.\n */\n ethDecrypt = 'eth_decrypt',\n\n /**\n * A transaction for getting an encryption public key.\n */\n ethGetEncryptionPublicKey = 'eth_getEncryptionPublicKey',\n\n /**\n * An incoming (deposit) transaction.\n */\n incoming = 'incoming',\n\n /**\n * A transaction for personal sign.\n */\n personalSign = 'personal_sign',\n\n /**\n * When a transaction is failed it can be retried by\n * resubmitting the same transaction with a higher gas fee. This type is also used\n * to speed up pending transactions. This is accomplished by creating a new tx with\n * the same nonce and higher gas fees.\n */\n retry = 'retry',\n\n /**\n * A transaction sending a network's native asset to a recipient.\n */\n simpleSend = 'simpleSend',\n\n /**\n * A transaction that is signing a message.\n */\n sign = 'eth_sign',\n\n /**\n * A transaction that is signing typed data.\n */\n signTypedData = 'eth_signTypedData',\n\n /**\n * A transaction sending a network's native asset to a recipient.\n */\n smart = 'smart',\n\n /**\n * A transaction swapping one token for another through MetaMask Swaps.\n */\n swap = 'swap',\n\n /**\n * Similar to the approve type, a swap approval is a special case of ERC20\n * approve method that requests an allowance of the token to spend on behalf\n * of the user for the MetaMask Swaps contract. The first swap for any token\n * will have an accompanying swapApproval transaction.\n */\n swapApproval = 'swapApproval',\n\n /**\n * A token transaction requesting an allowance of the token to spend on\n * behalf of the user.\n */\n tokenMethodApprove = 'approve',\n\n /**\n * A token transaction transferring tokens from an account that the sender\n * has an allowance of. The method is prefixed with safe because when calling\n * this method the contract checks to ensure that the receiver is an address\n * capable of handling the token being sent.\n */\n tokenMethodSafeTransferFrom = 'safetransferfrom',\n\n /**\n * A token transaction where the user is sending tokens that they own to\n * another address.\n */\n tokenMethodTransfer = 'transfer',\n\n /**\n * A token transaction transferring tokens from an account that the sender\n * has an allowance of. For more information on allowances, see the approve\n * type.\n */\n tokenMethodTransferFrom = 'transferfrom',\n\n /**\n * A token transaction requesting an allowance of all of a user's tokens to\n * spend on behalf of the user.\n */\n tokenMethodSetApprovalForAll = 'setapprovalforall',\n}\n\n/**\n * Standard data concerning a transaction to be processed by the blockchain.\n */\nexport interface TransactionParams {\n /**\n * Network ID as per EIP-155.\n */\n chainId?: Hex;\n\n /**\n * Data to pass with this transaction.\n */\n data?: string;\n\n /**\n * Error message for gas estimation failure.\n */\n estimateGasError?: string;\n\n /**\n * Estimated base fee for this transaction.\n */\n estimatedBaseFee?: string;\n\n /**\n * Address to send this transaction from.\n */\n from: string;\n\n /**\n * same as gasLimit?\n */\n gas?: string;\n\n /**\n * Maxmimum number of units of gas to use for this transaction.\n */\n gasLimit?: string;\n\n /**\n * Price per gas for legacy txs\n */\n gasPrice?: string;\n\n /**\n * Gas used in the transaction.\n */\n gasUsed?: string;\n\n /**\n * Maximum amount per gas to pay for the transaction, including the priority\n * fee.\n */\n maxFeePerGas?: string;\n\n /**\n * Maximum amount per gas to give to validator as incentive.\n */\n maxPriorityFeePerGas?: string;\n\n /**\n * Unique number to prevent replay attacks.\n */\n nonce?: string;\n\n /**\n * Address to send this transaction to.\n */\n to?: string;\n\n /**\n * Value associated with this transaction.\n */\n value?: string;\n\n /**\n * Type of transaction.\n * 0x0 indicates a legacy transaction.\n */\n type?: string;\n}\n\n/**\n * Standard data concerning a transaction processed by the blockchain.\n */\nexport interface TransactionReceipt {\n /**\n * The block hash of the block that this transaction was included in.\n */\n blockHash?: string;\n\n /**\n * The block number of the block that this transaction was included in.\n */\n blockNumber?: string;\n\n /**\n * Effective gas price the transaction was charged at.\n */\n effectiveGasPrice?: string;\n\n /**\n * Gas used in the transaction.\n */\n gasUsed?: string;\n\n /**\n * Total used gas in hex.\n */\n l1Fee?: string;\n\n /**\n * All the logs emitted by this transaction.\n */\n logs?: Log[];\n\n /**\n * The status of the transaction.\n */\n status?: string;\n\n /**\n * The index of this transaction in the list of transactions included in the block this transaction was mined in.\n */\n transactionIndex?: number;\n}\n\n/**\n * Represents an event that has been included in a transaction using the EVM `LOG` opcode.\n */\nexport interface Log {\n /**\n * Address of the contract that generated log.\n */\n address?: string;\n /**\n * List of topics for log.\n */\n topics?: string;\n}\n\n/**\n * The configuration required to fetch transaction data from a RemoteTransactionSource.\n */\nexport interface RemoteTransactionSourceRequest {\n /**\n * The address of the account to fetch transactions for.\n */\n address: string;\n\n /**\n * The chainId of the current network.\n */\n currentChainId: Hex;\n\n /**\n * Block number to start fetching transactions from.\n */\n fromBlock?: number;\n\n /**\n * Maximum number of transactions to retrieve.\n */\n limit?: number;\n}\n\n/**\n * An object capable of fetching transaction data from a remote source.\n * Used by the IncomingTransactionHelper to retrieve remote transaction data.\n */\nexport interface RemoteTransactionSource {\n /**\n * @param chainId - The chainId of the current network.\n * @returns Whether the remote transaction source supports the specified network.\n */\n isSupportedNetwork: (chainId: Hex) => boolean;\n\n /**\n * @returns An array of additional keys to use when caching the last fetched block number.\n */\n getLastBlockVariations?: () => string[];\n\n /**\n * @param request - A request object containing data such as the address and chain ID.\n * @returns An array of transaction metadata for the retrieved transactions.\n */\n fetchTransactions: (\n request: RemoteTransactionSourceRequest,\n ) => Promise<TransactionMeta[]>;\n}\n\n/**\n * Gas values initially suggested by the dApp.\n */\nexport interface DappSuggestedGasFees {\n gas?: string;\n gasPrice?: string;\n maxFeePerGas?: string;\n maxPriorityFeePerGas?: string;\n}\n\n/**\n * A transaction history operation that includes a note and timestamp.\n */\ntype ExtendedHistoryOperation = Operation & {\n note?: string;\n timestamp?: number;\n};\n\n/**\n * A transaction history entry that includes the ExtendedHistoryOperation as the first element.\n */\nexport type TransactionHistoryEntry = [\n ExtendedHistoryOperation,\n ...Operation[],\n];\n\n/**\n * A transaction history that includes the transaction meta as the first element.\n * And the rest of the elements are the operation arrays that were applied to the transaction meta.\n */\nexport type TransactionHistory = [\n TransactionMeta,\n ...TransactionHistoryEntry[],\n];\n\n/**\n * Result of inferring the transaction type.\n */\nexport type InferTransactionTypeResult = {\n /**\n * The contract code, in hex format if it exists. '0x0' or\n * '0x' are also indicators of non-existent contract code.\n */\n getCodeResponse?: string | null;\n\n /**\n * The type of transaction\n */\n type: TransactionType;\n};\n\n/**\n * A function for verifying a transaction, whether it is malicious or not\n */\nexport type SecurityProviderRequest = (\n requestData: TransactionMeta,\n messageType: string,\n) => Promise<any>;\n\n/**\n * Specifies the shape of the base transaction parameters.\n * Added in EIP-2718.\n */\nexport enum TransactionEnvelopeType {\n /**\n * A legacy transaction, the very first type.\n */\n legacy = '0x0',\n\n /**\n * EIP-2930 defined the access list transaction type that allowed for\n * specifying the state that a transaction would act upon in advance and\n * theoretically save on gas fees.\n */\n accessList = '0x1',\n\n /**\n * The type introduced comes from EIP-1559, Fee Market describes the addition\n * of a baseFee to blocks that will be burned instead of distributed to\n * miners. Transactions of this type have both a maxFeePerGas (maximum total\n * amount in gwei per gas to spend on the transaction) which is inclusive of\n * the maxPriorityFeePerGas (maximum amount of gwei per gas from the\n * transaction fee to distribute to miner).\n */\n feeMarket = '0x2',\n}\n\n/**\n * The source of the gas fee parameters on a transaction.\n */\nexport enum UserFeeLevel {\n CUSTOM = 'custom',\n DAPP_SUGGESTED = 'dappSuggested',\n MEDIUM = 'medium',\n}\n\n/**\n * Initial gas values set when the transaction was first created.\n */\nexport type DefaultGasEstimates = {\n /**\n * Source of the gas fee values, such as `dappSuggested` or `medium`.\n */\n estimateType?: string;\n\n /**\n * Maxmimum number of units of gas to use for this transaction.\n */\n gas?: string;\n\n /**\n * Price per gas for legacy transactions.\n */\n gasPrice?: string;\n\n /**\n * Maximum amount per gas to pay for the transaction, including the priority fee.\n */\n maxFeePerGas?: string;\n\n /**\n * Maximum amount per gas to give to validator as incentive.\n */\n maxPriorityFeePerGas?: string;\n};\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"etherscan.d.ts","sourceRoot":"","sources":["../../src/utils/etherscan.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAK3C,MAAM,WAAW,4BAA4B;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,gBAAgB,EAAE,MAAM,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,wBAAyB,SAAQ,4BAA4B;IAC5E,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,6BACf,SAAQ,4BAA4B;IACpC,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,4BAA4B,CAC3C,CAAC,SAAS,4BAA4B;IAEtC,MAAM,EAAE,GAAG,GAAG,GAAG,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,GAAG,CAAC,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,2BAA2B;IAC1C,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,GAAG,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;GASG;AACH,wBAAsB,0BAA0B,CAAC,EAC/C,OAAO,EACP,OAAO,EACP,SAAS,EACT,KAAK,GACN,EAAE,2BAA2B,GAAG,OAAO,CACtC,4BAA4B,CAAC,wBAAwB,CAAC,CACvD,CAOA;AAED;;;;;;;;;GASG;AACH,wBAAsB,+BAA+B,CAAC,EACpD,OAAO,EACP,OAAO,EACP,SAAS,EACT,KAAK,GACN,EAAE,2BAA2B,GAAG,OAAO,CACtC,4BAA4B,CAAC,6BAA6B,CAAC,CAC5D,CAOA"}
@@ -11,8 +11,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.fetchEtherscanTokenTransactions = exports.fetchEtherscanTransactions = void 0;
13
13
  const controller_utils_1 = require("@metamask/controller-utils");
14
- const constants_1 = require("./constants");
15
- const logger_1 = require("./logger");
14
+ const constants_1 = require("../constants");
15
+ const logger_1 = require("../logger");
16
16
  /**
17
17
  * Retrieves transaction data from Etherscan.
18
18
  *
@@ -95,8 +95,7 @@ function getEtherscanApiUrl(chainId, urlParams) {
95
95
  }
96
96
  const apiUrl = `https://${networkInfo.subdomain}.${networkInfo.domain}`;
97
97
  let url = `${apiUrl}/api?`;
98
- // eslint-disable-next-line guard-for-in
99
- for (const paramKey in urlParams) {
98
+ for (const paramKey of Object.keys(urlParams)) {
100
99
  const value = urlParams[paramKey];
101
100
  if (!value) {
102
101
  continue;
@@ -0,0 +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MG;AACH,SAAS,kBAAkB,CACzB,OAAY,EACZ,SAA6C;IAI7C,MAAM,WAAW,GAAG,wCAA4B,CAAC,OAA2B,CAAC,CAAC;IAE9E,IAAI,CAAC,WAAW,EAAE;QAChB,MAAM,IAAI,KAAK,CAAC,6CAA6C,OAAO,EAAE,CAAC,CAAC;KACzE;IAED,MAAM,MAAM,GAAG,WAAW,WAAW,CAAC,SAAS,IAAI,WAAW,CAAC,MAAM,EAAE,CAAC;IACxE,IAAI,GAAG,GAAG,GAAG,MAAM,OAAO,CAAC;IAE3B,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE;QAC7C,MAAM,KAAK,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;QAElC,IAAI,CAAC,KAAK,EAAE;YACV,SAAS;SACV;QAED,GAAG,IAAI,GAAG,QAAQ,IAAI,KAAK,GAAG,CAAC;KAChC;IAED,GAAG,IAAI,mBAAmB,CAAC;IAE3B,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["import { handleFetch } from '@metamask/controller-utils';\nimport type { Hex } from '@metamask/utils';\n\nimport { ETHERSCAN_SUPPORTED_NETWORKS } from '../constants';\nimport { incomingTransactionsLogger as log } from '../logger';\n\nexport interface EtherscanTransactionMetaBase {\n blockNumber: string;\n blockHash: string;\n confirmations: string;\n contractAddress: string;\n cumulativeGasUsed: string;\n from: string;\n gas: string;\n gasPrice: string;\n gasUsed: string;\n hash: string;\n nonce: string;\n timeStamp: string;\n to: string;\n transactionIndex: string;\n value: string;\n}\n\nexport interface EtherscanTransactionMeta extends EtherscanTransactionMetaBase {\n functionName: string;\n input: string;\n isError: string;\n methodId: string;\n txreceipt_status: string;\n}\n\nexport interface EtherscanTokenTransactionMeta\n extends EtherscanTransactionMetaBase {\n tokenDecimal: string;\n tokenName: string;\n tokenSymbol: string;\n}\n\nexport interface EtherscanTransactionResponse<\n T extends EtherscanTransactionMetaBase,\n> {\n status: '0' | '1';\n message?: string;\n result: string | T[];\n}\n\nexport interface EtherscanTransactionRequest {\n address: string;\n chainId: Hex;\n fromBlock?: number;\n limit?: number;\n}\n\n/**\n * Retrieves transaction data from Etherscan.\n *\n * @param request - Configuration required to fetch transactions.\n * @param request.address - Address to retrieve transactions for.\n * @param request.chainId - Current chain ID used to determine subdomain and domain.\n * @param request.fromBlock - Block number to start fetching transactions from.\n * @param request.limit - Number of transactions to retrieve.\n * @returns An Etherscan response object containing the request status and an array of token transaction data.\n */\nexport async function fetchEtherscanTransactions({\n address,\n chainId,\n fromBlock,\n limit,\n}: EtherscanTransactionRequest): Promise<\n EtherscanTransactionResponse<EtherscanTransactionMeta>\n> {\n return await fetchTransactions('txlist', {\n address,\n chainId,\n fromBlock,\n limit,\n });\n}\n\n/**\n * Retrieves token transaction data from Etherscan.\n *\n * @param request - Configuration required to fetch token transactions.\n * @param request.address - Address to retrieve token transactions for.\n * @param request.chainId - Current chain ID used to determine subdomain and domain.\n * @param request.fromBlock - Block number to start fetching token transactions from.\n * @param request.limit - Number of token transactions to retrieve.\n * @returns An Etherscan response object containing the request status and an array of token transaction data.\n */\nexport async function fetchEtherscanTokenTransactions({\n address,\n chainId,\n fromBlock,\n limit,\n}: EtherscanTransactionRequest): Promise<\n EtherscanTransactionResponse<EtherscanTokenTransactionMeta>\n> {\n return await fetchTransactions('tokentx', {\n address,\n chainId,\n fromBlock,\n limit,\n });\n}\n\n/**\n * Retrieves transaction data from Etherscan from a specific endpoint.\n *\n * @param action - The Etherscan endpoint to use.\n * @param options - Options bag.\n * @param options.address - Address to retrieve transactions for.\n * @param options.chainId - Current chain ID used to determine subdomain and domain.\n * @param options.fromBlock - Block number to start fetching transactions from.\n * @param options.limit - Number of transactions to retrieve.\n * @returns An object containing the request status and an array of transaction data.\n */\nasync function fetchTransactions<T extends EtherscanTransactionMetaBase>(\n action: string,\n {\n address,\n chainId,\n fromBlock,\n limit,\n }: {\n address: string;\n chainId: Hex;\n fromBlock?: number;\n limit?: number;\n },\n): Promise<EtherscanTransactionResponse<T>> {\n const urlParams = {\n module: 'account',\n address,\n startBlock: fromBlock?.toString(),\n offset: limit?.toString(),\n sort: 'desc',\n };\n\n const etherscanTxUrl = getEtherscanApiUrl(chainId, {\n ...urlParams,\n action,\n });\n\n log('Sending Etherscan request', etherscanTxUrl);\n\n const response = (await handleFetch(\n etherscanTxUrl,\n )) as EtherscanTransactionResponse<T>;\n\n return response;\n}\n\n/**\n * Return a URL that can be used to fetch data from Etherscan.\n *\n * @param chainId - Current chain ID used to determine subdomain and domain.\n * @param urlParams - The parameters used to construct the URL.\n * @returns URL to access Etherscan data.\n */\nfunction getEtherscanApiUrl(\n chainId: Hex,\n urlParams: Record<string, string | undefined>,\n): string {\n type SupportedChainId = keyof typeof ETHERSCAN_SUPPORTED_NETWORKS;\n\n const networkInfo = ETHERSCAN_SUPPORTED_NETWORKS[chainId as SupportedChainId];\n\n if (!networkInfo) {\n throw new Error(`Etherscan does not support chain with ID: ${chainId}`);\n }\n\n const apiUrl = `https://${networkInfo.subdomain}.${networkInfo.domain}`;\n let url = `${apiUrl}/api?`;\n\n for (const paramKey of Object.keys(urlParams)) {\n const value = urlParams[paramKey];\n\n if (!value) {\n continue;\n }\n\n url += `${paramKey}=${value}&`;\n }\n\n url += 'tag=latest&page=1';\n\n return url;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { TransactionMeta } from './types';
1
+ import type { TransactionMeta } from '../types';
2
2
  /**
3
3
  * Validates the external provided transaction meta.
4
4
  *
@@ -0,0 +1 @@
1
+ {"version":3,"file":"external-transactions.d.ts","sourceRoot":"","sources":["../../src/utils/external-transactions.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD;;;;;;GAMG;AACH,wBAAgB,oCAAoC,CAClD,eAAe,CAAC,EAAE,eAAe,EACjC,YAAY,CAAC,EAAE,eAAe,EAAE,EAChC,UAAU,CAAC,EAAE,eAAe,EAAE,QAoC/B"}
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.validateConfirmedExternalTransaction = void 0;
4
4
  // These utility functions are exclusively used by `confirmExternalTransaction` method in controller
5
5
  const rpc_errors_1 = require("@metamask/rpc-errors");
6
- const types_1 = require("./types");
6
+ const types_1 = require("../types");
7
7
  /**
8
8
  * Validates the external provided transaction meta.
9
9
  *
@@ -0,0 +1 @@
1
+ {"version":3,"file":"external-transactions.js","sourceRoot":"","sources":["../../src/utils/external-transactions.ts"],"names":[],"mappings":";;;AAAA,oGAAoG;AACpG,qDAAiD;AAEjD,oCAA6C;AAG7C;;;;;;GAMG;AACH,SAAgB,oCAAoC,CAClD,eAAiC,EACjC,YAAgC,EAChC,UAA8B;IAE9B,IAAI,CAAC,eAAe,IAAI,CAAC,eAAe,CAAC,QAAQ,EAAE;QACjD,MAAM,sBAAS,CAAC,aAAa,CAC3B,4DAA4D,CAC7D,CAAC;KACH;IAED,IAAI,eAAe,CAAC,MAAM,KAAK,yBAAiB,CAAC,SAAS,EAAE;QAC1D,MAAM,sBAAS,CAAC,aAAa,CAC3B,mDAAmD,CACpD,CAAC;KACH;IAED,MAAM,eAAe,GAAG,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC;IACvD,IAAI,UAAU,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;QACvC,MAAM,qBAAqB,GAAG,UAAU,CAAC,IAAI,CAC3C,CAAC,EAAE,EAAE,EAAE,WAAC,OAAA,CAAA,MAAA,EAAE,CAAC,QAAQ,0CAAE,KAAK,MAAK,eAAe,CAAA,EAAA,CAC/C,CAAC;QACF,IAAI,qBAAqB,EAAE;YACzB,MAAM,sBAAS,CAAC,aAAa,CAC3B,yDAAyD,CAC1D,CAAC;SACH;KACF;IAED,IAAI,YAAY,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE;QAC3C,MAAM,uBAAuB,GAAG,YAAY,CAAC,IAAI,CAC/C,CAAC,EAAE,EAAE,EAAE,WAAC,OAAA,CAAA,MAAA,EAAE,CAAC,QAAQ,0CAAE,KAAK,MAAK,eAAe,CAAA,EAAA,CAC/C,CAAC;QACF,IAAI,uBAAuB,EAAE;YAC3B,MAAM,sBAAS,CAAC,aAAa,CAC3B,2DAA2D,CAC5D,CAAC;SACH;KACF;AACH,CAAC;AAvCD,oFAuCC","sourcesContent":["// These utility functions are exclusively used by `confirmExternalTransaction` method in controller\nimport { rpcErrors } from '@metamask/rpc-errors';\n\nimport { TransactionStatus } from '../types';\nimport type { TransactionMeta } from '../types';\n\n/**\n * Validates the external provided transaction meta.\n *\n * @param transactionMeta - The transaction meta to validate.\n * @param confirmedTxs - The confirmed transactions in controller state.\n * @param pendingTxs - The submitted transactions in controller state.\n */\nexport function validateConfirmedExternalTransaction(\n transactionMeta?: TransactionMeta,\n confirmedTxs?: TransactionMeta[],\n pendingTxs?: TransactionMeta[],\n) {\n if (!transactionMeta || !transactionMeta.txParams) {\n throw rpcErrors.invalidParams(\n '\"transactionMeta\" or \"transactionMeta.txParams\" is missing',\n );\n }\n\n if (transactionMeta.status !== TransactionStatus.confirmed) {\n throw rpcErrors.invalidParams(\n 'External transaction status should be \"confirmed\"',\n );\n }\n\n const externalTxNonce = transactionMeta.txParams.nonce;\n if (pendingTxs && pendingTxs.length > 0) {\n const foundPendingTxByNonce = pendingTxs.find(\n (tx) => tx.txParams?.nonce === externalTxNonce,\n );\n if (foundPendingTxByNonce) {\n throw rpcErrors.invalidParams(\n 'External transaction nonce should not be in pending txs',\n );\n }\n }\n\n if (confirmedTxs && confirmedTxs.length > 0) {\n const foundConfirmedTxByNonce = confirmedTxs.find(\n (tx) => tx.txParams?.nonce === externalTxNonce,\n );\n if (foundConfirmedTxByNonce) {\n throw rpcErrors.invalidParams(\n 'External transaction nonce should not be in confirmed txs',\n );\n }\n }\n}\n"]}
@@ -0,0 +1,30 @@
1
+ import type EthQuery from '@metamask/eth-query';
2
+ import type { GasFeeState } from '@metamask/gas-fee-controller';
3
+ import type { TransactionParams } from '../types';
4
+ import { type TransactionMeta } from '../types';
5
+ export declare type UpdateGasFeesRequest = {
6
+ eip1559: boolean;
7
+ ethQuery: EthQuery;
8
+ getGasFeeEstimates: () => Promise<GasFeeState>;
9
+ txMeta: TransactionMeta;
10
+ };
11
+ export declare type GetGasFeeRequest = UpdateGasFeesRequest & {
12
+ initialParams: TransactionParams;
13
+ suggestedGasFees: Awaited<ReturnType<typeof getSuggestedGasFees>>;
14
+ };
15
+ export declare function updateGasFees(request: UpdateGasFeesRequest): Promise<void>;
16
+ declare function getSuggestedGasFees(request: UpdateGasFeesRequest): Promise<{
17
+ maxFeePerGas?: undefined;
18
+ maxPriorityFeePerGas?: undefined;
19
+ gasPrice?: undefined;
20
+ } | {
21
+ maxFeePerGas: `0x${string}`;
22
+ maxPriorityFeePerGas: `0x${string}`;
23
+ gasPrice?: undefined;
24
+ } | {
25
+ gasPrice: string | undefined;
26
+ maxFeePerGas?: undefined;
27
+ maxPriorityFeePerGas?: undefined;
28
+ }>;
29
+ export {};
30
+ //# sourceMappingURL=gas-fees.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gas-fees.d.ts","sourceRoot":"","sources":["../../src/utils/gas-fees.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAMhE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,EAAgB,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;AAE9D,oBAAY,oBAAoB,GAAG;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,QAAQ,CAAC;IACnB,kBAAkB,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,CAAC;IAC/C,MAAM,EAAE,eAAe,CAAC;CACzB,CAAC;AAEF,oBAAY,gBAAgB,GAAG,oBAAoB,GAAG;IACpD,aAAa,EAAE,iBAAiB,CAAC;IACjC,gBAAgB,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAAC;CACnE,CAAC;AAIF,wBAAsB,aAAa,CAAC,OAAO,EAAE,oBAAoB,iBAkChE;AAwJD,iBAAe,mBAAmB,CAAC,OAAO,EAAE,oBAAoB;;;;;;;;;;;;GAwD/D"}