@metamask/transaction-controller 36.1.0 → 37.1.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 +47 -1
- package/dist/TransactionController.cjs +2071 -0
- package/dist/TransactionController.cjs.map +1 -0
- package/dist/{types/TransactionController.d.ts → TransactionController.d.cts} +19 -26
- package/dist/TransactionController.d.cts.map +1 -0
- package/dist/TransactionController.d.mts +828 -0
- package/dist/TransactionController.d.mts.map +1 -0
- package/dist/TransactionController.mjs +2072 -44
- package/dist/TransactionController.mjs.map +1 -1
- package/dist/constants.cjs +170 -0
- package/dist/constants.cjs.map +1 -0
- package/dist/{types/constants.d.ts → constants.d.cts} +1 -1
- package/dist/constants.d.cts.map +1 -0
- package/dist/constants.d.mts +143 -0
- package/dist/constants.d.mts.map +1 -0
- package/dist/constants.mjs +165 -18
- package/dist/constants.mjs.map +1 -1
- package/dist/errors.cjs +30 -0
- package/dist/{chunk-HMOSP33F.js.map → errors.cjs.map} +1 -1
- package/dist/{types/errors.d.ts → errors.d.cts} +2 -2
- package/dist/errors.d.cts.map +1 -0
- package/dist/errors.d.mts +15 -0
- package/dist/errors.d.mts.map +1 -0
- package/dist/errors.mjs +22 -14
- package/dist/errors.mjs.map +1 -1
- package/dist/gas-flows/DefaultGasFeeFlow.cjs +87 -0
- package/dist/gas-flows/DefaultGasFeeFlow.cjs.map +1 -0
- package/dist/{types/gas-flows/DefaultGasFeeFlow.d.ts → gas-flows/DefaultGasFeeFlow.d.cts} +2 -2
- package/dist/gas-flows/DefaultGasFeeFlow.d.cts.map +1 -0
- package/dist/gas-flows/DefaultGasFeeFlow.d.mts +10 -0
- package/dist/gas-flows/DefaultGasFeeFlow.d.mts.map +1 -0
- package/dist/gas-flows/DefaultGasFeeFlow.mjs +81 -13
- package/dist/gas-flows/DefaultGasFeeFlow.mjs.map +1 -1
- package/dist/gas-flows/LineaGasFeeFlow.cjs +102 -0
- package/dist/gas-flows/LineaGasFeeFlow.cjs.map +1 -0
- package/dist/{types/gas-flows/LineaGasFeeFlow.d.ts → gas-flows/LineaGasFeeFlow.d.cts} +2 -2
- package/dist/gas-flows/LineaGasFeeFlow.d.cts.map +1 -0
- package/dist/gas-flows/LineaGasFeeFlow.d.mts +12 -0
- package/dist/gas-flows/LineaGasFeeFlow.d.mts.map +1 -0
- package/dist/gas-flows/LineaGasFeeFlow.mjs +96 -14
- package/dist/gas-flows/LineaGasFeeFlow.mjs.map +1 -1
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.cjs +29 -0
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.cjs.map +1 -0
- package/dist/{types/gas-flows/OptimismLayer1GasFeeFlow.d.ts → gas-flows/OptimismLayer1GasFeeFlow.d.cts} +3 -3
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.d.cts.map +1 -0
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.d.mts +10 -0
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.d.mts.map +1 -0
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.mjs +24 -10
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.mjs.map +1 -1
- package/dist/gas-flows/OracleLayer1GasFeeFlow.cjs +92 -0
- package/dist/gas-flows/OracleLayer1GasFeeFlow.cjs.map +1 -0
- package/dist/{types/gas-flows/OracleLayer1GasFeeFlow.d.ts → gas-flows/OracleLayer1GasFeeFlow.d.cts} +3 -3
- package/dist/gas-flows/OracleLayer1GasFeeFlow.d.cts.map +1 -0
- package/dist/gas-flows/OracleLayer1GasFeeFlow.d.mts +12 -0
- package/dist/gas-flows/OracleLayer1GasFeeFlow.d.mts.map +1 -0
- package/dist/gas-flows/OracleLayer1GasFeeFlow.mjs +88 -7
- package/dist/gas-flows/OracleLayer1GasFeeFlow.mjs.map +1 -1
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.cjs +21 -0
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.cjs.map +1 -0
- package/dist/{types/gas-flows/ScrollLayer1GasFeeFlow.d.ts → gas-flows/ScrollLayer1GasFeeFlow.d.cts} +3 -3
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.d.cts.map +1 -0
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.d.mts +10 -0
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.d.mts.map +1 -0
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.mjs +16 -10
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.mjs.map +1 -1
- package/dist/gas-flows/TestGasFeeFlow.cjs +73 -0
- package/dist/{chunk-FMRLPVFZ.mjs.map → gas-flows/TestGasFeeFlow.cjs.map} +1 -1
- package/dist/{types/gas-flows/TestGasFeeFlow.d.ts → gas-flows/TestGasFeeFlow.d.cts} +2 -2
- package/dist/gas-flows/TestGasFeeFlow.d.cts.map +1 -0
- package/dist/gas-flows/TestGasFeeFlow.d.mts +12 -0
- package/dist/gas-flows/TestGasFeeFlow.d.mts.map +1 -0
- package/dist/gas-flows/TestGasFeeFlow.mjs +67 -7
- package/dist/gas-flows/TestGasFeeFlow.mjs.map +1 -1
- package/dist/helpers/EtherscanRemoteTransactionSource.cjs +149 -0
- package/dist/helpers/EtherscanRemoteTransactionSource.cjs.map +1 -0
- package/dist/{types/helpers/EtherscanRemoteTransactionSource.d.ts → helpers/EtherscanRemoteTransactionSource.d.cts} +3 -3
- package/dist/helpers/EtherscanRemoteTransactionSource.d.cts.map +1 -0
- package/dist/helpers/EtherscanRemoteTransactionSource.d.mts +15 -0
- package/dist/helpers/EtherscanRemoteTransactionSource.d.mts.map +1 -0
- package/dist/helpers/EtherscanRemoteTransactionSource.mjs +147 -10
- package/dist/helpers/EtherscanRemoteTransactionSource.mjs.map +1 -1
- package/dist/helpers/GasFeePoller.cjs +185 -0
- package/dist/helpers/GasFeePoller.cjs.map +1 -0
- package/dist/{types/helpers/GasFeePoller.d.ts → helpers/GasFeePoller.d.cts} +7 -7
- package/dist/helpers/GasFeePoller.d.cts.map +1 -0
- package/dist/helpers/GasFeePoller.d.mts +35 -0
- package/dist/helpers/GasFeePoller.d.mts.map +1 -0
- package/dist/helpers/GasFeePoller.mjs +183 -10
- package/dist/helpers/GasFeePoller.mjs.map +1 -1
- package/dist/helpers/IncomingTransactionHelper.cjs +199 -0
- package/dist/helpers/IncomingTransactionHelper.cjs.map +1 -0
- package/dist/{types/helpers/IncomingTransactionHelper.d.ts → helpers/IncomingTransactionHelper.d.cts} +6 -6
- package/dist/helpers/IncomingTransactionHelper.d.cts.map +1 -0
- package/dist/helpers/IncomingTransactionHelper.d.mts +40 -0
- package/dist/helpers/IncomingTransactionHelper.d.mts.map +1 -0
- package/dist/helpers/IncomingTransactionHelper.mjs +190 -7
- package/dist/helpers/IncomingTransactionHelper.mjs.map +1 -1
- package/dist/helpers/MultichainTrackingHelper.cjs +284 -0
- package/dist/helpers/MultichainTrackingHelper.cjs.map +1 -0
- package/dist/{types/helpers/MultichainTrackingHelper.d.ts → helpers/MultichainTrackingHelper.d.cts} +8 -8
- package/dist/helpers/MultichainTrackingHelper.d.cts.map +1 -0
- package/dist/helpers/MultichainTrackingHelper.d.mts +76 -0
- package/dist/helpers/MultichainTrackingHelper.d.mts.map +1 -0
- package/dist/helpers/MultichainTrackingHelper.mjs +282 -11
- package/dist/helpers/MultichainTrackingHelper.mjs.map +1 -1
- package/dist/helpers/PendingTransactionTracker.cjs +327 -0
- package/dist/helpers/PendingTransactionTracker.cjs.map +1 -0
- package/dist/{types/helpers/PendingTransactionTracker.d.ts → helpers/PendingTransactionTracker.d.cts} +7 -8
- package/dist/helpers/PendingTransactionTracker.d.cts.map +1 -0
- package/dist/helpers/PendingTransactionTracker.d.mts +42 -0
- package/dist/helpers/PendingTransactionTracker.d.mts.map +1 -0
- package/dist/helpers/PendingTransactionTracker.mjs +319 -8
- package/dist/helpers/PendingTransactionTracker.mjs.map +1 -1
- package/dist/index.cjs +32 -0
- package/dist/index.cjs.map +1 -0
- package/dist/{types/index.d.ts → index.d.cts} +11 -10
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +11 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +7 -76
- package/dist/index.mjs.map +1 -1
- package/dist/logger.cjs +9 -0
- package/dist/logger.cjs.map +1 -0
- package/dist/{types/logger.d.ts → logger.d.cts} +2 -2
- package/dist/logger.d.cts.map +1 -0
- package/dist/logger.d.mts +6 -0
- package/dist/logger.d.mts.map +1 -0
- package/dist/logger.mjs +5 -11
- package/dist/logger.mjs.map +1 -1
- package/dist/types.cjs +308 -0
- package/dist/types.cjs.map +1 -0
- package/dist/{types/types.d.ts → types.d.cts} +35 -35
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.mts +1027 -0
- package/dist/types.d.mts.map +1 -0
- package/dist/types.mjs +304 -23
- package/dist/types.mjs.map +1 -1
- package/dist/utils/etherscan.cjs +111 -0
- package/dist/utils/etherscan.cjs.map +1 -0
- package/dist/{types/utils/etherscan.d.ts → utils/etherscan.d.cts} +2 -2
- package/dist/utils/etherscan.d.cts.map +1 -0
- package/dist/utils/etherscan.d.mts +71 -0
- package/dist/utils/etherscan.d.mts.map +1 -0
- package/dist/utils/etherscan.mjs +104 -13
- package/dist/utils/etherscan.mjs.map +1 -1
- package/dist/utils/external-transactions.cjs +36 -0
- package/dist/utils/external-transactions.cjs.map +1 -0
- package/dist/{types/utils/external-transactions.d.ts → utils/external-transactions.d.cts} +2 -2
- package/dist/utils/external-transactions.d.cts.map +1 -0
- package/dist/utils/external-transactions.d.mts +10 -0
- package/dist/utils/external-transactions.d.mts.map +1 -0
- package/dist/utils/external-transactions.mjs +31 -8
- package/dist/utils/external-transactions.mjs.map +1 -1
- package/dist/utils/gas-fees.cjs +208 -0
- package/dist/utils/gas-fees.cjs.map +1 -0
- package/dist/{types/utils/gas-fees.d.ts → utils/gas-fees.d.cts} +5 -5
- package/dist/utils/gas-fees.d.cts.map +1 -0
- package/dist/utils/gas-fees.d.mts +26 -0
- package/dist/utils/gas-fees.d.mts.map +1 -0
- package/dist/utils/gas-fees.mjs +202 -15
- package/dist/utils/gas-fees.mjs.map +1 -1
- package/dist/utils/gas-flow.cjs +76 -0
- package/dist/utils/gas-flow.cjs.map +1 -0
- package/dist/{types/utils/gas-flow.d.ts → utils/gas-flow.d.cts} +5 -5
- package/dist/utils/gas-flow.d.cts.map +1 -0
- package/dist/utils/gas-flow.d.mts +26 -0
- package/dist/utils/gas-flow.d.mts.map +1 -0
- package/dist/utils/gas-flow.mjs +70 -10
- package/dist/utils/gas-flow.mjs.map +1 -1
- package/dist/utils/gas.cjs +112 -0
- package/dist/utils/gas.cjs.map +1 -0
- package/dist/{types/utils/gas.d.ts → utils/gas.d.cts} +4 -4
- package/dist/utils/gas.d.cts.map +1 -0
- package/dist/utils/gas.d.mts +28 -0
- package/dist/utils/gas.d.mts.map +1 -0
- package/dist/utils/gas.mjs +105 -19
- package/dist/utils/gas.mjs.map +1 -1
- package/dist/utils/history.cjs +164 -0
- package/dist/utils/history.cjs.map +1 -0
- package/dist/{types/utils/history.d.ts → utils/history.d.cts} +2 -2
- package/dist/utils/history.d.cts.map +1 -0
- package/dist/utils/history.d.mts +29 -0
- package/dist/utils/history.d.mts.map +1 -0
- package/dist/utils/history.mjs +163 -13
- package/dist/utils/history.mjs.map +1 -1
- package/dist/utils/layer1-gas-fee-flow.cjs +59 -0
- package/dist/utils/layer1-gas-fee-flow.cjs.map +1 -0
- package/dist/{types/utils/layer1-gas-fee-flow.d.ts → utils/layer1-gas-fee-flow.d.cts} +4 -4
- package/dist/utils/layer1-gas-fee-flow.d.cts.map +1 -0
- package/dist/utils/layer1-gas-fee-flow.d.mts +25 -0
- package/dist/utils/layer1-gas-fee-flow.d.mts.map +1 -0
- package/dist/utils/layer1-gas-fee-flow.mjs +53 -10
- package/dist/utils/layer1-gas-fee-flow.mjs.map +1 -1
- package/dist/utils/nonce.cjs +66 -0
- package/dist/utils/nonce.cjs.map +1 -0
- package/dist/{types/utils/nonce.d.ts → utils/nonce.d.cts} +3 -3
- package/dist/utils/nonce.d.cts.map +1 -0
- package/dist/utils/nonce.d.mts +21 -0
- package/dist/utils/nonce.d.mts.map +1 -0
- package/dist/utils/nonce.mjs +60 -10
- package/dist/utils/nonce.mjs.map +1 -1
- package/dist/utils/retry.cjs +89 -0
- package/dist/utils/retry.cjs.map +1 -0
- package/dist/{types/utils/retry.d.ts → utils/retry.d.cts} +3 -3
- package/dist/utils/retry.d.cts.map +1 -0
- package/dist/utils/retry.d.mts +11 -0
- package/dist/utils/retry.d.mts.map +1 -0
- package/dist/utils/retry.mjs +84 -7
- package/dist/utils/retry.mjs.map +1 -1
- package/dist/utils/simulation-api.cjs +72 -0
- package/dist/utils/simulation-api.cjs.map +1 -0
- package/dist/{types/utils/simulation-api.d.ts → utils/simulation-api.d.cts} +2 -2
- package/dist/utils/simulation-api.d.cts.map +1 -0
- package/dist/utils/simulation-api.d.mts +107 -0
- package/dist/utils/simulation-api.d.mts.map +1 -0
- package/dist/utils/simulation-api.mjs +67 -10
- package/dist/utils/simulation-api.mjs.map +1 -1
- package/dist/utils/simulation.cjs +443 -0
- package/dist/utils/simulation.cjs.map +1 -0
- package/dist/{types/utils/simulation.d.ts → utils/simulation.d.cts} +6 -6
- package/dist/utils/simulation.d.cts.map +1 -0
- package/dist/utils/simulation.d.mts +46 -0
- package/dist/utils/simulation.d.mts.map +1 -0
- package/dist/utils/simulation.mjs +436 -15
- package/dist/utils/simulation.mjs.map +1 -1
- package/dist/utils/swaps.cjs +309 -0
- package/dist/utils/swaps.cjs.map +1 -0
- package/dist/{types/utils/swaps.d.ts → utils/swaps.d.cts} +5 -5
- package/dist/utils/swaps.d.cts.map +1 -0
- package/dist/utils/swaps.d.mts +84 -0
- package/dist/utils/swaps.d.mts.map +1 -0
- package/dist/utils/swaps.mjs +303 -22
- package/dist/utils/swaps.mjs.map +1 -1
- package/dist/utils/transaction-type.cjs +115 -0
- package/dist/utils/transaction-type.cjs.map +1 -0
- package/dist/{types/utils/transaction-type.d.ts → utils/transaction-type.d.cts} +3 -3
- package/dist/utils/transaction-type.d.cts.map +1 -0
- package/dist/utils/transaction-type.d.mts +14 -0
- package/dist/utils/transaction-type.d.mts.map +1 -0
- package/dist/utils/transaction-type.mjs +110 -10
- package/dist/utils/transaction-type.mjs.map +1 -1
- package/dist/utils/utils.cjs +151 -0
- package/dist/utils/utils.cjs.map +1 -0
- package/dist/{types/utils/utils.d.ts → utils/utils.d.cts} +2 -2
- package/dist/utils/utils.d.cts.map +1 -0
- package/dist/utils/utils.d.mts +52 -0
- package/dist/utils/utils.d.mts.map +1 -0
- package/dist/utils/utils.mjs +139 -21
- package/dist/utils/utils.mjs.map +1 -1
- package/dist/utils/validation.cjs +267 -0
- package/dist/{chunk-4OYPDGHO.js.map → utils/validation.cjs.map} +1 -1
- package/dist/{types/utils/validation.d.ts → utils/validation.d.cts} +2 -2
- package/dist/utils/validation.d.cts.map +1 -0
- package/dist/utils/validation.d.mts +20 -0
- package/dist/utils/validation.d.mts.map +1 -0
- package/dist/utils/validation.mjs +261 -11
- package/dist/utils/validation.mjs.map +1 -1
- package/package.json +20 -15
- package/dist/TransactionController.js +0 -46
- package/dist/TransactionController.js.map +0 -1
- package/dist/chunk-2XKEAKQG.js +0 -55
- package/dist/chunk-2XKEAKQG.js.map +0 -1
- package/dist/chunk-3AVRGHUO.mjs +0 -360
- package/dist/chunk-3AVRGHUO.mjs.map +0 -1
- package/dist/chunk-3ZV5YEUV.mjs +0 -239
- package/dist/chunk-3ZV5YEUV.mjs.map +0 -1
- package/dist/chunk-4OYPDGHO.js +0 -201
- package/dist/chunk-4V4XIPCI.mjs +0 -338
- package/dist/chunk-4V4XIPCI.mjs.map +0 -1
- package/dist/chunk-5G6OHAXI.mjs +0 -137
- package/dist/chunk-5G6OHAXI.mjs.map +0 -1
- package/dist/chunk-5HYWLTVQ.js +0 -228
- package/dist/chunk-5HYWLTVQ.js.map +0 -1
- package/dist/chunk-5QVDIVJH.js +0 -68
- package/dist/chunk-5QVDIVJH.js.map +0 -1
- package/dist/chunk-6B5BEO3R.mjs +0 -399
- package/dist/chunk-6B5BEO3R.mjs.map +0 -1
- package/dist/chunk-6DDVVUJC.mjs +0 -50
- package/dist/chunk-6DDVVUJC.mjs.map +0 -1
- package/dist/chunk-6OLJWLKK.js +0 -338
- package/dist/chunk-6OLJWLKK.js.map +0 -1
- package/dist/chunk-7LXE4KHV.js +0 -40
- package/dist/chunk-7LXE4KHV.js.map +0 -1
- package/dist/chunk-7NMV2NPM.js +0 -172
- package/dist/chunk-7NMV2NPM.js.map +0 -1
- package/dist/chunk-AWIJZAW3.mjs +0 -112
- package/dist/chunk-AWIJZAW3.mjs.map +0 -1
- package/dist/chunk-BZV72SCF.js +0 -226
- package/dist/chunk-BZV72SCF.js.map +0 -1
- package/dist/chunk-EGQCE3FK.mjs +0 -85
- package/dist/chunk-EGQCE3FK.mjs.map +0 -1
- package/dist/chunk-EHWAY6XU.js +0 -112
- package/dist/chunk-EHWAY6XU.js.map +0 -1
- package/dist/chunk-EKJXGERC.mjs +0 -172
- package/dist/chunk-EKJXGERC.mjs.map +0 -1
- package/dist/chunk-FG74Z3F5.mjs +0 -102
- package/dist/chunk-FG74Z3F5.mjs.map +0 -1
- package/dist/chunk-FMRLPVFZ.mjs +0 -66
- package/dist/chunk-FRKQ3Z2L.mjs +0 -40
- package/dist/chunk-FRKQ3Z2L.mjs.map +0 -1
- package/dist/chunk-HMOSP33F.js +0 -36
- package/dist/chunk-HQSNKCXI.mjs +0 -36
- package/dist/chunk-HQSNKCXI.mjs.map +0 -1
- package/dist/chunk-JIFPK37W.mjs +0 -257
- package/dist/chunk-JIFPK37W.mjs.map +0 -1
- package/dist/chunk-JOQK7A5G.mjs +0 -68
- package/dist/chunk-JOQK7A5G.mjs.map +0 -1
- package/dist/chunk-K4KOSAGM.mjs +0 -61
- package/dist/chunk-K4KOSAGM.mjs.map +0 -1
- package/dist/chunk-KG4UW4K4.mjs +0 -88
- package/dist/chunk-KG4UW4K4.mjs.map +0 -1
- package/dist/chunk-KT6UAKBB.js +0 -61
- package/dist/chunk-KT6UAKBB.js.map +0 -1
- package/dist/chunk-KTGMNUTQ.js +0 -106
- package/dist/chunk-KTGMNUTQ.js.map +0 -1
- package/dist/chunk-KYRW4BLA.mjs +0 -121
- package/dist/chunk-KYRW4BLA.mjs.map +0 -1
- package/dist/chunk-LFFYCDHB.mjs +0 -92
- package/dist/chunk-LFFYCDHB.mjs.map +0 -1
- package/dist/chunk-NNCUD3QF.js +0 -360
- package/dist/chunk-NNCUD3QF.js.map +0 -1
- package/dist/chunk-NNHSNPT2.mjs +0 -67
- package/dist/chunk-NNHSNPT2.mjs.map +0 -1
- package/dist/chunk-NOHEXQ7Y.mjs +0 -55
- package/dist/chunk-NOHEXQ7Y.mjs.map +0 -1
- package/dist/chunk-NYKRCWBG.js +0 -31
- package/dist/chunk-NYKRCWBG.js.map +0 -1
- package/dist/chunk-O6ZZVIFH.mjs +0 -176
- package/dist/chunk-O6ZZVIFH.mjs.map +0 -1
- package/dist/chunk-PRUNMTRD.js +0 -50
- package/dist/chunk-PRUNMTRD.js.map +0 -1
- package/dist/chunk-PSZ34BI5.js +0 -92
- package/dist/chunk-PSZ34BI5.js.map +0 -1
- package/dist/chunk-QKV7E5BO.js +0 -257
- package/dist/chunk-QKV7E5BO.js.map +0 -1
- package/dist/chunk-RHDPOIS4.js +0 -239
- package/dist/chunk-RHDPOIS4.js.map +0 -1
- package/dist/chunk-S6VGOPUY.js +0 -14
- package/dist/chunk-S6VGOPUY.js.map +0 -1
- package/dist/chunk-SD6CWFDF.js +0 -88
- package/dist/chunk-SD6CWFDF.js.map +0 -1
- package/dist/chunk-SFFOC25Q.mjs +0 -226
- package/dist/chunk-SFFOC25Q.mjs.map +0 -1
- package/dist/chunk-SMC5Q6ZH.mjs +0 -120
- package/dist/chunk-SMC5Q6ZH.mjs.map +0 -1
- package/dist/chunk-TIE3CPF7.js +0 -120
- package/dist/chunk-TIE3CPF7.js.map +0 -1
- package/dist/chunk-TJMQEH57.js +0 -66
- package/dist/chunk-TJMQEH57.js.map +0 -1
- package/dist/chunk-UGN7PBON.js +0 -176
- package/dist/chunk-UGN7PBON.js.map +0 -1
- package/dist/chunk-UHAFIPSL.js +0 -121
- package/dist/chunk-UHAFIPSL.js.map +0 -1
- package/dist/chunk-UHSRHP55.mjs +0 -106
- package/dist/chunk-UHSRHP55.mjs.map +0 -1
- package/dist/chunk-ULD4JC3Q.js +0 -399
- package/dist/chunk-ULD4JC3Q.js.map +0 -1
- package/dist/chunk-UQQWZT6C.mjs +0 -14
- package/dist/chunk-UQQWZT6C.mjs.map +0 -1
- package/dist/chunk-V72C4MCR.js +0 -137
- package/dist/chunk-V72C4MCR.js.map +0 -1
- package/dist/chunk-VEVVBHP3.mjs +0 -31
- package/dist/chunk-VEVVBHP3.mjs.map +0 -1
- package/dist/chunk-VGFPVAKX.mjs +0 -228
- package/dist/chunk-VGFPVAKX.mjs.map +0 -1
- package/dist/chunk-VKWOHNDO.js +0 -2509
- package/dist/chunk-VKWOHNDO.js.map +0 -1
- package/dist/chunk-WR5F34OW.js +0 -23
- package/dist/chunk-WR5F34OW.js.map +0 -1
- package/dist/chunk-X4XSEYPL.mjs +0 -201
- package/dist/chunk-X4XSEYPL.mjs.map +0 -1
- package/dist/chunk-XTMJ25EF.mjs +0 -2509
- package/dist/chunk-XTMJ25EF.mjs.map +0 -1
- package/dist/chunk-XUI43LEZ.mjs +0 -30
- package/dist/chunk-XUI43LEZ.mjs.map +0 -1
- package/dist/chunk-XVYXRCRL.js +0 -85
- package/dist/chunk-XVYXRCRL.js.map +0 -1
- package/dist/chunk-YVCX6Z75.js +0 -102
- package/dist/chunk-YVCX6Z75.js.map +0 -1
- package/dist/chunk-YWLMT7XH.js +0 -67
- package/dist/chunk-YWLMT7XH.js.map +0 -1
- package/dist/chunk-Z4BLTVTB.js +0 -30
- package/dist/chunk-Z4BLTVTB.js.map +0 -1
- package/dist/chunk-Z4GV3YQQ.mjs +0 -23
- package/dist/chunk-Z4GV3YQQ.mjs.map +0 -1
- package/dist/constants.js +0 -20
- package/dist/constants.js.map +0 -1
- package/dist/errors.js +0 -15
- package/dist/errors.js.map +0 -1
- package/dist/gas-flows/DefaultGasFeeFlow.js +0 -15
- package/dist/gas-flows/DefaultGasFeeFlow.js.map +0 -1
- package/dist/gas-flows/LineaGasFeeFlow.js +0 -16
- package/dist/gas-flows/LineaGasFeeFlow.js.map +0 -1
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.js +0 -11
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.js.map +0 -1
- package/dist/gas-flows/OracleLayer1GasFeeFlow.js +0 -9
- package/dist/gas-flows/OracleLayer1GasFeeFlow.js.map +0 -1
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.js +0 -11
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.js.map +0 -1
- package/dist/gas-flows/TestGasFeeFlow.js +0 -9
- package/dist/gas-flows/TestGasFeeFlow.js.map +0 -1
- package/dist/helpers/EtherscanRemoteTransactionSource.js +0 -12
- package/dist/helpers/EtherscanRemoteTransactionSource.js.map +0 -1
- package/dist/helpers/GasFeePoller.js +0 -12
- package/dist/helpers/GasFeePoller.js.map +0 -1
- package/dist/helpers/IncomingTransactionHelper.js +0 -9
- package/dist/helpers/IncomingTransactionHelper.js.map +0 -1
- package/dist/helpers/MultichainTrackingHelper.js +0 -13
- package/dist/helpers/MultichainTrackingHelper.js.map +0 -1
- package/dist/helpers/PendingTransactionTracker.js +0 -10
- package/dist/helpers/PendingTransactionTracker.js.map +0 -1
- package/dist/index.js +0 -77
- package/dist/index.js.map +0 -1
- package/dist/logger.js +0 -12
- package/dist/logger.js.map +0 -1
- package/dist/tsconfig.build.tsbuildinfo +0 -1
- package/dist/types/TransactionController.d.ts.map +0 -1
- package/dist/types/constants.d.ts.map +0 -1
- package/dist/types/errors.d.ts.map +0 -1
- package/dist/types/gas-flows/DefaultGasFeeFlow.d.ts.map +0 -1
- package/dist/types/gas-flows/LineaGasFeeFlow.d.ts.map +0 -1
- package/dist/types/gas-flows/OptimismLayer1GasFeeFlow.d.ts.map +0 -1
- package/dist/types/gas-flows/OracleLayer1GasFeeFlow.d.ts.map +0 -1
- package/dist/types/gas-flows/ScrollLayer1GasFeeFlow.d.ts.map +0 -1
- package/dist/types/gas-flows/TestGasFeeFlow.d.ts.map +0 -1
- package/dist/types/helpers/EtherscanRemoteTransactionSource.d.ts.map +0 -1
- package/dist/types/helpers/GasFeePoller.d.ts.map +0 -1
- package/dist/types/helpers/IncomingTransactionHelper.d.ts.map +0 -1
- package/dist/types/helpers/MultichainTrackingHelper.d.ts.map +0 -1
- package/dist/types/helpers/PendingTransactionTracker.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/logger.d.ts.map +0 -1
- package/dist/types/types.d.ts.map +0 -1
- package/dist/types/utils/etherscan.d.ts.map +0 -1
- package/dist/types/utils/external-transactions.d.ts.map +0 -1
- package/dist/types/utils/gas-fees.d.ts.map +0 -1
- package/dist/types/utils/gas-flow.d.ts.map +0 -1
- package/dist/types/utils/gas.d.ts.map +0 -1
- package/dist/types/utils/history.d.ts.map +0 -1
- package/dist/types/utils/layer1-gas-fee-flow.d.ts.map +0 -1
- package/dist/types/utils/nonce.d.ts.map +0 -1
- package/dist/types/utils/retry.d.ts.map +0 -1
- package/dist/types/utils/simulation-api.d.ts.map +0 -1
- package/dist/types/utils/simulation.d.ts.map +0 -1
- package/dist/types/utils/swaps.d.ts.map +0 -1
- package/dist/types/utils/transaction-type.d.ts.map +0 -1
- package/dist/types/utils/utils.d.ts.map +0 -1
- package/dist/types/utils/validation.d.ts.map +0 -1
- package/dist/types.js +0 -24
- package/dist/types.js.map +0 -1
- package/dist/utils/etherscan.js +0 -14
- package/dist/utils/etherscan.js.map +0 -1
- package/dist/utils/external-transactions.js +0 -9
- package/dist/utils/external-transactions.js.map +0 -1
- package/dist/utils/gas-fees.js +0 -16
- package/dist/utils/gas-fees.js.map +0 -1
- package/dist/utils/gas-flow.js +0 -11
- package/dist/utils/gas-flow.js.map +0 -1
- package/dist/utils/gas.js +0 -20
- package/dist/utils/gas.js.map +0 -1
- package/dist/utils/history.js +0 -14
- package/dist/utils/history.js.map +0 -1
- package/dist/utils/layer1-gas-fee-flow.js +0 -11
- package/dist/utils/layer1-gas-fee-flow.js.map +0 -1
- package/dist/utils/nonce.js +0 -11
- package/dist/utils/nonce.js.map +0 -1
- package/dist/utils/retry.js +0 -8
- package/dist/utils/retry.js.map +0 -1
- package/dist/utils/simulation-api.js +0 -11
- package/dist/utils/simulation-api.js.map +0 -1
- package/dist/utils/simulation.js +0 -17
- package/dist/utils/simulation.js.map +0 -1
- package/dist/utils/swaps.js +0 -24
- package/dist/utils/swaps.js.map +0 -1
- package/dist/utils/transaction-type.js +0 -11
- package/dist/utils/transaction-type.js.map +0 -1
- package/dist/utils/utils.js +0 -23
- package/dist/utils/utils.js.map +0 -1
- package/dist/utils/validation.js +0 -12
- package/dist/utils/validation.js.map +0 -1
package/dist/chunk-TJMQEH57.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var _chunkZ4BLTVTBjs = require('./chunk-Z4BLTVTB.js');
|
|
7
|
-
|
|
8
|
-
// src/gas-flows/TestGasFeeFlow.ts
|
|
9
|
-
var _controllerutils = require('@metamask/controller-utils');
|
|
10
|
-
var INCREMENT = 1e15;
|
|
11
|
-
var LEVEL_DIFFERENCE = 0.5;
|
|
12
|
-
var _counter, _getValueForTotalFee, getValueForTotalFee_fn;
|
|
13
|
-
var TestGasFeeFlow = class {
|
|
14
|
-
constructor() {
|
|
15
|
-
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _getValueForTotalFee);
|
|
16
|
-
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _counter, 1);
|
|
17
|
-
}
|
|
18
|
-
matchesTransaction(_transactionMeta) {
|
|
19
|
-
return true;
|
|
20
|
-
}
|
|
21
|
-
async getGasFees(request) {
|
|
22
|
-
const { transactionMeta } = request;
|
|
23
|
-
const { txParams } = transactionMeta;
|
|
24
|
-
const { gas: gasHex } = txParams;
|
|
25
|
-
if (!gasHex) {
|
|
26
|
-
throw new Error("Cannot estimate fee without gas value");
|
|
27
|
-
}
|
|
28
|
-
const gasDecimal = parseInt(gasHex, 16);
|
|
29
|
-
const difference = INCREMENT * LEVEL_DIFFERENCE;
|
|
30
|
-
const mediumMaxTarget = (_chunkZ4BLTVTBjs.__privateGet.call(void 0, this, _counter) + 1) * INCREMENT;
|
|
31
|
-
const mediumPriorityTarget = _chunkZ4BLTVTBjs.__privateGet.call(void 0, this, _counter) * INCREMENT;
|
|
32
|
-
const lowMaxTarget = mediumMaxTarget - difference;
|
|
33
|
-
const lowPriorityTarget = mediumPriorityTarget - difference;
|
|
34
|
-
const highMaxTarget = mediumMaxTarget + difference;
|
|
35
|
-
const highPriorityTarget = mediumPriorityTarget + difference;
|
|
36
|
-
_chunkZ4BLTVTBjs.__privateSet.call(void 0, this, _counter, _chunkZ4BLTVTBjs.__privateGet.call(void 0, this, _counter) + 1);
|
|
37
|
-
return {
|
|
38
|
-
estimates: {
|
|
39
|
-
type: "fee-market" /* FeeMarket */,
|
|
40
|
-
low: {
|
|
41
|
-
maxFeePerGas: _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _getValueForTotalFee, getValueForTotalFee_fn).call(this, lowMaxTarget, gasDecimal),
|
|
42
|
-
maxPriorityFeePerGas: _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _getValueForTotalFee, getValueForTotalFee_fn).call(this, lowPriorityTarget, gasDecimal)
|
|
43
|
-
},
|
|
44
|
-
medium: {
|
|
45
|
-
maxFeePerGas: _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _getValueForTotalFee, getValueForTotalFee_fn).call(this, mediumMaxTarget, gasDecimal),
|
|
46
|
-
maxPriorityFeePerGas: _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _getValueForTotalFee, getValueForTotalFee_fn).call(this, mediumPriorityTarget, gasDecimal)
|
|
47
|
-
},
|
|
48
|
-
high: {
|
|
49
|
-
maxFeePerGas: _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _getValueForTotalFee, getValueForTotalFee_fn).call(this, highMaxTarget, gasDecimal),
|
|
50
|
-
maxPriorityFeePerGas: _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _getValueForTotalFee, getValueForTotalFee_fn).call(this, highPriorityTarget, gasDecimal)
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
_counter = new WeakMap();
|
|
57
|
-
_getValueForTotalFee = new WeakSet();
|
|
58
|
-
getValueForTotalFee_fn = function(totalFee, gas) {
|
|
59
|
-
const feeDecimal = Math.ceil(totalFee / gas);
|
|
60
|
-
return _controllerutils.toHex.call(void 0, feeDecimal);
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
exports.TestGasFeeFlow = TestGasFeeFlow;
|
|
66
|
-
//# sourceMappingURL=chunk-TJMQEH57.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/gas-flows/TestGasFeeFlow.ts"],"names":[],"mappings":";;;;;;;;AAAA,SAAS,aAAa;AAWtB,IAAM,YAAY;AAClB,IAAM,mBAAmB;AAZzB;AAmBO,IAAM,iBAAN,MAA2C;AAAA,EAA3C;AA0DL;AAzDA,iCAAW;AAAA;AAAA,EAEX,mBAAmB,kBAA4C;AAC7D,WAAO;AAAA,EACT;AAAA,EAEA,MAAM,WAAW,SAAyD;AACxE,UAAM,EAAE,gBAAgB,IAAI;AAC5B,UAAM,EAAE,SAAS,IAAI;AACrB,UAAM,EAAE,KAAK,OAAO,IAAI;AAExB,QAAI,CAAC,QAAQ;AACX,YAAM,IAAI,MAAM,uCAAuC;AAAA,IACzD;AAEA,UAAM,aAAa,SAAS,QAAQ,EAAE;AACtC,UAAM,aAAa,YAAY;AAE/B,UAAM,mBAAmB,mBAAK,YAAW,KAAK;AAC9C,UAAM,uBAAuB,mBAAK,YAAW;AAE7C,UAAM,eAAe,kBAAkB;AACvC,UAAM,oBAAoB,uBAAuB;AAEjD,UAAM,gBAAgB,kBAAkB;AACxC,UAAM,qBAAqB,uBAAuB;AAElD,uBAAK,UAAL,mBAAK,YAAY;AAEjB,WAAO;AAAA,MACL,WAAW;AAAA,QACT;AAAA,QACA,KAAK;AAAA,UACH,cAAc,sBAAK,8CAAL,WAA0B,cAAc;AAAA,UACtD,sBAAsB,sBAAK,8CAAL,WACpB,mBACA;AAAA,QAEJ;AAAA,QACA,QAAQ;AAAA,UACN,cAAc,sBAAK,8CAAL,WAA0B,iBAAiB;AAAA,UACzD,sBAAsB,sBAAK,8CAAL,WACpB,sBACA;AAAA,QAEJ;AAAA,QACA,MAAM;AAAA,UACJ,cAAc,sBAAK,8CAAL,WAA0B,eAAe;AAAA,UACvD,sBAAsB,sBAAK,8CAAL,WACpB,oBACA;AAAA,QAEJ;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAMF;AA7DE;AAyDA;AAAA,yBAAoB,SAAC,UAAkB,KAAkB;AACvD,QAAM,aAAa,KAAK,KAAK,WAAW,GAAG;AAC3C,SAAO,MAAM,UAAU;AACzB","sourcesContent":["import { toHex } from '@metamask/controller-utils';\nimport type { Hex } from '@metamask/utils';\n\nimport {\n GasFeeEstimateType,\n type GasFeeFlow,\n type GasFeeFlowRequest,\n type GasFeeFlowResponse,\n type TransactionMeta,\n} from '../types';\n\nconst INCREMENT = 1e15; // 0.001 ETH\nconst LEVEL_DIFFERENCE = 0.5;\n\n/**\n * A gas fee flow to facilitate testing in the clients.\n * Increments the total gas fee by a fixed amount each time it is called.\n * Relies on the transaction's gas value to generate a distinct total fee in the UI.\n */\nexport class TestGasFeeFlow implements GasFeeFlow {\n #counter = 1;\n\n matchesTransaction(_transactionMeta: TransactionMeta): boolean {\n return true;\n }\n\n async getGasFees(request: GasFeeFlowRequest): Promise<GasFeeFlowResponse> {\n const { transactionMeta } = request;\n const { txParams } = transactionMeta;\n const { gas: gasHex } = txParams;\n\n if (!gasHex) {\n throw new Error('Cannot estimate fee without gas value');\n }\n\n const gasDecimal = parseInt(gasHex, 16);\n const difference = INCREMENT * LEVEL_DIFFERENCE;\n\n const mediumMaxTarget = (this.#counter + 1) * INCREMENT;\n const mediumPriorityTarget = this.#counter * INCREMENT;\n\n const lowMaxTarget = mediumMaxTarget - difference;\n const lowPriorityTarget = mediumPriorityTarget - difference;\n\n const highMaxTarget = mediumMaxTarget + difference;\n const highPriorityTarget = mediumPriorityTarget + difference;\n\n this.#counter += 1;\n\n return {\n estimates: {\n type: GasFeeEstimateType.FeeMarket,\n low: {\n maxFeePerGas: this.#getValueForTotalFee(lowMaxTarget, gasDecimal),\n maxPriorityFeePerGas: this.#getValueForTotalFee(\n lowPriorityTarget,\n gasDecimal,\n ),\n },\n medium: {\n maxFeePerGas: this.#getValueForTotalFee(mediumMaxTarget, gasDecimal),\n maxPriorityFeePerGas: this.#getValueForTotalFee(\n mediumPriorityTarget,\n gasDecimal,\n ),\n },\n high: {\n maxFeePerGas: this.#getValueForTotalFee(highMaxTarget, gasDecimal),\n maxPriorityFeePerGas: this.#getValueForTotalFee(\n highPriorityTarget,\n gasDecimal,\n ),\n },\n },\n };\n }\n\n #getValueForTotalFee(totalFee: number, gas: number): Hex {\n const feeDecimal = Math.ceil(totalFee / gas);\n return toHex(feeDecimal);\n }\n}\n"]}
|
package/dist/chunk-UGN7PBON.js
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/constants.ts
|
|
2
|
-
var CHAIN_IDS = {
|
|
3
|
-
MAINNET: "0x1",
|
|
4
|
-
GOERLI: "0x5",
|
|
5
|
-
BASE: "0x2105",
|
|
6
|
-
BASE_TESTNET: "0x14a33",
|
|
7
|
-
BSC: "0x38",
|
|
8
|
-
BSC_TESTNET: "0x61",
|
|
9
|
-
OPTIMISM: "0xa",
|
|
10
|
-
OPTIMISM_TESTNET: "0x1a4",
|
|
11
|
-
OPBNB: "0xcc",
|
|
12
|
-
OPBNB_TESTNET: "0x15eb",
|
|
13
|
-
OPTIMISM_SEPOLIA: "0xaa37dc",
|
|
14
|
-
POLYGON: "0x89",
|
|
15
|
-
POLYGON_TESTNET: "0x13881",
|
|
16
|
-
AVALANCHE: "0xa86a",
|
|
17
|
-
AVALANCHE_TESTNET: "0xa869",
|
|
18
|
-
FANTOM: "0xfa",
|
|
19
|
-
FANTOM_TESTNET: "0xfa2",
|
|
20
|
-
SEPOLIA: "0xaa36a7",
|
|
21
|
-
LINEA_GOERLI: "0xe704",
|
|
22
|
-
LINEA_SEPOLIA: "0xe705",
|
|
23
|
-
LINEA_MAINNET: "0xe708",
|
|
24
|
-
MOONBEAM: "0x504",
|
|
25
|
-
MOONBEAM_TESTNET: "0x507",
|
|
26
|
-
MOONRIVER: "0x505",
|
|
27
|
-
GNOSIS: "0x64",
|
|
28
|
-
ARBITRUM: "0xa4b1",
|
|
29
|
-
ZKSYNC_ERA: "0x144",
|
|
30
|
-
ZORA: "0x76adf1",
|
|
31
|
-
SCROLL: "0x82750",
|
|
32
|
-
SCROLL_SEPOLIA: "0x8274f"
|
|
33
|
-
};
|
|
34
|
-
var DEFAULT_ETHERSCAN_DOMAIN = "etherscan.io";
|
|
35
|
-
var DEFAULT_ETHERSCAN_SUBDOMAIN_PREFIX = "api";
|
|
36
|
-
var ETHERSCAN_SUPPORTED_NETWORKS = {
|
|
37
|
-
[CHAIN_IDS.GOERLI]: {
|
|
38
|
-
domain: DEFAULT_ETHERSCAN_DOMAIN,
|
|
39
|
-
subdomain: `${DEFAULT_ETHERSCAN_SUBDOMAIN_PREFIX}-goerli`
|
|
40
|
-
},
|
|
41
|
-
[CHAIN_IDS.MAINNET]: {
|
|
42
|
-
domain: DEFAULT_ETHERSCAN_DOMAIN,
|
|
43
|
-
subdomain: DEFAULT_ETHERSCAN_SUBDOMAIN_PREFIX
|
|
44
|
-
},
|
|
45
|
-
[CHAIN_IDS.SEPOLIA]: {
|
|
46
|
-
domain: DEFAULT_ETHERSCAN_DOMAIN,
|
|
47
|
-
subdomain: `${DEFAULT_ETHERSCAN_SUBDOMAIN_PREFIX}-sepolia`
|
|
48
|
-
},
|
|
49
|
-
[CHAIN_IDS.LINEA_GOERLI]: {
|
|
50
|
-
domain: "lineascan.build",
|
|
51
|
-
subdomain: `${DEFAULT_ETHERSCAN_SUBDOMAIN_PREFIX}-goerli`
|
|
52
|
-
},
|
|
53
|
-
[CHAIN_IDS.LINEA_SEPOLIA]: {
|
|
54
|
-
domain: "lineascan.build",
|
|
55
|
-
subdomain: `${DEFAULT_ETHERSCAN_SUBDOMAIN_PREFIX}-sepolia`
|
|
56
|
-
},
|
|
57
|
-
[CHAIN_IDS.LINEA_MAINNET]: {
|
|
58
|
-
domain: "lineascan.build",
|
|
59
|
-
subdomain: DEFAULT_ETHERSCAN_SUBDOMAIN_PREFIX
|
|
60
|
-
},
|
|
61
|
-
[CHAIN_IDS.BSC]: {
|
|
62
|
-
domain: "bscscan.com",
|
|
63
|
-
subdomain: DEFAULT_ETHERSCAN_SUBDOMAIN_PREFIX
|
|
64
|
-
},
|
|
65
|
-
[CHAIN_IDS.BSC_TESTNET]: {
|
|
66
|
-
domain: "bscscan.com",
|
|
67
|
-
subdomain: `${DEFAULT_ETHERSCAN_SUBDOMAIN_PREFIX}-testnet`
|
|
68
|
-
},
|
|
69
|
-
[CHAIN_IDS.OPTIMISM]: {
|
|
70
|
-
domain: DEFAULT_ETHERSCAN_DOMAIN,
|
|
71
|
-
subdomain: `${DEFAULT_ETHERSCAN_SUBDOMAIN_PREFIX}-optimistic`
|
|
72
|
-
},
|
|
73
|
-
[CHAIN_IDS.OPTIMISM_SEPOLIA]: {
|
|
74
|
-
domain: DEFAULT_ETHERSCAN_DOMAIN,
|
|
75
|
-
subdomain: `${DEFAULT_ETHERSCAN_SUBDOMAIN_PREFIX}-sepolia-optimistic`
|
|
76
|
-
},
|
|
77
|
-
[CHAIN_IDS.POLYGON]: {
|
|
78
|
-
domain: "polygonscan.com",
|
|
79
|
-
subdomain: DEFAULT_ETHERSCAN_SUBDOMAIN_PREFIX
|
|
80
|
-
},
|
|
81
|
-
[CHAIN_IDS.POLYGON_TESTNET]: {
|
|
82
|
-
domain: "polygonscan.com",
|
|
83
|
-
subdomain: `${DEFAULT_ETHERSCAN_SUBDOMAIN_PREFIX}-mumbai`
|
|
84
|
-
},
|
|
85
|
-
[CHAIN_IDS.AVALANCHE]: {
|
|
86
|
-
domain: "snowtrace.io",
|
|
87
|
-
subdomain: DEFAULT_ETHERSCAN_SUBDOMAIN_PREFIX
|
|
88
|
-
},
|
|
89
|
-
[CHAIN_IDS.AVALANCHE_TESTNET]: {
|
|
90
|
-
domain: "snowtrace.io",
|
|
91
|
-
subdomain: `${DEFAULT_ETHERSCAN_SUBDOMAIN_PREFIX}-testnet`
|
|
92
|
-
},
|
|
93
|
-
[CHAIN_IDS.FANTOM]: {
|
|
94
|
-
domain: "ftmscan.com",
|
|
95
|
-
subdomain: DEFAULT_ETHERSCAN_SUBDOMAIN_PREFIX
|
|
96
|
-
},
|
|
97
|
-
[CHAIN_IDS.FANTOM_TESTNET]: {
|
|
98
|
-
domain: "ftmscan.com",
|
|
99
|
-
subdomain: `${DEFAULT_ETHERSCAN_SUBDOMAIN_PREFIX}-testnet`
|
|
100
|
-
},
|
|
101
|
-
[CHAIN_IDS.MOONBEAM]: {
|
|
102
|
-
domain: "moonscan.io",
|
|
103
|
-
subdomain: `${DEFAULT_ETHERSCAN_SUBDOMAIN_PREFIX}-moonbeam`
|
|
104
|
-
},
|
|
105
|
-
[CHAIN_IDS.MOONBEAM_TESTNET]: {
|
|
106
|
-
domain: "moonscan.io",
|
|
107
|
-
subdomain: `${DEFAULT_ETHERSCAN_SUBDOMAIN_PREFIX}-moonbase`
|
|
108
|
-
},
|
|
109
|
-
[CHAIN_IDS.MOONRIVER]: {
|
|
110
|
-
domain: "moonscan.io",
|
|
111
|
-
subdomain: `${DEFAULT_ETHERSCAN_SUBDOMAIN_PREFIX}-moonriver`
|
|
112
|
-
},
|
|
113
|
-
[CHAIN_IDS.GNOSIS]: {
|
|
114
|
-
domain: "gnosisscan.io",
|
|
115
|
-
subdomain: `${DEFAULT_ETHERSCAN_SUBDOMAIN_PREFIX}-gnosis`
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
var GAS_BUFFER_CHAIN_OVERRIDES = {
|
|
119
|
-
[CHAIN_IDS.OPTIMISM]: 1,
|
|
120
|
-
[CHAIN_IDS.OPTIMISM_SEPOLIA]: 1
|
|
121
|
-
};
|
|
122
|
-
var ABI_SIMULATION_ERC20_WRAPPED = [
|
|
123
|
-
{
|
|
124
|
-
anonymous: false,
|
|
125
|
-
inputs: [
|
|
126
|
-
{ indexed: true, name: "to", type: "address" },
|
|
127
|
-
{ indexed: false, name: "wad", type: "uint256" }
|
|
128
|
-
],
|
|
129
|
-
name: "Deposit",
|
|
130
|
-
type: "event"
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
anonymous: false,
|
|
134
|
-
inputs: [
|
|
135
|
-
{ indexed: true, name: "from", type: "address" },
|
|
136
|
-
{ indexed: false, name: "wad", type: "uint256" }
|
|
137
|
-
],
|
|
138
|
-
name: "Withdrawal",
|
|
139
|
-
type: "event"
|
|
140
|
-
}
|
|
141
|
-
];
|
|
142
|
-
var ABI_SIMULATION_ERC721_LEGACY = [
|
|
143
|
-
{
|
|
144
|
-
anonymous: false,
|
|
145
|
-
inputs: [
|
|
146
|
-
{
|
|
147
|
-
indexed: false,
|
|
148
|
-
name: "_from",
|
|
149
|
-
type: "address"
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
indexed: false,
|
|
153
|
-
name: "_to",
|
|
154
|
-
type: "address"
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
indexed: false,
|
|
158
|
-
name: "_tokenId",
|
|
159
|
-
type: "uint256"
|
|
160
|
-
}
|
|
161
|
-
],
|
|
162
|
-
name: "Transfer",
|
|
163
|
-
type: "event"
|
|
164
|
-
}
|
|
165
|
-
];
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
exports.CHAIN_IDS = CHAIN_IDS; exports.DEFAULT_ETHERSCAN_DOMAIN = DEFAULT_ETHERSCAN_DOMAIN; exports.DEFAULT_ETHERSCAN_SUBDOMAIN_PREFIX = DEFAULT_ETHERSCAN_SUBDOMAIN_PREFIX; exports.ETHERSCAN_SUPPORTED_NETWORKS = ETHERSCAN_SUPPORTED_NETWORKS; exports.GAS_BUFFER_CHAIN_OVERRIDES = GAS_BUFFER_CHAIN_OVERRIDES; exports.ABI_SIMULATION_ERC20_WRAPPED = ABI_SIMULATION_ERC20_WRAPPED; exports.ABI_SIMULATION_ERC721_LEGACY = ABI_SIMULATION_ERC721_LEGACY;
|
|
176
|
-
//# sourceMappingURL=chunk-UGN7PBON.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/constants.ts"],"names":[],"mappings":";AAAO,IAAM,YAAY;AAAA,EACvB,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,cAAc;AAAA,EACd,KAAK;AAAA,EACL,aAAa;AAAA,EACb,UAAU;AAAA,EACV,kBAAkB;AAAA,EAClB,OAAO;AAAA,EACP,eAAe;AAAA,EACf,kBAAkB;AAAA,EAClB,SAAS;AAAA,EACT,iBAAiB;AAAA,EACjB,WAAW;AAAA,EACX,mBAAmB;AAAA,EACnB,QAAQ;AAAA,EACR,gBAAgB;AAAA,EAChB,SAAS;AAAA,EACT,cAAc;AAAA,EAC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ACR;AAAA,EACA;AAAA,IACE,WAAW;AAAA,IACX,QAAQ;AAAA,MACN,EAAE,SAAS,MAAM,MAAM,QAAQ,MAAM,UAAU;AAAA,MAC/C,EAAE,SAAS,OAAO,MAAM,OAAO,MAAM,UAAU;AAAA,IACjD;AAAA,IACA,MAAM;AAAA,IACN,MAAM;AAAA,EACR;AACF;AAGO,IAAM,+BAA+B;AAAA,EAC1C;AAAA,IACE,WAAW;AAAA,IACX,QAAQ;AAAA,MACN;AAAA,QACE,SAAS;AAAA,QACT,MAAM;AAAA,QACN,MAAM;AAAA,MACR;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,MAAM;AAAA,QACN,MAAM;AAAA,MACR;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,MAAM;AAAA,QACN,MAAM;AAAA,MACR;AAAA,IACF;AAAA,IACA,MAAM;AAAA,IACN,MAAM;AAAA,EACR;AACF","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 DEFAULT_ETHERSCAN_DOMAIN = 'etherscan.io';\nexport const DEFAULT_ETHERSCAN_SUBDOMAIN_PREFIX = 'api';\n\nexport const ETHERSCAN_SUPPORTED_NETWORKS = {\n [CHAIN_IDS.GOERLI]: {\n domain: DEFAULT_ETHERSCAN_DOMAIN,\n subdomain: `${DEFAULT_ETHERSCAN_SUBDOMAIN_PREFIX}-goerli`,\n },\n [CHAIN_IDS.MAINNET]: {\n domain: DEFAULT_ETHERSCAN_DOMAIN,\n subdomain: DEFAULT_ETHERSCAN_SUBDOMAIN_PREFIX,\n },\n [CHAIN_IDS.SEPOLIA]: {\n domain: DEFAULT_ETHERSCAN_DOMAIN,\n subdomain: `${DEFAULT_ETHERSCAN_SUBDOMAIN_PREFIX}-sepolia`,\n },\n [CHAIN_IDS.LINEA_GOERLI]: {\n domain: 'lineascan.build',\n subdomain: `${DEFAULT_ETHERSCAN_SUBDOMAIN_PREFIX}-goerli`,\n },\n [CHAIN_IDS.LINEA_SEPOLIA]: {\n domain: 'lineascan.build',\n subdomain: `${DEFAULT_ETHERSCAN_SUBDOMAIN_PREFIX}-sepolia`,\n },\n [CHAIN_IDS.LINEA_MAINNET]: {\n domain: 'lineascan.build',\n subdomain: DEFAULT_ETHERSCAN_SUBDOMAIN_PREFIX,\n },\n [CHAIN_IDS.BSC]: {\n domain: 'bscscan.com',\n subdomain: DEFAULT_ETHERSCAN_SUBDOMAIN_PREFIX,\n },\n [CHAIN_IDS.BSC_TESTNET]: {\n domain: 'bscscan.com',\n subdomain: `${DEFAULT_ETHERSCAN_SUBDOMAIN_PREFIX}-testnet`,\n },\n [CHAIN_IDS.OPTIMISM]: {\n domain: DEFAULT_ETHERSCAN_DOMAIN,\n subdomain: `${DEFAULT_ETHERSCAN_SUBDOMAIN_PREFIX}-optimistic`,\n },\n [CHAIN_IDS.OPTIMISM_SEPOLIA]: {\n domain: DEFAULT_ETHERSCAN_DOMAIN,\n subdomain: `${DEFAULT_ETHERSCAN_SUBDOMAIN_PREFIX}-sepolia-optimistic`,\n },\n [CHAIN_IDS.POLYGON]: {\n domain: 'polygonscan.com',\n subdomain: DEFAULT_ETHERSCAN_SUBDOMAIN_PREFIX,\n },\n [CHAIN_IDS.POLYGON_TESTNET]: {\n domain: 'polygonscan.com',\n subdomain: `${DEFAULT_ETHERSCAN_SUBDOMAIN_PREFIX}-mumbai`,\n },\n [CHAIN_IDS.AVALANCHE]: {\n domain: 'snowtrace.io',\n subdomain: DEFAULT_ETHERSCAN_SUBDOMAIN_PREFIX,\n },\n [CHAIN_IDS.AVALANCHE_TESTNET]: {\n domain: 'snowtrace.io',\n subdomain: `${DEFAULT_ETHERSCAN_SUBDOMAIN_PREFIX}-testnet`,\n },\n [CHAIN_IDS.FANTOM]: {\n domain: 'ftmscan.com',\n subdomain: DEFAULT_ETHERSCAN_SUBDOMAIN_PREFIX,\n },\n [CHAIN_IDS.FANTOM_TESTNET]: {\n domain: 'ftmscan.com',\n subdomain: `${DEFAULT_ETHERSCAN_SUBDOMAIN_PREFIX}-testnet`,\n },\n [CHAIN_IDS.MOONBEAM]: {\n domain: 'moonscan.io',\n subdomain: `${DEFAULT_ETHERSCAN_SUBDOMAIN_PREFIX}-moonbeam`,\n },\n [CHAIN_IDS.MOONBEAM_TESTNET]: {\n domain: 'moonscan.io',\n subdomain: `${DEFAULT_ETHERSCAN_SUBDOMAIN_PREFIX}-moonbase`,\n },\n [CHAIN_IDS.MOONRIVER]: {\n domain: 'moonscan.io',\n subdomain: `${DEFAULT_ETHERSCAN_SUBDOMAIN_PREFIX}-moonriver`,\n },\n [CHAIN_IDS.GNOSIS]: {\n domain: 'gnosisscan.io',\n subdomain: `${DEFAULT_ETHERSCAN_SUBDOMAIN_PREFIX}-gnosis`,\n },\n};\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"]}
|
package/dist/chunk-UHAFIPSL.js
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
var _chunkEHWAY6XUjs = require('./chunk-EHWAY6XU.js');
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var _chunkS6VGOPUYjs = require('./chunk-S6VGOPUY.js');
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var _chunkPSZ34BI5js = require('./chunk-PSZ34BI5.js');
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var _chunkZ4BLTVTBjs = require('./chunk-Z4BLTVTB.js');
|
|
14
|
-
|
|
15
|
-
// src/gas-flows/LineaGasFeeFlow.ts
|
|
16
|
-
var _controllerutils = require('@metamask/controller-utils');
|
|
17
|
-
var _utils = require('@metamask/utils');
|
|
18
|
-
var log = _utils.createModuleLogger.call(void 0, _chunkS6VGOPUYjs.projectLogger, "linea-gas-fee-flow");
|
|
19
|
-
var LINEA_CHAIN_IDS = [
|
|
20
|
-
_controllerutils.ChainId["linea-mainnet"],
|
|
21
|
-
_controllerutils.ChainId["linea-goerli"],
|
|
22
|
-
_controllerutils.ChainId["linea-sepolia"]
|
|
23
|
-
];
|
|
24
|
-
var BASE_FEE_MULTIPLIERS = {
|
|
25
|
-
low: 1,
|
|
26
|
-
medium: 1.35,
|
|
27
|
-
high: 1.7
|
|
28
|
-
};
|
|
29
|
-
var PRIORITY_FEE_MULTIPLIERS = {
|
|
30
|
-
low: 1,
|
|
31
|
-
medium: 1.05,
|
|
32
|
-
high: 1.1
|
|
33
|
-
};
|
|
34
|
-
var _getLineaGasFees, getLineaGasFees_fn, _getLineaResponse, getLineaResponse_fn, _getValuesFromMultipliers, getValuesFromMultipliers_fn, _getMaxFees, getMaxFees_fn, _feesToString, feesToString_fn;
|
|
35
|
-
var LineaGasFeeFlow = class {
|
|
36
|
-
constructor() {
|
|
37
|
-
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _getLineaGasFees);
|
|
38
|
-
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _getLineaResponse);
|
|
39
|
-
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _getValuesFromMultipliers);
|
|
40
|
-
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _getMaxFees);
|
|
41
|
-
_chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _feesToString);
|
|
42
|
-
}
|
|
43
|
-
matchesTransaction(transactionMeta) {
|
|
44
|
-
return LINEA_CHAIN_IDS.includes(transactionMeta.chainId);
|
|
45
|
-
}
|
|
46
|
-
async getGasFees(request) {
|
|
47
|
-
try {
|
|
48
|
-
return await _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _getLineaGasFees, getLineaGasFees_fn).call(this, request);
|
|
49
|
-
} catch (error) {
|
|
50
|
-
log("Using default flow as fallback due to error", error);
|
|
51
|
-
return new (0, _chunkEHWAY6XUjs.DefaultGasFeeFlow)().getGasFees(request);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
_getLineaGasFees = new WeakSet();
|
|
56
|
-
getLineaGasFees_fn = async function(request) {
|
|
57
|
-
const { ethQuery, transactionMeta } = request;
|
|
58
|
-
const lineaResponse = await _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _getLineaResponse, getLineaResponse_fn).call(this, transactionMeta, ethQuery);
|
|
59
|
-
log("Received Linea response", lineaResponse);
|
|
60
|
-
const baseFees = _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _getValuesFromMultipliers, getValuesFromMultipliers_fn).call(this, lineaResponse.baseFeePerGas, BASE_FEE_MULTIPLIERS);
|
|
61
|
-
log("Generated base fees", _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _feesToString, feesToString_fn).call(this, baseFees));
|
|
62
|
-
const priorityFees = _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _getValuesFromMultipliers, getValuesFromMultipliers_fn).call(this, lineaResponse.priorityFeePerGas, PRIORITY_FEE_MULTIPLIERS);
|
|
63
|
-
log("Generated priority fees", _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _feesToString, feesToString_fn).call(this, priorityFees));
|
|
64
|
-
const maxFees = _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _getMaxFees, getMaxFees_fn).call(this, baseFees, priorityFees);
|
|
65
|
-
log("Generated max fees", _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _feesToString, feesToString_fn).call(this, maxFees));
|
|
66
|
-
const estimates = Object.values(_chunkPSZ34BI5js.GasFeeEstimateLevel).reduce(
|
|
67
|
-
(result, level) => ({
|
|
68
|
-
...result,
|
|
69
|
-
[level]: {
|
|
70
|
-
maxFeePerGas: _controllerutils.toHex.call(void 0, maxFees[level]),
|
|
71
|
-
maxPriorityFeePerGas: _controllerutils.toHex.call(void 0, priorityFees[level])
|
|
72
|
-
}
|
|
73
|
-
}),
|
|
74
|
-
{ type: "fee-market" /* FeeMarket */ }
|
|
75
|
-
);
|
|
76
|
-
return { estimates };
|
|
77
|
-
};
|
|
78
|
-
_getLineaResponse = new WeakSet();
|
|
79
|
-
getLineaResponse_fn = function(transactionMeta, ethQuery) {
|
|
80
|
-
return _controllerutils.query.call(void 0, ethQuery, "linea_estimateGas", [
|
|
81
|
-
{
|
|
82
|
-
from: transactionMeta.txParams.from,
|
|
83
|
-
to: transactionMeta.txParams.to,
|
|
84
|
-
value: transactionMeta.txParams.value,
|
|
85
|
-
input: transactionMeta.txParams.data,
|
|
86
|
-
// Required in request but no impact on response.
|
|
87
|
-
gasPrice: "0x100000000"
|
|
88
|
-
}
|
|
89
|
-
]);
|
|
90
|
-
};
|
|
91
|
-
_getValuesFromMultipliers = new WeakSet();
|
|
92
|
-
getValuesFromMultipliers_fn = function(value, multipliers) {
|
|
93
|
-
const base = _controllerutils.hexToBN.call(void 0, value);
|
|
94
|
-
const low = base.muln(multipliers.low);
|
|
95
|
-
const medium = base.muln(multipliers.medium);
|
|
96
|
-
const high = base.muln(multipliers.high);
|
|
97
|
-
return {
|
|
98
|
-
low,
|
|
99
|
-
medium,
|
|
100
|
-
high
|
|
101
|
-
};
|
|
102
|
-
};
|
|
103
|
-
_getMaxFees = new WeakSet();
|
|
104
|
-
getMaxFees_fn = function(baseFees, priorityFees) {
|
|
105
|
-
return {
|
|
106
|
-
low: baseFees.low.add(priorityFees.low),
|
|
107
|
-
medium: baseFees.medium.add(priorityFees.medium),
|
|
108
|
-
high: baseFees.high.add(priorityFees.high)
|
|
109
|
-
};
|
|
110
|
-
};
|
|
111
|
-
_feesToString = new WeakSet();
|
|
112
|
-
feesToString_fn = function(fees) {
|
|
113
|
-
return Object.values(_chunkPSZ34BI5js.GasFeeEstimateLevel).map(
|
|
114
|
-
(level) => fees[level].toString(10)
|
|
115
|
-
);
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
exports.LineaGasFeeFlow = LineaGasFeeFlow;
|
|
121
|
-
//# sourceMappingURL=chunk-UHAFIPSL.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["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N, 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 { projectLogger } from '../logger';\nimport type {\n GasFeeEstimates,\n GasFeeFlow,\n GasFeeFlowRequest,\n GasFeeFlowResponse,\n TransactionMeta,\n} from '../types';\nimport { GasFeeEstimateLevel, GasFeeEstimateType } from '../types';\nimport { DefaultGasFeeFlow } from './DefaultGasFeeFlow';\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 // Required in request but no impact on response.\n gasPrice: '0x100000000',\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"]}
|
package/dist/chunk-UHSRHP55.mjs
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
// src/utils/utils.ts
|
|
2
|
-
import {
|
|
3
|
-
add0x,
|
|
4
|
-
getKnownPropertyNames,
|
|
5
|
-
isStrictHexString
|
|
6
|
-
} from "@metamask/utils";
|
|
7
|
-
var ESTIMATE_GAS_ERROR = "eth_estimateGas rpc method error";
|
|
8
|
-
var NORMALIZERS = {
|
|
9
|
-
data: (data) => add0x(padHexToEvenLength(data)),
|
|
10
|
-
from: (from) => add0x(from).toLowerCase(),
|
|
11
|
-
gas: (gas) => add0x(gas),
|
|
12
|
-
gasLimit: (gas) => add0x(gas),
|
|
13
|
-
gasPrice: (gasPrice) => add0x(gasPrice),
|
|
14
|
-
nonce: (nonce) => add0x(nonce),
|
|
15
|
-
to: (to) => add0x(to).toLowerCase(),
|
|
16
|
-
value: (value) => add0x(value),
|
|
17
|
-
maxFeePerGas: (maxFeePerGas) => add0x(maxFeePerGas),
|
|
18
|
-
maxPriorityFeePerGas: (maxPriorityFeePerGas) => add0x(maxPriorityFeePerGas),
|
|
19
|
-
estimatedBaseFee: (maxPriorityFeePerGas) => add0x(maxPriorityFeePerGas),
|
|
20
|
-
type: (type) => add0x(type)
|
|
21
|
-
};
|
|
22
|
-
function normalizeTransactionParams(txParams) {
|
|
23
|
-
const normalizedTxParams = { from: "" };
|
|
24
|
-
for (const key of getKnownPropertyNames(NORMALIZERS)) {
|
|
25
|
-
if (txParams[key]) {
|
|
26
|
-
normalizedTxParams[key] = NORMALIZERS[key](txParams[key]);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
if (!normalizedTxParams.value) {
|
|
30
|
-
normalizedTxParams.value = "0x0";
|
|
31
|
-
}
|
|
32
|
-
return normalizedTxParams;
|
|
33
|
-
}
|
|
34
|
-
function isEIP1559Transaction(txParams) {
|
|
35
|
-
const hasOwnProp = (obj, key) => Object.prototype.hasOwnProperty.call(obj, key);
|
|
36
|
-
return hasOwnProp(txParams, "maxFeePerGas") && hasOwnProp(txParams, "maxPriorityFeePerGas");
|
|
37
|
-
}
|
|
38
|
-
var validateGasValues = (gasValues) => {
|
|
39
|
-
Object.keys(gasValues).forEach((key) => {
|
|
40
|
-
const value = gasValues[key];
|
|
41
|
-
if (typeof value !== "string" || !isStrictHexString(value)) {
|
|
42
|
-
throw new TypeError(
|
|
43
|
-
// TODO: Either fix this lint violation or explain why it's necessary to ignore.
|
|
44
|
-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
45
|
-
`expected hex string for ${key} but received: ${value}`
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
};
|
|
50
|
-
function validateIfTransactionUnapproved(transactionMeta, fnName) {
|
|
51
|
-
if (transactionMeta?.status !== "unapproved" /* unapproved */) {
|
|
52
|
-
throw new Error(
|
|
53
|
-
// TODO: Either fix this lint violation or explain why it's necessary to ignore.
|
|
54
|
-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
55
|
-
`TransactionsController: Can only call ${fnName} on an unapproved transaction.
|
|
56
|
-
Current tx status: ${transactionMeta?.status}`
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
function normalizeTxError(error) {
|
|
61
|
-
return {
|
|
62
|
-
name: error.name,
|
|
63
|
-
message: error.message,
|
|
64
|
-
stack: error.stack,
|
|
65
|
-
code: error.code,
|
|
66
|
-
rpc: isJsonCompatible(error.value) ? error.value : void 0
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
function normalizeGasFeeValues(gasFeeValues) {
|
|
70
|
-
const normalize = (value) => typeof value === "string" ? add0x(value) : value;
|
|
71
|
-
if ("gasPrice" in gasFeeValues) {
|
|
72
|
-
return {
|
|
73
|
-
gasPrice: normalize(gasFeeValues.gasPrice)
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
return {
|
|
77
|
-
maxFeePerGas: normalize(gasFeeValues.maxFeePerGas),
|
|
78
|
-
maxPriorityFeePerGas: normalize(gasFeeValues.maxPriorityFeePerGas)
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
function isJsonCompatible(value) {
|
|
82
|
-
try {
|
|
83
|
-
JSON.parse(JSON.stringify(value));
|
|
84
|
-
return true;
|
|
85
|
-
} catch {
|
|
86
|
-
return false;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
function padHexToEvenLength(hex) {
|
|
90
|
-
const prefix = hex.toLowerCase().startsWith("0x") ? hex.slice(0, 2) : "";
|
|
91
|
-
const data = prefix ? hex.slice(2) : hex;
|
|
92
|
-
const evenData = data.length % 2 === 0 ? data : `0${data}`;
|
|
93
|
-
return prefix + evenData;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export {
|
|
97
|
-
ESTIMATE_GAS_ERROR,
|
|
98
|
-
normalizeTransactionParams,
|
|
99
|
-
isEIP1559Transaction,
|
|
100
|
-
validateGasValues,
|
|
101
|
-
validateIfTransactionUnapproved,
|
|
102
|
-
normalizeTxError,
|
|
103
|
-
normalizeGasFeeValues,
|
|
104
|
-
padHexToEvenLength
|
|
105
|
-
};
|
|
106
|
-
//# sourceMappingURL=chunk-UHSRHP55.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/utils.ts"],"sourcesContent":["import {\n add0x,\n getKnownPropertyNames,\n isStrictHexString,\n} from '@metamask/utils';\nimport type { Json } from '@metamask/utils';\n\nimport { TransactionStatus } from '../types';\nimport type {\n TransactionParams,\n TransactionMeta,\n TransactionError,\n GasPriceValue,\n FeeMarketEIP1559Values,\n} from '../types';\n\nexport const ESTIMATE_GAS_ERROR = 'eth_estimateGas rpc method error';\n\n// TODO: Replace `any` with type\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst NORMALIZERS: { [param in keyof TransactionParams]: any } = {\n data: (data: string) => add0x(padHexToEvenLength(data)),\n from: (from: string) => add0x(from).toLowerCase(),\n gas: (gas: string) => add0x(gas),\n gasLimit: (gas: string) => add0x(gas),\n gasPrice: (gasPrice: string) => add0x(gasPrice),\n nonce: (nonce: string) => add0x(nonce),\n to: (to: string) => add0x(to).toLowerCase(),\n value: (value: string) => add0x(value),\n maxFeePerGas: (maxFeePerGas: string) => add0x(maxFeePerGas),\n maxPriorityFeePerGas: (maxPriorityFeePerGas: string) =>\n add0x(maxPriorityFeePerGas),\n estimatedBaseFee: (maxPriorityFeePerGas: string) =>\n add0x(maxPriorityFeePerGas),\n type: (type: string) => add0x(type),\n};\n\n/**\n * Normalizes properties on transaction params.\n *\n * @param txParams - The transaction params to normalize.\n * @returns Normalized transaction params.\n */\nexport function normalizeTransactionParams(txParams: TransactionParams) {\n const normalizedTxParams: TransactionParams = { from: '' };\n\n for (const key of getKnownPropertyNames(NORMALIZERS)) {\n if (txParams[key]) {\n normalizedTxParams[key] = NORMALIZERS[key](txParams[key]);\n }\n }\n\n if (!normalizedTxParams.value) {\n normalizedTxParams.value = '0x0';\n }\n\n return normalizedTxParams;\n}\n\n/**\n * Checks if a transaction is EIP-1559 by checking for the existence of\n * maxFeePerGas and maxPriorityFeePerGas within its parameters.\n *\n * @param txParams - Transaction params object to add.\n * @returns Boolean that is true if the transaction is EIP-1559 (has maxFeePerGas and maxPriorityFeePerGas), otherwise returns false.\n */\nexport function isEIP1559Transaction(txParams: TransactionParams): boolean {\n const hasOwnProp = (obj: TransactionParams, key: string) =>\n Object.prototype.hasOwnProperty.call(obj, key);\n return (\n hasOwnProp(txParams, 'maxFeePerGas') &&\n hasOwnProp(txParams, 'maxPriorityFeePerGas')\n );\n}\n\nexport const validateGasValues = (\n gasValues: GasPriceValue | FeeMarketEIP1559Values,\n) => {\n Object.keys(gasValues).forEach((key) => {\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const value = (gasValues as any)[key];\n if (typeof value !== 'string' || !isStrictHexString(value)) {\n throw new TypeError(\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n `expected hex string for ${key} but received: ${value}`,\n );\n }\n });\n};\n\n/**\n * Validates that a transaction is unapproved.\n * Throws if the transaction is not unapproved.\n *\n * @param transactionMeta - The transaction metadata to check.\n * @param fnName - The name of the function calling this helper.\n */\nexport function validateIfTransactionUnapproved(\n transactionMeta: TransactionMeta | undefined,\n fnName: string,\n) {\n if (transactionMeta?.status !== TransactionStatus.unapproved) {\n throw new Error(\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n `TransactionsController: Can only call ${fnName} on an unapproved transaction.\\n Current tx status: ${transactionMeta?.status}`,\n );\n }\n}\n\n/**\n * Normalizes properties on transaction params.\n *\n * @param error - The error to be normalize.\n * @returns Normalized transaction error.\n */\nexport function normalizeTxError(\n error: Error & { code?: string; value?: unknown },\n): TransactionError {\n return {\n name: error.name,\n message: error.message,\n stack: error.stack,\n code: error.code,\n rpc: isJsonCompatible(error.value) ? error.value : undefined,\n };\n}\n\n/**\n * Normalize an object containing gas fee values.\n *\n * @param gasFeeValues - An object containing gas fee values.\n * @returns An object containing normalized gas fee values.\n */\nexport function normalizeGasFeeValues(\n gasFeeValues: GasPriceValue | FeeMarketEIP1559Values,\n): GasPriceValue | FeeMarketEIP1559Values {\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const normalize = (value: any) =>\n typeof value === 'string' ? add0x(value) : value;\n\n if ('gasPrice' in gasFeeValues) {\n return {\n gasPrice: normalize(gasFeeValues.gasPrice),\n };\n }\n\n return {\n maxFeePerGas: normalize(gasFeeValues.maxFeePerGas),\n maxPriorityFeePerGas: normalize(gasFeeValues.maxPriorityFeePerGas),\n };\n}\n\n/**\n * Determines whether the given value can be encoded as JSON.\n *\n * @param value - The value.\n * @returns True if the value is JSON-encodable, false if not.\n */\nfunction isJsonCompatible(value: unknown): value is Json {\n try {\n JSON.parse(JSON.stringify(value));\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Ensure a hex string is of even length by adding a leading 0 if necessary.\n * Any existing `0x` prefix is preserved but is not added if missing.\n *\n * @param hex - The hex string to ensure is even.\n * @returns The hex string with an even length.\n */\nexport function padHexToEvenLength(hex: string) {\n const prefix = hex.toLowerCase().startsWith('0x') ? hex.slice(0, 2) : '';\n const data = prefix ? hex.slice(2) : hex;\n const evenData = data.length % 2 === 0 ? data : `0${data}`;\n\n return prefix + evenData;\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAYA,IAAM,qBAAqB;AAIlC,IAAM,cAA2D;AAAA,EAC/D,MAAM,CAAC,SAAiB,MAAM,mBAAmB,IAAI,CAAC;AAAA,EACtD,MAAM,CAAC,SAAiB,MAAM,IAAI,EAAE,YAAY;AAAA,EAChD,KAAK,CAAC,QAAgB,MAAM,GAAG;AAAA,EAC/B,UAAU,CAAC,QAAgB,MAAM,GAAG;AAAA,EACpC,UAAU,CAAC,aAAqB,MAAM,QAAQ;AAAA,EAC9C,OAAO,CAAC,UAAkB,MAAM,KAAK;AAAA,EACrC,IAAI,CAAC,OAAe,MAAM,EAAE,EAAE,YAAY;AAAA,EAC1C,OAAO,CAAC,UAAkB,MAAM,KAAK;AAAA,EACrC,cAAc,CAAC,iBAAyB,MAAM,YAAY;AAAA,EAC1D,sBAAsB,CAAC,yBACrB,MAAM,oBAAoB;AAAA,EAC5B,kBAAkB,CAAC,yBACjB,MAAM,oBAAoB;AAAA,EAC5B,MAAM,CAAC,SAAiB,MAAM,IAAI;AACpC;AAQO,SAAS,2BAA2B,UAA6B;AACtE,QAAM,qBAAwC,EAAE,MAAM,GAAG;AAEzD,aAAW,OAAO,sBAAsB,WAAW,GAAG;AACpD,QAAI,SAAS,GAAG,GAAG;AACjB,yBAAmB,GAAG,IAAI,YAAY,GAAG,EAAE,SAAS,GAAG,CAAC;AAAA,IAC1D;AAAA,EACF;AAEA,MAAI,CAAC,mBAAmB,OAAO;AAC7B,uBAAmB,QAAQ;AAAA,EAC7B;AAEA,SA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