@metamask/transaction-controller 9.2.0 → 11.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 (42) hide show
  1. package/CHANGELOG.md +37 -1
  2. package/dist/EtherscanRemoteTransactionSource.d.ts +2 -2
  3. package/dist/EtherscanRemoteTransactionSource.d.ts.map +1 -1
  4. package/dist/EtherscanRemoteTransactionSource.js +42 -19
  5. package/dist/EtherscanRemoteTransactionSource.js.map +1 -1
  6. package/dist/IncomingTransactionHelper.d.ts +4 -3
  7. package/dist/IncomingTransactionHelper.d.ts.map +1 -1
  8. package/dist/IncomingTransactionHelper.js +40 -25
  9. package/dist/IncomingTransactionHelper.js.map +1 -1
  10. package/dist/TransactionController.d.ts +114 -26
  11. package/dist/TransactionController.d.ts.map +1 -1
  12. package/dist/TransactionController.js +377 -120
  13. package/dist/TransactionController.js.map +1 -1
  14. package/dist/constants.d.ts +2 -0
  15. package/dist/constants.d.ts.map +1 -1
  16. package/dist/constants.js +26 -26
  17. package/dist/constants.js.map +1 -1
  18. package/dist/etherscan.d.ts +5 -6
  19. package/dist/etherscan.d.ts.map +1 -1
  20. package/dist/etherscan.js +7 -14
  21. package/dist/etherscan.js.map +1 -1
  22. package/dist/external-transactions.d.ts +10 -0
  23. package/dist/external-transactions.d.ts.map +1 -0
  24. package/dist/external-transactions.js +36 -0
  25. package/dist/external-transactions.js.map +1 -0
  26. package/dist/history.d.ts +15 -0
  27. package/dist/history.d.ts.map +1 -0
  28. package/dist/history.js +75 -0
  29. package/dist/history.js.map +1 -0
  30. package/dist/logger.d.ts +6 -0
  31. package/dist/logger.d.ts.map +1 -0
  32. package/dist/logger.js +8 -0
  33. package/dist/logger.js.map +1 -0
  34. package/dist/types.d.ts +129 -20
  35. package/dist/types.d.ts.map +1 -1
  36. package/dist/types.js +1 -0
  37. package/dist/types.js.map +1 -1
  38. package/dist/utils.d.ts +19 -10
  39. package/dist/utils.d.ts.map +1 -1
  40. package/dist/utils.js +49 -34
  41. package/dist/utils.js.map +1 -1
  42. package/package.json +5 -3
@@ -29,11 +29,12 @@ export interface EtherscanTokenTransactionMeta extends EtherscanTransactionMetaB
29
29
  tokenSymbol: string;
30
30
  }
31
31
  export interface EtherscanTransactionResponse<T extends EtherscanTransactionMetaBase> {
32
- result: T[];
32
+ status: '0' | '1';
33
+ message?: string;
34
+ result: string | T[];
33
35
  }
34
36
  export interface EtherscanTransactionRequest {
35
37
  address: string;
36
- apiKey?: string;
37
38
  chainId: Hex;
38
39
  fromBlock?: number;
39
40
  limit?: number;
@@ -43,23 +44,21 @@ export interface EtherscanTransactionRequest {
43
44
  *
44
45
  * @param request - Configuration required to fetch transactions.
45
46
  * @param request.address - Address to retrieve transactions for.
46
- * @param request.apiKey - Etherscan API key.
47
47
  * @param request.chainId - Current chain ID used to determine subdomain and domain.
48
48
  * @param request.fromBlock - Block number to start fetching transactions from.
49
49
  * @param request.limit - Number of transactions to retrieve.
50
50
  * @returns An Etherscan response object containing the request status and an array of token transaction data.
51
51
  */
52
- export declare function fetchEtherscanTransactions({ address, apiKey, chainId, fromBlock, limit, }: EtherscanTransactionRequest): Promise<EtherscanTransactionResponse<EtherscanTransactionMeta>>;
52
+ export declare function fetchEtherscanTransactions({ address, chainId, fromBlock, limit, }: EtherscanTransactionRequest): Promise<EtherscanTransactionResponse<EtherscanTransactionMeta>>;
53
53
  /**
54
54
  * Retrieves token transaction data from Etherscan.
55
55
  *
56
56
  * @param request - Configuration required to fetch token transactions.
57
57
  * @param request.address - Address to retrieve token transactions for.
58
- * @param request.apiKey - Etherscan API key.
59
58
  * @param request.chainId - Current chain ID used to determine subdomain and domain.
60
59
  * @param request.fromBlock - Block number to start fetching token transactions from.
61
60
  * @param request.limit - Number of token transactions to retrieve.
62
61
  * @returns An Etherscan response object containing the request status and an array of token transaction data.
63
62
  */
64
- export declare function fetchEtherscanTokenTransactions({ address, apiKey, chainId, fromBlock, limit, }: EtherscanTransactionRequest): Promise<EtherscanTransactionResponse<EtherscanTokenTransactionMeta>>;
63
+ export declare function fetchEtherscanTokenTransactions({ address, chainId, fromBlock, limit, }: EtherscanTransactionRequest): Promise<EtherscanTransactionResponse<EtherscanTokenTransactionMeta>>;
65
64
  //# sourceMappingURL=etherscan.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"etherscan.d.ts","sourceRoot":"","sources":["../src/etherscan.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAI3C,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,CAAC,EAAE,CAAC;C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AC5E,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"}
package/dist/etherscan.js CHANGED
@@ -12,22 +12,21 @@ 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
14
  const constants_1 = require("./constants");
15
+ const logger_1 = require("./logger");
15
16
  /**
16
17
  * Retrieves transaction data from Etherscan.
17
18
  *
18
19
  * @param request - Configuration required to fetch transactions.
19
20
  * @param request.address - Address to retrieve transactions for.
20
- * @param request.apiKey - Etherscan API key.
21
21
  * @param request.chainId - Current chain ID used to determine subdomain and domain.
22
22
  * @param request.fromBlock - Block number to start fetching transactions from.
23
23
  * @param request.limit - Number of transactions to retrieve.
24
24
  * @returns An Etherscan response object containing the request status and an array of token transaction data.
25
25
  */
26
- function fetchEtherscanTransactions({ address, apiKey, chainId, fromBlock, limit, }) {
26
+ function fetchEtherscanTransactions({ address, chainId, fromBlock, limit, }) {
27
27
  return __awaiter(this, void 0, void 0, function* () {
28
28
  return yield fetchTransactions('txlist', {
29
29
  address,
30
- apiKey,
31
30
  chainId,
32
31
  fromBlock,
33
32
  limit,
@@ -40,17 +39,15 @@ exports.fetchEtherscanTransactions = fetchEtherscanTransactions;
40
39
  *
41
40
  * @param request - Configuration required to fetch token transactions.
42
41
  * @param request.address - Address to retrieve token transactions for.
43
- * @param request.apiKey - Etherscan API key.
44
42
  * @param request.chainId - Current chain ID used to determine subdomain and domain.
45
43
  * @param request.fromBlock - Block number to start fetching token transactions from.
46
44
  * @param request.limit - Number of token transactions to retrieve.
47
45
  * @returns An Etherscan response object containing the request status and an array of token transaction data.
48
46
  */
49
- function fetchEtherscanTokenTransactions({ address, apiKey, chainId, fromBlock, limit, }) {
47
+ function fetchEtherscanTokenTransactions({ address, chainId, fromBlock, limit, }) {
50
48
  return __awaiter(this, void 0, void 0, function* () {
51
49
  return yield fetchTransactions('tokentx', {
52
50
  address,
53
- apiKey,
54
51
  chainId,
55
52
  fromBlock,
56
53
  limit,
@@ -64,28 +61,24 @@ exports.fetchEtherscanTokenTransactions = fetchEtherscanTokenTransactions;
64
61
  * @param action - The Etherscan endpoint to use.
65
62
  * @param options - Options bag.
66
63
  * @param options.address - Address to retrieve transactions for.
67
- * @param options.apiKey - Etherscan API key.
68
64
  * @param options.chainId - Current chain ID used to determine subdomain and domain.
69
65
  * @param options.fromBlock - Block number to start fetching transactions from.
70
66
  * @param options.limit - Number of transactions to retrieve.
71
67
  * @returns An object containing the request status and an array of transaction data.
72
68
  */
73
- function fetchTransactions(action, { address, apiKey, chainId, fromBlock, limit, }) {
69
+ function fetchTransactions(action, { address, chainId, fromBlock, limit, }) {
74
70
  return __awaiter(this, void 0, void 0, function* () {
75
71
  const urlParams = {
76
72
  module: 'account',
77
73
  address,
78
74
  startBlock: fromBlock === null || fromBlock === void 0 ? void 0 : fromBlock.toString(),
79
- apikey: apiKey,
80
75
  offset: limit === null || limit === void 0 ? void 0 : limit.toString(),
81
- order: 'desc',
76
+ sort: 'desc',
82
77
  };
83
78
  const etherscanTxUrl = getEtherscanApiUrl(chainId, Object.assign(Object.assign({}, urlParams), { action }));
79
+ (0, logger_1.incomingTransactionsLogger)('Sending Etherscan request', etherscanTxUrl);
84
80
  const response = (yield (0, controller_utils_1.handleFetch)(etherscanTxUrl));
85
- if (response.status === '0' && response.message === 'NOTOK') {
86
- throw new Error(`Etherscan request failed - ${response.result}`);
87
- }
88
- return { result: response.result };
81
+ return response;
89
82
  });
90
83
  }
91
84
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"etherscan.js","sourceRoot":"","sources":["../src/etherscan.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iEAAyD;AAGzD,2CAA2D;AAuD3D;;;;;;;;;;GAUG;AACH,SAAsB,0BAA0B,CAAC,EAC/C,OAAO,EACP,MAAM,EACN,OAAO,EACP,SAAS,EACT,KAAK,GACuB;;QAG5B,OAAO,MAAM,iBAAiB,CAAC,QAAQ,EAAE;YACvC,OAAO;YACP,MAAM;YACN,OAAO;YACP,SAAS;YACT,KAAK;SACN,CAAC,CAAC;IACL,CAAC;CAAA;AAhBD,gEAgBC;AAED;;;;;;;;;;GAUG;AACH,SAAsB,+BAA+B,CAAC,EACpD,OAAO,EACP,MAAM,EACN,OAAO,EACP,SAAS,EACT,KAAK,GACuB;;QAG5B,OAAO,MAAM,iBAAiB,CAAC,SAAS,EAAE;YACxC,O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C;IAE3B,wCAAwC;IACxC,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE;QAChC,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';\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 result: T[];\n}\n\nexport interface EtherscanTransactionRequest {\n address: string;\n apiKey?: string;\n chainId: Hex;\n fromBlock?: number;\n limit?: number;\n}\n\ninterface RawEtherscanResponse<T extends EtherscanTransactionMetaBase> {\n status: '0' | '1';\n message: string;\n result: string | T[];\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.apiKey - Etherscan API key.\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 apiKey,\n chainId,\n fromBlock,\n limit,\n}: EtherscanTransactionRequest): Promise<\n EtherscanTransactionResponse<EtherscanTransactionMeta>\n> {\n return await fetchTransactions('txlist', {\n address,\n apiKey,\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.apiKey - Etherscan API key.\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 apiKey,\n chainId,\n fromBlock,\n limit,\n}: EtherscanTransactionRequest): Promise<\n EtherscanTransactionResponse<EtherscanTokenTransactionMeta>\n> {\n return await fetchTransactions('tokentx', {\n address,\n apiKey,\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.apiKey - Etherscan API key.\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 apiKey,\n chainId,\n fromBlock,\n limit,\n }: {\n address: string;\n apiKey?: 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 apikey: apiKey,\n offset: limit?.toString(),\n order: 'desc',\n };\n\n const etherscanTxUrl = getEtherscanApiUrl(chainId, {\n ...urlParams,\n action,\n });\n\n const response = (await handleFetch(\n etherscanTxUrl,\n )) as RawEtherscanResponse<T>;\n\n if (response.status === '0' && response.message === 'NOTOK') {\n throw new Error(`Etherscan request failed - ${response.result}`);\n }\n\n return { result: response.result as T[] };\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 // eslint-disable-next-line guard-for-in\n for (const paramKey in 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
+ {"version":3,"file":"etherscan.js","sourceRoot":"","sources":["../src/etherscan.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iEAAyD;AAGzD,2CAA2D;AAC3D,qCAA6D;AAkD7D;;;;;;;;;GASG;AACH,SAAsB,0BAA0B,CAAC,EAC/C,OAAO,EACP,OAAO,EACP,SAAS,EACT,KAAK,GACuB;;QAG5B,OAAO,MAAM,iBAAiB,CAAC,QAAQ,EAAE;YACvC,OAAO;YACP,OAAO;YACP,SAAS;YACT,KAAK;SACN,CAAC,CAAC;IACL,CAAC;CAAA;AAdD,gEAcC;AAED;;;;;;;;;GASG;AACH,SAAsB,+BAA+B,CAAC,EACpD,OAAO,EACP,OAAO,EACP,SAAS,EACT,KAAK,GACuB;;QAG5B,OAAO,MAAM,iBAAiB,CAAC,SAAS,EAAE;YACxC,OAAO;YACP,OAAO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G,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 // eslint-disable-next-line guard-for-in\n for (const paramKey in 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"]}
@@ -0,0 +1,10 @@
1
+ import type { TransactionMeta } from './types';
2
+ /**
3
+ * Validates the external provided transaction meta.
4
+ *
5
+ * @param transactionMeta - The transaction meta to validate.
6
+ * @param confirmedTxs - The confirmed transactions in controller state.
7
+ * @param pendingTxs - The submitted transactions in controller state.
8
+ */
9
+ export declare function validateConfirmedExternalTransaction(transactionMeta?: TransactionMeta, confirmedTxs?: TransactionMeta[], pendingTxs?: TransactionMeta[]): void;
10
+ //# sourceMappingURL=external-transactions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"external-transactions.d.ts","sourceRoot":"","sources":["../src/external-transactions.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C;;;;;;GAMG;AACH,wBAAgB,oCAAoC,CAClD,eAAe,CAAC,EAAE,eAAe,EACjC,YAAY,CAAC,EAAE,eAAe,EAAE,EAChC,UAAU,CAAC,EAAE,eAAe,EAAE,QAoC/B"}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateConfirmedExternalTransaction = void 0;
4
+ // These utility functions are exclusively used by `confirmExternalTransaction` method in controller
5
+ const eth_rpc_errors_1 = require("eth-rpc-errors");
6
+ const types_1 = require("./types");
7
+ /**
8
+ * Validates the external provided transaction meta.
9
+ *
10
+ * @param transactionMeta - The transaction meta to validate.
11
+ * @param confirmedTxs - The confirmed transactions in controller state.
12
+ * @param pendingTxs - The submitted transactions in controller state.
13
+ */
14
+ function validateConfirmedExternalTransaction(transactionMeta, confirmedTxs, pendingTxs) {
15
+ if (!transactionMeta || !transactionMeta.txParams) {
16
+ throw eth_rpc_errors_1.ethErrors.rpc.invalidParams('"transactionMeta" or "transactionMeta.txParams" is missing');
17
+ }
18
+ if (transactionMeta.status !== types_1.TransactionStatus.confirmed) {
19
+ throw eth_rpc_errors_1.ethErrors.rpc.invalidParams('External transaction status should be "confirmed"');
20
+ }
21
+ const externalTxNonce = transactionMeta.txParams.nonce;
22
+ if (pendingTxs && pendingTxs.length > 0) {
23
+ const foundPendingTxByNonce = pendingTxs.find((tx) => { var _a; return ((_a = tx.txParams) === null || _a === void 0 ? void 0 : _a.nonce) === externalTxNonce; });
24
+ if (foundPendingTxByNonce) {
25
+ throw eth_rpc_errors_1.ethErrors.rpc.invalidParams('External transaction nonce should not be in pending txs');
26
+ }
27
+ }
28
+ if (confirmedTxs && confirmedTxs.length > 0) {
29
+ const foundConfirmedTxByNonce = confirmedTxs.find((tx) => { var _a; return ((_a = tx.txParams) === null || _a === void 0 ? void 0 : _a.nonce) === externalTxNonce; });
30
+ if (foundConfirmedTxByNonce) {
31
+ throw eth_rpc_errors_1.ethErrors.rpc.invalidParams('External transaction nonce should not be in confirmed txs');
32
+ }
33
+ }
34
+ }
35
+ exports.validateConfirmedExternalTransaction = validateConfirmedExternalTransaction;
36
+ //# sourceMappingURL=external-transactions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"external-transactions.js","sourceRoot":"","sources":["../src/external-transactions.ts"],"names":[],"mappings":";;;AAAA,oGAAoG;AACpG,mDAA2C;AAE3C,mCAA4C;AAG5C;;;;;;GAMG;AACH,SAAgB,oCAAoC,CAClD,eAAiC,EACjC,YAAgC,EAChC,UAA8B;IAE9B,IAAI,CAAC,eAAe,IAAI,CAAC,eAAe,CAAC,QAAQ,EAAE;QACjD,MAAM,0BAAS,CAAC,GAAG,CAAC,aAAa,CAC/B,4DAA4D,CAC7D,CAAC;KACH;IAED,IAAI,eAAe,CAAC,MAAM,KAAK,yBAAiB,CAAC,SAAS,EAAE;QAC1D,MAAM,0BAAS,CAAC,GAAG,CAAC,aAAa,CAC/B,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,0BAAS,CAAC,GAAG,CAAC,aAAa,CAC/B,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,0BAAS,CAAC,GAAG,CAAC,aAAa,CAC/B,2DAA2D,CAC5D,CAAC;SACH;KACF;AACH,CAAC;AAvCD,oFAuCC","sourcesContent":["// These utility functions are exclusively used by `confirmExternalTransaction` method in controller\nimport { ethErrors } from 'eth-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 ethErrors.rpc.invalidParams(\n '\"transactionMeta\" or \"transactionMeta.txParams\" is missing',\n );\n }\n\n if (transactionMeta.status !== TransactionStatus.confirmed) {\n throw ethErrors.rpc.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 ethErrors.rpc.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 ethErrors.rpc.invalidParams(\n 'External transaction nonce should not be in confirmed txs',\n );\n }\n }\n}\n"]}
@@ -0,0 +1,15 @@
1
+ import type { TransactionMeta } from './types';
2
+ /**
3
+ * Add initial history snapshot to the provided transactionMeta history.
4
+ *
5
+ * @param transactionMeta - TransactionMeta to add initial history snapshot to.
6
+ */
7
+ export declare function addInitialHistorySnapshot(transactionMeta: TransactionMeta): void;
8
+ /**
9
+ * Compares and adds history entry to the provided transactionMeta history.
10
+ *
11
+ * @param transactionMeta - TransactionMeta to add history entry to.
12
+ * @param note - Note to add to history entry.
13
+ */
14
+ export declare function updateTransactionHistory(transactionMeta: TransactionMeta, note: string): void;
15
+ //# sourceMappingURL=history.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../src/history.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAGV,eAAe,EAChB,MAAM,SAAS,CAAC;AAEjB;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,eAAe,EAAE,eAAe,QAGzE;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,eAAe,EAAE,eAAe,EAChC,IAAI,EAAE,MAAM,GACX,IAAI,CAWN"}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.updateTransactionHistory = exports.addInitialHistorySnapshot = void 0;
7
+ const fast_json_patch_1 = __importDefault(require("fast-json-patch"));
8
+ const lodash_1 = require("lodash");
9
+ /**
10
+ * Add initial history snapshot to the provided transactionMeta history.
11
+ *
12
+ * @param transactionMeta - TransactionMeta to add initial history snapshot to.
13
+ */
14
+ function addInitialHistorySnapshot(transactionMeta) {
15
+ const snapshot = snapshotFromTransactionMeta(transactionMeta);
16
+ transactionMeta.history = [snapshot];
17
+ }
18
+ exports.addInitialHistorySnapshot = addInitialHistorySnapshot;
19
+ /**
20
+ * Compares and adds history entry to the provided transactionMeta history.
21
+ *
22
+ * @param transactionMeta - TransactionMeta to add history entry to.
23
+ * @param note - Note to add to history entry.
24
+ */
25
+ function updateTransactionHistory(transactionMeta, note) {
26
+ var _a;
27
+ const currentState = snapshotFromTransactionMeta(transactionMeta);
28
+ const previousState = replayHistory(transactionMeta.history);
29
+ const historyEntry = generateHistoryEntry(previousState, currentState, note);
30
+ if (historyEntry.length) {
31
+ (_a = transactionMeta === null || transactionMeta === void 0 ? void 0 : transactionMeta.history) === null || _a === void 0 ? void 0 : _a.push(historyEntry);
32
+ }
33
+ }
34
+ exports.updateTransactionHistory = updateTransactionHistory;
35
+ /**
36
+ * Generates a history entry from the previous and new transaction metadata.
37
+ *
38
+ * @param previousState - The previous transaction metadata.
39
+ * @param currentState - The new transaction metadata.
40
+ * @param note - A note for the transaction metada update.
41
+ * @returns An array of history operation.
42
+ */
43
+ function generateHistoryEntry(previousState, currentState, note) {
44
+ const historyOperationsEntry = fast_json_patch_1.default.compare(previousState, currentState);
45
+ // Add a note to the first operation, since it breaks if we append it to the entry
46
+ if (historyOperationsEntry[0]) {
47
+ if (note) {
48
+ historyOperationsEntry[0].note = note;
49
+ }
50
+ historyOperationsEntry[0].timestamp = Date.now();
51
+ }
52
+ return historyOperationsEntry;
53
+ }
54
+ /**
55
+ * Recovers previous transactionMeta from passed history array.
56
+ *
57
+ * @param transactionHistory - The transaction metadata to replay.
58
+ * @returns The transaction metadata.
59
+ */
60
+ function replayHistory(transactionHistory) {
61
+ const shortHistory = (0, lodash_1.cloneDeep)(transactionHistory);
62
+ return shortHistory.reduce((val, entry) => fast_json_patch_1.default.applyPatch(val, entry).newDocument);
63
+ }
64
+ /**
65
+ * Clone the transaction meta data without the history property.
66
+ *
67
+ * @param transactionMeta - The transaction metadata to snapshot.
68
+ * @returns A deep clone of transaction metadata without history property.
69
+ */
70
+ function snapshotFromTransactionMeta(transactionMeta) {
71
+ const snapshot = Object.assign({}, transactionMeta);
72
+ delete snapshot.history;
73
+ return (0, lodash_1.cloneDeep)(snapshot);
74
+ }
75
+ //# sourceMappingURL=history.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"history.js","sourceRoot":"","sources":["../src/history.ts"],"names":[],"mappings":";;;;;;AAAA,sEAAyC;AACzC,mCAAmC;AAQnC;;;;GAIG;AACH,SAAgB,yBAAyB,CAAC,eAAgC;IACxE,MAAM,QAAQ,GAAG,2BAA2B,CAAC,eAAe,CAAC,CAAC;IAC9D,eAAe,CAAC,OAAO,GAAG,CAAC,QAAQ,CAAC,CAAC;AACvC,CAAC;AAHD,8DAGC;AAED;;;;;GAKG;AACH,SAAgB,wBAAwB,CACtC,eAAgC,EAChC,IAAY;;IAEZ,MAAM,YAAY,GAAG,2BAA2B,CAAC,eAAe,CAAC,CAAC;IAClE,MAAM,aAAa,GAAG,aAAa,CACjC,eAAe,CAAC,OAA6B,CAC9C,CAAC;IAEF,MAAM,YAAY,GAAG,oBAAoB,CAAC,aAAa,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;IAE7E,IAAI,YAAY,CAAC,MAAM,EAAE;QACvB,MAAA,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,OAAO,0CAAE,IAAI,CAAC,YAAY,CAAC,CAAC;KAC9C;AACH,CAAC;AAdD,4DAcC;AAED;;;;;;;GAOG;AACH,SAAS,oBAAoB,CAC3B,aAAkB,EAClB,YAA6B,EAC7B,IAAY;IAEZ,MAAM,sBAAsB,GAAG,yBAAU,CAAC,OAAO,CAC/C,aAAa,EACb,YAAY,CACc,CAAC;IAC7B,kFAAkF;IAClF,IAAI,sBAAsB,CAAC,CAAC,CAAC,EAAE;QAC7B,IAAI,IAAI,EAAE;YACR,sBAAsB,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC;SACvC;QACD,sBAAsB,CAAC,CAAC,CAAC,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;KAClD;IACD,OAAO,sBAAsB,CAAC;AAChC,CAAC;AAED;;;;;GAKG;AACH,SAAS,aAAa,CACpB,kBAAsC;IAEtC,MAAM,YAAY,GAAG,IAAA,kBAAS,EAAC,kBAAkB,CAAC,CAAC;IACnD,OAAO,YAAY,CAAC,MAAM,CACxB,CAAC,GAAG,EAAE,KAAU,EAAE,EAAE,CAAC,yBAAU,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,WAAW,CAChD,CAAC;AACvB,CAAC;AAED;;;;;GAKG;AACH,SAAS,2BAA2B,CAClC,eAAgC;IAEhC,MAAM,QAAQ,qBAAQ,eAAe,CAAE,CAAC;IACxC,OAAO,QAAQ,CAAC,OAAO,CAAC;IACxB,OAAO,IAAA,kBAAS,EAAC,QAAQ,CAAC,CAAC;AAC7B,CAAC","sourcesContent":["import jsonDiffer from 'fast-json-patch';\nimport { cloneDeep } from 'lodash';\n\nimport type {\n TransactionHistory,\n TransactionHistoryEntry,\n TransactionMeta,\n} from './types';\n\n/**\n * Add initial history snapshot to the provided transactionMeta history.\n *\n * @param transactionMeta - TransactionMeta to add initial history snapshot to.\n */\nexport function addInitialHistorySnapshot(transactionMeta: TransactionMeta) {\n const snapshot = snapshotFromTransactionMeta(transactionMeta);\n transactionMeta.history = [snapshot];\n}\n\n/**\n * Compares and adds history entry to the provided transactionMeta history.\n *\n * @param transactionMeta - TransactionMeta to add history entry to.\n * @param note - Note to add to history entry.\n */\nexport function updateTransactionHistory(\n transactionMeta: TransactionMeta,\n note: string,\n): void {\n const currentState = snapshotFromTransactionMeta(transactionMeta);\n const previousState = replayHistory(\n transactionMeta.history as TransactionHistory,\n );\n\n const historyEntry = generateHistoryEntry(previousState, currentState, note);\n\n if (historyEntry.length) {\n transactionMeta?.history?.push(historyEntry);\n }\n}\n\n/**\n * Generates a history entry from the previous and new transaction metadata.\n *\n * @param previousState - The previous transaction metadata.\n * @param currentState - The new transaction metadata.\n * @param note - A note for the transaction metada update.\n * @returns An array of history operation.\n */\nfunction generateHistoryEntry(\n previousState: any,\n currentState: TransactionMeta,\n note: string,\n): TransactionHistoryEntry {\n const historyOperationsEntry = jsonDiffer.compare(\n previousState,\n currentState,\n ) as TransactionHistoryEntry;\n // Add a note to the first operation, since it breaks if we append it to the entry\n if (historyOperationsEntry[0]) {\n if (note) {\n historyOperationsEntry[0].note = note;\n }\n historyOperationsEntry[0].timestamp = Date.now();\n }\n return historyOperationsEntry;\n}\n\n/**\n * Recovers previous transactionMeta from passed history array.\n *\n * @param transactionHistory - The transaction metadata to replay.\n * @returns The transaction metadata.\n */\nfunction replayHistory(\n transactionHistory: TransactionHistory,\n): TransactionMeta {\n const shortHistory = cloneDeep(transactionHistory);\n return shortHistory.reduce(\n (val, entry: any) => jsonDiffer.applyPatch(val, entry).newDocument,\n ) as TransactionMeta;\n}\n\n/**\n * Clone the transaction meta data without the history property.\n *\n * @param transactionMeta - The transaction metadata to snapshot.\n * @returns A deep clone of transaction metadata without history property.\n */\nfunction snapshotFromTransactionMeta(\n transactionMeta: TransactionMeta,\n): TransactionMeta {\n const snapshot = { ...transactionMeta };\n delete snapshot.history;\n return cloneDeep(snapshot);\n}\n"]}
@@ -0,0 +1,6 @@
1
+ /// <reference types="debug" />
2
+ import { createModuleLogger } from '@metamask/utils';
3
+ export declare const projectLogger: import("debug").Debugger;
4
+ export declare const incomingTransactionsLogger: import("debug").Debugger;
5
+ export { createModuleLogger };
6
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":";AAAA,OAAO,EAAuB,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1E,eAAO,MAAM,aAAa,0BAAgD,CAAC;AAE3E,eAAO,MAAM,0BAA0B,0BAGtC,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
package/dist/logger.js ADDED
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createModuleLogger = exports.incomingTransactionsLogger = exports.projectLogger = void 0;
4
+ const utils_1 = require("@metamask/utils");
5
+ Object.defineProperty(exports, "createModuleLogger", { enumerable: true, get: function () { return utils_1.createModuleLogger; } });
6
+ exports.projectLogger = (0, utils_1.createProjectLogger)('transaction-controller');
7
+ exports.incomingTransactionsLogger = (0, utils_1.createModuleLogger)(exports.projectLogger, 'incoming-transactions');
8
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":";;;AAAA,2CAA0E;AASjE,mGATqB,0BAAkB,OASrB;AAPd,QAAA,aAAa,GAAG,IAAA,2BAAmB,EAAC,wBAAwB,CAAC,CAAC;AAE9D,QAAA,0BAA0B,GAAG,IAAA,0BAAkB,EAC1D,qBAAa,EACb,uBAAuB,CACxB,CAAC","sourcesContent":["import { createProjectLogger, createModuleLogger } from '@metamask/utils';\n\nexport const projectLogger = createProjectLogger('transaction-controller');\n\nexport const incomingTransactionsLogger = createModuleLogger(\n projectLogger,\n 'incoming-transactions',\n);\n\nexport { createModuleLogger };\n"]}
package/dist/types.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { Hex } from '@metamask/utils';
2
+ import type { Operation } from 'fast-json-patch';
2
3
  /**
3
4
  * Representation of transaction metadata.
4
5
  */
@@ -12,6 +13,10 @@ export declare type TransactionMeta = ({
12
13
  * Information about a single transaction such as status and block number.
13
14
  */
14
15
  declare type TransactionMetaBase = {
16
+ /**
17
+ * Unique ID to prevent duplicate requests.
18
+ */
19
+ actionId?: string;
15
20
  /**
16
21
  * Base fee of the block as a hex value, introduced in EIP-1559.
17
22
  */
@@ -32,6 +37,10 @@ declare type TransactionMetaBase = {
32
37
  * Gas values provided by the dApp.
33
38
  */
34
39
  dappSuggestedGasFees?: DappSuggestedGasFees;
40
+ /**
41
+ * The default estimate for gas.
42
+ */
43
+ defaultGasEstimates?: string;
35
44
  /**
36
45
  * String to indicate what device the transaction was confirmed on.
37
46
  */
@@ -40,6 +49,22 @@ declare type TransactionMetaBase = {
40
49
  * The estimated base fee of the transaction.
41
50
  */
42
51
  estimatedBaseFee?: string;
52
+ /**
53
+ * Which estimate level that the API suggested.
54
+ */
55
+ estimateSuggested?: string;
56
+ /**
57
+ * Which estimate level was used
58
+ */
59
+ estimateUsed?: string;
60
+ /**
61
+ * A hex string of the transaction hash, used to identify the transaction on the network.
62
+ */
63
+ hash?: string;
64
+ /**
65
+ * A history of mutations to TransactionMeta.
66
+ */
67
+ history?: TransactionHistory;
43
68
  /**
44
69
  * Generated UUID associated with this transaction.
45
70
  */
@@ -56,26 +81,51 @@ declare type TransactionMetaBase = {
56
81
  * Origin this transaction was sent from.
57
82
  */
58
83
  origin?: string;
84
+ /**
85
+ * The original gas estimation of the transaction.
86
+ */
87
+ originalGasEstimate?: string;
88
+ /**
89
+ * The transaction's 'r' value as a hex string.
90
+ */
91
+ r?: string;
59
92
  /**
60
93
  * Hex representation of the underlying transaction.
61
94
  */
62
- rawTransaction?: string;
95
+ rawTx?: string;
63
96
  /**
64
- * Timestamp associated with this transaction.
97
+ * When the transaction is dropped, this is the replacement transaction hash.
65
98
  */
66
- time: number;
99
+ replacedBy?: string;
67
100
  /**
68
- * Whether transaction recipient is a smart contract.
101
+ * When the transaction is dropped, this is the replacement transaction ID.
69
102
  */
70
- toSmartContract?: boolean;
103
+ replacedById?: string;
71
104
  /**
72
- * Underlying Transaction object.
105
+ * The transaction's 's' value as a hex string.
106
+ */
107
+ s?: string;
108
+ /**
109
+ * Response from security validator.
110
+ */
111
+ securityAlertResponse?: Record<string, unknown>;
112
+ /**
113
+ * An array of entries that describe the user's journey through the send flow.
114
+ * This is purely attached to state logs for troubleshooting and support.
115
+ */
116
+ sendFlowHistory?: SendFlowHistoryEntry[];
117
+ /**
118
+ * The time the transaction was submitted to the network, in Unix epoch time (ms).
73
119
  */
74
- transaction: Transaction;
120
+ submittedTime?: number;
121
+ /**
122
+ * Timestamp associated with this transaction.
123
+ */
124
+ time: number;
75
125
  /**
76
- * Hash of a successful transaction.
126
+ * Whether transaction recipient is a smart contract.
77
127
  */
78
- transactionHash?: string;
128
+ toSmartContract?: boolean;
79
129
  /**
80
130
  * Additional transfer information.
81
131
  */
@@ -84,18 +134,40 @@ declare type TransactionMetaBase = {
84
134
  decimals: number;
85
135
  symbol: string;
86
136
  };
137
+ /**
138
+ * Underlying Transaction object.
139
+ */
140
+ txParams: TransactionParams;
87
141
  /**
88
142
  * Transaction receipt.
89
143
  */
90
144
  txReceipt?: TransactionReceipt;
145
+ /**
146
+ * The transaction's 'v' value as a hex string.
147
+ */
148
+ v?: string;
149
+ /**
150
+ * The gas limit supplied by user.
151
+ */
152
+ userEditedGasLimit?: boolean;
153
+ /**
154
+ * Estimate level user selected.
155
+ */
156
+ userFeeLevel?: string;
91
157
  /**
92
158
  * Whether the transaction is verified on the blockchain.
93
159
  */
94
160
  verifiedOnBlockchain?: boolean;
161
+ };
162
+ export declare type SendFlowHistoryEntry = {
95
163
  /**
96
- * Response from security validator.
164
+ * String to indicate user interaction information.
97
165
  */
98
- securityAlertResponse?: Record<string, unknown>;
166
+ entry: string;
167
+ /**
168
+ * Timestamp associated with this entry.
169
+ */
170
+ timestamp: number;
99
171
  };
100
172
  /**
101
173
  * The status of the transaction. Each status represents the state of the transaction internally
@@ -106,6 +178,7 @@ export declare enum TransactionStatus {
106
178
  approved = "approved",
107
179
  cancelled = "cancelled",
108
180
  confirmed = "confirmed",
181
+ dropped = "dropped",
109
182
  failed = "failed",
110
183
  rejected = "rejected",
111
184
  signed = "signed",
@@ -123,7 +196,7 @@ export declare enum WalletDevice {
123
196
  /**
124
197
  * Standard data concerning a transaction to be processed by the blockchain.
125
198
  */
126
- export interface Transaction {
199
+ export interface TransactionParams {
127
200
  /**
128
201
  * Network ID as per EIP-155.
129
202
  */
@@ -145,11 +218,15 @@ export interface Transaction {
145
218
  */
146
219
  from: string;
147
220
  /**
148
- * Gas to send with this transaction.
221
+ * same as gasLimit?
149
222
  */
150
223
  gas?: string;
151
224
  /**
152
- * Price of gas with this transaction.
225
+ * Maxmimum number of units of gas to use for this transaction.
226
+ */
227
+ gasLimit?: string;
228
+ /**
229
+ * Price per gas for legacy txs
153
230
  */
154
231
  gasPrice?: string;
155
232
  /**
@@ -157,11 +234,12 @@ export interface Transaction {
157
234
  */
158
235
  gasUsed?: string;
159
236
  /**
160
- * Maximum fee per gas for this transaction.
237
+ * Maximum amount per gas to pay for the transaction, including the priority
238
+ * fee.
161
239
  */
162
240
  maxFeePerGas?: string;
163
241
  /**
164
- * Maximum priority fee per gas for this transaction.
242
+ * Maximum amount per gas to give to validator as incentive.
165
243
  */
166
244
  maxPriorityFeePerGas?: string;
167
245
  /**
@@ -235,10 +313,6 @@ export interface RemoteTransactionSourceRequest {
235
313
  * The address of the account to fetch transactions for.
236
314
  */
237
315
  address: string;
238
- /**
239
- * API key if required by the remote source.
240
- */
241
- apiKey?: string;
242
316
  /**
243
317
  * The chainId of the current network.
244
318
  */
@@ -261,7 +335,20 @@ export interface RemoteTransactionSourceRequest {
261
335
  * Used by the IncomingTransactionHelper to retrieve remote transaction data.
262
336
  */
263
337
  export interface RemoteTransactionSource {
338
+ /**
339
+ * @param chainId - The chainId of the current network.
340
+ * @param networkId - The networkId of the current network.
341
+ * @returns Whether the remote transaction source supports the specified network.
342
+ */
264
343
  isSupportedNetwork: (chainId: Hex, networkId: string) => boolean;
344
+ /**
345
+ * @returns An array of additional keys to use when caching the last fetched block number.
346
+ */
347
+ getLastBlockVariations?: () => string[];
348
+ /**
349
+ * @param request - A request object containing data such as the address and chain ID.
350
+ * @returns An array of transaction metadata for the retrieved transactions.
351
+ */
265
352
  fetchTransactions: (request: RemoteTransactionSourceRequest) => Promise<TransactionMeta[]>;
266
353
  }
267
354
  /**
@@ -273,5 +360,27 @@ export interface DappSuggestedGasFees {
273
360
  maxFeePerGas?: string;
274
361
  maxPriorityFeePerGas?: string;
275
362
  }
363
+ /**
364
+ * A transaction history operation that includes a note and timestamp.
365
+ */
366
+ declare type ExtendedHistoryOperation = Operation & {
367
+ note?: string;
368
+ timestamp?: number;
369
+ };
370
+ /**
371
+ * A transaction history entry that includes the ExtendedHistoryOperation as the first element.
372
+ */
373
+ export declare type TransactionHistoryEntry = [
374
+ ExtendedHistoryOperation,
375
+ ...Operation[]
376
+ ];
377
+ /**
378
+ * A transaction history that includes the transaction meta as the first element.
379
+ * And the rest of the elements are the operation arrays that were applied to the transaction meta.
380
+ */
381
+ export declare type TransactionHistory = [
382
+ TransactionMeta,
383
+ ...TransactionHistoryEntry[]
384
+ ];
276
385
  export {};
277
386
  //# 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;AAE3C;;GAEG;AACH,oBAAY,eAAe,GACvB,CAAC;IACC,MAAM,EAAE,OAAO,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;CAC9D,GAAG,mBA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