@metamask/transaction-controller 52.1.0 → 52.3.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 +55 -4
- package/dist/TransactionController.cjs +111 -28
- package/dist/TransactionController.cjs.map +1 -1
- package/dist/TransactionController.d.cts +33 -5
- package/dist/TransactionController.d.cts.map +1 -1
- package/dist/TransactionController.d.mts +33 -5
- package/dist/TransactionController.d.mts.map +1 -1
- package/dist/TransactionController.mjs +114 -31
- package/dist/TransactionController.mjs.map +1 -1
- package/dist/constants.cjs +1 -0
- package/dist/constants.cjs.map +1 -1
- package/dist/constants.d.cts +1 -0
- package/dist/constants.d.cts.map +1 -1
- package/dist/constants.d.mts +1 -0
- package/dist/constants.d.mts.map +1 -1
- package/dist/constants.mjs +1 -0
- package/dist/constants.mjs.map +1 -1
- package/dist/gas-flows/DefaultGasFeeFlow.cjs +1 -3
- package/dist/gas-flows/DefaultGasFeeFlow.cjs.map +1 -1
- package/dist/gas-flows/DefaultGasFeeFlow.d.cts +2 -2
- package/dist/gas-flows/DefaultGasFeeFlow.d.cts.map +1 -1
- package/dist/gas-flows/DefaultGasFeeFlow.d.mts +2 -2
- package/dist/gas-flows/DefaultGasFeeFlow.d.mts.map +1 -1
- package/dist/gas-flows/DefaultGasFeeFlow.mjs +1 -3
- package/dist/gas-flows/DefaultGasFeeFlow.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 +5 -1
- package/dist/gas-flows/LineaGasFeeFlow.d.cts.map +1 -1
- package/dist/gas-flows/LineaGasFeeFlow.d.mts +5 -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 +5 -1
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.d.cts.map +1 -1
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.d.mts +5 -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/OracleLayer1GasFeeFlow.cjs.map +1 -1
- package/dist/gas-flows/OracleLayer1GasFeeFlow.d.cts +5 -1
- package/dist/gas-flows/OracleLayer1GasFeeFlow.d.cts.map +1 -1
- package/dist/gas-flows/OracleLayer1GasFeeFlow.d.mts +5 -1
- package/dist/gas-flows/OracleLayer1GasFeeFlow.d.mts.map +1 -1
- package/dist/gas-flows/OracleLayer1GasFeeFlow.mjs.map +1 -1
- package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.cjs +123 -0
- package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.cjs.map +1 -0
- package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.d.cts +28 -0
- package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.d.cts.map +1 -0
- package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.d.mts +28 -0
- package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.d.mts.map +1 -0
- package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.mjs +118 -0
- package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.mjs.map +1 -0
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.cjs +1 -1
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.cjs.map +1 -1
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.d.cts +5 -1
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.d.cts.map +1 -1
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.d.mts +5 -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/gas-flows/TestGasFeeFlow.cjs +1 -1
- package/dist/gas-flows/TestGasFeeFlow.cjs.map +1 -1
- package/dist/gas-flows/TestGasFeeFlow.d.cts +2 -2
- package/dist/gas-flows/TestGasFeeFlow.d.cts.map +1 -1
- package/dist/gas-flows/TestGasFeeFlow.d.mts +2 -2
- package/dist/gas-flows/TestGasFeeFlow.d.mts.map +1 -1
- package/dist/gas-flows/TestGasFeeFlow.mjs +1 -1
- package/dist/gas-flows/TestGasFeeFlow.mjs.map +1 -1
- package/dist/helpers/GasFeePoller.cjs +11 -8
- package/dist/helpers/GasFeePoller.cjs.map +1 -1
- package/dist/helpers/GasFeePoller.d.cts +6 -5
- package/dist/helpers/GasFeePoller.d.cts.map +1 -1
- package/dist/helpers/GasFeePoller.d.mts +6 -5
- package/dist/helpers/GasFeePoller.d.mts.map +1 -1
- package/dist/helpers/GasFeePoller.mjs +11 -8
- package/dist/helpers/GasFeePoller.mjs.map +1 -1
- package/dist/helpers/IncomingTransactionHelper.cjs +2 -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 +2 -1
- package/dist/helpers/IncomingTransactionHelper.mjs.map +1 -1
- package/dist/helpers/PendingTransactionTracker.cjs +6 -2
- package/dist/helpers/PendingTransactionTracker.cjs.map +1 -1
- package/dist/helpers/PendingTransactionTracker.d.cts +5 -2
- package/dist/helpers/PendingTransactionTracker.d.cts.map +1 -1
- package/dist/helpers/PendingTransactionTracker.d.mts +5 -2
- package/dist/helpers/PendingTransactionTracker.d.mts.map +1 -1
- package/dist/helpers/PendingTransactionTracker.mjs +6 -2
- package/dist/helpers/PendingTransactionTracker.mjs.map +1 -1
- package/dist/helpers/TransactionPoller.cjs +12 -8
- package/dist/helpers/TransactionPoller.cjs.map +1 -1
- package/dist/helpers/TransactionPoller.d.cts +7 -3
- package/dist/helpers/TransactionPoller.d.cts.map +1 -1
- package/dist/helpers/TransactionPoller.d.mts +7 -3
- package/dist/helpers/TransactionPoller.d.mts.map +1 -1
- package/dist/helpers/TransactionPoller.mjs +11 -7
- package/dist/helpers/TransactionPoller.mjs.map +1 -1
- package/dist/hooks/CollectPublishHook.cjs +84 -0
- package/dist/hooks/CollectPublishHook.cjs.map +1 -0
- package/dist/hooks/CollectPublishHook.d.cts +29 -0
- package/dist/hooks/CollectPublishHook.d.cts.map +1 -0
- package/dist/hooks/CollectPublishHook.d.mts +29 -0
- package/dist/hooks/CollectPublishHook.d.mts.map +1 -0
- package/dist/hooks/CollectPublishHook.mjs +80 -0
- package/dist/hooks/CollectPublishHook.mjs.map +1 -0
- package/dist/hooks/ExtraTransactionsPublishHook.cjs +90 -0
- package/dist/hooks/ExtraTransactionsPublishHook.cjs.map +1 -0
- package/dist/hooks/ExtraTransactionsPublishHook.d.cts +18 -0
- package/dist/hooks/ExtraTransactionsPublishHook.d.cts.map +1 -0
- package/dist/hooks/ExtraTransactionsPublishHook.d.mts +18 -0
- package/dist/hooks/ExtraTransactionsPublishHook.d.mts.map +1 -0
- package/dist/hooks/ExtraTransactionsPublishHook.mjs +86 -0
- package/dist/hooks/ExtraTransactionsPublishHook.mjs.map +1 -0
- 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.map +1 -1
- package/dist/types.d.cts +161 -7
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +161 -7
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/dist/utils/batch.cjs +142 -1
- package/dist/utils/batch.cjs.map +1 -1
- package/dist/utils/batch.d.cts +7 -1
- package/dist/utils/batch.d.cts.map +1 -1
- package/dist/utils/batch.d.mts +7 -1
- package/dist/utils/batch.d.mts.map +1 -1
- package/dist/utils/batch.mjs +142 -1
- package/dist/utils/batch.mjs.map +1 -1
- package/dist/utils/eip7702.cjs +12 -0
- package/dist/utils/eip7702.cjs.map +1 -1
- package/dist/utils/eip7702.d.cts.map +1 -1
- package/dist/utils/eip7702.d.mts.map +1 -1
- package/dist/utils/eip7702.mjs +12 -0
- package/dist/utils/eip7702.mjs.map +1 -1
- package/dist/utils/feature-flags.cjs +39 -2
- package/dist/utils/feature-flags.cjs.map +1 -1
- package/dist/utils/feature-flags.d.cts +49 -0
- package/dist/utils/feature-flags.d.cts.map +1 -1
- package/dist/utils/feature-flags.d.mts +49 -0
- package/dist/utils/feature-flags.d.mts.map +1 -1
- package/dist/utils/feature-flags.mjs +36 -1
- package/dist/utils/feature-flags.mjs.map +1 -1
- package/dist/utils/gas-fees.cjs +21 -3
- package/dist/utils/gas-fees.cjs.map +1 -1
- package/dist/utils/gas-fees.d.cts +14 -0
- package/dist/utils/gas-fees.d.cts.map +1 -1
- package/dist/utils/gas-fees.d.mts +14 -0
- package/dist/utils/gas-fees.d.mts.map +1 -1
- package/dist/utils/gas-fees.mjs +19 -2
- package/dist/utils/gas-fees.mjs.map +1 -1
- package/dist/utils/gas-flow.cjs +3 -2
- package/dist/utils/gas-flow.cjs.map +1 -1
- package/dist/utils/gas-flow.d.cts +3 -1
- package/dist/utils/gas-flow.d.cts.map +1 -1
- package/dist/utils/gas-flow.d.mts +3 -1
- package/dist/utils/gas-flow.d.mts.map +1 -1
- package/dist/utils/gas-flow.mjs +3 -2
- package/dist/utils/gas-flow.mjs.map +1 -1
- package/dist/utils/gas.cjs +7 -3
- package/dist/utils/gas.cjs.map +1 -1
- package/dist/utils/gas.mjs +7 -3
- package/dist/utils/gas.mjs.map +1 -1
- package/dist/utils/layer1-gas-fee-flow.cjs +9 -4
- 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 +9 -4
- package/dist/utils/layer1-gas-fee-flow.mjs.map +1 -1
- package/dist/utils/nonce.cjs +3 -3
- package/dist/utils/nonce.cjs.map +1 -1
- package/dist/utils/nonce.d.cts +2 -2
- package/dist/utils/nonce.d.cts.map +1 -1
- package/dist/utils/nonce.d.mts +2 -2
- package/dist/utils/nonce.d.mts.map +1 -1
- package/dist/utils/nonce.mjs +3 -3
- package/dist/utils/nonce.mjs.map +1 -1
- package/dist/utils/simulation-api.cjs.map +1 -1
- package/dist/utils/simulation-api.d.cts +37 -0
- package/dist/utils/simulation-api.d.cts.map +1 -1
- package/dist/utils/simulation-api.d.mts +37 -0
- package/dist/utils/simulation-api.d.mts.map +1 -1
- package/dist/utils/simulation-api.mjs.map +1 -1
- package/dist/utils/simulation.cjs +63 -9
- package/dist/utils/simulation.cjs.map +1 -1
- package/dist/utils/simulation.d.cts +7 -2
- package/dist/utils/simulation.d.cts.map +1 -1
- package/dist/utils/simulation.d.mts +7 -2
- package/dist/utils/simulation.d.mts.map +1 -1
- package/dist/utils/simulation.mjs +63 -9
- package/dist/utils/simulation.mjs.map +1 -1
- package/dist/utils/utils.cjs +23 -1
- package/dist/utils/utils.cjs.map +1 -1
- package/dist/utils/utils.d.cts +8 -0
- package/dist/utils/utils.d.cts.map +1 -1
- package/dist/utils/utils.d.mts +8 -0
- package/dist/utils/utils.d.mts.map +1 -1
- package/dist/utils/utils.mjs +22 -1
- package/dist/utils/utils.mjs.map +1 -1
- package/package.json +1 -1
package/dist/constants.cjs
CHANGED
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,EAA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,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"]}
|
|
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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I,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;AAEW,QAAA,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 MEGAETH_TESTNET: '0x18c6',\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
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
|
|
1
|
+
{"version":3,"file":"constants.d.cts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCZ,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
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
|
|
1
|
+
{"version":3,"file":"constants.d.mts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCZ,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
package/dist/constants.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.mjs","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":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rE,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"]}
|
|
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,QAAQ,EAAE,OAAO;IACjB,gBAAgB,EAAE,OAAO;IACzB,SAAS,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AAO,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 MEGAETH_TESTNET: '0x18c6',\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"]}
|
|
@@ -20,7 +20,7 @@ class DefaultGasFeeFlow {
|
|
|
20
20
|
constructor() {
|
|
21
21
|
_DefaultGasFeeFlow_instances.add(this);
|
|
22
22
|
}
|
|
23
|
-
matchesTransaction(
|
|
23
|
+
matchesTransaction() {
|
|
24
24
|
return true;
|
|
25
25
|
}
|
|
26
26
|
async getGasFees(request) {
|
|
@@ -41,8 +41,6 @@ class DefaultGasFeeFlow {
|
|
|
41
41
|
response = __classPrivateFieldGet(this, _DefaultGasFeeFlow_instances, "m", _DefaultGasFeeFlow_getGasPriceEstimates).call(this, gasFeeEstimates);
|
|
42
42
|
break;
|
|
43
43
|
default:
|
|
44
|
-
// TODO: Either fix this lint violation or explain why it's necessary to ignore.
|
|
45
|
-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
46
44
|
throw new Error(`Unsupported gas estimate type: ${gasEstimateType}`);
|
|
47
45
|
}
|
|
48
46
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultGasFeeFlow.cjs","sourceRoot":"","sources":["../../src/gas-flows/DefaultGasFeeFlow.ts"],"names":[],"mappings":";;;;;;;;;AAKA,qEAAkE;AAElE,2CAAqD;AAErD,0CAA0C;
|
|
1
|
+
{"version":3,"file":"DefaultGasFeeFlow.cjs","sourceRoot":"","sources":["../../src/gas-flows/DefaultGasFeeFlow.ts"],"names":[],"mappings":";;;;;;;;;AAKA,qEAAkE;AAElE,2CAAqD;AAErD,0CAA0C;AAW1C,wCAAmE;AACnE,oDAAwD;AAExD,MAAM,GAAG,GAAG,IAAA,0BAAkB,EAAC,sBAAa,EAAE,sBAAsB,CAAC,CAAC;AAEtE;;GAEG;AACH,MAAa,iBAAiB;IAA9B;;IAwGA,CAAC;IAvGC,kBAAkB;QAChB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,OAA0B;QACzC,MAAM,EAAE,oBAAoB,EAAE,GAAG,OAAO,CAAC;QACzC,MAAM,EAAE,eAAe,EAAE,eAAe,EA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MAAM,CACtD,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QAClB,GAAG,MAAM;QACT,CAAC,KAAK,CAAC,EAAE,uBAAA,IAAI,uEAAgB,MAApB,IAAI,EAAiB,eAAe,EAAE,KAAK,CAAC;KACtD,CAAC,EACF,EAAyC,CAC1C,CAAC;IAEF,OAAO;QACL,IAAI,EAAE,0BAAkB,CAAC,MAAM;QAC/B,GAAG,MAAM;KACV,CAAC;AACJ,CAAC,6FAGC,eAAoC;IAEpC,OAAO;QACL,IAAI,EAAE,0BAAkB,CAAC,QAAQ;QACjC,QAAQ,EAAE,IAAA,8BAAmB,EAAC,eAAe,CAAC,QAAQ,CAAC;KACxD,CAAC;AACJ,CAAC,uFAGC,eAA0C,EAC1C,KAA0B;IAE1B,MAAM,YAAY,GAAG,IAAA,8BAAmB,EACtC,eAAe,CAAC,KAAK,CAAC,CAAC,qBAAqB,CAC7C,CAAC;IAEF,MAAM,oBAAoB,GAAG,IAAA,8BAAmB,EAC9C,eAAe,CAAC,KAAK,CAAC,CAAC,6BAA6B,CACrD,CAAC;IAEF,OAAO;QACL,YAAY;QACZ,oBAAoB;KACrB,CAAC;AACJ,CAAC,iFAGC,eAAuC,EACvC,KAA0B;IAE1B,OAAO,IAAA,8BAAmB,EAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;AACrD,CAAC","sourcesContent":["import type {\n LegacyGasPriceEstimate,\n GasFeeEstimates as FeeMarketGasPriceEstimate,\n EthGasPriceEstimate,\n} from '@metamask/gas-fee-controller';\nimport { GAS_ESTIMATE_TYPES } from '@metamask/gas-fee-controller';\nimport type { Hex } from '@metamask/utils';\nimport { createModuleLogger } from '@metamask/utils';\n\nimport { projectLogger } from '../logger';\nimport type {\n FeeMarketGasFeeEstimateForLevel,\n FeeMarketGasFeeEstimates,\n GasFeeEstimates,\n GasFeeFlow,\n GasFeeFlowRequest,\n GasFeeFlowResponse,\n GasPriceGasFeeEstimates,\n LegacyGasFeeEstimates,\n} from '../types';\nimport { GasFeeEstimateLevel, GasFeeEstimateType } from '../types';\nimport { gweiDecimalToWeiHex } from '../utils/gas-fees';\n\nconst log = createModuleLogger(projectLogger, 'default-gas-fee-flow');\n\n/**\n * The standard implementation of a gas fee flow that obtains gas fee estimates using only the GasFeeController.\n */\nexport class DefaultGasFeeFlow implements GasFeeFlow {\n matchesTransaction(): boolean {\n return true;\n }\n\n async getGasFees(request: GasFeeFlowRequest): Promise<GasFeeFlowResponse> {\n const { gasFeeControllerData } = request;\n const { gasEstimateType, gasFeeEstimates } = gasFeeControllerData;\n\n let response: GasFeeEstimates;\n\n switch (gasEstimateType) {\n case GAS_ESTIMATE_TYPES.FEE_MARKET:\n log('Using fee market estimates', gasFeeEstimates);\n response = this.#getFeeMarkEstimates(gasFeeEstimates);\n break;\n case GAS_ESTIMATE_TYPES.LEGACY:\n log('Using legacy estimates', gasFeeEstimates);\n response = this.#getLegacyEstimates(\n gasFeeEstimates as LegacyGasPriceEstimate,\n );\n break;\n case GAS_ESTIMATE_TYPES.ETH_GASPRICE:\n log('Using eth_gasPrice estimates', gasFeeEstimates);\n response = this.#getGasPriceEstimates(\n gasFeeEstimates as EthGasPriceEstimate,\n );\n break;\n default:\n throw new Error(`Unsupported gas estimate type: ${gasEstimateType}`);\n }\n\n return {\n estimates: response,\n };\n }\n\n #getFeeMarkEstimates(\n gasFeeEstimates: FeeMarketGasPriceEstimate,\n ): FeeMarketGasFeeEstimates {\n const levels = Object.values(GasFeeEstimateLevel).reduce(\n (result, level) => ({\n ...result,\n [level]: this.#getFeeMarketLevel(gasFeeEstimates, level),\n }),\n {} as Omit<FeeMarketGasFeeEstimates, 'type'>,\n );\n\n return {\n type: GasFeeEstimateType.FeeMarket,\n ...levels,\n };\n }\n\n #getLegacyEstimates(\n gasFeeEstimates: LegacyGasPriceEstimate,\n ): LegacyGasFeeEstimates {\n const levels = Object.values(GasFeeEstimateLevel).reduce(\n (result, level) => ({\n ...result,\n [level]: this.#getLegacyLevel(gasFeeEstimates, level),\n }),\n {} as Omit<LegacyGasFeeEstimates, 'type'>,\n );\n\n return {\n type: GasFeeEstimateType.Legacy,\n ...levels,\n };\n }\n\n #getGasPriceEstimates(\n gasFeeEstimates: EthGasPriceEstimate,\n ): GasPriceGasFeeEstimates {\n return {\n type: GasFeeEstimateType.GasPrice,\n gasPrice: gweiDecimalToWeiHex(gasFeeEstimates.gasPrice),\n };\n }\n\n #getFeeMarketLevel(\n gasFeeEstimates: FeeMarketGasPriceEstimate,\n level: GasFeeEstimateLevel,\n ): FeeMarketGasFeeEstimateForLevel {\n const maxFeePerGas = gweiDecimalToWeiHex(\n gasFeeEstimates[level].suggestedMaxFeePerGas,\n );\n\n const maxPriorityFeePerGas = gweiDecimalToWeiHex(\n gasFeeEstimates[level].suggestedMaxPriorityFeePerGas,\n );\n\n return {\n maxFeePerGas,\n maxPriorityFeePerGas,\n };\n }\n\n #getLegacyLevel(\n gasFeeEstimates: LegacyGasPriceEstimate,\n level: GasFeeEstimateLevel,\n ): Hex {\n return gweiDecimalToWeiHex(gasFeeEstimates[level]);\n }\n}\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { GasFeeFlow, GasFeeFlowRequest, GasFeeFlowResponse
|
|
1
|
+
import type { GasFeeFlow, GasFeeFlowRequest, GasFeeFlowResponse } from "../types.cjs";
|
|
2
2
|
/**
|
|
3
3
|
* The standard implementation of a gas fee flow that obtains gas fee estimates using only the GasFeeController.
|
|
4
4
|
*/
|
|
5
5
|
export declare class DefaultGasFeeFlow implements GasFeeFlow {
|
|
6
6
|
#private;
|
|
7
|
-
matchesTransaction(
|
|
7
|
+
matchesTransaction(): boolean;
|
|
8
8
|
getGasFees(request: GasFeeFlowRequest): Promise<GasFeeFlowResponse>;
|
|
9
9
|
}
|
|
10
10
|
//# sourceMappingURL=DefaultGasFeeFlow.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultGasFeeFlow.d.cts","sourceRoot":"","sources":["../../src/gas-flows/DefaultGasFeeFlow.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAIV,UAAU,EACV,iBAAiB,EACjB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"DefaultGasFeeFlow.d.cts","sourceRoot":"","sources":["../../src/gas-flows/DefaultGasFeeFlow.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAIV,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAGnB,qBAAiB;AAMlB;;GAEG;AACH,qBAAa,iBAAkB,YAAW,UAAU;;IAClD,kBAAkB,IAAI,OAAO;IAIvB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAmG1E"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { GasFeeFlow, GasFeeFlowRequest, GasFeeFlowResponse
|
|
1
|
+
import type { GasFeeFlow, GasFeeFlowRequest, GasFeeFlowResponse } from "../types.mjs";
|
|
2
2
|
/**
|
|
3
3
|
* The standard implementation of a gas fee flow that obtains gas fee estimates using only the GasFeeController.
|
|
4
4
|
*/
|
|
5
5
|
export declare class DefaultGasFeeFlow implements GasFeeFlow {
|
|
6
6
|
#private;
|
|
7
|
-
matchesTransaction(
|
|
7
|
+
matchesTransaction(): boolean;
|
|
8
8
|
getGasFees(request: GasFeeFlowRequest): Promise<GasFeeFlowResponse>;
|
|
9
9
|
}
|
|
10
10
|
//# sourceMappingURL=DefaultGasFeeFlow.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultGasFeeFlow.d.mts","sourceRoot":"","sources":["../../src/gas-flows/DefaultGasFeeFlow.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAIV,UAAU,EACV,iBAAiB,EACjB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"DefaultGasFeeFlow.d.mts","sourceRoot":"","sources":["../../src/gas-flows/DefaultGasFeeFlow.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAIV,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAGnB,qBAAiB;AAMlB;;GAEG;AACH,qBAAa,iBAAkB,YAAW,UAAU;;IAClD,kBAAkB,IAAI,OAAO;IAIvB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAmG1E"}
|
|
@@ -17,7 +17,7 @@ export class DefaultGasFeeFlow {
|
|
|
17
17
|
constructor() {
|
|
18
18
|
_DefaultGasFeeFlow_instances.add(this);
|
|
19
19
|
}
|
|
20
|
-
matchesTransaction(
|
|
20
|
+
matchesTransaction() {
|
|
21
21
|
return true;
|
|
22
22
|
}
|
|
23
23
|
async getGasFees(request) {
|
|
@@ -38,8 +38,6 @@ export class DefaultGasFeeFlow {
|
|
|
38
38
|
response = __classPrivateFieldGet(this, _DefaultGasFeeFlow_instances, "m", _DefaultGasFeeFlow_getGasPriceEstimates).call(this, gasFeeEstimates);
|
|
39
39
|
break;
|
|
40
40
|
default:
|
|
41
|
-
// TODO: Either fix this lint violation or explain why it's necessary to ignore.
|
|
42
|
-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
43
41
|
throw new Error(`Unsupported gas estimate type: ${gasEstimateType}`);
|
|
44
42
|
}
|
|
45
43
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultGasFeeFlow.mjs","sourceRoot":"","sources":["../../src/gas-flows/DefaultGasFeeFlow.ts"],"names":[],"mappings":";;;;;;AAKA,OAAO,EAAE,kBAAkB,EAAE,qCAAqC;AAElE,OAAO,EAAE,kBAAkB,EAAE,wBAAwB;AAErD,OAAO,EAAE,aAAa,EAAE,sBAAkB;
|
|
1
|
+
{"version":3,"file":"DefaultGasFeeFlow.mjs","sourceRoot":"","sources":["../../src/gas-flows/DefaultGasFeeFlow.ts"],"names":[],"mappings":";;;;;;AAKA,OAAO,EAAE,kBAAkB,EAAE,qCAAqC;AAElE,OAAO,EAAE,kBAAkB,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C,KAAK,CAAC,CAAC,CAAC;AACrD,CAAC","sourcesContent":["import type {\n LegacyGasPriceEstimate,\n GasFeeEstimates as FeeMarketGasPriceEstimate,\n EthGasPriceEstimate,\n} from '@metamask/gas-fee-controller';\nimport { GAS_ESTIMATE_TYPES } from '@metamask/gas-fee-controller';\nimport type { Hex } from '@metamask/utils';\nimport { createModuleLogger } from '@metamask/utils';\n\nimport { projectLogger } from '../logger';\nimport type {\n FeeMarketGasFeeEstimateForLevel,\n FeeMarketGasFeeEstimates,\n GasFeeEstimates,\n GasFeeFlow,\n GasFeeFlowRequest,\n GasFeeFlowResponse,\n GasPriceGasFeeEstimates,\n LegacyGasFeeEstimates,\n} from '../types';\nimport { GasFeeEstimateLevel, GasFeeEstimateType } from '../types';\nimport { gweiDecimalToWeiHex } from '../utils/gas-fees';\n\nconst log = createModuleLogger(projectLogger, 'default-gas-fee-flow');\n\n/**\n * The standard implementation of a gas fee flow that obtains gas fee estimates using only the GasFeeController.\n */\nexport class DefaultGasFeeFlow implements GasFeeFlow {\n matchesTransaction(): boolean {\n return true;\n }\n\n async getGasFees(request: GasFeeFlowRequest): Promise<GasFeeFlowResponse> {\n const { gasFeeControllerData } = request;\n const { gasEstimateType, gasFeeEstimates } = gasFeeControllerData;\n\n let response: GasFeeEstimates;\n\n switch (gasEstimateType) {\n case GAS_ESTIMATE_TYPES.FEE_MARKET:\n log('Using fee market estimates', gasFeeEstimates);\n response = this.#getFeeMarkEstimates(gasFeeEstimates);\n break;\n case GAS_ESTIMATE_TYPES.LEGACY:\n log('Using legacy estimates', gasFeeEstimates);\n response = this.#getLegacyEstimates(\n gasFeeEstimates as LegacyGasPriceEstimate,\n );\n break;\n case GAS_ESTIMATE_TYPES.ETH_GASPRICE:\n log('Using eth_gasPrice estimates', gasFeeEstimates);\n response = this.#getGasPriceEstimates(\n gasFeeEstimates as EthGasPriceEstimate,\n );\n break;\n default:\n throw new Error(`Unsupported gas estimate type: ${gasEstimateType}`);\n }\n\n return {\n estimates: response,\n };\n }\n\n #getFeeMarkEstimates(\n gasFeeEstimates: FeeMarketGasPriceEstimate,\n ): FeeMarketGasFeeEstimates {\n const levels = Object.values(GasFeeEstimateLevel).reduce(\n (result, level) => ({\n ...result,\n [level]: this.#getFeeMarketLevel(gasFeeEstimates, level),\n }),\n {} as Omit<FeeMarketGasFeeEstimates, 'type'>,\n );\n\n return {\n type: GasFeeEstimateType.FeeMarket,\n ...levels,\n };\n }\n\n #getLegacyEstimates(\n gasFeeEstimates: LegacyGasPriceEstimate,\n ): LegacyGasFeeEstimates {\n const levels = Object.values(GasFeeEstimateLevel).reduce(\n (result, level) => ({\n ...result,\n [level]: this.#getLegacyLevel(gasFeeEstimates, level),\n }),\n {} as Omit<LegacyGasFeeEstimates, 'type'>,\n );\n\n return {\n type: GasFeeEstimateType.Legacy,\n ...levels,\n };\n }\n\n #getGasPriceEstimates(\n gasFeeEstimates: EthGasPriceEstimate,\n ): GasPriceGasFeeEstimates {\n return {\n type: GasFeeEstimateType.GasPrice,\n gasPrice: gweiDecimalToWeiHex(gasFeeEstimates.gasPrice),\n };\n }\n\n #getFeeMarketLevel(\n gasFeeEstimates: FeeMarketGasPriceEstimate,\n level: GasFeeEstimateLevel,\n ): FeeMarketGasFeeEstimateForLevel {\n const maxFeePerGas = gweiDecimalToWeiHex(\n gasFeeEstimates[level].suggestedMaxFeePerGas,\n );\n\n const maxPriorityFeePerGas = gweiDecimalToWeiHex(\n gasFeeEstimates[level].suggestedMaxPriorityFeePerGas,\n );\n\n return {\n maxFeePerGas,\n maxPriorityFeePerGas,\n };\n }\n\n #getLegacyLevel(\n gasFeeEstimates: LegacyGasPriceEstimate,\n level: GasFeeEstimateLevel,\n ): Hex {\n return gweiDecimalToWeiHex(gasFeeEstimates[level]);\n }\n}\n"]}
|
|
@@ -37,7 +37,7 @@ class LineaGasFeeFlow {
|
|
|
37
37
|
constructor() {
|
|
38
38
|
_LineaGasFeeFlow_instances.add(this);
|
|
39
39
|
}
|
|
40
|
-
matchesTransaction(transactionMeta) {
|
|
40
|
+
matchesTransaction({ transactionMeta, }) {
|
|
41
41
|
return LINEA_CHAIN_IDS.includes(transactionMeta.chainId);
|
|
42
42
|
}
|
|
43
43
|
async getGasFees(request) {
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AAS1C,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;IACN,MAAM,EAAE,IAAI;IACZ,IAAI,EAAE,GAAG;CACV,CAAC;AAEF;;;;GAIG;AACH,MAAa,eAAe;IAA5B;;IA6GA,CAAC;IA5GC,kBAAkB,CAAC,EACjB,eAAe,GAIhB;QACC,OAAO,eAAe,CAAC,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IAC3D,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,OAA0B;QACzC,IAAI;YACF,OAAO,MAAM,uBAAA,IAAI,oEAAiB,MAArB,IAA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,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 { TransactionControllerMessenger } from '../TransactionController';\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({\n transactionMeta,\n }: {\n transactionMeta: TransactionMeta;\n messenger: TransactionControllerMessenger;\n }): 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,3 +1,4 @@
|
|
|
1
|
+
import type { TransactionControllerMessenger } from "../TransactionController.cjs";
|
|
1
2
|
import type { GasFeeFlow, GasFeeFlowRequest, GasFeeFlowResponse, TransactionMeta } from "../types.cjs";
|
|
2
3
|
/**
|
|
3
4
|
* Implementation of a gas fee flow specific to Linea networks that obtains gas fee estimates using:
|
|
@@ -6,7 +7,10 @@ import type { GasFeeFlow, GasFeeFlowRequest, GasFeeFlowResponse, TransactionMeta
|
|
|
6
7
|
*/
|
|
7
8
|
export declare class LineaGasFeeFlow implements GasFeeFlow {
|
|
8
9
|
#private;
|
|
9
|
-
matchesTransaction(transactionMeta
|
|
10
|
+
matchesTransaction({ transactionMeta, }: {
|
|
11
|
+
transactionMeta: TransactionMeta;
|
|
12
|
+
messenger: TransactionControllerMessenger;
|
|
13
|
+
}): boolean;
|
|
10
14
|
getGasFees(request: GasFeeFlowRequest): Promise<GasFeeFlowResponse>;
|
|
11
15
|
}
|
|
12
16
|
//# sourceMappingURL=LineaGasFeeFlow.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
1
|
+
{"version":3,"file":"LineaGasFeeFlow.d.cts","sourceRoot":"","sources":["../../src/gas-flows/LineaGasFeeFlow.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,8BAA8B,EAAE,qCAAiC;AAC/E,OAAO,KAAK,EAEV,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EAChB,qBAAiB;AAgClB;;;;GAIG;AACH,qBAAa,eAAgB,YAAW,UAAU;;IAChD,kBAAkB,CAAC,EACjB,eAAe,GAChB,EAAE;QACD,eAAe,EAAE,eAAe,CAAC;QACjC,SAAS,EAAE,8BAA8B,CAAC;KAC3C,GAAG,OAAO;IAIL,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAmG1E"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TransactionControllerMessenger } from "../TransactionController.mjs";
|
|
1
2
|
import type { GasFeeFlow, GasFeeFlowRequest, GasFeeFlowResponse, TransactionMeta } from "../types.mjs";
|
|
2
3
|
/**
|
|
3
4
|
* Implementation of a gas fee flow specific to Linea networks that obtains gas fee estimates using:
|
|
@@ -6,7 +7,10 @@ import type { GasFeeFlow, GasFeeFlowRequest, GasFeeFlowResponse, TransactionMeta
|
|
|
6
7
|
*/
|
|
7
8
|
export declare class LineaGasFeeFlow implements GasFeeFlow {
|
|
8
9
|
#private;
|
|
9
|
-
matchesTransaction(transactionMeta
|
|
10
|
+
matchesTransaction({ transactionMeta, }: {
|
|
11
|
+
transactionMeta: TransactionMeta;
|
|
12
|
+
messenger: TransactionControllerMessenger;
|
|
13
|
+
}): boolean;
|
|
10
14
|
getGasFees(request: GasFeeFlowRequest): Promise<GasFeeFlowResponse>;
|
|
11
15
|
}
|
|
12
16
|
//# sourceMappingURL=LineaGasFeeFlow.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
1
|
+
{"version":3,"file":"LineaGasFeeFlow.d.mts","sourceRoot":"","sources":["../../src/gas-flows/LineaGasFeeFlow.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,8BAA8B,EAAE,qCAAiC;AAC/E,OAAO,KAAK,EAEV,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EAChB,qBAAiB;AAgClB;;;;GAIG;AACH,qBAAa,eAAgB,YAAW,UAAU;;IAChD,kBAAkB,CAAC,EACjB,eAAe,GAChB,EAAE;QACD,eAAe,EAAE,eAAe,CAAC;QACjC,SAAS,EAAE,8BAA8B,CAAC;KAC3C,GAAG,OAAO;IAIL,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAmG1E"}
|
|
@@ -34,7 +34,7 @@ export class LineaGasFeeFlow {
|
|
|
34
34
|
constructor() {
|
|
35
35
|
_LineaGasFeeFlow_instances.add(this);
|
|
36
36
|
}
|
|
37
|
-
matchesTransaction(transactionMeta) {
|
|
37
|
+
matchesTransaction({ transactionMeta, }) {
|
|
38
38
|
return LINEA_CHAIN_IDS.includes(transactionMeta.chainId);
|
|
39
39
|
}
|
|
40
40
|
async getGasFees(request) {
|
|
@@ -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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,CAAC,mBAAmB,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 { TransactionControllerMessenger } from '../TransactionController';\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({\n transactionMeta,\n }: {\n transactionMeta: TransactionMeta;\n messenger: TransactionControllerMessenger;\n }): 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"]}
|
|
@@ -21,7 +21,7 @@ class OptimismLayer1GasFeeFlow extends OracleLayer1GasFeeFlow_1.OracleLayer1GasF
|
|
|
21
21
|
constructor() {
|
|
22
22
|
super(OPTIMISM_GAS_PRICE_ORACLE_ADDRESS);
|
|
23
23
|
}
|
|
24
|
-
matchesTransaction(transactionMeta) {
|
|
24
|
+
matchesTransaction({ transactionMeta, }) {
|
|
25
25
|
return OPTIMISM_STACK_CHAIN_IDS.includes(transactionMeta.chainId);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OptimismLayer1GasFeeFlow.cjs","sourceRoot":"","sources":["../../src/gas-flows/OptimismLayer1GasFeeFlow.ts"],"names":[],"mappings":";;;AAEA,yEAAkE;AAClE,gDAAyC;
|
|
1
|
+
{"version":3,"file":"OptimismLayer1GasFeeFlow.cjs","sourceRoot":"","sources":["../../src/gas-flows/OptimismLayer1GasFeeFlow.ts"],"names":[],"mappings":";;;AAEA,yEAAkE;AAClE,gDAAyC;AAIzC,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,EACjB,eAAe,GAIhB;QACC,OAAO,wBAAwB,CAAC,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACpE,CAAC;CACF;AAbD,4DAaC","sourcesContent":["import { type Hex } from '@metamask/utils';\n\nimport { OracleLayer1GasFeeFlow } from './OracleLayer1GasFeeFlow';\nimport { CHAIN_IDS } from '../constants';\nimport type { TransactionControllerMessenger } from '../TransactionController';\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({\n transactionMeta,\n }: {\n transactionMeta: TransactionMeta;\n messenger: TransactionControllerMessenger;\n }): boolean {\n return OPTIMISM_STACK_CHAIN_IDS.includes(transactionMeta.chainId);\n }\n}\n"]}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { OracleLayer1GasFeeFlow } from "./OracleLayer1GasFeeFlow.cjs";
|
|
2
|
+
import type { TransactionControllerMessenger } from "../TransactionController.cjs";
|
|
2
3
|
import type { TransactionMeta } from "../types.cjs";
|
|
3
4
|
/**
|
|
4
5
|
* Optimism layer 1 gas fee flow that obtains gas fee estimate using an oracle contract.
|
|
5
6
|
*/
|
|
6
7
|
export declare class OptimismLayer1GasFeeFlow extends OracleLayer1GasFeeFlow {
|
|
7
8
|
constructor();
|
|
8
|
-
matchesTransaction(transactionMeta
|
|
9
|
+
matchesTransaction({ transactionMeta, }: {
|
|
10
|
+
transactionMeta: TransactionMeta;
|
|
11
|
+
messenger: TransactionControllerMessenger;
|
|
12
|
+
}): boolean;
|
|
9
13
|
}
|
|
10
14
|
//# sourceMappingURL=OptimismLayer1GasFeeFlow.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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,8BAA8B,EAAE,qCAAiC;AAC/E,OAAO,KAAK,EAAE,eAAe,EAAE,qBAAiB;AAgBhD;;GAEG;AACH,qBAAa,wBAAyB,SAAQ,sBAAsB;;IAKlE,kBAAkB,CAAC,EACjB,eAAe,GAChB,EAAE;QACD,eAAe,EAAE,eAAe,CAAC;QACjC,SAAS,EAAE,8BAA8B,CAAC;KAC3C,GAAG,OAAO;CAGZ"}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { OracleLayer1GasFeeFlow } from "./OracleLayer1GasFeeFlow.mjs";
|
|
2
|
+
import type { TransactionControllerMessenger } from "../TransactionController.mjs";
|
|
2
3
|
import type { TransactionMeta } from "../types.mjs";
|
|
3
4
|
/**
|
|
4
5
|
* Optimism layer 1 gas fee flow that obtains gas fee estimate using an oracle contract.
|
|
5
6
|
*/
|
|
6
7
|
export declare class OptimismLayer1GasFeeFlow extends OracleLayer1GasFeeFlow {
|
|
7
8
|
constructor();
|
|
8
|
-
matchesTransaction(transactionMeta
|
|
9
|
+
matchesTransaction({ transactionMeta, }: {
|
|
10
|
+
transactionMeta: TransactionMeta;
|
|
11
|
+
messenger: TransactionControllerMessenger;
|
|
12
|
+
}): boolean;
|
|
9
13
|
}
|
|
10
14
|
//# sourceMappingURL=OptimismLayer1GasFeeFlow.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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,8BAA8B,EAAE,qCAAiC;AAC/E,OAAO,KAAK,EAAE,eAAe,EAAE,qBAAiB;AAgBhD;;GAEG;AACH,qBAAa,wBAAyB,SAAQ,sBAAsB;;IAKlE,kBAAkB,CAAC,EACjB,eAAe,GAChB,EAAE;QACD,eAAe,EAAE,eAAe,CAAC;QACjC,SAAS,EAAE,8BAA8B,CAAC;KAC3C,GAAG,OAAO;CAGZ"}
|
|
@@ -18,7 +18,7 @@ export class OptimismLayer1GasFeeFlow extends OracleLayer1GasFeeFlow {
|
|
|
18
18
|
constructor() {
|
|
19
19
|
super(OPTIMISM_GAS_PRICE_ORACLE_ADDRESS);
|
|
20
20
|
}
|
|
21
|
-
matchesTransaction(transactionMeta) {
|
|
21
|
+
matchesTransaction({ transactionMeta, }) {
|
|
22
22
|
return OPTIMISM_STACK_CHAIN_IDS.includes(transactionMeta.chainId);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AAIzC,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,EACjB,eAAe,GAIhB;QACC,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 { TransactionControllerMessenger } from '../TransactionController';\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({\n transactionMeta,\n }: {\n transactionMeta: TransactionMeta;\n messenger: TransactionControllerMessenger;\n }): boolean {\n return OPTIMISM_STACK_CHAIN_IDS.includes(transactionMeta.chainId);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OracleLayer1GasFeeFlow.cjs","sourceRoot":"","sources":["../../src/gas-flows/OracleLayer1GasFeeFlow.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,wDAAoD;AACpD,wDAA+E;AAE/E,2CAAqD;AAErD,0CAA0C;
|
|
1
|
+
{"version":3,"file":"OracleLayer1GasFeeFlow.cjs","sourceRoot":"","sources":["../../src/gas-flows/OracleLayer1GasFeeFlow.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,wDAAoD;AACpD,wDAA+E;AAE/E,2CAAqD;AAErD,0CAA0C;AAQ1C,kDAAsD;AAEtD,MAAM,GAAG,GAAG,IAAA,0BAAkB,EAAC,sBAAa,EAAE,4BAA4B,CAAC,CAAC;AAE5E,MAAM,SAAS,GACb,kEAAkE,CAAC;AAErE,MAAM,oBAAoB,GAAG;IAC3B;QACE,MAAM,EAAE,CAAC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AC,CAAC;IAE9D,IAAI,MAAM,KAAK,SAAS,EAAE;QACxB,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;KAC3D;IAED,OAAO;QACL,SAAS,EAAE,MAAM,CAAC,WAAW,EAAE;KAChC,CAAC;AACJ,CAAC,uHAGC,eAAgC,EAChC,IAAa;IAEb,MAAM,QAAQ,GAAG,uBAAA,IAAI,yFAAwB,MAA5B,IAAI,EAAyB,eAAe,CAAC,CAAC;IAC/D,MAAM,EAAE,OAAO,EAAE,GAAG,eAAe,CAAC;IAEpC,IAAI,uBAAuB,GAAG,IAAA,4BAAkB,EAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAEpE,IAAI,IAAI,EAAE;QACR,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QAChD,uBAAuB,GAAG,uBAAuB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;KACnE;IAED,OAAO,uBAAuB,CAAC;AACjC,CAAC,2GAGC,eAAgC;IAEhC,OAAO;QACL,GAAG,eAAe,CAAC,QAAQ;QAC3B,QAAQ,EAAE,eAAe,CAAC,QAAQ,CAAC,GAAG;KACvC,CAAC;AACJ,CAAC","sourcesContent":["import { Contract } from '@ethersproject/contracts';\nimport { Web3Provider, type ExternalProvider } from '@ethersproject/providers';\nimport type { Hex } from '@metamask/utils';\nimport { createModuleLogger } from '@metamask/utils';\n\nimport { projectLogger } from '../logger';\nimport type { TransactionControllerMessenger } from '../TransactionController';\nimport type {\n Layer1GasFeeFlow,\n Layer1GasFeeFlowRequest,\n Layer1GasFeeFlowResponse,\n TransactionMeta,\n} from '../types';\nimport { prepareTransaction } from '../utils/prepare';\n\nconst log = createModuleLogger(projectLogger, 'oracle-layer1-gas-fee-flow');\n\nconst DUMMY_KEY =\n 'abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789';\n\nconst GAS_PRICE_ORACLE_ABI = [\n {\n inputs: [{ internalType: 'bytes', name: '_data', type: 'bytes' }],\n name: 'getL1Fee',\n outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],\n stateMutability: 'view',\n type: 'function',\n },\n];\n\n/**\n * Layer 1 gas fee flow that obtains gas fee estimate using an oracle smart contract.\n */\nexport abstract class OracleLayer1GasFeeFlow implements Layer1GasFeeFlow {\n readonly #oracleAddress: Hex;\n\n readonly #signTransaction: boolean;\n\n constructor(oracleAddress: Hex, signTransaction?: boolean) {\n this.#oracleAddress = oracleAddress;\n this.#signTransaction = signTransaction ?? false;\n }\n\n abstract matchesTransaction({\n transactionMeta,\n messenger,\n }: {\n transactionMeta: TransactionMeta;\n messenger: TransactionControllerMessenger;\n }): boolean;\n\n async getLayer1Fee(\n request: Layer1GasFeeFlowRequest,\n ): Promise<Layer1GasFeeFlowResponse> {\n try {\n return await this.#getOracleLayer1GasFee(request);\n } catch (error) {\n log('Failed to get oracle layer 1 gas fee', error);\n throw new Error(`Failed to get oracle layer 1 gas fee`);\n }\n }\n\n async #getOracleLayer1GasFee(\n request: Layer1GasFeeFlowRequest,\n ): Promise<Layer1GasFeeFlowResponse> {\n const { provider, transactionMeta } = request;\n\n const contract = new Contract(\n this.#oracleAddress,\n GAS_PRICE_ORACLE_ABI,\n // Network controller provider type is incompatible with ethers provider\n new Web3Provider(provider as unknown as ExternalProvider),\n );\n\n const serializedTransaction = this.#buildUnserializedTransaction(\n transactionMeta,\n this.#signTransaction,\n ).serialize();\n\n const result = await contract.getL1Fee(serializedTransaction);\n\n if (result === undefined) {\n throw new Error('No value returned from oracle contract');\n }\n\n return {\n layer1Fee: result.toHexString(),\n };\n }\n\n #buildUnserializedTransaction(\n transactionMeta: TransactionMeta,\n sign: boolean,\n ) {\n const txParams = this.#buildTransactionParams(transactionMeta);\n const { chainId } = transactionMeta;\n\n let unserializedTransaction = prepareTransaction(chainId, txParams);\n\n if (sign) {\n const keyBuffer = Buffer.from(DUMMY_KEY, 'hex');\n unserializedTransaction = unserializedTransaction.sign(keyBuffer);\n }\n\n return unserializedTransaction;\n }\n\n #buildTransactionParams(\n transactionMeta: TransactionMeta,\n ): TransactionMeta['txParams'] {\n return {\n ...transactionMeta.txParams,\n gasLimit: transactionMeta.txParams.gas,\n };\n }\n}\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Hex } from "@metamask/utils";
|
|
2
|
+
import type { TransactionControllerMessenger } from "../TransactionController.cjs";
|
|
2
3
|
import type { Layer1GasFeeFlow, Layer1GasFeeFlowRequest, Layer1GasFeeFlowResponse, TransactionMeta } from "../types.cjs";
|
|
3
4
|
/**
|
|
4
5
|
* Layer 1 gas fee flow that obtains gas fee estimate using an oracle smart contract.
|
|
@@ -6,7 +7,10 @@ import type { Layer1GasFeeFlow, Layer1GasFeeFlowRequest, Layer1GasFeeFlowRespons
|
|
|
6
7
|
export declare abstract class OracleLayer1GasFeeFlow implements Layer1GasFeeFlow {
|
|
7
8
|
#private;
|
|
8
9
|
constructor(oracleAddress: Hex, signTransaction?: boolean);
|
|
9
|
-
abstract matchesTransaction(transactionMeta
|
|
10
|
+
abstract matchesTransaction({ transactionMeta, messenger, }: {
|
|
11
|
+
transactionMeta: TransactionMeta;
|
|
12
|
+
messenger: TransactionControllerMessenger;
|
|
13
|
+
}): boolean;
|
|
10
14
|
getLayer1Fee(request: Layer1GasFeeFlowRequest): Promise<Layer1GasFeeFlowResponse>;
|
|
11
15
|
}
|
|
12
16
|
//# sourceMappingURL=OracleLayer1GasFeeFlow.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OracleLayer1GasFeeFlow.d.cts","sourceRoot":"","sources":["../../src/gas-flows/OracleLayer1GasFeeFlow.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,wBAAwB;AAI3C,OAAO,KAAK,EACV,gBAAgB,EAChB,uBAAuB,EACvB,wBAAwB,EACxB,eAAe,EAChB,qBAAiB;AAkBlB;;GAEG;AACH,8BAAsB,sBAAuB,YAAW,gBAAgB;;gBAK1D,aAAa,EAAE,GAAG,EAAE,eAAe,CAAC,EAAE,OAAO;IAKzD,QAAQ,CAAC,kBAAkB,CAAC,eAAe,EAAE,eAAe,GAAG,OAAO;
|
|
1
|
+
{"version":3,"file":"OracleLayer1GasFeeFlow.d.cts","sourceRoot":"","sources":["../../src/gas-flows/OracleLayer1GasFeeFlow.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,wBAAwB;AAI3C,OAAO,KAAK,EAAE,8BAA8B,EAAE,qCAAiC;AAC/E,OAAO,KAAK,EACV,gBAAgB,EAChB,uBAAuB,EACvB,wBAAwB,EACxB,eAAe,EAChB,qBAAiB;AAkBlB;;GAEG;AACH,8BAAsB,sBAAuB,YAAW,gBAAgB;;gBAK1D,aAAa,EAAE,GAAG,EAAE,eAAe,CAAC,EAAE,OAAO;IAKzD,QAAQ,CAAC,kBAAkB,CAAC,EAC1B,eAAe,EACf,SAAS,GACV,EAAE;QACD,eAAe,EAAE,eAAe,CAAC;QACjC,SAAS,EAAE,8BAA8B,CAAC;KAC3C,GAAG,OAAO;IAEL,YAAY,CAChB,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,wBAAwB,CAAC;CA8DrC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Hex } from "@metamask/utils";
|
|
2
|
+
import type { TransactionControllerMessenger } from "../TransactionController.mjs";
|
|
2
3
|
import type { Layer1GasFeeFlow, Layer1GasFeeFlowRequest, Layer1GasFeeFlowResponse, TransactionMeta } from "../types.mjs";
|
|
3
4
|
/**
|
|
4
5
|
* Layer 1 gas fee flow that obtains gas fee estimate using an oracle smart contract.
|
|
@@ -6,7 +7,10 @@ import type { Layer1GasFeeFlow, Layer1GasFeeFlowRequest, Layer1GasFeeFlowRespons
|
|
|
6
7
|
export declare abstract class OracleLayer1GasFeeFlow implements Layer1GasFeeFlow {
|
|
7
8
|
#private;
|
|
8
9
|
constructor(oracleAddress: Hex, signTransaction?: boolean);
|
|
9
|
-
abstract matchesTransaction(transactionMeta
|
|
10
|
+
abstract matchesTransaction({ transactionMeta, messenger, }: {
|
|
11
|
+
transactionMeta: TransactionMeta;
|
|
12
|
+
messenger: TransactionControllerMessenger;
|
|
13
|
+
}): boolean;
|
|
10
14
|
getLayer1Fee(request: Layer1GasFeeFlowRequest): Promise<Layer1GasFeeFlowResponse>;
|
|
11
15
|
}
|
|
12
16
|
//# sourceMappingURL=OracleLayer1GasFeeFlow.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OracleLayer1GasFeeFlow.d.mts","sourceRoot":"","sources":["../../src/gas-flows/OracleLayer1GasFeeFlow.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,wBAAwB;AAI3C,OAAO,KAAK,EACV,gBAAgB,EAChB,uBAAuB,EACvB,wBAAwB,EACxB,eAAe,EAChB,qBAAiB;AAkBlB;;GAEG;AACH,8BAAsB,sBAAuB,YAAW,gBAAgB;;gBAK1D,aAAa,EAAE,GAAG,EAAE,eAAe,CAAC,EAAE,OAAO;IAKzD,QAAQ,CAAC,kBAAkB,CAAC,eAAe,EAAE,eAAe,GAAG,OAAO;
|
|
1
|
+
{"version":3,"file":"OracleLayer1GasFeeFlow.d.mts","sourceRoot":"","sources":["../../src/gas-flows/OracleLayer1GasFeeFlow.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,wBAAwB;AAI3C,OAAO,KAAK,EAAE,8BAA8B,EAAE,qCAAiC;AAC/E,OAAO,KAAK,EACV,gBAAgB,EAChB,uBAAuB,EACvB,wBAAwB,EACxB,eAAe,EAChB,qBAAiB;AAkBlB;;GAEG;AACH,8BAAsB,sBAAuB,YAAW,gBAAgB;;gBAK1D,aAAa,EAAE,GAAG,EAAE,eAAe,CAAC,EAAE,OAAO;IAKzD,QAAQ,CAAC,kBAAkB,CAAC,EAC1B,eAAe,EACf,SAAS,GACV,EAAE;QACD,eAAe,EAAE,eAAe,CAAC;QACjC,SAAS,EAAE,8BAA8B,CAAC;KAC3C,GAAG,OAAO;IAEL,YAAY,CAChB,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,wBAAwB,CAAC;CA8DrC"}
|