@metamask/transaction-controller 45.1.0 → 47.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.
- package/CHANGELOG.md +45 -1
- package/dist/TransactionController.cjs +152 -43
- package/dist/TransactionController.cjs.map +1 -1
- package/dist/TransactionController.d.cts +88 -72
- package/dist/TransactionController.d.cts.map +1 -1
- package/dist/TransactionController.d.mts +88 -72
- package/dist/TransactionController.d.mts.map +1 -1
- package/dist/TransactionController.mjs +151 -42
- package/dist/TransactionController.mjs.map +1 -1
- package/dist/api/accounts-api.cjs +2 -0
- package/dist/api/accounts-api.cjs.map +1 -1
- package/dist/api/accounts-api.d.cts +2 -0
- package/dist/api/accounts-api.d.cts.map +1 -1
- package/dist/api/accounts-api.d.mts +2 -0
- package/dist/api/accounts-api.d.mts.map +1 -1
- package/dist/api/accounts-api.mjs +2 -0
- package/dist/api/accounts-api.mjs.map +1 -1
- package/dist/constants.cjs +20 -1
- package/dist/constants.cjs.map +1 -1
- package/dist/constants.d.cts +15 -0
- package/dist/constants.d.cts.map +1 -1
- package/dist/constants.d.mts +15 -0
- package/dist/constants.d.mts.map +1 -1
- package/dist/constants.mjs +19 -0
- package/dist/constants.mjs.map +1 -1
- package/dist/gas-flows/LineaGasFeeFlow.cjs +1 -1
- package/dist/gas-flows/LineaGasFeeFlow.cjs.map +1 -1
- package/dist/gas-flows/LineaGasFeeFlow.d.cts.map +1 -1
- package/dist/gas-flows/LineaGasFeeFlow.d.mts.map +1 -1
- package/dist/gas-flows/LineaGasFeeFlow.mjs +1 -1
- package/dist/gas-flows/LineaGasFeeFlow.mjs.map +1 -1
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.cjs +1 -1
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.cjs.map +1 -1
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.d.cts +1 -1
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.d.cts.map +1 -1
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.d.mts +1 -1
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.d.mts.map +1 -1
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.mjs +1 -1
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.mjs.map +1 -1
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.cjs +1 -1
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.cjs.map +1 -1
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.d.cts +1 -1
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.d.cts.map +1 -1
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.d.mts +1 -1
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.d.mts.map +1 -1
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.mjs +1 -1
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.mjs.map +1 -1
- package/dist/helpers/GasFeePoller.cjs +1 -0
- package/dist/helpers/GasFeePoller.cjs.map +1 -1
- package/dist/helpers/GasFeePoller.d.cts +1 -0
- package/dist/helpers/GasFeePoller.d.cts.map +1 -1
- package/dist/helpers/GasFeePoller.d.mts +1 -0
- package/dist/helpers/GasFeePoller.d.mts.map +1 -1
- package/dist/helpers/GasFeePoller.mjs +1 -0
- package/dist/helpers/GasFeePoller.mjs.map +1 -1
- package/dist/helpers/IncomingTransactionHelper.cjs.map +1 -1
- package/dist/helpers/IncomingTransactionHelper.d.cts.map +1 -1
- package/dist/helpers/IncomingTransactionHelper.d.mts.map +1 -1
- package/dist/helpers/IncomingTransactionHelper.mjs.map +1 -1
- package/dist/helpers/MethodDataHelper.cjs.map +1 -1
- package/dist/helpers/MethodDataHelper.d.cts.map +1 -1
- package/dist/helpers/MethodDataHelper.d.mts.map +1 -1
- package/dist/helpers/MethodDataHelper.mjs.map +1 -1
- package/dist/helpers/MultichainTrackingHelper.cjs +1 -21
- package/dist/helpers/MultichainTrackingHelper.cjs.map +1 -1
- package/dist/helpers/MultichainTrackingHelper.d.cts.map +1 -1
- package/dist/helpers/MultichainTrackingHelper.d.mts.map +1 -1
- package/dist/helpers/MultichainTrackingHelper.mjs +1 -21
- package/dist/helpers/MultichainTrackingHelper.mjs.map +1 -1
- package/dist/helpers/PendingTransactionTracker.cjs.map +1 -1
- package/dist/helpers/PendingTransactionTracker.d.cts.map +1 -1
- package/dist/helpers/PendingTransactionTracker.d.mts.map +1 -1
- package/dist/helpers/PendingTransactionTracker.mjs.map +1 -1
- package/dist/{utils/resimulate.cjs → helpers/ResimulateHelper.cjs} +93 -4
- package/dist/helpers/ResimulateHelper.cjs.map +1 -0
- package/dist/{utils/resimulate.d.cts → helpers/ResimulateHelper.d.cts} +13 -1
- package/dist/helpers/ResimulateHelper.d.cts.map +1 -0
- package/dist/{utils/resimulate.d.mts → helpers/ResimulateHelper.d.mts} +13 -1
- package/dist/helpers/ResimulateHelper.d.mts.map +1 -0
- package/dist/{utils/resimulate.mjs → helpers/ResimulateHelper.mjs} +93 -5
- package/dist/helpers/ResimulateHelper.mjs.map +1 -0
- package/dist/helpers/TransactionPoller.cjs +2 -0
- package/dist/helpers/TransactionPoller.cjs.map +1 -1
- package/dist/helpers/TransactionPoller.d.cts +2 -0
- package/dist/helpers/TransactionPoller.d.cts.map +1 -1
- package/dist/helpers/TransactionPoller.d.mts +2 -0
- package/dist/helpers/TransactionPoller.d.mts.map +1 -1
- package/dist/helpers/TransactionPoller.mjs +2 -0
- package/dist/helpers/TransactionPoller.mjs.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/types.cjs +5 -0
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +55 -0
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +55 -0
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs +5 -0
- package/dist/types.mjs.map +1 -1
- package/dist/utils/batch.cjs +89 -0
- package/dist/utils/batch.cjs.map +1 -0
- package/dist/utils/batch.d.cts +33 -0
- package/dist/utils/batch.d.cts.map +1 -0
- package/dist/utils/batch.d.mts +33 -0
- package/dist/utils/batch.d.mts.map +1 -0
- package/dist/utils/batch.mjs +84 -0
- package/dist/utils/batch.mjs.map +1 -0
- package/dist/utils/eip7702.cjs +84 -2
- package/dist/utils/eip7702.cjs.map +1 -1
- package/dist/utils/eip7702.d.cts +35 -10
- package/dist/utils/eip7702.d.cts.map +1 -1
- package/dist/utils/eip7702.d.mts +35 -10
- package/dist/utils/eip7702.d.mts.map +1 -1
- package/dist/utils/eip7702.mjs +82 -3
- package/dist/utils/eip7702.mjs.map +1 -1
- package/dist/utils/feature-flags.cjs +53 -0
- package/dist/utils/feature-flags.cjs.map +1 -0
- package/dist/utils/feature-flags.d.cts +39 -0
- package/dist/utils/feature-flags.d.cts.map +1 -0
- package/dist/utils/feature-flags.d.mts +39 -0
- package/dist/utils/feature-flags.d.mts.map +1 -0
- package/dist/utils/feature-flags.mjs +47 -0
- package/dist/utils/feature-flags.mjs.map +1 -0
- package/dist/utils/gas-fees.cjs +48 -3
- package/dist/utils/gas-fees.cjs.map +1 -1
- package/dist/utils/gas-fees.d.cts +11 -0
- package/dist/utils/gas-fees.d.cts.map +1 -1
- package/dist/utils/gas-fees.d.mts +11 -0
- package/dist/utils/gas-fees.d.mts.map +1 -1
- package/dist/utils/gas-fees.mjs +48 -3
- package/dist/utils/gas-fees.mjs.map +1 -1
- package/dist/utils/gas-flow.cjs +4 -0
- package/dist/utils/gas-flow.cjs.map +1 -1
- package/dist/utils/gas-flow.d.cts +1 -0
- package/dist/utils/gas-flow.d.cts.map +1 -1
- package/dist/utils/gas-flow.d.mts +1 -0
- package/dist/utils/gas-flow.d.mts.map +1 -1
- package/dist/utils/gas-flow.mjs +4 -0
- package/dist/utils/gas-flow.mjs.map +1 -1
- package/dist/utils/gas.cjs +50 -1
- package/dist/utils/gas.cjs.map +1 -1
- package/dist/utils/gas.d.cts +22 -0
- package/dist/utils/gas.d.cts.map +1 -1
- package/dist/utils/gas.d.mts +22 -0
- package/dist/utils/gas.d.mts.map +1 -1
- package/dist/utils/gas.mjs +50 -1
- package/dist/utils/gas.mjs.map +1 -1
- package/dist/utils/layer1-gas-fee-flow.cjs +5 -1
- package/dist/utils/layer1-gas-fee-flow.cjs.map +1 -1
- package/dist/utils/layer1-gas-fee-flow.d.cts +4 -1
- package/dist/utils/layer1-gas-fee-flow.d.cts.map +1 -1
- package/dist/utils/layer1-gas-fee-flow.d.mts +4 -1
- package/dist/utils/layer1-gas-fee-flow.d.mts.map +1 -1
- package/dist/utils/layer1-gas-fee-flow.mjs +5 -1
- package/dist/utils/layer1-gas-fee-flow.mjs.map +1 -1
- package/dist/utils/retry.cjs +4 -0
- package/dist/utils/retry.cjs.map +1 -1
- package/dist/utils/retry.d.cts +1 -0
- package/dist/utils/retry.d.cts.map +1 -1
- package/dist/utils/retry.d.mts +1 -0
- package/dist/utils/retry.d.mts.map +1 -1
- package/dist/utils/retry.mjs +4 -0
- package/dist/utils/retry.mjs.map +1 -1
- package/dist/utils/simulation-api.cjs +6 -0
- package/dist/utils/simulation-api.cjs.map +1 -1
- package/dist/utils/simulation-api.d.cts +2 -0
- package/dist/utils/simulation-api.d.cts.map +1 -1
- package/dist/utils/simulation-api.d.mts +2 -0
- package/dist/utils/simulation-api.d.mts.map +1 -1
- package/dist/utils/simulation-api.mjs +6 -0
- package/dist/utils/simulation-api.mjs.map +1 -1
- package/dist/utils/simulation.cjs +19 -5
- package/dist/utils/simulation.cjs.map +1 -1
- package/dist/utils/simulation.d.cts +3 -1
- package/dist/utils/simulation.d.cts.map +1 -1
- package/dist/utils/simulation.d.mts +3 -1
- package/dist/utils/simulation.d.mts.map +1 -1
- package/dist/utils/simulation.mjs +19 -5
- package/dist/utils/simulation.mjs.map +1 -1
- package/dist/utils/swaps.cjs +2 -1
- package/dist/utils/swaps.cjs.map +1 -1
- package/dist/utils/swaps.d.cts +1 -0
- package/dist/utils/swaps.d.cts.map +1 -1
- package/dist/utils/swaps.d.mts +1 -0
- package/dist/utils/swaps.d.mts.map +1 -1
- package/dist/utils/swaps.mjs +2 -1
- package/dist/utils/swaps.mjs.map +1 -1
- package/dist/utils/transaction-type.cjs +3 -1
- package/dist/utils/transaction-type.cjs.map +1 -1
- package/dist/utils/transaction-type.mjs +3 -1
- package/dist/utils/transaction-type.mjs.map +1 -1
- package/dist/utils/validation.cjs +34 -5
- package/dist/utils/validation.cjs.map +1 -1
- package/dist/utils/validation.d.cts +19 -3
- package/dist/utils/validation.d.cts.map +1 -1
- package/dist/utils/validation.d.mts +19 -3
- package/dist/utils/validation.d.mts.map +1 -1
- package/dist/utils/validation.mjs +33 -5
- package/dist/utils/validation.mjs.map +1 -1
- package/package.json +7 -5
- package/dist/utils/resimulate.cjs.map +0 -1
- package/dist/utils/resimulate.d.cts.map +0 -1
- package/dist/utils/resimulate.d.mts.map +0 -1
- package/dist/utils/resimulate.mjs.map +0 -1
|
@@ -22,6 +22,7 @@ const SUPPORTED_CHAIN_IDS_FOR_RELATIONSHIP_API = [
|
|
|
22
22
|
const log = (0, utils_1.createModuleLogger)(logger_1.projectLogger, 'accounts-api');
|
|
23
23
|
/**
|
|
24
24
|
* Fetch account address relationship from the accounts API.
|
|
25
|
+
*
|
|
25
26
|
* @param request - The request object.
|
|
26
27
|
* @returns The raw response object from the API.
|
|
27
28
|
*/
|
|
@@ -53,6 +54,7 @@ async function getAccountAddressRelationship(request) {
|
|
|
53
54
|
exports.getAccountAddressRelationship = getAccountAddressRelationship;
|
|
54
55
|
/**
|
|
55
56
|
* Fetch account transactions from the accounts API.
|
|
57
|
+
*
|
|
56
58
|
* @param request - The request object.
|
|
57
59
|
* @returns The response object.
|
|
58
60
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounts-api.cjs","sourceRoot":"","sources":["../../src/api/accounts-api.ts"],"names":[],"m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QACnC,MAAM,CAAC,IAAI,CAAC,YAAY,OAAO,EAAE,CAAC,CAAC;KACpC;IAED,IAAI,cAAc,EAAE;QAClB,MAAM,CAAC,IAAI,CAAC,kBAAkB,cAAc,EAAE,CAAC,CAAC;KACjD;IAED,IAAI,YAAY,EAAE;QAChB,MAAM,CAAC,IAAI,CAAC,gBAAgB,YAAY,EAAE,CAAC,CAAC;KAC7C;IAED,IAAI,MAAM,EAAE;QACV,MAAM,CAAC,IAAI,CAAC,UAAU,MAAM,EAAE,CAAC,CAAC;KACjC;IAED,IAAI,aAAa,EAAE;QACjB,MAAM,CAAC,IAAI,CAAC,iBAAiB,aAAa,EAAE,CAAC,CAAC;KAC/C;IAED,IAAI,MAAM,CAAC,MAAM,EAAE;QACjB,GAAG,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;KAC/B;IAED,GAAG,CAAC,8BAA8B,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC;IAEtD,MAAM,OAAO,GAAG;QACd,CAAC,aAAa,CAAC,EAAE,SAAS;KAC3B,CAAC;IAEF,MAAM,QAAQ,GAAG,MAAM,IAAA,kCAAe,EAAC,GAAG,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IACzD,MAAM,YAAY,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IAE3C,GAAG,CAAC,gCAAgC,EAAE,YAAY,CAAC,CAAC;IAEpD,OAAO,YAAY,CAAC;AACtB,CAAC;AApDD,wDAoDC","sourcesContent":["import { successfulFetch } from '@metamask/controller-utils';\nimport type { Hex } from '@metamask/utils';\nimport { createModuleLogger } from '@metamask/utils';\n\nimport { FirstTimeInteractionError } from '../errors';\nimport { projectLogger } from '../logger';\n\nexport type AccountAddressRelationshipResponse = {\n chainId?: number;\n count?: number;\n data?: {\n hash: string;\n timestamp: string;\n chainId: number;\n blockNumber: string;\n blockHash: string;\n gas: number;\n gasUsed: number;\n gasPrice: string;\n effectiveGasPrice: number;\n nonce: number;\n cumulativeGasUsed: number;\n methodId: string;\n value: string;\n to: string;\n from: string;\n };\n txHash?: string;\n};\n\nexport type AccountAddressRelationshipResult =\n AccountAddressRelationshipResponse & {\n error?: {\n code: string;\n message: string;\n };\n };\n\nexport type GetAccountAddressRelationshipRequest = {\n /** Chain ID of account relationship to check. */\n chainId: number;\n\n /** Recipient of the transaction. */\n to: string;\n\n /** Sender of the transaction. */\n from: string;\n};\n\nexport type TransactionResponse = {\n hash: Hex;\n timestamp: string;\n chainId: number;\n blockNumber: number;\n blockHash: Hex;\n gas: number;\n gasUsed: number;\n gasPrice: string;\n effectiveGasPrice: string;\n nonce: number;\n cumulativeGasUsed: number;\n methodId: null;\n value: string;\n to: string;\n from: string;\n isError: boolean;\n valueTransfers: {\n contractAddress: string;\n decimal: number;\n symbol: string;\n from: string;\n to: string;\n amount: string;\n }[];\n};\n\nexport type GetAccountTransactionsRequest = {\n address: Hex;\n chainIds?: Hex[];\n cursor?: string;\n endTimestamp?: number;\n sortDirection?: 'ASC' | 'DESC';\n startTimestamp?: number;\n};\n\nexport type GetAccountTransactionsResponse = {\n data: TransactionResponse[];\n pageInfo: {\n count: number;\n hasNextPage: boolean;\n cursor?: string;\n };\n};\n\nconst BASE_URL = `https://accounts.api.cx.metamask.io`;\nconst BASE_URL_ACCOUNTS = `${BASE_URL}/v1/accounts/`;\nconst CLIENT_HEADER = 'x-metamask-clientproduct';\nconst CLIENT_ID = 'metamask-transaction-controller';\n\nconst SUPPORTED_CHAIN_IDS_FOR_RELATIONSHIP_API = [\n 1, // Ethereum Mainnet\n 10, // Optimism\n 56, // BSC\n 137, // Polygon\n 8453, // Base\n 42161, // Arbitrum\n 59144, // Linea\n 534352, // Scroll\n];\n\nconst log = createModuleLogger(projectLogger, 'accounts-api');\n\n/**\n * Fetch account address relationship from the accounts API.\n *\n * @param request - The request object.\n * @returns The raw response object from the API.\n */\nexport async function getAccountAddressRelationship(\n request: GetAccountAddressRelationshipRequest,\n): Promise<AccountAddressRelationshipResult> {\n const { chainId, from, to } = request;\n\n if (!SUPPORTED_CHAIN_IDS_FOR_RELATIONSHIP_API.includes(chainId)) {\n log('Unsupported chain ID for account relationship API', chainId);\n throw new FirstTimeInteractionError('Unsupported chain ID');\n }\n\n const url = `${BASE_URL}/v1/networks/${chainId}/accounts/${from}/relationships/${to}`;\n\n log('Getting account address relationship', { request, url });\n\n const headers = {\n [CLIENT_HEADER]: CLIENT_ID,\n };\n\n const response = await successfulFetch(url, { headers });\n\n if (response.status === 204) {\n // The accounts API returns a 204 status code when there are no transactions with empty body\n // imitating a count of 0\n return { count: 0 };\n }\n\n const responseJson: AccountAddressRelationshipResult = await response.json();\n\n log('Retrieved account address relationship', responseJson);\n\n if (responseJson.error) {\n const { code, message } = responseJson.error;\n throw new FirstTimeInteractionError(message, code);\n }\n\n return responseJson;\n}\n\n/**\n * Fetch account transactions from the accounts API.\n *\n * @param request - The request object.\n * @returns The response object.\n */\nexport async function getAccountTransactions(\n request: GetAccountTransactionsRequest,\n): Promise<GetAccountTransactionsResponse> {\n const {\n address,\n chainIds,\n cursor,\n endTimestamp,\n sortDirection,\n startTimestamp,\n } = request;\n\n let url = `${BASE_URL_ACCOUNTS}${address}/transactions`;\n const params = [];\n\n if (chainIds) {\n const network = chainIds.join(',');\n params.push(`networks=${network}`);\n }\n\n if (startTimestamp) {\n params.push(`startTimestamp=${startTimestamp}`);\n }\n\n if (endTimestamp) {\n params.push(`endTimestamp=${endTimestamp}`);\n }\n\n if (cursor) {\n params.push(`cursor=${cursor}`);\n }\n\n if (sortDirection) {\n params.push(`sortDirection=${sortDirection}`);\n }\n\n if (params.length) {\n url += `?${params.join('&')}`;\n }\n\n log('Getting account transactions', { request, url });\n\n const headers = {\n [CLIENT_HEADER]: CLIENT_ID,\n };\n\n const response = await successfulFetch(url, { headers });\n const responseJson = await response.json();\n\n log('Retrieved account transactions', responseJson);\n\n return responseJson;\n}\n"]}
|
|
@@ -79,12 +79,14 @@ export type GetAccountTransactionsResponse = {
|
|
|
79
79
|
};
|
|
80
80
|
/**
|
|
81
81
|
* Fetch account address relationship from the accounts API.
|
|
82
|
+
*
|
|
82
83
|
* @param request - The request object.
|
|
83
84
|
* @returns The raw response object from the API.
|
|
84
85
|
*/
|
|
85
86
|
export declare function getAccountAddressRelationship(request: GetAccountAddressRelationshipRequest): Promise<AccountAddressRelationshipResult>;
|
|
86
87
|
/**
|
|
87
88
|
* Fetch account transactions from the accounts API.
|
|
89
|
+
*
|
|
88
90
|
* @param request - The request object.
|
|
89
91
|
* @returns The response object.
|
|
90
92
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounts-api.d.cts","sourceRoot":"","sources":["../../src/api/accounts-api.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,wBAAwB;AAM3C,MAAM,MAAM,kCAAkC,GAAG;IAC/C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,EAAE,MAAM,CAAC;QAClB,GAAG,EAAE,MAAM,CAAC;QACZ,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,KAAK,EAAE,MAAM,CAAC;QACd,iBAAiB,EAAE,MAAM,CAAC;QAC1B,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,gCAAgC,GAC1C,kCAAkC,GAAG;IACnC,KAAK,CAAC,EA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EAAE;QACR,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,OAAO,CAAC;QACrB,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;CACH,CAAC;AAoBF;;;;;GAKG;AACH,wBAAsB,6BAA6B,CACjD,OAAO,EAAE,oCAAoC,GAC5C,OAAO,CAAC,gCAAgC,CAAC,CAkC3C;AAED;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,6BAA6B,GACrC,OAAO,CAAC,8BAA8B,CAAC,CAkDzC"}
|
|
@@ -79,12 +79,14 @@ export type GetAccountTransactionsResponse = {
|
|
|
79
79
|
};
|
|
80
80
|
/**
|
|
81
81
|
* Fetch account address relationship from the accounts API.
|
|
82
|
+
*
|
|
82
83
|
* @param request - The request object.
|
|
83
84
|
* @returns The raw response object from the API.
|
|
84
85
|
*/
|
|
85
86
|
export declare function getAccountAddressRelationship(request: GetAccountAddressRelationshipRequest): Promise<AccountAddressRelationshipResult>;
|
|
86
87
|
/**
|
|
87
88
|
* Fetch account transactions from the accounts API.
|
|
89
|
+
*
|
|
88
90
|
* @param request - The request object.
|
|
89
91
|
* @returns The response object.
|
|
90
92
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounts-api.d.mts","sourceRoot":"","sources":["../../src/api/accounts-api.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,wBAAwB;AAM3C,MAAM,MAAM,kCAAkC,GAAG;IAC/C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,EAAE,MAAM,CAAC;QAClB,GAAG,EAAE,MAAM,CAAC;QACZ,OAAO,EAAE,MAAM,CAAC;QAChB,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AAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IAC1C,OAAO,EAAE,GAAG,CAAC;IACb,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG;IAC3C,IAAI,EAAE,mBAAmB,EAAE,CAAC;IAC5B,QAAQ,EAAE;QACR,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,OAAO,CAAC;QACrB,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;CACH,CAAC;AAoBF;;;;;GAKG;AACH,wBAAsB,6BAA6B,CACjD,OAAO,EAAE,oCAAoC,GAC5C,OAAO,CAAC,gCAAgC,CAAC,CAkC3C;AAED;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,6BAA6B,GACrC,OAAO,CAAC,8BAA8B,CAAC,CAkDzC"}
|
|
@@ -19,6 +19,7 @@ const SUPPORTED_CHAIN_IDS_FOR_RELATIONSHIP_API = [
|
|
|
19
19
|
const log = createModuleLogger(projectLogger, 'accounts-api');
|
|
20
20
|
/**
|
|
21
21
|
* Fetch account address relationship from the accounts API.
|
|
22
|
+
*
|
|
22
23
|
* @param request - The request object.
|
|
23
24
|
* @returns The raw response object from the API.
|
|
24
25
|
*/
|
|
@@ -49,6 +50,7 @@ export async function getAccountAddressRelationship(request) {
|
|
|
49
50
|
}
|
|
50
51
|
/**
|
|
51
52
|
* Fetch account transactions from the accounts API.
|
|
53
|
+
*
|
|
52
54
|
* @param request - The request object.
|
|
53
55
|
* @returns The response object.
|
|
54
56
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounts-api.mjs","sourceRoot":"","sources":["../../src/api/accounts-api.ts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AC;IAEZ,IAAI,GAAG,GAAG,GAAG,iBAAiB,GAAG,OAAO,eAAe,CAAC;IACxD,MAAM,MAAM,GAAG,EAAE,CAAC;IAElB,IAAI,QAAQ,EAAE;QACZ,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACnC,MAAM,CAAC,IAAI,CAAC,YAAY,OAAO,EAAE,CAAC,CAAC;KACpC;IAED,IAAI,cAAc,EAAE;QAClB,MAAM,CAAC,IAAI,CAAC,kBAAkB,cAAc,EAAE,CAAC,CAAC;KACjD;IAED,IAAI,YAAY,EAAE;QAChB,MAAM,CAAC,IAAI,CAAC,gBAAgB,YAAY,EAAE,CAAC,CAAC;KAC7C;IAED,IAAI,MAAM,EAAE;QACV,MAAM,CAAC,IAAI,CAAC,UAAU,MAAM,EAAE,CAAC,CAAC;KACjC;IAED,IAAI,aAAa,EAAE;QACjB,MAAM,CAAC,IAAI,CAAC,iBAAiB,aAAa,EAAE,CAAC,CAAC;KAC/C;IAED,IAAI,MAAM,CAAC,MAAM,EAAE;QACjB,GAAG,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;KAC/B;IAED,GAAG,CAAC,8BAA8B,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC;IAEtD,MAAM,OAAO,GAAG;QACd,CAAC,aAAa,CAAC,EAAE,SAAS;KAC3B,CAAC;IAEF,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IACzD,MAAM,YAAY,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IAE3C,GAAG,CAAC,gCAAgC,EAAE,YAAY,CAAC,CAAC;IAEpD,OAAO,YAAY,CAAC;AACtB,CAAC","sourcesContent":["import { successfulFetch } from '@metamask/controller-utils';\nimport type { Hex } from '@metamask/utils';\nimport { createModuleLogger } from '@metamask/utils';\n\nimport { FirstTimeInteractionError } from '../errors';\nimport { projectLogger } from '../logger';\n\nexport type AccountAddressRelationshipResponse = {\n chainId?: number;\n count?: number;\n data?: {\n hash: string;\n timestamp: string;\n chainId: number;\n blockNumber: string;\n blockHash: string;\n gas: number;\n gasUsed: number;\n gasPrice: string;\n effectiveGasPrice: number;\n nonce: number;\n cumulativeGasUsed: number;\n methodId: string;\n value: string;\n to: string;\n from: string;\n };\n txHash?: string;\n};\n\nexport type AccountAddressRelationshipResult =\n AccountAddressRelationshipResponse & {\n error?: {\n code: string;\n message: string;\n };\n };\n\nexport type GetAccountAddressRelationshipRequest = {\n /** Chain ID of account relationship to check. */\n chainId: number;\n\n /** Recipient of the transaction. */\n to: string;\n\n /** Sender of the transaction. */\n from: string;\n};\n\nexport type TransactionResponse = {\n hash: Hex;\n timestamp: string;\n chainId: number;\n blockNumber: number;\n blockHash: Hex;\n gas: number;\n gasUsed: number;\n gasPrice: string;\n effectiveGasPrice: string;\n nonce: number;\n cumulativeGasUsed: number;\n methodId: null;\n value: string;\n to: string;\n from: string;\n isError: boolean;\n valueTransfers: {\n contractAddress: string;\n decimal: number;\n symbol: string;\n from: string;\n to: string;\n amount: string;\n }[];\n};\n\nexport type GetAccountTransactionsRequest = {\n address: Hex;\n chainIds?: Hex[];\n cursor?: string;\n endTimestamp?: number;\n sortDirection?: 'ASC' | 'DESC';\n startTimestamp?: number;\n};\n\nexport type GetAccountTransactionsResponse = {\n data: TransactionResponse[];\n pageInfo: {\n count: number;\n hasNextPage: boolean;\n cursor?: string;\n };\n};\n\nconst BASE_URL = `https://accounts.api.cx.metamask.io`;\nconst BASE_URL_ACCOUNTS = `${BASE_URL}/v1/accounts/`;\nconst CLIENT_HEADER = 'x-metamask-clientproduct';\nconst CLIENT_ID = 'metamask-transaction-controller';\n\nconst SUPPORTED_CHAIN_IDS_FOR_RELATIONSHIP_API = [\n 1, // Ethereum Mainnet\n 10, // Optimism\n 56, // BSC\n 137, // Polygon\n 8453, // Base\n 42161, // Arbitrum\n 59144, // Linea\n 534352, // Scroll\n];\n\nconst log = createModuleLogger(projectLogger, 'accounts-api');\n\n/**\n * Fetch account address relationship from the accounts API.\n *\n * @param request - The request object.\n * @returns The raw response object from the API.\n */\nexport async function getAccountAddressRelationship(\n request: GetAccountAddressRelationshipRequest,\n): Promise<AccountAddressRelationshipResult> {\n const { chainId, from, to } = request;\n\n if (!SUPPORTED_CHAIN_IDS_FOR_RELATIONSHIP_API.includes(chainId)) {\n log('Unsupported chain ID for account relationship API', chainId);\n throw new FirstTimeInteractionError('Unsupported chain ID');\n }\n\n const url = `${BASE_URL}/v1/networks/${chainId}/accounts/${from}/relationships/${to}`;\n\n log('Getting account address relationship', { request, url });\n\n const headers = {\n [CLIENT_HEADER]: CLIENT_ID,\n };\n\n const response = await successfulFetch(url, { headers });\n\n if (response.status === 204) {\n // The accounts API returns a 204 status code when there are no transactions with empty body\n // imitating a count of 0\n return { count: 0 };\n }\n\n const responseJson: AccountAddressRelationshipResult = await response.json();\n\n log('Retrieved account address relationship', responseJson);\n\n if (responseJson.error) {\n const { code, message } = responseJson.error;\n throw new FirstTimeInteractionError(message, code);\n }\n\n return responseJson;\n}\n\n/**\n * Fetch account transactions from the accounts API.\n *\n * @param request - The request object.\n * @returns The response object.\n */\nexport async function getAccountTransactions(\n request: GetAccountTransactionsRequest,\n): Promise<GetAccountTransactionsResponse> {\n const {\n address,\n chainIds,\n cursor,\n endTimestamp,\n sortDirection,\n startTimestamp,\n } = request;\n\n let url = `${BASE_URL_ACCOUNTS}${address}/transactions`;\n const params = [];\n\n if (chainIds) {\n const network = chainIds.join(',');\n params.push(`networks=${network}`);\n }\n\n if (startTimestamp) {\n params.push(`startTimestamp=${startTimestamp}`);\n }\n\n if (endTimestamp) {\n params.push(`endTimestamp=${endTimestamp}`);\n }\n\n if (cursor) {\n params.push(`cursor=${cursor}`);\n }\n\n if (sortDirection) {\n params.push(`sortDirection=${sortDirection}`);\n }\n\n if (params.length) {\n url += `?${params.join('&')}`;\n }\n\n log('Getting account transactions', { request, url });\n\n const headers = {\n [CLIENT_HEADER]: CLIENT_ID,\n };\n\n const response = await successfulFetch(url, { headers });\n const responseJson = await response.json();\n\n log('Retrieved account transactions', responseJson);\n\n return responseJson;\n}\n"]}
|
package/dist/constants.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ABI_SIMULATION_ERC721_LEGACY = exports.ABI_SIMULATION_ERC20_WRAPPED = exports.GAS_BUFFER_CHAIN_OVERRIDES = exports.CHAIN_IDS = void 0;
|
|
3
|
+
exports.ABI_IERC7821 = exports.ABI_SIMULATION_ERC721_LEGACY = exports.ABI_SIMULATION_ERC20_WRAPPED = exports.GAS_BUFFER_CHAIN_OVERRIDES = exports.CHAIN_IDS = void 0;
|
|
4
4
|
exports.CHAIN_IDS = {
|
|
5
5
|
MAINNET: '0x1',
|
|
6
6
|
GOERLI: '0x5',
|
|
@@ -83,4 +83,23 @@ exports.ABI_SIMULATION_ERC721_LEGACY = [
|
|
|
83
83
|
type: 'event',
|
|
84
84
|
},
|
|
85
85
|
];
|
|
86
|
+
exports.ABI_IERC7821 = [
|
|
87
|
+
{
|
|
88
|
+
type: 'function',
|
|
89
|
+
name: 'execute',
|
|
90
|
+
inputs: [
|
|
91
|
+
{ name: 'mode', type: 'bytes32', internalType: 'ModeCode' },
|
|
92
|
+
{ name: 'executionData', type: 'bytes', internalType: 'bytes' },
|
|
93
|
+
],
|
|
94
|
+
outputs: [],
|
|
95
|
+
stateMutability: 'payable',
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
type: 'function',
|
|
99
|
+
name: 'supportsExecutionMode',
|
|
100
|
+
inputs: [{ name: 'mode', type: 'bytes32', internalType: 'ModeCode' }],
|
|
101
|
+
outputs: [{ name: '', type: 'bool', internalType: 'bool' }],
|
|
102
|
+
stateMutability: 'view',
|
|
103
|
+
},
|
|
104
|
+
];
|
|
86
105
|
//# sourceMappingURL=constants.cjs.map
|
package/dist/constants.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.cjs","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,SAAS,GAAG;IACvB,OAAO,EAAE,KAAK;IACd,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,QAAQ;IACd,YAAY,EAAE,SAAS;IACvB,GAAG,EAAE,MAAM;IACX,WAAW,EAAE,MAAM;IACnB,QAAQ,EAAE,KAAK;IACf,gBAAgB,EAAE,OAAO;IACzB,KAAK,EAAE,MAAM;IACb,aAAa,EAAE,QAAQ;IACvB,gBAAgB,EAAE,UAAU;IAC5B,OAAO,EAAE,MAAM;IACf,eAAe,EAAE,SAAS;IAC1B,SAAS,EAAE,QAAQ;IACnB,iBAAiB,EAAE,QAAQ;IAC3B,MAAM,EAAE,MAAM;IACd,cAAc,EAAE,OAAO;IACvB,OAAO,EAAE,UAAU;IACnB,YAAY,EAAE,QAAQ;IACtB,aAAa,EAAE,QAAQ;IACvB,aAAa,EAAE,QAAQ;IACvB,QAAQ,EAAE,OAAO;IACjB,gBAAgB,EAAE,OAAO;IACzB,SAAS,EAAE,OAAO;IAClB,MAAM,EAAE,MAAM;IACd,QAAQ,EAAE,QAAQ;IAClB,UAAU,EAAE,OAAO;IACnB,IAAI,EAAE,UAAU;IAChB,MAAM,EAAE,SAAS;IACjB,cAAc,EAAE,SAAS;CACjB,CAAC;AAEE,QAAA,0BAA0B,GAAG;IACxC,CAAC,iBAAS,CAAC,QAAQ,CAAC,EAAE,CAAC;IACvB,CAAC,iBAAS,CAAC,gBAAgB,CAAC,EAAE,CAAC;CAChC,CAAC;AAEF,iEAAiE;AACpD,QAAA,4BAA4B,GAAG;IAC1C;QACE,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE;YACN,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE;YAC9C,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE;SACjD;QACD,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,OAAO;KACd;IACD;QACE,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE;YACN,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE;YAChD,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE;SACjD;QACD,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE,OAAO;KACd;CACF,CAAC;AAEF,iEAAiE;AACpD,QAAA,4BAA4B,GAAG;IAC1C;QACE,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE;YACN;gBACE,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,SAAS;aAChB;YACD;gBACE,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE,KAAK;gBACX,IAAI,EAAE,SAAS;aAChB;YACD;gBACE,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,SAAS;aAChB;SACF;QACD,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,OAAO;KACd;CACF,CAAC","sourcesContent":["export const CHAIN_IDS = {\n MAINNET: '0x1',\n GOERLI: '0x5',\n BASE: '0x2105',\n BASE_TESTNET: '0x14a33',\n BSC: '0x38',\n BSC_TESTNET: '0x61',\n OPTIMISM: '0xa',\n OPTIMISM_TESTNET: '0x1a4',\n OPBNB: '0xcc',\n OPBNB_TESTNET: '0x15eb',\n OPTIMISM_SEPOLIA: '0xaa37dc',\n POLYGON: '0x89',\n POLYGON_TESTNET: '0x13881',\n AVALANCHE: '0xa86a',\n AVALANCHE_TESTNET: '0xa869',\n FANTOM: '0xfa',\n FANTOM_TESTNET: '0xfa2',\n SEPOLIA: '0xaa36a7',\n LINEA_GOERLI: '0xe704',\n LINEA_SEPOLIA: '0xe705',\n LINEA_MAINNET: '0xe708',\n MOONBEAM: '0x504',\n MOONBEAM_TESTNET: '0x507',\n MOONRIVER: '0x505',\n GNOSIS: '0x64',\n ARBITRUM: '0xa4b1',\n ZKSYNC_ERA: '0x144',\n ZORA: '0x76adf1',\n SCROLL: '0x82750',\n SCROLL_SEPOLIA: '0x8274f',\n} as const;\n\nexport const GAS_BUFFER_CHAIN_OVERRIDES = {\n [CHAIN_IDS.OPTIMISM]: 1,\n [CHAIN_IDS.OPTIMISM_SEPOLIA]: 1,\n};\n\n/** Extract of the Wrapped ERC-20 ABI required for simulation. */\nexport const ABI_SIMULATION_ERC20_WRAPPED = [\n {\n anonymous: false,\n inputs: [\n { indexed: true, name: 'to', type: 'address' },\n { indexed: false, name: 'wad', type: 'uint256' },\n ],\n name: 'Deposit',\n type: 'event',\n },\n {\n anonymous: false,\n inputs: [\n { indexed: true, name: 'from', type: 'address' },\n { indexed: false, name: 'wad', type: 'uint256' },\n ],\n name: 'Withdrawal',\n type: 'event',\n },\n];\n\n/** Extract of the legacy ERC-721 ABI required for simulation. */\nexport const ABI_SIMULATION_ERC721_LEGACY = [\n {\n anonymous: false,\n inputs: [\n {\n indexed: false,\n name: '_from',\n type: 'address',\n },\n {\n indexed: false,\n name: '_to',\n type: 'address',\n },\n {\n indexed: false,\n name: '_tokenId',\n type: 'uint256',\n },\n ],\n name: 'Transfer',\n type: 'event',\n },\n];\n"]}
|
|
1
|
+
{"version":3,"file":"constants.cjs","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,SAAS,GAAG;IACvB,OAAO,EAAE,KAAK;IACd,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,QAAQ;IACd,YAAY,EAAE,SAAS;IACvB,GAAG,EAAE,MAAM;IACX,WAAW,EAAE,MAAM;IACnB,QAAQ,EAAE,KAAK;IACf,gBAAgB,EAAE,OAAO;IACzB,KAAK,E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'0xa',\n OPTIMISM_TESTNET: '0x1a4',\n OPBNB: '0xcc',\n OPBNB_TESTNET: '0x15eb',\n OPTIMISM_SEPOLIA: '0xaa37dc',\n POLYGON: '0x89',\n POLYGON_TESTNET: '0x13881',\n AVALANCHE: '0xa86a',\n AVALANCHE_TESTNET: '0xa869',\n FANTOM: '0xfa',\n FANTOM_TESTNET: '0xfa2',\n SEPOLIA: '0xaa36a7',\n LINEA_GOERLI: '0xe704',\n LINEA_SEPOLIA: '0xe705',\n LINEA_MAINNET: '0xe708',\n MOONBEAM: '0x504',\n MOONBEAM_TESTNET: '0x507',\n MOONRIVER: '0x505',\n GNOSIS: '0x64',\n ARBITRUM: '0xa4b1',\n ZKSYNC_ERA: '0x144',\n ZORA: '0x76adf1',\n SCROLL: '0x82750',\n SCROLL_SEPOLIA: '0x8274f',\n} as const;\n\nexport const GAS_BUFFER_CHAIN_OVERRIDES = {\n [CHAIN_IDS.OPTIMISM]: 1,\n [CHAIN_IDS.OPTIMISM_SEPOLIA]: 1,\n};\n\n/** Extract of the Wrapped ERC-20 ABI required for simulation. */\nexport const ABI_SIMULATION_ERC20_WRAPPED = [\n {\n anonymous: false,\n inputs: [\n { indexed: true, name: 'to', type: 'address' },\n { indexed: false, name: 'wad', type: 'uint256' },\n ],\n name: 'Deposit',\n type: 'event',\n },\n {\n anonymous: false,\n inputs: [\n { indexed: true, name: 'from', type: 'address' },\n { indexed: false, name: 'wad', type: 'uint256' },\n ],\n name: 'Withdrawal',\n type: 'event',\n },\n];\n\n/** Extract of the legacy ERC-721 ABI required for simulation. */\nexport const ABI_SIMULATION_ERC721_LEGACY = [\n {\n anonymous: false,\n inputs: [\n {\n indexed: false,\n name: '_from',\n type: 'address',\n },\n {\n indexed: false,\n name: '_to',\n type: 'address',\n },\n {\n indexed: false,\n name: '_tokenId',\n type: 'uint256',\n },\n ],\n name: 'Transfer',\n type: 'event',\n },\n];\n\nexport const ABI_IERC7821 = [\n {\n type: 'function',\n name: 'execute',\n inputs: [\n { name: 'mode', type: 'bytes32', internalType: 'ModeCode' },\n { name: 'executionData', type: 'bytes', internalType: 'bytes' },\n ],\n outputs: [],\n stateMutability: 'payable',\n },\n {\n type: 'function',\n name: 'supportsExecutionMode',\n inputs: [{ name: 'mode', type: 'bytes32', internalType: 'ModeCode' }],\n outputs: [{ name: '', type: 'bool', internalType: 'bool' }],\n stateMutability: 'view',\n },\n];\n"]}
|
package/dist/constants.d.cts
CHANGED
|
@@ -56,4 +56,19 @@ export declare const ABI_SIMULATION_ERC721_LEGACY: {
|
|
|
56
56
|
name: string;
|
|
57
57
|
type: string;
|
|
58
58
|
}[];
|
|
59
|
+
export declare const ABI_IERC7821: {
|
|
60
|
+
type: string;
|
|
61
|
+
name: string;
|
|
62
|
+
inputs: {
|
|
63
|
+
name: string;
|
|
64
|
+
type: string;
|
|
65
|
+
internalType: string;
|
|
66
|
+
}[];
|
|
67
|
+
outputs: {
|
|
68
|
+
name: string;
|
|
69
|
+
type: string;
|
|
70
|
+
internalType: string;
|
|
71
|
+
}[];
|
|
72
|
+
stateMutability: string;
|
|
73
|
+
}[];
|
|
59
74
|
//# sourceMappingURL=constants.d.cts.map
|
package/dist/constants.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.cts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BZ,CAAC;AAEX,eAAO,MAAM,0BAA0B;;;CAGtC,CAAC;AAEF,iEAAiE;AACjE,eAAO,MAAM,4BAA4B;;;;;;;;;GAmBxC,CAAC;AAEF,iEAAiE;AACjE,eAAO,MAAM,4BAA4B;;;;;;;;;GAuBxC,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.d.cts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BZ,CAAC;AAEX,eAAO,MAAM,0BAA0B;;;CAGtC,CAAC;AAEF,iEAAiE;AACjE,eAAO,MAAM,4BAA4B;;;;;;;;;GAmBxC,CAAC;AAEF,iEAAiE;AACjE,eAAO,MAAM,4BAA4B;;;;;;;;;GAuBxC,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;;;;;;GAkBxB,CAAC"}
|
package/dist/constants.d.mts
CHANGED
|
@@ -56,4 +56,19 @@ export declare const ABI_SIMULATION_ERC721_LEGACY: {
|
|
|
56
56
|
name: string;
|
|
57
57
|
type: string;
|
|
58
58
|
}[];
|
|
59
|
+
export declare const ABI_IERC7821: {
|
|
60
|
+
type: string;
|
|
61
|
+
name: string;
|
|
62
|
+
inputs: {
|
|
63
|
+
name: string;
|
|
64
|
+
type: string;
|
|
65
|
+
internalType: string;
|
|
66
|
+
}[];
|
|
67
|
+
outputs: {
|
|
68
|
+
name: string;
|
|
69
|
+
type: string;
|
|
70
|
+
internalType: string;
|
|
71
|
+
}[];
|
|
72
|
+
stateMutability: string;
|
|
73
|
+
}[];
|
|
59
74
|
//# sourceMappingURL=constants.d.mts.map
|
package/dist/constants.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.mts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BZ,CAAC;AAEX,eAAO,MAAM,0BAA0B;;;CAGtC,CAAC;AAEF,iEAAiE;AACjE,eAAO,MAAM,4BAA4B;;;;;;;;;GAmBxC,CAAC;AAEF,iEAAiE;AACjE,eAAO,MAAM,4BAA4B;;;;;;;;;GAuBxC,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.d.mts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BZ,CAAC;AAEX,eAAO,MAAM,0BAA0B;;;CAGtC,CAAC;AAEF,iEAAiE;AACjE,eAAO,MAAM,4BAA4B;;;;;;;;;GAmBxC,CAAC;AAEF,iEAAiE;AACjE,eAAO,MAAM,4BAA4B;;;;;;;;;GAuBxC,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;;;;;;GAkBxB,CAAC"}
|
package/dist/constants.mjs
CHANGED
|
@@ -80,4 +80,23 @@ export const ABI_SIMULATION_ERC721_LEGACY = [
|
|
|
80
80
|
type: 'event',
|
|
81
81
|
},
|
|
82
82
|
];
|
|
83
|
+
export const ABI_IERC7821 = [
|
|
84
|
+
{
|
|
85
|
+
type: 'function',
|
|
86
|
+
name: 'execute',
|
|
87
|
+
inputs: [
|
|
88
|
+
{ name: 'mode', type: 'bytes32', internalType: 'ModeCode' },
|
|
89
|
+
{ name: 'executionData', type: 'bytes', internalType: 'bytes' },
|
|
90
|
+
],
|
|
91
|
+
outputs: [],
|
|
92
|
+
stateMutability: 'payable',
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
type: 'function',
|
|
96
|
+
name: 'supportsExecutionMode',
|
|
97
|
+
inputs: [{ name: 'mode', type: 'bytes32', internalType: 'ModeCode' }],
|
|
98
|
+
outputs: [{ name: '', type: 'bool', internalType: 'bool' }],
|
|
99
|
+
stateMutability: 'view',
|
|
100
|
+
},
|
|
101
|
+
];
|
|
83
102
|
//# sourceMappingURL=constants.mjs.map
|
package/dist/constants.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.mjs","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,OAAO,EAAE,KAAK;IACd,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,QAAQ;IACd,YAAY,EAAE,SAAS;IACvB,GAAG,EAAE,MAAM;IACX,WAAW,EAAE,MAAM;IACnB,QAAQ,EAAE,KAAK;IACf,gBAAgB,EAAE,OA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,EAAE,SAAS,EAAE;SACjD;QACD,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE,OAAO;KACd;CACF,CAAC;AAEF,iEAAiE;AACjE,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C;QACE,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE;YACN;gBACE,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,SAAS;aAChB;YACD;gBACE,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE,KAAK;gBACX,IAAI,EAAE,SAAS;aAChB;YACD;gBACE,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,SAAS;aAChB;SACF;QACD,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,OAAO;KACd;CACF,CAAC","sourcesContent":["export const CHAIN_IDS = {\n MAINNET: '0x1',\n GOERLI: '0x5',\n BASE: '0x2105',\n BASE_TESTNET: '0x14a33',\n BSC: '0x38',\n BSC_TESTNET: '0x61',\n OPTIMISM: '0xa',\n OPTIMISM_TESTNET: '0x1a4',\n OPBNB: '0xcc',\n OPBNB_TESTNET: '0x15eb',\n OPTIMISM_SEPOLIA: '0xaa37dc',\n POLYGON: '0x89',\n POLYGON_TESTNET: '0x13881',\n AVALANCHE: '0xa86a',\n AVALANCHE_TESTNET: '0xa869',\n FANTOM: '0xfa',\n FANTOM_TESTNET: '0xfa2',\n SEPOLIA: '0xaa36a7',\n LINEA_GOERLI: '0xe704',\n LINEA_SEPOLIA: '0xe705',\n LINEA_MAINNET: '0xe708',\n MOONBEAM: '0x504',\n MOONBEAM_TESTNET: '0x507',\n MOONRIVER: '0x505',\n GNOSIS: '0x64',\n ARBITRUM: '0xa4b1',\n ZKSYNC_ERA: '0x144',\n ZORA: '0x76adf1',\n SCROLL: '0x82750',\n SCROLL_SEPOLIA: '0x8274f',\n} as const;\n\nexport const GAS_BUFFER_CHAIN_OVERRIDES = {\n [CHAIN_IDS.OPTIMISM]: 1,\n [CHAIN_IDS.OPTIMISM_SEPOLIA]: 1,\n};\n\n/** Extract of the Wrapped ERC-20 ABI required for simulation. */\nexport const ABI_SIMULATION_ERC20_WRAPPED = [\n {\n anonymous: false,\n inputs: [\n { indexed: true, name: 'to', type: 'address' },\n { indexed: false, name: 'wad', type: 'uint256' },\n ],\n name: 'Deposit',\n type: 'event',\n },\n {\n anonymous: false,\n inputs: [\n { indexed: true, name: 'from', type: 'address' },\n { indexed: false, name: 'wad', type: 'uint256' },\n ],\n name: 'Withdrawal',\n type: 'event',\n },\n];\n\n/** Extract of the legacy ERC-721 ABI required for simulation. */\nexport const ABI_SIMULATION_ERC721_LEGACY = [\n {\n anonymous: false,\n inputs: [\n {\n indexed: false,\n name: '_from',\n type: 'address',\n },\n {\n indexed: false,\n name: '_to',\n type: 'address',\n },\n {\n indexed: false,\n name: '_tokenId',\n type: 'uint256',\n },\n ],\n name: 'Transfer',\n type: 'event',\n },\n];\n"]}
|
|
1
|
+
{"version":3,"file":"constants.mjs","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,OAAO,EAAE,KAAK;IACd,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,QAAQ;IACd,YAAY,EAAE,SAAS;IACvB,GAAG,EAAE,MAAM;IACX,WAAW,EAAE,MAAM;IACnB,QAAQ,EAAE,KAAK;IACf,gBAAgB,EAAE,OAAO;IACzB,KAAK,EAAE,MAAM;IACb,aAAa,EAAE,QAAQ;IACvB,gBAAgB,EAAE,UAAU;IAC5B,OAAO,EAAE,MAAM;IACf,eAAe,EAAE,SAAS;IAC1B,SAAS,EAAE,QAAQ;IACnB,iBAAiB,EAAE,QAAQ;IAC3B,MAAM,EAAE,MAAM;IACd,cAAc,EAAE,OAAO;IACvB,OAAO,EAAE,UAAU;IACnB,YAAY,EAAE,QAAQ;IACtB,aAAa,EAAE,QAAQ;IACvB,aAAa,EAAE,QAAQ;IACvB,Q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,EAAE,SAAS;aAChB;YACD;gBACE,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,SAAS;aAChB;SACF;QACD,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,OAAO;KACd;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B;QACE,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,SAAS;QACf,MAAM,EAAE;YACN,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE;YAC3D,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE;SAChE;QACD,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,SAAS;KAC3B;IACD;QACE,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,uBAAuB;QAC7B,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC;QACrE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC;QAC3D,eAAe,EAAE,MAAM;KACxB;CACF,CAAC","sourcesContent":["export const CHAIN_IDS = {\n MAINNET: '0x1',\n GOERLI: '0x5',\n BASE: '0x2105',\n BASE_TESTNET: '0x14a33',\n BSC: '0x38',\n BSC_TESTNET: '0x61',\n OPTIMISM: '0xa',\n OPTIMISM_TESTNET: '0x1a4',\n OPBNB: '0xcc',\n OPBNB_TESTNET: '0x15eb',\n OPTIMISM_SEPOLIA: '0xaa37dc',\n POLYGON: '0x89',\n POLYGON_TESTNET: '0x13881',\n AVALANCHE: '0xa86a',\n AVALANCHE_TESTNET: '0xa869',\n FANTOM: '0xfa',\n FANTOM_TESTNET: '0xfa2',\n SEPOLIA: '0xaa36a7',\n LINEA_GOERLI: '0xe704',\n LINEA_SEPOLIA: '0xe705',\n LINEA_MAINNET: '0xe708',\n MOONBEAM: '0x504',\n MOONBEAM_TESTNET: '0x507',\n MOONRIVER: '0x505',\n GNOSIS: '0x64',\n ARBITRUM: '0xa4b1',\n ZKSYNC_ERA: '0x144',\n ZORA: '0x76adf1',\n SCROLL: '0x82750',\n SCROLL_SEPOLIA: '0x8274f',\n} as const;\n\nexport const GAS_BUFFER_CHAIN_OVERRIDES = {\n [CHAIN_IDS.OPTIMISM]: 1,\n [CHAIN_IDS.OPTIMISM_SEPOLIA]: 1,\n};\n\n/** Extract of the Wrapped ERC-20 ABI required for simulation. */\nexport const ABI_SIMULATION_ERC20_WRAPPED = [\n {\n anonymous: false,\n inputs: [\n { indexed: true, name: 'to', type: 'address' },\n { indexed: false, name: 'wad', type: 'uint256' },\n ],\n name: 'Deposit',\n type: 'event',\n },\n {\n anonymous: false,\n inputs: [\n { indexed: true, name: 'from', type: 'address' },\n { indexed: false, name: 'wad', type: 'uint256' },\n ],\n name: 'Withdrawal',\n type: 'event',\n },\n];\n\n/** Extract of the legacy ERC-721 ABI required for simulation. */\nexport const ABI_SIMULATION_ERC721_LEGACY = [\n {\n anonymous: false,\n inputs: [\n {\n indexed: false,\n name: '_from',\n type: 'address',\n },\n {\n indexed: false,\n name: '_to',\n type: 'address',\n },\n {\n indexed: false,\n name: '_tokenId',\n type: 'uint256',\n },\n ],\n name: 'Transfer',\n type: 'event',\n },\n];\n\nexport const ABI_IERC7821 = [\n {\n type: 'function',\n name: 'execute',\n inputs: [\n { name: 'mode', type: 'bytes32', internalType: 'ModeCode' },\n { name: 'executionData', type: 'bytes', internalType: 'bytes' },\n ],\n outputs: [],\n stateMutability: 'payable',\n },\n {\n type: 'function',\n name: 'supportsExecutionMode',\n inputs: [{ name: 'mode', type: 'bytes32', internalType: 'ModeCode' }],\n outputs: [{ name: '', type: 'bool', internalType: 'bool' }],\n stateMutability: 'view',\n },\n];\n"]}
|
|
@@ -9,9 +9,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.LineaGasFeeFlow = void 0;
|
|
10
10
|
const controller_utils_1 = require("@metamask/controller-utils");
|
|
11
11
|
const utils_1 = require("@metamask/utils");
|
|
12
|
+
const DefaultGasFeeFlow_1 = require("./DefaultGasFeeFlow.cjs");
|
|
12
13
|
const logger_1 = require("../logger.cjs");
|
|
13
14
|
const types_1 = require("../types.cjs");
|
|
14
|
-
const DefaultGasFeeFlow_1 = require("./DefaultGasFeeFlow.cjs");
|
|
15
15
|
const log = (0, utils_1.createModuleLogger)(logger_1.projectLogger, 'linea-gas-fee-flow');
|
|
16
16
|
const LINEA_CHAIN_IDS = [
|
|
17
17
|
controller_utils_1.ChainId['linea-mainnet'],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LineaGasFeeFlow.cjs","sourceRoot":"","sources":["../../src/gas-flows/LineaGasFeeFlow.ts"],"names":[],"mappings":";;;;;;;;;AAAA,iEAA4E;AAE5E,2CAA+D;AAG/D,0CAA0C;AAQ1C,wCAAmE;
|
|
1
|
+
{"version":3,"file":"LineaGasFeeFlow.cjs","sourceRoot":"","sources":["../../src/gas-flows/LineaGasFeeFlow.ts"],"names":[],"mappings":";;;;;;;;;AAAA,iEAA4E;AAE5E,2CAA+D;AAG/D,+DAAwD;AACxD,0CAA0C;AAQ1C,wCAAmE;AAWnE,MAAM,GAAG,GAAG,IAAA,0BAAkB,EAAC,sBAAa,EAAE,oBAAoB,CAAC,CAAC;AAEpE,MAAM,eAAe,GAAU;IAC7B,0BAAO,CAAC,eAAe,CAAC;IACxB,0BAAO,CAAC,cAAc,CAAC;IACvB,0BAAO,CAAC,eAAe,CAAC;CACzB,CAAC;AAEF,MAAM,oBAAoB,GAAG;IAC3B,GAAG,EAAE,CAAC;IACN,MAAM,EAAE,IAAI;IACZ,IAAI,EAAE,GAAG;CACV,CAAC;AAEF,MAAM,wBAAwB,GAAG;IAC/B,GAAG,EAAE,CAAC;I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,IAAI,CAAC,CAAC;IAEzC,OAAO;QACL,GAAG;QACH,MAAM;QACN,IAAI;KACL,CAAC;AACJ,CAAC,qEAGC,QAAyC,EACzC,YAA6C;IAE7C,OAAO;QACL,GAAG,EAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC;QACvC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC;QAChD,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,CAAC;KAC3C,CAAC;AACJ,CAAC,yEAEa,IAAiB;IAC7B,OAAO,MAAM,CAAC,MAAM,CAAC,2BAAmB,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CACtD,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CACzB,CAAC;AACJ,CAAC","sourcesContent":["import { ChainId, hexToBN, query, toHex } from '@metamask/controller-utils';\nimport type EthQuery from '@metamask/eth-query';\nimport { createModuleLogger, type Hex } from '@metamask/utils';\nimport type BN from 'bn.js';\n\nimport { DefaultGasFeeFlow } from './DefaultGasFeeFlow';\nimport { projectLogger } from '../logger';\nimport type {\n GasFeeEstimates,\n GasFeeFlow,\n GasFeeFlowRequest,\n GasFeeFlowResponse,\n TransactionMeta,\n} from '../types';\nimport { GasFeeEstimateLevel, GasFeeEstimateType } from '../types';\n\ntype LineaEstimateGasResponse = {\n baseFeePerGas: Hex;\n priorityFeePerGas: Hex;\n};\n\ntype FeesByLevel = {\n [key in GasFeeEstimateLevel]: BN;\n};\n\nconst log = createModuleLogger(projectLogger, 'linea-gas-fee-flow');\n\nconst LINEA_CHAIN_IDS: Hex[] = [\n ChainId['linea-mainnet'],\n ChainId['linea-goerli'],\n ChainId['linea-sepolia'],\n];\n\nconst BASE_FEE_MULTIPLIERS = {\n low: 1,\n medium: 1.35,\n high: 1.7,\n};\n\nconst PRIORITY_FEE_MULTIPLIERS = {\n low: 1,\n medium: 1.05,\n high: 1.1,\n};\n\n/**\n * Implementation of a gas fee flow specific to Linea networks that obtains gas fee estimates using:\n * - The `linea_estimateGas` RPC method to obtain the base fee and lowest priority fee.\n * - Static multipliers to increase the base and priority fees.\n */\nexport class LineaGasFeeFlow implements GasFeeFlow {\n matchesTransaction(transactionMeta: TransactionMeta): boolean {\n return LINEA_CHAIN_IDS.includes(transactionMeta.chainId);\n }\n\n async getGasFees(request: GasFeeFlowRequest): Promise<GasFeeFlowResponse> {\n try {\n return await this.#getLineaGasFees(request);\n } catch (error) {\n log('Using default flow as fallback due to error', error);\n return new DefaultGasFeeFlow().getGasFees(request);\n }\n }\n\n async #getLineaGasFees(\n request: GasFeeFlowRequest,\n ): Promise<GasFeeFlowResponse> {\n const { ethQuery, transactionMeta } = request;\n\n const lineaResponse = await this.#getLineaResponse(\n transactionMeta,\n ethQuery,\n );\n\n log('Received Linea response', lineaResponse);\n\n const baseFees = this.#getValuesFromMultipliers(\n lineaResponse.baseFeePerGas,\n BASE_FEE_MULTIPLIERS,\n );\n\n log('Generated base fees', this.#feesToString(baseFees));\n\n const priorityFees = this.#getValuesFromMultipliers(\n lineaResponse.priorityFeePerGas,\n PRIORITY_FEE_MULTIPLIERS,\n );\n\n log('Generated priority fees', this.#feesToString(priorityFees));\n\n const maxFees = this.#getMaxFees(baseFees, priorityFees);\n\n log('Generated max fees', this.#feesToString(maxFees));\n\n const estimates = Object.values(GasFeeEstimateLevel).reduce(\n (result, level) => ({\n ...result,\n [level]: {\n maxFeePerGas: toHex(maxFees[level]),\n maxPriorityFeePerGas: toHex(priorityFees[level]),\n },\n }),\n { type: GasFeeEstimateType.FeeMarket } as GasFeeEstimates,\n );\n\n return { estimates };\n }\n\n #getLineaResponse(\n transactionMeta: TransactionMeta,\n ethQuery: EthQuery,\n ): Promise<LineaEstimateGasResponse> {\n return query(ethQuery, 'linea_estimateGas', [\n {\n from: transactionMeta.txParams.from,\n to: transactionMeta.txParams.to,\n value: transactionMeta.txParams.value,\n input: transactionMeta.txParams.data,\n },\n ]);\n }\n\n #getValuesFromMultipliers(\n value: Hex,\n multipliers: { low: number; medium: number; high: number },\n ): FeesByLevel {\n const base = hexToBN(value);\n const low = base.muln(multipliers.low);\n const medium = base.muln(multipliers.medium);\n const high = base.muln(multipliers.high);\n\n return {\n low,\n medium,\n high,\n };\n }\n\n #getMaxFees(\n baseFees: Record<GasFeeEstimateLevel, BN>,\n priorityFees: Record<GasFeeEstimateLevel, BN>,\n ): FeesByLevel {\n return {\n low: baseFees.low.add(priorityFees.low),\n medium: baseFees.medium.add(priorityFees.medium),\n high: baseFees.high.add(priorityFees.high),\n };\n }\n\n #feesToString(fees: FeesByLevel) {\n return Object.values(GasFeeEstimateLevel).map((level) =>\n fees[level].toString(10),\n );\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LineaGasFeeFlow.d.cts","sourceRoot":"","sources":["../../src/gas-flows/LineaGasFeeFlow.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LineaGasFeeFlow.d.cts","sourceRoot":"","sources":["../../src/gas-flows/LineaGasFeeFlow.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAEV,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EAChB,qBAAiB;AAgClB;;;;GAIG;AACH,qBAAa,eAAgB,YAAW,UAAU;;IAChD,kBAAkB,CAAC,eAAe,EAAE,eAAe,GAAG,OAAO;IAIvD,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAmG1E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LineaGasFeeFlow.d.mts","sourceRoot":"","sources":["../../src/gas-flows/LineaGasFeeFlow.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LineaGasFeeFlow.d.mts","sourceRoot":"","sources":["../../src/gas-flows/LineaGasFeeFlow.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAEV,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EAChB,qBAAiB;AAgClB;;;;GAIG;AACH,qBAAa,eAAgB,YAAW,UAAU;;IAChD,kBAAkB,CAAC,eAAe,EAAE,eAAe,GAAG,OAAO;IAIvD,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAmG1E"}
|
|
@@ -6,9 +6,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
6
6
|
var _LineaGasFeeFlow_instances, _LineaGasFeeFlow_getLineaGasFees, _LineaGasFeeFlow_getLineaResponse, _LineaGasFeeFlow_getValuesFromMultipliers, _LineaGasFeeFlow_getMaxFees, _LineaGasFeeFlow_feesToString;
|
|
7
7
|
import { ChainId, hexToBN, query, toHex } from "@metamask/controller-utils";
|
|
8
8
|
import { createModuleLogger } from "@metamask/utils";
|
|
9
|
+
import { DefaultGasFeeFlow } from "./DefaultGasFeeFlow.mjs";
|
|
9
10
|
import { projectLogger } from "../logger.mjs";
|
|
10
11
|
import { GasFeeEstimateLevel, GasFeeEstimateType } from "../types.mjs";
|
|
11
|
-
import { DefaultGasFeeFlow } from "./DefaultGasFeeFlow.mjs";
|
|
12
12
|
const log = createModuleLogger(projectLogger, 'linea-gas-fee-flow');
|
|
13
13
|
const LINEA_CHAIN_IDS = [
|
|
14
14
|
ChainId['linea-mainnet'],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LineaGasFeeFlow.mjs","sourceRoot":"","sources":["../../src/gas-flows/LineaGasFeeFlow.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,mCAAmC;AAE5E,OAAO,EAAE,kBAAkB,EAAY,wBAAwB;AAG/D,OAAO,EAAE,aAAa,EAAE,sBAAkB;AAQ1C,OAAO,EAAE,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,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CACzB,CAAC;AACJ,CAAC","sourcesContent":["import { ChainId, hexToBN, query, toHex } from '@metamask/controller-utils';\nimport type EthQuery from '@metamask/eth-query';\nimport { createModuleLogger, type Hex } from '@metamask/utils';\nimport type BN from 'bn.js';\n\nimport { DefaultGasFeeFlow } from './DefaultGasFeeFlow';\nimport { projectLogger } from '../logger';\nimport type {\n GasFeeEstimates,\n GasFeeFlow,\n GasFeeFlowRequest,\n GasFeeFlowResponse,\n TransactionMeta,\n} from '../types';\nimport { GasFeeEstimateLevel, GasFeeEstimateType } from '../types';\n\ntype LineaEstimateGasResponse = {\n baseFeePerGas: Hex;\n priorityFeePerGas: Hex;\n};\n\ntype FeesByLevel = {\n [key in GasFeeEstimateLevel]: BN;\n};\n\nconst log = createModuleLogger(projectLogger, 'linea-gas-fee-flow');\n\nconst LINEA_CHAIN_IDS: Hex[] = [\n ChainId['linea-mainnet'],\n ChainId['linea-goerli'],\n ChainId['linea-sepolia'],\n];\n\nconst BASE_FEE_MULTIPLIERS = {\n low: 1,\n medium: 1.35,\n high: 1.7,\n};\n\nconst PRIORITY_FEE_MULTIPLIERS = {\n low: 1,\n medium: 1.05,\n high: 1.1,\n};\n\n/**\n * Implementation of a gas fee flow specific to Linea networks that obtains gas fee estimates using:\n * - The `linea_estimateGas` RPC method to obtain the base fee and lowest priority fee.\n * - Static multipliers to increase the base and priority fees.\n */\nexport class LineaGasFeeFlow implements GasFeeFlow {\n matchesTransaction(transactionMeta: TransactionMeta): boolean {\n return LINEA_CHAIN_IDS.includes(transactionMeta.chainId);\n }\n\n async getGasFees(request: GasFeeFlowRequest): Promise<GasFeeFlowResponse> {\n try {\n return await this.#getLineaGasFees(request);\n } catch (error) {\n log('Using default flow as fallback due to error', error);\n return new DefaultGasFeeFlow().getGasFees(request);\n }\n }\n\n async #getLineaGasFees(\n request: GasFeeFlowRequest,\n ): Promise<GasFeeFlowResponse> {\n const { ethQuery, transactionMeta } = request;\n\n const lineaResponse = await this.#getLineaResponse(\n transactionMeta,\n ethQuery,\n );\n\n log('Received Linea response', lineaResponse);\n\n const baseFees = this.#getValuesFromMultipliers(\n lineaResponse.baseFeePerGas,\n BASE_FEE_MULTIPLIERS,\n );\n\n log('Generated base fees', this.#feesToString(baseFees));\n\n const priorityFees = this.#getValuesFromMultipliers(\n lineaResponse.priorityFeePerGas,\n PRIORITY_FEE_MULTIPLIERS,\n );\n\n log('Generated priority fees', this.#feesToString(priorityFees));\n\n const maxFees = this.#getMaxFees(baseFees, priorityFees);\n\n log('Generated max fees', this.#feesToString(maxFees));\n\n const estimates = Object.values(GasFeeEstimateLevel).reduce(\n (result, level) => ({\n ...result,\n [level]: {\n maxFeePerGas: toHex(maxFees[level]),\n maxPriorityFeePerGas: toHex(priorityFees[level]),\n },\n }),\n { type: GasFeeEstimateType.FeeMarket } as GasFeeEstimates,\n );\n\n return { estimates };\n }\n\n #getLineaResponse(\n transactionMeta: TransactionMeta,\n ethQuery: EthQuery,\n ): Promise<LineaEstimateGasResponse> {\n return query(ethQuery, 'linea_estimateGas', [\n {\n from: transactionMeta.txParams.from,\n to: transactionMeta.txParams.to,\n value: transactionMeta.txParams.value,\n input: transactionMeta.txParams.data,\n },\n ]);\n }\n\n #getValuesFromMultipliers(\n value: Hex,\n multipliers: { low: number; medium: number; high: number },\n ): FeesByLevel {\n const base = hexToBN(value);\n const low = base.muln(multipliers.low);\n const medium = base.muln(multipliers.medium);\n const high = base.muln(multipliers.high);\n\n return {\n low,\n medium,\n high,\n };\n }\n\n #getMaxFees(\n baseFees: Record<GasFeeEstimateLevel, BN>,\n priorityFees: Record<GasFeeEstimateLevel, BN>,\n ): FeesByLevel {\n return {\n low: baseFees.low.add(priorityFees.low),\n medium: baseFees.medium.add(priorityFees.medium),\n high: baseFees.high.add(priorityFees.high),\n };\n }\n\n #feesToString(fees: FeesByLevel) {\n return Object.values(GasFeeEstimateLevel).map((level) =>\n fees[level].toString(10),\n );\n }\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OptimismLayer1GasFeeFlow = void 0;
|
|
4
|
-
const constants_1 = require("../constants.cjs");
|
|
5
4
|
const OracleLayer1GasFeeFlow_1 = require("./OracleLayer1GasFeeFlow.cjs");
|
|
5
|
+
const constants_1 = require("../constants.cjs");
|
|
6
6
|
const OPTIMISM_STACK_CHAIN_IDS = [
|
|
7
7
|
constants_1.CHAIN_IDS.OPTIMISM,
|
|
8
8
|
constants_1.CHAIN_IDS.OPTIMISM_TESTNET,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OptimismLayer1GasFeeFlow.cjs","sourceRoot":"","sources":["../../src/gas-flows/OptimismLayer1GasFeeFlow.ts"],"names":[],"mappings":";;;AAEA,
|
|
1
|
+
{"version":3,"file":"OptimismLayer1GasFeeFlow.cjs","sourceRoot":"","sources":["../../src/gas-flows/OptimismLayer1GasFeeFlow.ts"],"names":[],"mappings":";;;AAEA,yEAAkE;AAClE,gDAAyC;AAGzC,MAAM,wBAAwB,GAAU;IACtC,qBAAS,CAAC,QAAQ;IAClB,qBAAS,CAAC,gBAAgB;IAC1B,qBAAS,CAAC,IAAI;IACd,qBAAS,CAAC,YAAY;IACtB,qBAAS,CAAC,KAAK;IACf,qBAAS,CAAC,aAAa;IACvB,qBAAS,CAAC,IAAI;CACf,CAAC;AAEF,8GAA8G;AAC9G,MAAM,iCAAiC,GACrC,4CAA4C,CAAC;AAE/C;;GAEG;AACH,MAAa,wBAAyB,SAAQ,+CAAsB;IAClE;QACE,KAAK,CAAC,iCAAiC,CAAC,CAAC;IAC3C,CAAC;IAED,kBAAkB,CAAC,eAAgC;QACjD,OAAO,wBAAwB,CAAC,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACpE,CAAC;CACF;AARD,4DAQC","sourcesContent":["import { type Hex } from '@metamask/utils';\n\nimport { OracleLayer1GasFeeFlow } from './OracleLayer1GasFeeFlow';\nimport { CHAIN_IDS } from '../constants';\nimport type { TransactionMeta } from '../types';\n\nconst OPTIMISM_STACK_CHAIN_IDS: Hex[] = [\n CHAIN_IDS.OPTIMISM,\n CHAIN_IDS.OPTIMISM_TESTNET,\n CHAIN_IDS.BASE,\n CHAIN_IDS.BASE_TESTNET,\n CHAIN_IDS.OPBNB,\n CHAIN_IDS.OPBNB_TESTNET,\n CHAIN_IDS.ZORA,\n];\n\n// BlockExplorer link: https://optimistic.etherscan.io/address/0x420000000000000000000000000000000000000f#code\nconst OPTIMISM_GAS_PRICE_ORACLE_ADDRESS =\n '0x420000000000000000000000000000000000000F';\n\n/**\n * Optimism layer 1 gas fee flow that obtains gas fee estimate using an oracle contract.\n */\nexport class OptimismLayer1GasFeeFlow extends OracleLayer1GasFeeFlow {\n constructor() {\n super(OPTIMISM_GAS_PRICE_ORACLE_ADDRESS);\n }\n\n matchesTransaction(transactionMeta: TransactionMeta): boolean {\n return OPTIMISM_STACK_CHAIN_IDS.includes(transactionMeta.chainId);\n }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { TransactionMeta } from "../types.cjs";
|
|
2
1
|
import { OracleLayer1GasFeeFlow } from "./OracleLayer1GasFeeFlow.cjs";
|
|
2
|
+
import type { TransactionMeta } from "../types.cjs";
|
|
3
3
|
/**
|
|
4
4
|
* Optimism layer 1 gas fee flow that obtains gas fee estimate using an oracle contract.
|
|
5
5
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OptimismLayer1GasFeeFlow.d.cts","sourceRoot":"","sources":["../../src/gas-flows/OptimismLayer1GasFeeFlow.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"OptimismLayer1GasFeeFlow.d.cts","sourceRoot":"","sources":["../../src/gas-flows/OptimismLayer1GasFeeFlow.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,qCAAiC;AAElE,OAAO,KAAK,EAAE,eAAe,EAAE,qBAAiB;AAgBhD;;GAEG;AACH,qBAAa,wBAAyB,SAAQ,sBAAsB;;IAKlE,kBAAkB,CAAC,eAAe,EAAE,eAAe,GAAG,OAAO;CAG9D"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { TransactionMeta } from "../types.mjs";
|
|
2
1
|
import { OracleLayer1GasFeeFlow } from "./OracleLayer1GasFeeFlow.mjs";
|
|
2
|
+
import type { TransactionMeta } from "../types.mjs";
|
|
3
3
|
/**
|
|
4
4
|
* Optimism layer 1 gas fee flow that obtains gas fee estimate using an oracle contract.
|
|
5
5
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OptimismLayer1GasFeeFlow.d.mts","sourceRoot":"","sources":["../../src/gas-flows/OptimismLayer1GasFeeFlow.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"OptimismLayer1GasFeeFlow.d.mts","sourceRoot":"","sources":["../../src/gas-flows/OptimismLayer1GasFeeFlow.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,qCAAiC;AAElE,OAAO,KAAK,EAAE,eAAe,EAAE,qBAAiB;AAgBhD;;GAEG;AACH,qBAAa,wBAAyB,SAAQ,sBAAsB;;IAKlE,kBAAkB,CAAC,eAAe,EAAE,eAAe,GAAG,OAAO;CAG9D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OptimismLayer1GasFeeFlow.mjs","sourceRoot":"","sources":["../../src/gas-flows/OptimismLayer1GasFeeFlow.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"OptimismLayer1GasFeeFlow.mjs","sourceRoot":"","sources":["../../src/gas-flows/OptimismLayer1GasFeeFlow.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,qCAAiC;AAClE,OAAO,EAAE,SAAS,EAAE,yBAAqB;AAGzC,MAAM,wBAAwB,GAAU;IACtC,SAAS,CAAC,QAAQ;IAClB,SAAS,CAAC,gBAAgB;IAC1B,SAAS,CAAC,IAAI;IACd,SAAS,CAAC,YAAY;IACtB,SAAS,CAAC,KAAK;IACf,SAAS,CAAC,aAAa;IACvB,SAAS,CAAC,IAAI;CACf,CAAC;AAEF,8GAA8G;AAC9G,MAAM,iCAAiC,GACrC,4CAA4C,CAAC;AAE/C;;GAEG;AACH,MAAM,OAAO,wBAAyB,SAAQ,sBAAsB;IAClE;QACE,KAAK,CAAC,iCAAiC,CAAC,CAAC;IAC3C,CAAC;IAED,kBAAkB,CAAC,eAAgC;QACjD,OAAO,wBAAwB,CAAC,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACpE,CAAC;CACF","sourcesContent":["import { type Hex } from '@metamask/utils';\n\nimport { OracleLayer1GasFeeFlow } from './OracleLayer1GasFeeFlow';\nimport { CHAIN_IDS } from '../constants';\nimport type { TransactionMeta } from '../types';\n\nconst OPTIMISM_STACK_CHAIN_IDS: Hex[] = [\n CHAIN_IDS.OPTIMISM,\n CHAIN_IDS.OPTIMISM_TESTNET,\n CHAIN_IDS.BASE,\n CHAIN_IDS.BASE_TESTNET,\n CHAIN_IDS.OPBNB,\n CHAIN_IDS.OPBNB_TESTNET,\n CHAIN_IDS.ZORA,\n];\n\n// BlockExplorer link: https://optimistic.etherscan.io/address/0x420000000000000000000000000000000000000f#code\nconst OPTIMISM_GAS_PRICE_ORACLE_ADDRESS =\n '0x420000000000000000000000000000000000000F';\n\n/**\n * Optimism layer 1 gas fee flow that obtains gas fee estimate using an oracle contract.\n */\nexport class OptimismLayer1GasFeeFlow extends OracleLayer1GasFeeFlow {\n constructor() {\n super(OPTIMISM_GAS_PRICE_ORACLE_ADDRESS);\n }\n\n matchesTransaction(transactionMeta: TransactionMeta): boolean {\n return OPTIMISM_STACK_CHAIN_IDS.includes(transactionMeta.chainId);\n }\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ScrollLayer1GasFeeFlow = void 0;
|
|
4
|
-
const constants_1 = require("../constants.cjs");
|
|
5
4
|
const OracleLayer1GasFeeFlow_1 = require("./OracleLayer1GasFeeFlow.cjs");
|
|
5
|
+
const constants_1 = require("../constants.cjs");
|
|
6
6
|
const SCROLL_CHAIN_IDS = [constants_1.CHAIN_IDS.SCROLL, constants_1.CHAIN_IDS.SCROLL_SEPOLIA];
|
|
7
7
|
// BlockExplorer link: https://scrollscan.com/address/0x5300000000000000000000000000000000000002#code
|
|
8
8
|
const SCROLL_GAS_PRICE_ORACLE_ADDRESS = '0x5300000000000000000000000000000000000002';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScrollLayer1GasFeeFlow.cjs","sourceRoot":"","sources":["../../src/gas-flows/ScrollLayer1GasFeeFlow.ts"],"names":[],"mappings":";;;AAEA,
|
|
1
|
+
{"version":3,"file":"ScrollLayer1GasFeeFlow.cjs","sourceRoot":"","sources":["../../src/gas-flows/ScrollLayer1GasFeeFlow.ts"],"names":[],"mappings":";;;AAEA,yEAAkE;AAClE,gDAAyC;AAGzC,MAAM,gBAAgB,GAAU,CAAC,qBAAS,CAAC,MAAM,EAAE,qBAAS,CAAC,cAAc,CAAC,CAAC;AAE7E,qGAAqG;AACrG,MAAM,+BAA+B,GACnC,4CAA4C,CAAC;AAE/C;;GAEG;AACH,MAAa,sBAAuB,SAAQ,+CAAsB;IAChE;QACE,KAAK,CAAC,+BAA+B,EAAE,IAAI,CAAC,CAAC;IAC/C,CAAC;IAED,kBAAkB,CAAC,eAAgC;QACjD,OAAO,gBAAgB,CAAC,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IAC5D,CAAC;CACF;AARD,wDAQC","sourcesContent":["import { type Hex } from '@metamask/utils';\n\nimport { OracleLayer1GasFeeFlow } from './OracleLayer1GasFeeFlow';\nimport { CHAIN_IDS } from '../constants';\nimport type { TransactionMeta } from '../types';\n\nconst SCROLL_CHAIN_IDS: Hex[] = [CHAIN_IDS.SCROLL, CHAIN_IDS.SCROLL_SEPOLIA];\n\n// BlockExplorer link: https://scrollscan.com/address/0x5300000000000000000000000000000000000002#code\nconst SCROLL_GAS_PRICE_ORACLE_ADDRESS =\n '0x5300000000000000000000000000000000000002';\n\n/**\n * Scroll layer 1 gas fee flow that obtains gas fee estimate using an oracle contract.\n */\nexport class ScrollLayer1GasFeeFlow extends OracleLayer1GasFeeFlow {\n constructor() {\n super(SCROLL_GAS_PRICE_ORACLE_ADDRESS, true);\n }\n\n matchesTransaction(transactionMeta: TransactionMeta): boolean {\n return SCROLL_CHAIN_IDS.includes(transactionMeta.chainId);\n }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { TransactionMeta } from "../types.cjs";
|
|
2
1
|
import { OracleLayer1GasFeeFlow } from "./OracleLayer1GasFeeFlow.cjs";
|
|
2
|
+
import type { TransactionMeta } from "../types.cjs";
|
|
3
3
|
/**
|
|
4
4
|
* Scroll layer 1 gas fee flow that obtains gas fee estimate using an oracle contract.
|
|
5
5
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScrollLayer1GasFeeFlow.d.cts","sourceRoot":"","sources":["../../src/gas-flows/ScrollLayer1GasFeeFlow.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ScrollLayer1GasFeeFlow.d.cts","sourceRoot":"","sources":["../../src/gas-flows/ScrollLayer1GasFeeFlow.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,qCAAiC;AAElE,OAAO,KAAK,EAAE,eAAe,EAAE,qBAAiB;AAQhD;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,sBAAsB;;IAKhE,kBAAkB,CAAC,eAAe,EAAE,eAAe,GAAG,OAAO;CAG9D"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { TransactionMeta } from "../types.mjs";
|
|
2
1
|
import { OracleLayer1GasFeeFlow } from "./OracleLayer1GasFeeFlow.mjs";
|
|
2
|
+
import type { TransactionMeta } from "../types.mjs";
|
|
3
3
|
/**
|
|
4
4
|
* Scroll layer 1 gas fee flow that obtains gas fee estimate using an oracle contract.
|
|
5
5
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScrollLayer1GasFeeFlow.d.mts","sourceRoot":"","sources":["../../src/gas-flows/ScrollLayer1GasFeeFlow.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ScrollLayer1GasFeeFlow.d.mts","sourceRoot":"","sources":["../../src/gas-flows/ScrollLayer1GasFeeFlow.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,qCAAiC;AAElE,OAAO,KAAK,EAAE,eAAe,EAAE,qBAAiB;AAQhD;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,sBAAsB;;IAKhE,kBAAkB,CAAC,eAAe,EAAE,eAAe,GAAG,OAAO;CAG9D"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CHAIN_IDS } from "../constants.mjs";
|
|
2
1
|
import { OracleLayer1GasFeeFlow } from "./OracleLayer1GasFeeFlow.mjs";
|
|
2
|
+
import { CHAIN_IDS } from "../constants.mjs";
|
|
3
3
|
const SCROLL_CHAIN_IDS = [CHAIN_IDS.SCROLL, CHAIN_IDS.SCROLL_SEPOLIA];
|
|
4
4
|
// BlockExplorer link: https://scrollscan.com/address/0x5300000000000000000000000000000000000002#code
|
|
5
5
|
const SCROLL_GAS_PRICE_ORACLE_ADDRESS = '0x5300000000000000000000000000000000000002';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScrollLayer1GasFeeFlow.mjs","sourceRoot":"","sources":["../../src/gas-flows/ScrollLayer1GasFeeFlow.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ScrollLayer1GasFeeFlow.mjs","sourceRoot":"","sources":["../../src/gas-flows/ScrollLayer1GasFeeFlow.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,qCAAiC;AAClE,OAAO,EAAE,SAAS,EAAE,yBAAqB;AAGzC,MAAM,gBAAgB,GAAU,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC;AAE7E,qGAAqG;AACrG,MAAM,+BAA+B,GACnC,4CAA4C,CAAC;AAE/C;;GAEG;AACH,MAAM,OAAO,sBAAuB,SAAQ,sBAAsB;IAChE;QACE,KAAK,CAAC,+BAA+B,EAAE,IAAI,CAAC,CAAC;IAC/C,CAAC;IAED,kBAAkB,CAAC,eAAgC;QACjD,OAAO,gBAAgB,CAAC,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IAC5D,CAAC;CACF","sourcesContent":["import { type Hex } from '@metamask/utils';\n\nimport { OracleLayer1GasFeeFlow } from './OracleLayer1GasFeeFlow';\nimport { CHAIN_IDS } from '../constants';\nimport type { TransactionMeta } from '../types';\n\nconst SCROLL_CHAIN_IDS: Hex[] = [CHAIN_IDS.SCROLL, CHAIN_IDS.SCROLL_SEPOLIA];\n\n// BlockExplorer link: https://scrollscan.com/address/0x5300000000000000000000000000000000000002#code\nconst SCROLL_GAS_PRICE_ORACLE_ADDRESS =\n '0x5300000000000000000000000000000000000002';\n\n/**\n * Scroll layer 1 gas fee flow that obtains gas fee estimate using an oracle contract.\n */\nexport class ScrollLayer1GasFeeFlow extends OracleLayer1GasFeeFlow {\n constructor() {\n super(SCROLL_GAS_PRICE_ORACLE_ADDRESS, true);\n }\n\n matchesTransaction(transactionMeta: TransactionMeta): boolean {\n return SCROLL_CHAIN_IDS.includes(transactionMeta.chainId);\n }\n}\n"]}
|