@metamask-previews/transaction-controller 36.1.0-preview-367cb1da → 36.1.0-preview-cf09c0a
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/dist/TransactionController.cjs +2026 -0
- package/dist/TransactionController.cjs.map +1 -0
- package/dist/{types/TransactionController.d.ts → TransactionController.d.cts} +15 -15
- package/dist/TransactionController.d.cts.map +1 -0
- package/dist/TransactionController.d.mts +827 -0
- package/dist/TransactionController.d.mts.map +1 -0
- package/dist/TransactionController.mjs +2027 -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 +328 -0
- package/dist/helpers/PendingTransactionTracker.cjs.map +1 -0
- package/dist/{types/helpers/PendingTransactionTracker.d.ts → helpers/PendingTransactionTracker.d.cts} +5 -5
- 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 +320 -8
- package/dist/helpers/PendingTransactionTracker.mjs.map +1 -1
- package/dist/index.cjs +28 -0
- package/dist/index.cjs.map +1 -0
- package/dist/{types/index.d.ts → index.d.cts} +10 -10
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +10 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +6 -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} +7 -7
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.mts +999 -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-DIPBZJ5G.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 +12 -7
- 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-4SYKJQLR.js +0 -228
- package/dist/chunk-4SYKJQLR.js.map +0 -1
- package/dist/chunk-4V4XIPCI.mjs +0 -338
- package/dist/chunk-4V4XIPCI.mjs.map +0 -1
- package/dist/chunk-4ZOE2ACZ.js +0 -67
- package/dist/chunk-4ZOE2ACZ.js.map +0 -1
- package/dist/chunk-5G6OHAXI.mjs +0 -137
- package/dist/chunk-5G6OHAXI.mjs.map +0 -1
- package/dist/chunk-5QVDIVJH.js +0 -68
- package/dist/chunk-5QVDIVJH.js.map +0 -1
- package/dist/chunk-6DDVVUJC.mjs +0 -50
- package/dist/chunk-6DDVVUJC.mjs.map +0 -1
- package/dist/chunk-6DODV6OV.js +0 -390
- package/dist/chunk-6DODV6OV.js.map +0 -1
- package/dist/chunk-6JO6EU6Z.mjs +0 -67
- package/dist/chunk-6JO6EU6Z.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-7M2R5AHC.mjs +0 -390
- package/dist/chunk-7M2R5AHC.mjs.map +0 -1
- package/dist/chunk-7NMV2NPM.js +0 -172
- package/dist/chunk-7NMV2NPM.js.map +0 -1
- package/dist/chunk-ASTXVFGJ.mjs +0 -92
- package/dist/chunk-ASTXVFGJ.mjs.map +0 -1
- package/dist/chunk-CKRPGICI.js +0 -2499
- package/dist/chunk-CKRPGICI.js.map +0 -1
- package/dist/chunk-DIPBZJ5G.js +0 -201
- package/dist/chunk-EGQCE3FK.mjs +0 -85
- package/dist/chunk-EGQCE3FK.mjs.map +0 -1
- package/dist/chunk-EHIRNR33.mjs +0 -228
- package/dist/chunk-EHIRNR33.mjs.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-H5MYUJHR.js +0 -92
- package/dist/chunk-H5MYUJHR.js.map +0 -1
- package/dist/chunk-HAW3IWCX.mjs +0 -201
- package/dist/chunk-HAW3IWCX.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-NNCUD3QF.js +0 -360
- package/dist/chunk-NNCUD3QF.js.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-ORWR5LSG.js +0 -112
- package/dist/chunk-ORWR5LSG.js.map +0 -1
- package/dist/chunk-PRUNMTRD.js +0 -50
- package/dist/chunk-PRUNMTRD.js.map +0 -1
- package/dist/chunk-Q44JQKVP.mjs +0 -112
- package/dist/chunk-Q44JQKVP.mjs.map +0 -1
- package/dist/chunk-QKV7E5BO.js +0 -257
- package/dist/chunk-QKV7E5BO.js.map +0 -1
- package/dist/chunk-REFVF44I.mjs +0 -2499
- package/dist/chunk-REFVF44I.mjs.map +0 -1
- package/dist/chunk-RGWMNCTE.mjs +0 -121
- package/dist/chunk-RGWMNCTE.mjs.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-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-UHSRHP55.mjs +0 -106
- package/dist/chunk-UHSRHP55.mjs.map +0 -1
- package/dist/chunk-UQQWZT6C.mjs +0 -14
- package/dist/chunk-UQQWZT6C.mjs.map +0 -1
- package/dist/chunk-V2OWJ7RY.mjs +0 -226
- package/dist/chunk-V2OWJ7RY.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-WFRHYZIO.js +0 -226
- package/dist/chunk-WFRHYZIO.js.map +0 -1
- package/dist/chunk-WR5F34OW.js +0 -23
- package/dist/chunk-WR5F34OW.js.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-YAFENU6Y.js +0 -121
- package/dist/chunk-YAFENU6Y.js.map +0 -1
- package/dist/chunk-YVCX6Z75.js +0 -102
- package/dist/chunk-YVCX6Z75.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
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/history.ts"],"names":[],"mappings":"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","sourcesContent":["import jsonDiffer from 'fast-json-patch';\nimport { cloneDeep, merge } from 'lodash';\n\nimport type {\n TransactionHistory,\n TransactionHistoryEntry,\n TransactionMeta,\n} from '../types';\n\n/**\n * The maximum allowed length of the `transaction.history` property.\n */\nexport const MAX_TRANSACTION_HISTORY_LENGTH = 100;\n\n/**\n * A list of trarnsaction history paths that may be used for display. These entries will not be\n * compressed.\n */\nexport const DISPLAYED_TRANSACTION_HISTORY_PATHS = [\n '/status',\n '/txParams/gasPrice',\n '/txParams/gas',\n '/estimatedBaseFee',\n '/blockTimestamp',\n];\n\n/**\n * Build a new version of the provided transaction with an initial history\n * entry, which is just a snapshot of the transaction.\n *\n * @param transactionMeta - TransactionMeta to add initial history snapshot to.\n * @returns A copy of `transactionMeta` with a new `history` property.\n */\nexport function addInitialHistorySnapshot(\n transactionMeta: TransactionMeta,\n): TransactionMeta {\n const snapshot = snapshotFromTransactionMeta(transactionMeta);\n return merge({}, transactionMeta, { history: [snapshot] });\n}\n\n/**\n * Builds a new version of the transaction with a new history entry if\n * it has a `history` property, or just returns the transaction.\n *\n * @param transactionMeta - TransactionMeta to add history entry to.\n * @param note - Note to add to history entry.\n * @returns A copy of `transactionMeta` with a new `history` entry if it has an\n * existing non-empty `history` array.\n */\nexport function updateTransactionHistory(\n transactionMeta: TransactionMeta,\n note: string,\n): TransactionMeta {\n if (!transactionMeta.history) {\n return transactionMeta;\n }\n\n const currentState = snapshotFromTransactionMeta(transactionMeta);\n const previousState = replayHistory(transactionMeta.history);\n const newHistoryEntry = generateHistoryEntry(\n previousState,\n currentState,\n note,\n );\n\n if (newHistoryEntry.length === 0) {\n return transactionMeta;\n }\n\n // Casts required here because this list has two separate types of entries:\n // TransactionMeta and TransactionHistoryEntry. The only TransactionMeta is the first\n // entry, but TypeScript loses that type information when `slice` is called for some reason.\n let updatedHistory = [\n ...transactionMeta.history,\n newHistoryEntry,\n ] as TransactionHistory;\n\n if (updatedHistory.length > MAX_TRANSACTION_HISTORY_LENGTH) {\n updatedHistory = compressTransactionHistory(updatedHistory);\n }\n\n return merge({}, transactionMeta, {\n history: updatedHistory,\n });\n}\n\n/**\n * Compress the transaction history, if it is possible to do so without compressing entries used\n * for display. History entries are merged together to make room for a single new entry.\n *\n * @param transactionHistory - The transaction history to compress.\n * @returns A compressed transaction history.\n */\nfunction compressTransactionHistory(\n transactionHistory: TransactionHistory,\n): TransactionHistory {\n const initialEntry = transactionHistory[0];\n // Casts required here because this list has two separate types of entries:\n // TransactionMeta and TransactionHistoryEntry. The only TransactionMeta is the first\n // entry, but TypeScript loses that type information when `slice` is called for some reason.\n const historyEntries = transactionHistory.slice(\n 1,\n ) as TransactionHistoryEntry[];\n\n const firstNonDisplayedEntryIndex = historyEntries.findIndex(\n (historyEntry) => {\n return !historyEntry.some(({ path }) =>\n DISPLAYED_TRANSACTION_HISTORY_PATHS.includes(path),\n );\n },\n );\n\n // If no non-displayed entry is found, let history exceed max size.\n // TODO: Move data used for display to another property, so that we can more reliably limit\n // history size or remove it altogether.\n if (firstNonDisplayedEntryIndex === -1) {\n return transactionHistory;\n }\n\n // If a non-displayed entry is found that we can remove, merge it with another entry.\n // The entry we're merging with might be a \"displayed\" entry, but that's OK, merging more changes\n // in does not break our display logic.\n const mergeTargetEntryIndex =\n // Merge with previous entry if there is no next entry.\n // We default to merging with next because the next entry might also be non-displayed, so it\n // might be removed in a future trim, saving more space.\n firstNonDisplayedEntryIndex === historyEntries.length - 1\n ? firstNonDisplayedEntryIndex - 1\n : firstNonDisplayedEntryIndex + 1;\n const firstIndexToMerge = Math.min(\n firstNonDisplayedEntryIndex,\n mergeTargetEntryIndex,\n );\n const firstEntryToMerge = historyEntries[firstIndexToMerge];\n const secondEntryToMerge = historyEntries[firstIndexToMerge + 1];\n\n const beforeMergeState = replayHistory([\n initialEntry,\n ...historyEntries.slice(0, firstIndexToMerge),\n ]);\n const afterMergeState = replayHistory([\n beforeMergeState,\n firstEntryToMerge,\n secondEntryToMerge,\n ]);\n const mergedHistoryEntry = generateHistoryEntry(\n beforeMergeState,\n afterMergeState,\n `${String(firstEntryToMerge[0].note)}, ${String(\n secondEntryToMerge[0].note,\n )}`,\n );\n\n historyEntries.splice(firstIndexToMerge, 2, mergedHistoryEntry);\n return [initialEntry, ...historyEntries];\n}\n\n/**\n * Generates a history entry from the previous and new transaction metadata.\n *\n * @param previousState - The previous transaction metadata.\n * @param currentState - The new transaction metadata.\n * @param note - A note for the transaction metada update.\n * @returns An array of history operation.\n */\nfunction generateHistoryEntry(\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n previousState: any,\n currentState: TransactionMeta,\n note: string,\n): TransactionHistoryEntry {\n const historyOperationsEntry = jsonDiffer.compare(\n previousState,\n currentState,\n ) as TransactionHistoryEntry;\n // Add a note to the first operation, since it breaks if we append it to the entry\n if (historyOperationsEntry[0]) {\n if (note) {\n historyOperationsEntry[0].note = note;\n }\n historyOperationsEntry[0].timestamp = Date.now();\n }\n return historyOperationsEntry;\n}\n\n/**\n * Recovers previous transactionMeta from passed history array.\n *\n * @param transactionHistory - The transaction metadata to replay.\n * @returns The transaction metadata.\n */\nfunction replayHistory(\n transactionHistory: TransactionHistory,\n): TransactionMeta {\n const shortHistory = cloneDeep(transactionHistory);\n return shortHistory.reduce(\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (val, entry: any) => jsonDiffer.applyPatch(val, entry).newDocument,\n ) as TransactionMeta;\n}\n\n/**\n * Clone the transaction meta data without the history property.\n *\n * @param transactionMeta - The transaction metadata to snapshot.\n * @returns A deep clone of transaction metadata without history property.\n */\nfunction snapshotFromTransactionMeta(\n transactionMeta: TransactionMeta,\n): TransactionMeta {\n const snapshot = { ...transactionMeta };\n delete snapshot.history;\n return cloneDeep(snapshot);\n}\n"]}
|
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":"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","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-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":"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","names":[]}
|
package/dist/chunk-UQQWZT6C.mjs
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// src/logger.ts
|
|
2
|
-
import { createProjectLogger, createModuleLogger } from "@metamask/utils";
|
|
3
|
-
var projectLogger = createProjectLogger("transaction-controller");
|
|
4
|
-
var incomingTransactionsLogger = createModuleLogger(
|
|
5
|
-
projectLogger,
|
|
6
|
-
"incoming-transactions"
|
|
7
|
-
);
|
|
8
|
-
|
|
9
|
-
export {
|
|
10
|
-
createModuleLogger,
|
|
11
|
-
projectLogger,
|
|
12
|
-
incomingTransactionsLogger
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=chunk-UQQWZT6C.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/logger.ts"],"sourcesContent":["/* istanbul ignore file */\n\nimport { createProjectLogger, createModuleLogger } from '@metamask/utils';\n\nexport const projectLogger = createProjectLogger('transaction-controller');\n\nexport const incomingTransactionsLogger = createModuleLogger(\n projectLogger,\n 'incoming-transactions',\n);\n\nexport { createModuleLogger };\n"],"mappings":";AAEA,SAAS,qBAAqB,0BAA0B;AAEjD,IAAM,gBAAgB,oBAAoB,wBAAwB;AAElE,IAAM,6BAA6B;AAAA,EACxC;AAAA,EACA;AACF;","names":[]}
|
package/dist/chunk-V2OWJ7RY.mjs
DELETED
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
SWAP_TRANSACTION_TYPES
|
|
3
|
-
} from "./chunk-JIFPK37W.mjs";
|
|
4
|
-
import {
|
|
5
|
-
getGasFeeFlow
|
|
6
|
-
} from "./chunk-6JO6EU6Z.mjs";
|
|
7
|
-
import {
|
|
8
|
-
projectLogger
|
|
9
|
-
} from "./chunk-UQQWZT6C.mjs";
|
|
10
|
-
|
|
11
|
-
// src/utils/gas-fees.ts
|
|
12
|
-
import {
|
|
13
|
-
ORIGIN_METAMASK,
|
|
14
|
-
gweiDecToWEIBN,
|
|
15
|
-
query,
|
|
16
|
-
toHex
|
|
17
|
-
} from "@metamask/controller-utils";
|
|
18
|
-
import { add0x, createModuleLogger } from "@metamask/utils";
|
|
19
|
-
var log = createModuleLogger(projectLogger, "gas-fees");
|
|
20
|
-
async function updateGasFees(request) {
|
|
21
|
-
const { txMeta } = request;
|
|
22
|
-
const initialParams = { ...txMeta.txParams };
|
|
23
|
-
const isSwap = SWAP_TRANSACTION_TYPES.includes(
|
|
24
|
-
txMeta.type
|
|
25
|
-
);
|
|
26
|
-
const savedGasFees = isSwap ? void 0 : request.getSavedGasFees(txMeta.chainId);
|
|
27
|
-
const suggestedGasFees = await getSuggestedGasFees(request);
|
|
28
|
-
log("Suggested gas fees", suggestedGasFees);
|
|
29
|
-
const getGasFeeRequest = {
|
|
30
|
-
...request,
|
|
31
|
-
initialParams,
|
|
32
|
-
savedGasFees,
|
|
33
|
-
suggestedGasFees
|
|
34
|
-
};
|
|
35
|
-
txMeta.txParams.maxFeePerGas = getMaxFeePerGas(getGasFeeRequest);
|
|
36
|
-
txMeta.txParams.maxPriorityFeePerGas = getMaxPriorityFeePerGas(getGasFeeRequest);
|
|
37
|
-
txMeta.txParams.gasPrice = getGasPrice(getGasFeeRequest);
|
|
38
|
-
txMeta.userFeeLevel = getUserFeeLevel(getGasFeeRequest);
|
|
39
|
-
log("Updated gas fee properties", {
|
|
40
|
-
maxFeePerGas: txMeta.txParams.maxFeePerGas,
|
|
41
|
-
maxPriorityFeePerGas: txMeta.txParams.maxPriorityFeePerGas,
|
|
42
|
-
gasPrice: txMeta.txParams.gasPrice
|
|
43
|
-
});
|
|
44
|
-
if (txMeta.txParams.maxFeePerGas || txMeta.txParams.maxPriorityFeePerGas) {
|
|
45
|
-
delete txMeta.txParams.gasPrice;
|
|
46
|
-
}
|
|
47
|
-
if (txMeta.txParams.gasPrice) {
|
|
48
|
-
delete txMeta.txParams.maxFeePerGas;
|
|
49
|
-
delete txMeta.txParams.maxPriorityFeePerGas;
|
|
50
|
-
}
|
|
51
|
-
updateDefaultGasEstimates(txMeta);
|
|
52
|
-
}
|
|
53
|
-
function gweiDecimalToWeiHex(value) {
|
|
54
|
-
return toHex(gweiDecToWEIBN(value));
|
|
55
|
-
}
|
|
56
|
-
function getMaxFeePerGas(request) {
|
|
57
|
-
const { savedGasFees, eip1559, initialParams, suggestedGasFees } = request;
|
|
58
|
-
if (!eip1559) {
|
|
59
|
-
return void 0;
|
|
60
|
-
}
|
|
61
|
-
if (savedGasFees) {
|
|
62
|
-
const maxFeePerGas = gweiDecimalToWeiHex(savedGasFees.maxBaseFee);
|
|
63
|
-
log("Using maxFeePerGas from savedGasFees", maxFeePerGas);
|
|
64
|
-
return maxFeePerGas;
|
|
65
|
-
}
|
|
66
|
-
if (initialParams.maxFeePerGas) {
|
|
67
|
-
log("Using maxFeePerGas from request", initialParams.maxFeePerGas);
|
|
68
|
-
return initialParams.maxFeePerGas;
|
|
69
|
-
}
|
|
70
|
-
if (initialParams.gasPrice && !initialParams.maxPriorityFeePerGas) {
|
|
71
|
-
log(
|
|
72
|
-
"Setting maxFeePerGas to gasPrice from request",
|
|
73
|
-
initialParams.gasPrice
|
|
74
|
-
);
|
|
75
|
-
return initialParams.gasPrice;
|
|
76
|
-
}
|
|
77
|
-
if (suggestedGasFees.maxFeePerGas) {
|
|
78
|
-
log("Using suggested maxFeePerGas", suggestedGasFees.maxFeePerGas);
|
|
79
|
-
return suggestedGasFees.maxFeePerGas;
|
|
80
|
-
}
|
|
81
|
-
if (suggestedGasFees.gasPrice) {
|
|
82
|
-
log(
|
|
83
|
-
"Setting maxFeePerGas to suggested gasPrice",
|
|
84
|
-
suggestedGasFees.gasPrice
|
|
85
|
-
);
|
|
86
|
-
return suggestedGasFees.gasPrice;
|
|
87
|
-
}
|
|
88
|
-
log("maxFeePerGas not set");
|
|
89
|
-
return void 0;
|
|
90
|
-
}
|
|
91
|
-
function getMaxPriorityFeePerGas(request) {
|
|
92
|
-
const { eip1559, initialParams, savedGasFees, suggestedGasFees, txMeta } = request;
|
|
93
|
-
if (!eip1559) {
|
|
94
|
-
return void 0;
|
|
95
|
-
}
|
|
96
|
-
if (savedGasFees) {
|
|
97
|
-
const maxPriorityFeePerGas = gweiDecimalToWeiHex(savedGasFees.priorityFee);
|
|
98
|
-
log(
|
|
99
|
-
"Using maxPriorityFeePerGas from savedGasFees.priorityFee",
|
|
100
|
-
maxPriorityFeePerGas
|
|
101
|
-
);
|
|
102
|
-
return maxPriorityFeePerGas;
|
|
103
|
-
}
|
|
104
|
-
if (initialParams.maxPriorityFeePerGas) {
|
|
105
|
-
log(
|
|
106
|
-
"Using maxPriorityFeePerGas from request",
|
|
107
|
-
initialParams.maxPriorityFeePerGas
|
|
108
|
-
);
|
|
109
|
-
return initialParams.maxPriorityFeePerGas;
|
|
110
|
-
}
|
|
111
|
-
if (initialParams.gasPrice && !initialParams.maxFeePerGas) {
|
|
112
|
-
log(
|
|
113
|
-
"Setting maxPriorityFeePerGas to gasPrice from request",
|
|
114
|
-
initialParams.gasPrice
|
|
115
|
-
);
|
|
116
|
-
return initialParams.gasPrice;
|
|
117
|
-
}
|
|
118
|
-
if (suggestedGasFees.maxPriorityFeePerGas) {
|
|
119
|
-
log(
|
|
120
|
-
"Using suggested maxPriorityFeePerGas",
|
|
121
|
-
suggestedGasFees.maxPriorityFeePerGas
|
|
122
|
-
);
|
|
123
|
-
return suggestedGasFees.maxPriorityFeePerGas;
|
|
124
|
-
}
|
|
125
|
-
if (txMeta.txParams.maxFeePerGas) {
|
|
126
|
-
log(
|
|
127
|
-
"Setting maxPriorityFeePerGas to maxFeePerGas",
|
|
128
|
-
txMeta.txParams.maxFeePerGas
|
|
129
|
-
);
|
|
130
|
-
return txMeta.txParams.maxFeePerGas;
|
|
131
|
-
}
|
|
132
|
-
log("maxPriorityFeePerGas not set");
|
|
133
|
-
return void 0;
|
|
134
|
-
}
|
|
135
|
-
function getGasPrice(request) {
|
|
136
|
-
const { eip1559, initialParams, suggestedGasFees } = request;
|
|
137
|
-
if (eip1559) {
|
|
138
|
-
return void 0;
|
|
139
|
-
}
|
|
140
|
-
if (initialParams.gasPrice) {
|
|
141
|
-
log("Using gasPrice from request", initialParams.gasPrice);
|
|
142
|
-
return initialParams.gasPrice;
|
|
143
|
-
}
|
|
144
|
-
if (suggestedGasFees.maxFeePerGas) {
|
|
145
|
-
log("Using suggested maxFeePerGas", suggestedGasFees.maxFeePerGas);
|
|
146
|
-
return suggestedGasFees.maxFeePerGas;
|
|
147
|
-
}
|
|
148
|
-
if (suggestedGasFees.gasPrice) {
|
|
149
|
-
log("Using suggested gasPrice", suggestedGasFees.gasPrice);
|
|
150
|
-
return suggestedGasFees.gasPrice;
|
|
151
|
-
}
|
|
152
|
-
log("gasPrice not set");
|
|
153
|
-
return void 0;
|
|
154
|
-
}
|
|
155
|
-
function getUserFeeLevel(request) {
|
|
156
|
-
const { eip1559, initialParams, savedGasFees, suggestedGasFees, txMeta } = request;
|
|
157
|
-
if (!eip1559) {
|
|
158
|
-
return void 0;
|
|
159
|
-
}
|
|
160
|
-
if (savedGasFees) {
|
|
161
|
-
return "custom" /* CUSTOM */;
|
|
162
|
-
}
|
|
163
|
-
if (!initialParams.maxFeePerGas && !initialParams.maxPriorityFeePerGas && initialParams.gasPrice) {
|
|
164
|
-
return txMeta.origin === ORIGIN_METAMASK ? "custom" /* CUSTOM */ : "dappSuggested" /* DAPP_SUGGESTED */;
|
|
165
|
-
}
|
|
166
|
-
if (!initialParams.maxFeePerGas && !initialParams.maxPriorityFeePerGas && suggestedGasFees.maxFeePerGas && suggestedGasFees.maxPriorityFeePerGas) {
|
|
167
|
-
return "medium" /* MEDIUM */;
|
|
168
|
-
}
|
|
169
|
-
if (txMeta.origin === ORIGIN_METAMASK) {
|
|
170
|
-
return "medium" /* MEDIUM */;
|
|
171
|
-
}
|
|
172
|
-
return "dappSuggested" /* DAPP_SUGGESTED */;
|
|
173
|
-
}
|
|
174
|
-
function updateDefaultGasEstimates(txMeta) {
|
|
175
|
-
if (!txMeta.defaultGasEstimates) {
|
|
176
|
-
txMeta.defaultGasEstimates = {};
|
|
177
|
-
}
|
|
178
|
-
txMeta.defaultGasEstimates.maxFeePerGas = txMeta.txParams.maxFeePerGas;
|
|
179
|
-
txMeta.defaultGasEstimates.maxPriorityFeePerGas = txMeta.txParams.maxPriorityFeePerGas;
|
|
180
|
-
txMeta.defaultGasEstimates.gasPrice = txMeta.txParams.gasPrice;
|
|
181
|
-
txMeta.defaultGasEstimates.estimateType = txMeta.userFeeLevel;
|
|
182
|
-
}
|
|
183
|
-
async function getSuggestedGasFees(request) {
|
|
184
|
-
const { eip1559, ethQuery, gasFeeFlows, getGasFeeEstimates, txMeta } = request;
|
|
185
|
-
const { networkClientId } = txMeta;
|
|
186
|
-
if (!eip1559 && txMeta.txParams.gasPrice || eip1559 && txMeta.txParams.maxFeePerGas && txMeta.txParams.maxPriorityFeePerGas) {
|
|
187
|
-
return {};
|
|
188
|
-
}
|
|
189
|
-
const gasFeeFlow = getGasFeeFlow(txMeta, gasFeeFlows);
|
|
190
|
-
try {
|
|
191
|
-
const gasFeeControllerData = await getGasFeeEstimates({ networkClientId });
|
|
192
|
-
const response = await gasFeeFlow.getGasFees({
|
|
193
|
-
ethQuery,
|
|
194
|
-
gasFeeControllerData,
|
|
195
|
-
transactionMeta: txMeta
|
|
196
|
-
});
|
|
197
|
-
const gasFeeEstimateType = response.estimates?.type;
|
|
198
|
-
switch (gasFeeEstimateType) {
|
|
199
|
-
case "fee-market" /* FeeMarket */:
|
|
200
|
-
return response.estimates.medium;
|
|
201
|
-
case "legacy" /* Legacy */:
|
|
202
|
-
return {
|
|
203
|
-
gasPrice: response.estimates.medium
|
|
204
|
-
};
|
|
205
|
-
case "eth_gasPrice" /* GasPrice */:
|
|
206
|
-
return { gasPrice: response.estimates.gasPrice };
|
|
207
|
-
default:
|
|
208
|
-
throw new Error(
|
|
209
|
-
// TODO: Either fix this lint violation or explain why it's necessary to ignore.
|
|
210
|
-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
211
|
-
`Unsupported gas fee estimate type returned from flow: ${gasFeeEstimateType}`
|
|
212
|
-
);
|
|
213
|
-
}
|
|
214
|
-
} catch (error) {
|
|
215
|
-
log("Failed to get suggested gas fees", error);
|
|
216
|
-
}
|
|
217
|
-
const gasPriceDecimal = await query(ethQuery, "gasPrice");
|
|
218
|
-
const gasPrice = gasPriceDecimal ? add0x(gasPriceDecimal.toString(16)) : void 0;
|
|
219
|
-
return { gasPrice };
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
export {
|
|
223
|
-
updateGasFees,
|
|
224
|
-
gweiDecimalToWeiHex
|
|
225
|
-
};
|
|
226
|
-
//# sourceMappingURL=chunk-V2OWJ7RY.mjs.map
|