@metamask/transaction-controller 25.2.1 → 26.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +39 -1
- package/dist/TransactionController.js +20 -18
- package/dist/TransactionController.mjs +19 -17
- package/dist/{chunk-5UL3VDFT.mjs → chunk-35MG26Y3.mjs} +13 -12
- package/dist/chunk-35MG26Y3.mjs.map +1 -0
- package/dist/{chunk-R7NJVDWN.js → chunk-5WFLNKCL.js} +7 -6
- package/dist/chunk-5WFLNKCL.js.map +1 -0
- package/dist/{chunk-PF3UOCRW.js → chunk-6V2LR6JL.js} +7 -7
- package/dist/{chunk-PGTV7236.mjs → chunk-7HNSDVVO.mjs} +3 -3
- package/dist/{chunk-BYBPZUHS.mjs → chunk-A4P4B3OF.mjs} +14 -6
- package/dist/chunk-A4P4B3OF.mjs.map +1 -0
- package/dist/{chunk-I6RY3XOG.mjs → chunk-APJWB5VY.mjs} +62 -27
- package/dist/chunk-APJWB5VY.mjs.map +1 -0
- package/dist/{chunk-F3CMU2DM.js → chunk-C3UHJPYJ.js} +6 -6
- package/dist/{chunk-Z3HHSD5I.mjs → chunk-DTMKGTYC.mjs} +3 -2
- package/dist/chunk-DTMKGTYC.mjs.map +1 -0
- package/dist/{chunk-VEJ3MIZG.js → chunk-FK7AP6SH.js} +11 -2
- package/dist/chunk-FK7AP6SH.js.map +1 -0
- package/dist/{chunk-ZQFMTLZJ.mjs → chunk-FTB6MCSH.mjs} +39 -24
- package/dist/chunk-FTB6MCSH.mjs.map +1 -0
- package/dist/{chunk-7BG5XOXJ.js → chunk-GASIS3QH.js} +77 -42
- package/dist/chunk-GASIS3QH.js.map +1 -0
- package/dist/{chunk-RQKICZYP.js → chunk-GRQB2ARK.js} +3 -3
- package/dist/{chunk-XKNFL657.mjs → chunk-HLG525BC.mjs} +2 -2
- package/dist/chunk-HMOSP33F.js +36 -0
- package/dist/chunk-HMOSP33F.js.map +1 -0
- package/dist/chunk-HQSNKCXI.mjs +36 -0
- package/dist/chunk-HQSNKCXI.mjs.map +1 -0
- package/dist/{chunk-QEX3QMSL.js → chunk-HUVOOFOM.js} +15 -14
- package/dist/chunk-HUVOOFOM.js.map +1 -0
- package/dist/{chunk-NRWEI43Q.js → chunk-I7VD6IET.js} +40 -25
- package/dist/chunk-I7VD6IET.js.map +1 -0
- package/dist/chunk-JW6P2G5A.mjs +132 -0
- package/dist/chunk-JW6P2G5A.mjs.map +1 -0
- package/dist/{chunk-6XMG522E.mjs → chunk-K4KOSAGM.mjs} +8 -3
- package/dist/chunk-K4KOSAGM.mjs.map +1 -0
- package/dist/{chunk-JRBREX22.mjs → chunk-KG4UW4K4.mjs} +17 -4
- package/dist/chunk-KG4UW4K4.mjs.map +1 -0
- package/dist/{chunk-QRSTF45Q.mjs → chunk-KKCD5UMP.mjs} +3 -3
- package/dist/{chunk-GE57YNGX.js → chunk-KT6UAKBB.js} +8 -3
- package/dist/chunk-KT6UAKBB.js.map +1 -0
- package/dist/chunk-QG2WVQE3.js +132 -0
- package/dist/chunk-QG2WVQE3.js.map +1 -0
- package/dist/{chunk-5OQ373JS.js → chunk-QTQSCTQA.js} +10 -10
- package/dist/{chunk-VEREDMI2.mjs → chunk-RIYIJTEU.mjs} +2 -2
- package/dist/{chunk-IZI7FQIN.mjs → chunk-RU6NJIUD.mjs} +3 -3
- package/dist/{chunk-HS277C77.js → chunk-SD6CWFDF.js} +16 -3
- package/dist/chunk-SD6CWFDF.js.map +1 -0
- package/dist/{chunk-3D3SA6PY.mjs → chunk-TJXPMOA6.mjs} +2 -2
- package/dist/{chunk-DWHMMJOW.mjs → chunk-TWND5SFD.mjs} +2 -2
- package/dist/{chunk-IK55QTGO.mjs → chunk-TZEAWUXE.mjs} +3 -3
- package/dist/{chunk-TZTP4JVA.js → chunk-UH7FNVKS.js} +4 -4
- package/dist/{chunk-5IHLDAOF.js → chunk-UUSYJGGQ.js} +5 -5
- package/dist/{chunk-GC77BSQZ.js → chunk-V5X6MZHN.js} +16 -8
- package/dist/chunk-V5X6MZHN.js.map +1 -0
- package/dist/{chunk-CXXGL43K.js → chunk-VP2DBWOT.js} +3 -3
- package/dist/{chunk-KFL2GGZC.mjs → chunk-W3CS5GRD.mjs} +7 -6
- package/dist/chunk-W3CS5GRD.mjs.map +1 -0
- package/dist/{chunk-ITDY6AIZ.js → chunk-WIZVJM2B.js} +3 -2
- package/dist/chunk-WIZVJM2B.js.map +1 -0
- package/dist/{chunk-FHG5GY6F.js → chunk-XZILQVNW.js} +6 -6
- package/dist/{chunk-W57BD6NX.mjs → chunk-YEJJKWT2.mjs} +11 -2
- package/dist/chunk-YEJJKWT2.mjs.map +1 -0
- package/dist/constants.js +2 -2
- package/dist/constants.mjs +1 -1
- package/dist/errors.js +15 -0
- package/dist/errors.js.map +1 -0
- package/dist/errors.mjs +15 -0
- package/dist/errors.mjs.map +1 -0
- package/dist/gas-flows/DefaultGasFeeFlow.js +7 -7
- package/dist/gas-flows/DefaultGasFeeFlow.mjs +6 -6
- package/dist/gas-flows/LineaGasFeeFlow.js +8 -8
- package/dist/gas-flows/LineaGasFeeFlow.mjs +7 -7
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.js +10 -0
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.js.map +1 -0
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.mjs +10 -0
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.mjs.map +1 -0
- package/dist/helpers/EtherscanRemoteTransactionSource.js +5 -5
- package/dist/helpers/EtherscanRemoteTransactionSource.mjs +4 -4
- package/dist/helpers/GasFeePoller.js +5 -5
- package/dist/helpers/GasFeePoller.mjs +4 -4
- package/dist/helpers/MultichainTrackingHelper.js +6 -6
- package/dist/helpers/MultichainTrackingHelper.mjs +5 -5
- package/dist/helpers/PendingTransactionTracker.js +1 -1
- package/dist/helpers/PendingTransactionTracker.mjs +1 -1
- package/dist/index.js +24 -20
- package/dist/index.mjs +23 -19
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/TransactionController.d.ts +8 -0
- package/dist/types/TransactionController.d.ts.map +1 -1
- package/dist/types/constants.d.ts +1 -0
- package/dist/types/constants.d.ts.map +1 -1
- package/dist/types/errors.d.ts +15 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/gas-flows/OptimismLayer1GasFeeFlow.d.ts +10 -0
- package/dist/types/gas-flows/OptimismLayer1GasFeeFlow.d.ts.map +1 -0
- package/dist/types/helpers/GasFeePoller.d.ts +4 -5
- package/dist/types/helpers/GasFeePoller.d.ts.map +1 -1
- package/dist/types/helpers/MultichainTrackingHelper.d.ts +4 -0
- package/dist/types/helpers/MultichainTrackingHelper.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/types.d.ts +15 -7
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils/layer1-gas-fee-flow.d.ts +11 -2
- package/dist/types/utils/layer1-gas-fee-flow.d.ts.map +1 -1
- package/dist/types/utils/simulation-api.d.ts.map +1 -1
- package/dist/types/utils/simulation.d.ts.map +1 -1
- package/dist/types/utils/transaction-type.d.ts.map +1 -1
- package/dist/types.js +4 -2
- package/dist/types.mjs +3 -1
- package/dist/utils/etherscan.js +3 -3
- package/dist/utils/etherscan.mjs +2 -2
- package/dist/utils/external-transactions.js +1 -1
- package/dist/utils/external-transactions.mjs +1 -1
- package/dist/utils/gas-fees.js +6 -6
- package/dist/utils/gas-fees.mjs +5 -5
- package/dist/utils/gas-flow.js +3 -3
- package/dist/utils/gas-flow.mjs +2 -2
- package/dist/utils/gas.js +3 -3
- package/dist/utils/gas.mjs +2 -2
- package/dist/utils/layer1-gas-fee-flow.js +4 -2
- package/dist/utils/layer1-gas-fee-flow.mjs +3 -1
- package/dist/utils/simulation-api.js +4 -2
- package/dist/utils/simulation-api.mjs +3 -1
- package/dist/utils/simulation.js +5 -4
- package/dist/utils/simulation.mjs +4 -3
- package/dist/utils/swaps.js +4 -4
- package/dist/utils/swaps.mjs +3 -3
- package/dist/utils/transaction-type.js +3 -3
- package/dist/utils/transaction-type.mjs +2 -2
- package/dist/utils/utils.js +1 -1
- package/dist/utils/utils.mjs +1 -1
- package/dist/utils/validation.js +1 -1
- package/dist/utils/validation.mjs +1 -1
- package/package.json +7 -5
- package/dist/chunk-5UL3VDFT.mjs.map +0 -1
- package/dist/chunk-6XMG522E.mjs.map +0 -1
- package/dist/chunk-7BG5XOXJ.js.map +0 -1
- package/dist/chunk-BYBPZUHS.mjs.map +0 -1
- package/dist/chunk-GC77BSQZ.js.map +0 -1
- package/dist/chunk-GE57YNGX.js.map +0 -1
- package/dist/chunk-HS277C77.js.map +0 -1
- package/dist/chunk-I6RY3XOG.mjs.map +0 -1
- package/dist/chunk-ITDY6AIZ.js.map +0 -1
- package/dist/chunk-JRBREX22.mjs.map +0 -1
- package/dist/chunk-KFL2GGZC.mjs.map +0 -1
- package/dist/chunk-NRWEI43Q.js.map +0 -1
- package/dist/chunk-QEX3QMSL.js.map +0 -1
- package/dist/chunk-R7NJVDWN.js.map +0 -1
- package/dist/chunk-VEJ3MIZG.js.map +0 -1
- package/dist/chunk-W57BD6NX.mjs.map +0 -1
- package/dist/chunk-Z3HHSD5I.mjs.map +0 -1
- package/dist/chunk-ZQFMTLZJ.mjs.map +0 -1
- /package/dist/{chunk-PF3UOCRW.js.map → chunk-6V2LR6JL.js.map} +0 -0
- /package/dist/{chunk-PGTV7236.mjs.map → chunk-7HNSDVVO.mjs.map} +0 -0
- /package/dist/{chunk-F3CMU2DM.js.map → chunk-C3UHJPYJ.js.map} +0 -0
- /package/dist/{chunk-RQKICZYP.js.map → chunk-GRQB2ARK.js.map} +0 -0
- /package/dist/{chunk-XKNFL657.mjs.map → chunk-HLG525BC.mjs.map} +0 -0
- /package/dist/{chunk-QRSTF45Q.mjs.map → chunk-KKCD5UMP.mjs.map} +0 -0
- /package/dist/{chunk-5OQ373JS.js.map → chunk-QTQSCTQA.js.map} +0 -0
- /package/dist/{chunk-VEREDMI2.mjs.map → chunk-RIYIJTEU.mjs.map} +0 -0
- /package/dist/{chunk-IZI7FQIN.mjs.map → chunk-RU6NJIUD.mjs.map} +0 -0
- /package/dist/{chunk-3D3SA6PY.mjs.map → chunk-TJXPMOA6.mjs.map} +0 -0
- /package/dist/{chunk-DWHMMJOW.mjs.map → chunk-TWND5SFD.mjs.map} +0 -0
- /package/dist/{chunk-IK55QTGO.mjs.map → chunk-TZEAWUXE.mjs.map} +0 -0
- /package/dist/{chunk-TZTP4JVA.js.map → chunk-UH7FNVKS.js.map} +0 -0
- /package/dist/{chunk-5IHLDAOF.js.map → chunk-UUSYJGGQ.js.map} +0 -0
- /package/dist/{chunk-CXXGL43K.js.map → chunk-VP2DBWOT.js.map} +0 -0
- /package/dist/{chunk-FHG5GY6F.js.map → chunk-XZILQVNW.js.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,42 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [26.0.0]
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Run `OptimismLayer1GasFeeFlow` on Optimism stack based transactions in order to add `layer1GasFee` property to transaction meta. ([#4055](https://github.com/MetaMask/core/pull/4055))
|
|
15
|
+
- Add `getLayer1GasFee` method to `TransactionController` to get the layer 1 gas fee for the given transaction params ([#4055](https://github.com/MetaMask/core/pull/4055))
|
|
16
|
+
- Add `SimulationErrorCode` enum ([#4106](https://github.com/MetaMask/core/pull/4106))
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- **BREAKING:** Bump peer dependency `@metamask/gas-fee-controller` to `^15.0.0` ([#4121](https://github.com/MetaMask/core/pull/4121))
|
|
21
|
+
- Update `addTransaction` to skip simulation if `requireApproval` is specified as `false` ([#4106](https://github.com/MetaMask/core/pull/4106))
|
|
22
|
+
- Provide simulation error code in locally generated errors (under the `code` property) ([#4106](https://github.com/MetaMask/core/pull/4106))
|
|
23
|
+
- Add dependency `@ethersproject/contracts` `^5.7.0` ([#4055](https://github.com/MetaMask/core/pull/4055))
|
|
24
|
+
- Add dependency `@ethersproject/providers` `^5.7.0` ([#4055](https://github.com/MetaMask/core/pull/4055))
|
|
25
|
+
- Bump dependency `@metamask/network-controller` to `^18.1.0` ([#4121](https://github.com/MetaMask/core/pull/4121))
|
|
26
|
+
|
|
27
|
+
### Removed
|
|
28
|
+
|
|
29
|
+
- **BREAKING**: Remove `isReverted` property from `SimulationError` type. ([#4106](https://github.com/MetaMask/core/pull/4106))
|
|
30
|
+
|
|
31
|
+
## [25.3.0]
|
|
32
|
+
|
|
33
|
+
### Added
|
|
34
|
+
|
|
35
|
+
- Add support for transactions with type `increaseAllowance` ([#4069](https://github.com/MetaMask/core/pull/4069))
|
|
36
|
+
- Also add "increaseAllowance" to `TransactionType` under `tokenMethodIncreaseAllowance`
|
|
37
|
+
|
|
38
|
+
### Changed
|
|
39
|
+
|
|
40
|
+
- Bump `@metamask/metamask-eth-abis` to `^3.1.1` ([#4069](https://github.com/MetaMask/core/pull/4069))
|
|
41
|
+
|
|
42
|
+
### Fixed
|
|
43
|
+
|
|
44
|
+
- Provide updated transaction metadata to publish hook ([#4101](https://github.com/MetaMask/core/pull/4101))
|
|
45
|
+
|
|
10
46
|
## [25.2.1]
|
|
11
47
|
|
|
12
48
|
### Changed
|
|
@@ -712,7 +748,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
712
748
|
|
|
713
749
|
All changes listed after this point were applied to this package following the monorepo conversion.
|
|
714
750
|
|
|
715
|
-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@
|
|
751
|
+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@26.0.0...HEAD
|
|
752
|
+
[26.0.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@25.3.0...@metamask/transaction-controller@26.0.0
|
|
753
|
+
[25.3.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@25.2.1...@metamask/transaction-controller@25.3.0
|
|
716
754
|
[25.2.1]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@25.2.0...@metamask/transaction-controller@25.2.1
|
|
717
755
|
[25.2.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@25.1.0...@metamask/transaction-controller@25.2.0
|
|
718
756
|
[25.1.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@25.0.0...@metamask/transaction-controller@25.1.0
|
|
@@ -4,31 +4,33 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkGASIS3QHjs = require('./chunk-GASIS3QH.js');
|
|
8
|
+
require('./chunk-SD6CWFDF.js');
|
|
8
9
|
require('./chunk-VH47Q6TS.js');
|
|
9
|
-
require('./chunk-
|
|
10
|
+
require('./chunk-GRQB2ARK.js');
|
|
10
11
|
require('./chunk-QP75SWIQ.js');
|
|
11
12
|
require('./chunk-ZNZEJDOE.js');
|
|
12
|
-
require('./chunk-
|
|
13
|
-
require('./chunk-
|
|
14
|
-
require('./chunk-
|
|
15
|
-
require('./chunk-
|
|
16
|
-
require('./chunk-
|
|
13
|
+
require('./chunk-V5X6MZHN.js');
|
|
14
|
+
require('./chunk-KT6UAKBB.js');
|
|
15
|
+
require('./chunk-QG2WVQE3.js');
|
|
16
|
+
require('./chunk-HUVOOFOM.js');
|
|
17
|
+
require('./chunk-5WFLNKCL.js');
|
|
17
18
|
require('./chunk-DTDTOMTB.js');
|
|
18
|
-
require('./chunk-
|
|
19
|
+
require('./chunk-I7VD6IET.js');
|
|
20
|
+
require('./chunk-C3UHJPYJ.js');
|
|
19
21
|
require('./chunk-5XBULBP2.js');
|
|
22
|
+
require('./chunk-VP2DBWOT.js');
|
|
20
23
|
require('./chunk-7LXE4KHV.js');
|
|
21
|
-
require('./chunk-
|
|
22
|
-
require('./chunk-
|
|
23
|
-
require('./chunk-
|
|
24
|
-
require('./chunk-
|
|
24
|
+
require('./chunk-HMOSP33F.js');
|
|
25
|
+
require('./chunk-XZILQVNW.js');
|
|
26
|
+
require('./chunk-6V2LR6JL.js');
|
|
27
|
+
require('./chunk-UUSYJGGQ.js');
|
|
28
|
+
require('./chunk-QTQSCTQA.js');
|
|
25
29
|
require('./chunk-UGFBA4GV.js');
|
|
26
|
-
require('./chunk-
|
|
27
|
-
require('./chunk-
|
|
28
|
-
require('./chunk-CXXGL43K.js');
|
|
29
|
-
require('./chunk-ITDY6AIZ.js');
|
|
30
|
+
require('./chunk-UH7FNVKS.js');
|
|
31
|
+
require('./chunk-WIZVJM2B.js');
|
|
30
32
|
require('./chunk-S6VGOPUY.js');
|
|
31
|
-
require('./chunk-
|
|
33
|
+
require('./chunk-FK7AP6SH.js');
|
|
32
34
|
require('./chunk-Z4BLTVTB.js');
|
|
33
35
|
|
|
34
36
|
|
|
@@ -36,5 +38,5 @@ require('./chunk-Z4BLTVTB.js');
|
|
|
36
38
|
|
|
37
39
|
|
|
38
40
|
|
|
39
|
-
exports.ApprovalState =
|
|
41
|
+
exports.ApprovalState = _chunkGASIS3QHjs.ApprovalState; exports.CANCEL_RATE = _chunkGASIS3QHjs.CANCEL_RATE; exports.HARDFORK = _chunkGASIS3QHjs.HARDFORK; exports.SPEED_UP_RATE = _chunkGASIS3QHjs.SPEED_UP_RATE; exports.TransactionController = _chunkGASIS3QHjs.TransactionController;
|
|
40
42
|
//# sourceMappingURL=TransactionController.js.map
|
|
@@ -4,31 +4,33 @@ import {
|
|
|
4
4
|
HARDFORK,
|
|
5
5
|
SPEED_UP_RATE,
|
|
6
6
|
TransactionController
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-APJWB5VY.mjs";
|
|
8
|
+
import "./chunk-KG4UW4K4.mjs";
|
|
8
9
|
import "./chunk-NM6OYEPP.mjs";
|
|
9
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-HLG525BC.mjs";
|
|
10
11
|
import "./chunk-XGRAHX6T.mjs";
|
|
11
12
|
import "./chunk-NHRBO3LU.mjs";
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-A4P4B3OF.mjs";
|
|
14
|
+
import "./chunk-K4KOSAGM.mjs";
|
|
15
|
+
import "./chunk-JW6P2G5A.mjs";
|
|
16
|
+
import "./chunk-35MG26Y3.mjs";
|
|
17
|
+
import "./chunk-W3CS5GRD.mjs";
|
|
17
18
|
import "./chunk-Y7ENNK7L.mjs";
|
|
18
|
-
import "./chunk-
|
|
19
|
+
import "./chunk-FTB6MCSH.mjs";
|
|
20
|
+
import "./chunk-RU6NJIUD.mjs";
|
|
19
21
|
import "./chunk-JRQHIBG5.mjs";
|
|
22
|
+
import "./chunk-RIYIJTEU.mjs";
|
|
20
23
|
import "./chunk-FRKQ3Z2L.mjs";
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-
|
|
23
|
-
import "./chunk-
|
|
24
|
-
import "./chunk-
|
|
24
|
+
import "./chunk-HQSNKCXI.mjs";
|
|
25
|
+
import "./chunk-7HNSDVVO.mjs";
|
|
26
|
+
import "./chunk-KKCD5UMP.mjs";
|
|
27
|
+
import "./chunk-TZEAWUXE.mjs";
|
|
28
|
+
import "./chunk-TJXPMOA6.mjs";
|
|
25
29
|
import "./chunk-J56A7UCK.mjs";
|
|
26
|
-
import "./chunk-
|
|
27
|
-
import "./chunk-
|
|
28
|
-
import "./chunk-VEREDMI2.mjs";
|
|
29
|
-
import "./chunk-Z3HHSD5I.mjs";
|
|
30
|
+
import "./chunk-TWND5SFD.mjs";
|
|
31
|
+
import "./chunk-DTMKGTYC.mjs";
|
|
30
32
|
import "./chunk-UQQWZT6C.mjs";
|
|
31
|
-
import "./chunk-
|
|
33
|
+
import "./chunk-YEJJKWT2.mjs";
|
|
32
34
|
import "./chunk-XUI43LEZ.mjs";
|
|
33
35
|
export {
|
|
34
36
|
ApprovalState,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
updateTransactionLayer1GasFee
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-W3CS5GRD.mjs";
|
|
4
4
|
import {
|
|
5
5
|
getGasFeeFlow
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-TWND5SFD.mjs";
|
|
7
7
|
import {
|
|
8
8
|
projectLogger
|
|
9
9
|
} from "./chunk-UQQWZT6C.mjs";
|
|
@@ -15,26 +15,27 @@ import {
|
|
|
15
15
|
} from "./chunk-XUI43LEZ.mjs";
|
|
16
16
|
|
|
17
17
|
// src/helpers/GasFeePoller.ts
|
|
18
|
+
import EthQuery from "@metamask/eth-query";
|
|
18
19
|
import { createModuleLogger } from "@metamask/utils";
|
|
19
20
|
import EventEmitter from "events";
|
|
20
21
|
var log = createModuleLogger(projectLogger, "gas-fee-poller");
|
|
21
22
|
var INTERVAL_MILLISECONDS = 1e4;
|
|
22
|
-
var _gasFeeFlows,
|
|
23
|
+
var _gasFeeFlows, _getGasFeeControllerEstimates, _getProvider, _getTransactions, _layer1GasFeeFlows, _timeout, _running, _start, start_fn, _stop, stop_fn, _onTimeout, onTimeout_fn, _updateTransactionGasFeeEstimates, updateTransactionGasFeeEstimates_fn, _updateTransactionSuggestedFees, updateTransactionSuggestedFees_fn, _updateTransactionLayer1GasFee, updateTransactionLayer1GasFee_fn, _getUnapprovedTransactions, getUnapprovedTransactions_fn;
|
|
23
24
|
var GasFeePoller = class {
|
|
24
25
|
/**
|
|
25
26
|
* Constructs a new instance of the GasFeePoller.
|
|
26
27
|
* @param options - The options for this instance.
|
|
27
28
|
* @param options.gasFeeFlows - The gas fee flows to use to obtain suitable gas fees.
|
|
28
|
-
* @param options.getEthQuery - Callback to obtain an EthQuery instance.
|
|
29
29
|
* @param options.getGasFeeControllerEstimates - Callback to obtain the default fee estimates.
|
|
30
|
+
* @param options.getProvider - Callback to obtain a provider instance.
|
|
30
31
|
* @param options.getTransactions - Callback to obtain the transaction data.
|
|
31
32
|
* @param options.layer1GasFeeFlows - The layer 1 gas fee flows to use to obtain suitable layer 1 gas fees.
|
|
32
33
|
* @param options.onStateChange - Callback to register a listener for controller state changes.
|
|
33
34
|
*/
|
|
34
35
|
constructor({
|
|
35
36
|
gasFeeFlows,
|
|
36
|
-
getEthQuery,
|
|
37
37
|
getGasFeeControllerEstimates,
|
|
38
|
+
getProvider,
|
|
38
39
|
getTransactions,
|
|
39
40
|
layer1GasFeeFlows,
|
|
40
41
|
onStateChange
|
|
@@ -48,16 +49,16 @@ var GasFeePoller = class {
|
|
|
48
49
|
__privateAdd(this, _getUnapprovedTransactions);
|
|
49
50
|
this.hub = new EventEmitter();
|
|
50
51
|
__privateAdd(this, _gasFeeFlows, void 0);
|
|
51
|
-
__privateAdd(this, _getEthQuery, void 0);
|
|
52
52
|
__privateAdd(this, _getGasFeeControllerEstimates, void 0);
|
|
53
|
+
__privateAdd(this, _getProvider, void 0);
|
|
53
54
|
__privateAdd(this, _getTransactions, void 0);
|
|
54
55
|
__privateAdd(this, _layer1GasFeeFlows, void 0);
|
|
55
56
|
__privateAdd(this, _timeout, void 0);
|
|
56
57
|
__privateAdd(this, _running, false);
|
|
57
58
|
__privateSet(this, _gasFeeFlows, gasFeeFlows);
|
|
58
59
|
__privateSet(this, _layer1GasFeeFlows, layer1GasFeeFlows);
|
|
59
|
-
__privateSet(this, _getEthQuery, getEthQuery);
|
|
60
60
|
__privateSet(this, _getGasFeeControllerEstimates, getGasFeeControllerEstimates);
|
|
61
|
+
__privateSet(this, _getProvider, getProvider);
|
|
61
62
|
__privateSet(this, _getTransactions, getTransactions);
|
|
62
63
|
onStateChange(() => {
|
|
63
64
|
const unapprovedTransactions = __privateMethod(this, _getUnapprovedTransactions, getUnapprovedTransactions_fn).call(this);
|
|
@@ -70,8 +71,8 @@ var GasFeePoller = class {
|
|
|
70
71
|
}
|
|
71
72
|
};
|
|
72
73
|
_gasFeeFlows = new WeakMap();
|
|
73
|
-
_getEthQuery = new WeakMap();
|
|
74
74
|
_getGasFeeControllerEstimates = new WeakMap();
|
|
75
|
+
_getProvider = new WeakMap();
|
|
75
76
|
_getTransactions = new WeakMap();
|
|
76
77
|
_layer1GasFeeFlows = new WeakMap();
|
|
77
78
|
_timeout = new WeakMap();
|
|
@@ -116,7 +117,7 @@ updateTransactionGasFeeEstimates_fn = async function() {
|
|
|
116
117
|
_updateTransactionSuggestedFees = new WeakSet();
|
|
117
118
|
updateTransactionSuggestedFees_fn = async function(transactionMeta) {
|
|
118
119
|
const { chainId, networkClientId } = transactionMeta;
|
|
119
|
-
const ethQuery = __privateGet(this,
|
|
120
|
+
const ethQuery = new EthQuery(__privateGet(this, _getProvider).call(this, chainId, networkClientId));
|
|
120
121
|
const gasFeeFlow = getGasFeeFlow(transactionMeta, __privateGet(this, _gasFeeFlows));
|
|
121
122
|
if (!gasFeeFlow) {
|
|
122
123
|
log("No gas fee flow found", transactionMeta.id);
|
|
@@ -158,9 +159,9 @@ updateTransactionSuggestedFees_fn = async function(transactionMeta) {
|
|
|
158
159
|
_updateTransactionLayer1GasFee = new WeakSet();
|
|
159
160
|
updateTransactionLayer1GasFee_fn = async function(transactionMeta) {
|
|
160
161
|
const { chainId, networkClientId } = transactionMeta;
|
|
161
|
-
const
|
|
162
|
+
const provider = __privateGet(this, _getProvider).call(this, chainId, networkClientId);
|
|
162
163
|
await updateTransactionLayer1GasFee({
|
|
163
|
-
|
|
164
|
+
provider,
|
|
164
165
|
layer1GasFeeFlows: __privateGet(this, _layer1GasFeeFlows),
|
|
165
166
|
transactionMeta
|
|
166
167
|
});
|
|
@@ -179,4 +180,4 @@ getUnapprovedTransactions_fn = function() {
|
|
|
179
180
|
export {
|
|
180
181
|
GasFeePoller
|
|
181
182
|
};
|
|
182
|
-
//# sourceMappingURL=chunk-
|
|
183
|
+
//# sourceMappingURL=chunk-35MG26Y3.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/helpers/GasFeePoller.ts"],"sourcesContent":["import EthQuery from '@metamask/eth-query';\nimport type { GasFeeState } from '@metamask/gas-fee-controller';\nimport type { NetworkClientId, Provider } from '@metamask/network-controller';\nimport type { Hex } from '@metamask/utils';\nimport { createModuleLogger } from '@metamask/utils';\nimport EventEmitter from 'events';\n\nimport { projectLogger } from '../logger';\nimport type {\n GasFeeEstimates,\n GasFeeFlow,\n GasFeeFlowRequest,\n Layer1GasFeeFlow,\n} from '../types';\nimport { TransactionStatus, type TransactionMeta } from '../types';\nimport { getGasFeeFlow } from '../utils/gas-flow';\nimport { updateTransactionLayer1GasFee } from '../utils/layer1-gas-fee-flow';\n\nconst log = createModuleLogger(projectLogger, 'gas-fee-poller');\n\nconst INTERVAL_MILLISECONDS = 10000;\n\n/**\n * Automatically polls and updates suggested gas fees on unapproved transactions.\n */\nexport class GasFeePoller {\n hub: EventEmitter = new EventEmitter();\n\n #gasFeeFlows: GasFeeFlow[];\n\n #getGasFeeControllerEstimates: () => Promise<GasFeeState>;\n\n #getProvider: (chainId: Hex, networkClientId?: NetworkClientId) => Provider;\n\n #getTransactions: () => TransactionMeta[];\n\n #layer1GasFeeFlows: Layer1GasFeeFlow[];\n\n #timeout: ReturnType<typeof setTimeout> | undefined;\n\n #running = false;\n\n /**\n * Constructs a new instance of the GasFeePoller.\n * @param options - The options for this instance.\n * @param options.gasFeeFlows - The gas fee flows to use to obtain suitable gas fees.\n * @param options.getGasFeeControllerEstimates - Callback to obtain the default fee estimates.\n * @param options.getProvider - Callback to obtain a provider instance.\n * @param options.getTransactions - Callback to obtain the transaction data.\n * @param options.layer1GasFeeFlows - The layer 1 gas fee flows to use to obtain suitable layer 1 gas fees.\n * @param options.onStateChange - Callback to register a listener for controller state changes.\n */\n constructor({\n gasFeeFlows,\n getGasFeeControllerEstimates,\n getProvider,\n getTransactions,\n layer1GasFeeFlows,\n onStateChange,\n }: {\n gasFeeFlows: GasFeeFlow[];\n getGasFeeControllerEstimates: () => Promise<GasFeeState>;\n getProvider: (chainId: Hex, networkClientId?: NetworkClientId) => Provider;\n getTransactions: () => TransactionMeta[];\n layer1GasFeeFlows: Layer1GasFeeFlow[];\n onStateChange: (listener: () => void) => void;\n }) {\n this.#gasFeeFlows = gasFeeFlows;\n this.#layer1GasFeeFlows = layer1GasFeeFlows;\n this.#getGasFeeControllerEstimates = getGasFeeControllerEstimates;\n this.#getProvider = getProvider;\n this.#getTransactions = getTransactions;\n\n onStateChange(() => {\n const unapprovedTransactions = this.#getUnapprovedTransactions();\n\n if (unapprovedTransactions.length) {\n this.#start();\n } else {\n this.#stop();\n }\n });\n }\n\n #start() {\n if (this.#running) {\n return;\n }\n\n // Intentionally not awaiting since this starts the timeout chain.\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.#onTimeout();\n\n this.#running = true;\n\n log('Started polling');\n }\n\n #stop() {\n if (!this.#running) {\n return;\n }\n\n clearTimeout(this.#timeout);\n\n this.#timeout = undefined;\n this.#running = false;\n\n log('Stopped polling');\n }\n\n async #onTimeout() {\n await this.#updateTransactionGasFeeEstimates();\n\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n this.#timeout = setTimeout(() => this.#onTimeout(), INTERVAL_MILLISECONDS);\n }\n\n async #updateTransactionGasFeeEstimates() {\n const unapprovedTransactions = this.#getUnapprovedTransactions();\n\n log('Found unapproved transactions', {\n count: unapprovedTransactions.length,\n });\n\n await Promise.all(\n unapprovedTransactions.flatMap((tx) => [\n this.#updateTransactionSuggestedFees(tx),\n this.#updateTransactionLayer1GasFee(tx),\n ]),\n );\n }\n\n async #updateTransactionSuggestedFees(transactionMeta: TransactionMeta) {\n const { chainId, networkClientId } = transactionMeta;\n\n const ethQuery = new EthQuery(this.#getProvider(chainId, networkClientId));\n const gasFeeFlow = getGasFeeFlow(transactionMeta, this.#gasFeeFlows);\n\n if (!gasFeeFlow) {\n log('No gas fee flow found', transactionMeta.id);\n } else {\n log(\n 'Found gas fee flow',\n gasFeeFlow.constructor.name,\n transactionMeta.id,\n );\n }\n\n const request: GasFeeFlowRequest = {\n ethQuery,\n getGasFeeControllerEstimates: this.#getGasFeeControllerEstimates,\n transactionMeta,\n };\n\n let gasFeeEstimates: GasFeeEstimates | undefined;\n\n if (gasFeeFlow) {\n try {\n const response = await gasFeeFlow.getGasFees(request);\n gasFeeEstimates = response.estimates;\n } catch (error) {\n log('Failed to get suggested gas fees', transactionMeta.id, error);\n }\n }\n\n if (!gasFeeEstimates && transactionMeta.gasFeeEstimatesLoaded) {\n return;\n }\n\n const updatedTransactionMeta: TransactionMeta = {\n ...transactionMeta,\n gasFeeEstimates,\n gasFeeEstimatesLoaded: true,\n };\n\n this.hub.emit('transaction-updated', updatedTransactionMeta);\n\n log('Updated suggested gas fees', {\n gasFeeEstimates: updatedTransactionMeta.gasFeeEstimates,\n transaction: updatedTransactionMeta.id,\n });\n }\n\n async #updateTransactionLayer1GasFee(transactionMeta: TransactionMeta) {\n const { chainId, networkClientId } = transactionMeta;\n const provider = this.#getProvider(chainId, networkClientId);\n\n await updateTransactionLayer1GasFee({\n provider,\n layer1GasFeeFlows: this.#layer1GasFeeFlows,\n transactionMeta,\n });\n\n if (transactionMeta.layer1GasFee === undefined) {\n return;\n }\n\n this.hub.emit('transaction-updated', transactionMeta);\n }\n\n #getUnapprovedTransactions() {\n return this.#getTransactions().filter(\n (tx) => tx.status === TransactionStatus.unapproved,\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,OAAO,cAAc;AAIrB,SAAS,0BAA0B;AACnC,OAAO,kBAAkB;AAazB,IAAM,MAAM,mBAAmB,eAAe,gBAAgB;AAE9D,IAAM,wBAAwB;AApB9B;AAyBO,IAAM,eAAN,MAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA2BxB,YAAY;AAAA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ACtD;AAEA;AAAA,+BAA0B,WAAG;AAC3B,SAAO,mBAAK,kBAAL,WAAwB;AAAA,IAC7B,CAAC,OAAO,GAAG;AAAA,EACb;AACF;","names":[]}
|
|
@@ -18,9 +18,9 @@ function getLayer1GasFeeFlow(transactionMeta, layer1GasFeeFlows) {
|
|
|
18
18
|
);
|
|
19
19
|
}
|
|
20
20
|
async function getTransactionLayer1GasFee({
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
layer1GasFeeFlows,
|
|
22
|
+
provider,
|
|
23
|
+
transactionMeta
|
|
24
24
|
}) {
|
|
25
25
|
const layer1GasFeeFlow = getLayer1GasFeeFlow(
|
|
26
26
|
transactionMeta,
|
|
@@ -32,7 +32,7 @@ async function getTransactionLayer1GasFee({
|
|
|
32
32
|
}
|
|
33
33
|
try {
|
|
34
34
|
const { layer1Fee } = await layer1GasFeeFlow.getLayer1Fee({
|
|
35
|
-
|
|
35
|
+
provider,
|
|
36
36
|
transactionMeta
|
|
37
37
|
});
|
|
38
38
|
return layer1Fee;
|
|
@@ -44,5 +44,6 @@ async function getTransactionLayer1GasFee({
|
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
|
|
48
|
+
exports.updateTransactionLayer1GasFee = updateTransactionLayer1GasFee; exports.getTransactionLayer1GasFee = getTransactionLayer1GasFee;
|
|
49
|
+
//# sourceMappingURL=chunk-5WFLNKCL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/layer1-gas-fee-flow.ts"],"names":[],"mappings":";;;;;AACA,SAAS,0BAAoC;AAK7C,IAAM,MAAM,mBAAmB,eAAe,sBAAsB;AAepE,eAAsB,8BACpB,SACA;AACA,QAAM,eAAe,MAAM,2BAA2B,OAAO;AAE7D,MAAI,cAAc;AAChB,UAAM,EAAE,gBAAgB,IAAI;AAC5B,oBAAgB,eAAe;AAAA,EACjC;AACF;AAQA,SAAS,oBACP,iBACA,mBAC8B;AAC9B,SAAO,kBAAkB;AAAA,IAAK,CAAC,qBAC7B,iBAAiB,mBAAmB,eAAe;AAAA,EACrD;AACF;AASA,eAAsB,2BAA2B;AAAA,EAC/C;AAAA,EACA;AAAA,EACA;AACF,GAAwD;AACtD,QAAM,mBAAmB;AAAA,IACvB;AAAA,IACA;AAAA,EACF;AACA,MAAI,CAAC,kBAAkB;AACrB,QAAI,kCAAkC,gBAAgB,EAAE;AACxD,WAAO;AAAA,EACT;AAEA,MAAI;AACF,UAAM,EAAE,UAAU,IAAI,MAAM,iBAAiB,aAAa;AAAA,MACxD;AAAA,MACA;AAAA,IACF,CAAC;AACD,WAAO;AAAA,EACT,SAAS,OAAO;AACd,QAAI,iCAAiC,gBAAgB,IAAI,KAAK;AAC9D,WAAO;AAAA,EACT;AACF","sourcesContent":["import type { Provider } from '@metamask/network-controller';\nimport { createModuleLogger, type Hex } from '@metamask/utils';\n\nimport { projectLogger } from '../logger';\nimport type { Layer1GasFeeFlow, TransactionMeta } from '../types';\n\nconst log = createModuleLogger(projectLogger, 'layer-1-gas-fee-flow');\n\nexport type UpdateLayer1GasFeeRequest = {\n layer1GasFeeFlows: Layer1GasFeeFlow[];\n provider: Provider;\n transactionMeta: TransactionMeta;\n};\n\n/**\n * Updates the given transactionMeta with the layer 1 gas fee.\n * @param request - The request to use when getting the layer 1 gas fee.\n * @param request.provider - Provider used to create a new underlying EthQuery instance\n * @param request.transactionMeta - The transaction to get the layer 1 gas fee for.\n * @param request.layer1GasFeeFlows - The layer 1 gas fee flows to search.\n */\nexport async function updateTransactionLayer1GasFee(\n request: UpdateLayer1GasFeeRequest,\n) {\n const layer1GasFee = await getTransactionLayer1GasFee(request);\n\n if (layer1GasFee) {\n const { transactionMeta } = request;\n transactionMeta.layer1GasFee = layer1GasFee;\n }\n}\n\n/**\n * Get the layer 1 gas fee flow for a transaction.\n * @param transactionMeta - The transaction to get the layer 1 gas fee flow for.\n * @param layer1GasFeeFlows - The layer 1 gas fee flows to search.\n * @returns The layer 1 gas fee flow for the transaction, or undefined if none match.\n */\nfunction getLayer1GasFeeFlow(\n transactionMeta: TransactionMeta,\n layer1GasFeeFlows: Layer1GasFeeFlow[],\n): Layer1GasFeeFlow | undefined {\n return layer1GasFeeFlows.find((layer1GasFeeFlow) =>\n layer1GasFeeFlow.matchesTransaction(transactionMeta),\n );\n}\n\n/**\n * Get the layer 1 gas fee for a transaction and return the layer1Fee.\n * @param request - The request to use when getting the layer 1 gas fee.\n * @param request.layer1GasFeeFlows - The layer 1 gas fee flows to search.\n * @param request.provider - The provider to use to get the layer 1 gas fee.\n * @param request.transactionMeta - The transaction to get the layer 1 gas fee for.\n */\nexport async function getTransactionLayer1GasFee({\n layer1GasFeeFlows,\n provider,\n transactionMeta,\n}: UpdateLayer1GasFeeRequest): Promise<Hex | undefined> {\n const layer1GasFeeFlow = getLayer1GasFeeFlow(\n transactionMeta,\n layer1GasFeeFlows,\n );\n if (!layer1GasFeeFlow) {\n log('Layer 1 gas fee flow not found', transactionMeta.id);\n return undefined;\n }\n\n try {\n const { layer1Fee } = await layer1GasFeeFlow.getLayer1Fee({\n provider,\n transactionMeta,\n });\n return layer1Fee;\n } catch (error) {\n log('Failed to get layer 1 gas fee', transactionMeta.id, error);\n return undefined;\n }\n}\n"]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkUUSYJGGQjs = require('./chunk-UUSYJGGQ.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkS6VGOPUYjs = require('./chunk-S6VGOPUY.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkFK7AP6SHjs = require('./chunk-FK7AP6SH.js');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
@@ -37,7 +37,7 @@ var DefaultGasFeeFlow = class {
|
|
|
37
37
|
} else {
|
|
38
38
|
throw new Error(`'No gas fee estimates available`);
|
|
39
39
|
}
|
|
40
|
-
const estimates = Object.values(
|
|
40
|
+
const estimates = Object.values(_chunkFK7AP6SHjs.GasFeeEstimateLevel).reduce(
|
|
41
41
|
(result, level) => ({
|
|
42
42
|
...result,
|
|
43
43
|
[level]: _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _getEstimateLevel, getEstimateLevel_fn).call(this, {
|
|
@@ -64,10 +64,10 @@ getEstimateLevel_fn = function({
|
|
|
64
64
|
};
|
|
65
65
|
_getFeeMarketLevel = new WeakSet();
|
|
66
66
|
getFeeMarketLevel_fn = function(gasFeeEstimates, level) {
|
|
67
|
-
const maxFeePerGas =
|
|
67
|
+
const maxFeePerGas = _chunkUUSYJGGQjs.gweiDecimalToWeiHex.call(void 0,
|
|
68
68
|
gasFeeEstimates[level].suggestedMaxFeePerGas
|
|
69
69
|
);
|
|
70
|
-
const maxPriorityFeePerGas =
|
|
70
|
+
const maxPriorityFeePerGas = _chunkUUSYJGGQjs.gweiDecimalToWeiHex.call(void 0,
|
|
71
71
|
gasFeeEstimates[level].suggestedMaxPriorityFeePerGas
|
|
72
72
|
);
|
|
73
73
|
return {
|
|
@@ -77,7 +77,7 @@ getFeeMarketLevel_fn = function(gasFeeEstimates, level) {
|
|
|
77
77
|
};
|
|
78
78
|
_getLegacyLevel = new WeakSet();
|
|
79
79
|
getLegacyLevel_fn = function(gasFeeEstimates, level) {
|
|
80
|
-
const gasPrice =
|
|
80
|
+
const gasPrice = _chunkUUSYJGGQjs.gweiDecimalToWeiHex.call(void 0, gasFeeEstimates[level]);
|
|
81
81
|
return {
|
|
82
82
|
maxFeePerGas: gasPrice,
|
|
83
83
|
maxPriorityFeePerGas: gasPrice
|
|
@@ -87,4 +87,4 @@ getLegacyLevel_fn = function(gasFeeEstimates, level) {
|
|
|
87
87
|
|
|
88
88
|
|
|
89
89
|
exports.DefaultGasFeeFlow = DefaultGasFeeFlow;
|
|
90
|
-
//# sourceMappingURL=chunk-
|
|
90
|
+
//# sourceMappingURL=chunk-6V2LR6JL.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DefaultGasFeeFlow
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-KKCD5UMP.mjs";
|
|
4
4
|
import {
|
|
5
5
|
projectLogger
|
|
6
6
|
} from "./chunk-UQQWZT6C.mjs";
|
|
7
7
|
import {
|
|
8
8
|
GasFeeEstimateLevel
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-YEJJKWT2.mjs";
|
|
10
10
|
import {
|
|
11
11
|
__privateAdd,
|
|
12
12
|
__privateMethod
|
|
@@ -118,4 +118,4 @@ feesToString_fn = function(fees) {
|
|
|
118
118
|
export {
|
|
119
119
|
LineaGasFeeFlow
|
|
120
120
|
};
|
|
121
|
-
//# sourceMappingURL=chunk-
|
|
121
|
+
//# sourceMappingURL=chunk-7HNSDVVO.mjs.map
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
simulateTransactions
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-K4KOSAGM.mjs";
|
|
4
|
+
import {
|
|
5
|
+
SimulationError,
|
|
6
|
+
SimulationInvalidResponseError,
|
|
7
|
+
SimulationRevertedError
|
|
8
|
+
} from "./chunk-HQSNKCXI.mjs";
|
|
4
9
|
import {
|
|
5
10
|
projectLogger
|
|
6
11
|
} from "./chunk-UQQWZT6C.mjs";
|
|
@@ -11,6 +16,7 @@ import { hexToBN, toHex } from "@metamask/controller-utils";
|
|
|
11
16
|
import { abiERC20, abiERC721, abiERC1155 } from "@metamask/metamask-eth-abis";
|
|
12
17
|
import { createModuleLogger } from "@metamask/utils";
|
|
13
18
|
var log = createModuleLogger(projectLogger, "simulation");
|
|
19
|
+
var REVERTED_ERRORS = ["execution reverted", "insufficient funds for gas"];
|
|
14
20
|
async function getSimulationData(request) {
|
|
15
21
|
const { chainId, from, to, value, data } = request;
|
|
16
22
|
log("Getting simulation data", request);
|
|
@@ -30,8 +36,11 @@ async function getSimulationData(request) {
|
|
|
30
36
|
withLogs: true
|
|
31
37
|
});
|
|
32
38
|
const transactionError = response.transactions?.[0]?.error;
|
|
39
|
+
if (REVERTED_ERRORS.some((error) => transactionError?.includes(error))) {
|
|
40
|
+
throw new SimulationRevertedError();
|
|
41
|
+
}
|
|
33
42
|
if (transactionError) {
|
|
34
|
-
throw
|
|
43
|
+
throw new SimulationError(transactionError);
|
|
35
44
|
}
|
|
36
45
|
const nativeBalanceChange = getNativeBalanceChange(request.from, response);
|
|
37
46
|
const events = getEvents(response);
|
|
@@ -48,8 +57,7 @@ async function getSimulationData(request) {
|
|
|
48
57
|
tokenBalanceChanges: [],
|
|
49
58
|
error: {
|
|
50
59
|
code: rawError.code,
|
|
51
|
-
message: rawError.message
|
|
52
|
-
isReverted: rawError.message?.includes("execution reverted") ?? false
|
|
60
|
+
message: rawError.message
|
|
53
61
|
}
|
|
54
62
|
};
|
|
55
63
|
}
|
|
@@ -130,7 +138,7 @@ async function getTokenBalanceChanges(request, events) {
|
|
|
130
138
|
});
|
|
131
139
|
log("Balance simulation response", response);
|
|
132
140
|
if (response.transactions.length !== balanceTransactions.length * 2 + 1) {
|
|
133
|
-
throw new
|
|
141
|
+
throw new SimulationInvalidResponseError();
|
|
134
142
|
}
|
|
135
143
|
return [...balanceTransactionsByToken.keys()].map((token, index) => {
|
|
136
144
|
const previousBalance = normalizeReturnValue(
|
|
@@ -262,4 +270,4 @@ function normalizeReturnValue(value) {
|
|
|
262
270
|
export {
|
|
263
271
|
getSimulationData
|
|
264
272
|
};
|
|
265
|
-
//# sourceMappingURL=chunk-
|
|
273
|
+
//# sourceMappingURL=chunk-A4P4B3OF.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/simulation.ts"],"sourcesContent":["import type { Fragment, LogDescription, Result } from '@ethersproject/abi';\nimport { Interface } from '@ethersproject/abi';\nimport { hexToBN, toHex } from '@metamask/controller-utils';\nimport { abiERC20, abiERC721, abiERC1155 } from '@metamask/metamask-eth-abis';\nimport { createModuleLogger, type Hex } from '@metamask/utils';\n\nimport {\n SimulationError,\n SimulationInvalidResponseError,\n SimulationRevertedError,\n} from '../errors';\nimport { projectLogger } from '../logger';\nimport type {\n SimulationBalanceChange,\n SimulationData,\n SimulationTokenBalanceChange,\n SimulationToken,\n} from '../types';\nimport { SimulationTokenStandard } from '../types';\nimport { simulateTransactions } from './simulation-api';\nimport type {\n SimulationResponseLog,\n SimulationRequestTransaction,\n SimulationResponse,\n SimulationResponseCallTrace,\n} from './simulation-api';\n\nconst log = createModuleLogger(projectLogger, 'simulation');\n\nconst REVERTED_ERRORS = ['execution reverted', 'insufficient funds for gas'];\n\ntype ABI = Fragment[];\n\nexport type GetSimulationDataRequest = {\n chainId: Hex;\n from: Hex;\n to?: Hex;\n value?: Hex;\n data?: Hex;\n};\n\ntype ParsedEvent = {\n contractAddress: Hex;\n tokenStandard: SimulationTokenStandard;\n name: string;\n args: Record<string, Hex | Hex[]>;\n abi: ABI;\n};\n\n/**\n * Generate simulation data for a transaction.\n * @param request - The transaction to simulate.\n * @param request.chainId - The chain ID of the transaction.\n * @param request.from - The sender of the transaction.\n * @param request.to - The recipient of the transaction.\n * @param request.value - The value of the transaction.\n * @param request.data - The data of the transaction.\n * @returns The simulation data.\n */\nexport async function getSimulationData(\n request: GetSimulationDataRequest,\n): Promise<SimulationData> {\n const { chainId, from, to, value, data } = request;\n\n log('Getting simulation data', request);\n\n try {\n const response = await simulateTransactions(chainId, {\n transactions: [\n {\n data,\n from,\n maxFeePerGas: '0x0',\n maxPriorityFeePerGas: '0x0',\n to,\n value,\n },\n ],\n withCallTrace: true,\n withLogs: true,\n });\n\n const transactionError = response.transactions?.[0]?.error;\n\n if (REVERTED_ERRORS.some((error) => transactionError?.includes(error))) {\n throw new SimulationRevertedError();\n }\n\n if (transactionError) {\n throw new SimulationError(transactionError);\n }\n\n const nativeBalanceChange = getNativeBalanceChange(request.from, response);\n const events = getEvents(response);\n\n log('Parsed events', events);\n\n const tokenBalanceChanges = await getTokenBalanceChanges(request, events);\n\n return {\n nativeBalanceChange,\n tokenBalanceChanges,\n };\n } catch (error) {\n log('Failed to get simulation data', error, request);\n\n const rawError = error as { code?: number; message?: string };\n\n return {\n tokenBalanceChanges: [],\n error: {\n code: rawError.code,\n message: rawError.message,\n },\n };\n }\n}\n\n/**\n * Extract the native balance change from a simulation response.\n * @param userAddress - The user's account address.\n * @param response - The simulation response.\n * @returns The native balance change or undefined if unchanged.\n */\nfunction getNativeBalanceChange(\n userAddress: Hex,\n response: SimulationResponse,\n): SimulationBalanceChange | undefined {\n const transactionResponse = response.transactions[0];\n\n /* istanbul ignore next */\n if (!transactionResponse) {\n return undefined;\n }\n\n const { stateDiff } = transactionResponse;\n const previousBalance = stateDiff?.pre?.[userAddress]?.balance;\n const newBalance = stateDiff?.post?.[userAddress]?.balance;\n\n if (!previousBalance || !newBalance) {\n return undefined;\n }\n\n return getSimulationBalanceChange(previousBalance, newBalance);\n}\n\n/**\n * Extract events from a simulation response.\n * @param response - The simulation response.\n * @returns The parsed events.\n */\nfunction getEvents(response: SimulationResponse): ParsedEvent[] {\n /* istanbul ignore next */\n const logs = extractLogs(\n response.transactions[0]?.callTrace ?? ({} as SimulationResponseCallTrace),\n );\n\n log('Extracted logs', logs);\n\n const erc20Interface = new Interface(abiERC20);\n const erc721Interface = new Interface(abiERC721);\n const erc1155Interface = new Interface(abiERC1155);\n\n return logs\n .map((currentLog) => {\n const event = parseLog(\n currentLog,\n erc20Interface,\n erc721Interface,\n erc1155Interface,\n );\n\n if (!event) {\n log('Failed to parse log', currentLog);\n return undefined;\n }\n\n /* istanbul ignore next */\n const inputs = event.abi.find((e) => e.name === event.name)?.inputs;\n\n /* istanbul ignore if */\n if (!inputs) {\n log('Failed to find inputs for event', event);\n return undefined;\n }\n\n const args = parseEventArgs(event.args, inputs);\n\n return {\n contractAddress: currentLog.address,\n tokenStandard: event.standard,\n name: event.name,\n args,\n abi: event.abi,\n };\n })\n .filter((e) => e !== undefined) as ParsedEvent[];\n}\n\n/**\n * Parse event arguments using ABI input definitions.\n * @param args - The raw event arguments.\n * @param abiInputs - The ABI input definitions.\n * @returns The parsed event arguments.\n */\nfunction parseEventArgs(\n args: Result,\n abiInputs: { name: string }[],\n): Record<string, Hex | Hex[]> {\n return args.reduce((result, arg, index) => {\n const name = abiInputs[index].name.replace('_', '');\n const value = parseEventArgValue(arg);\n\n result[name] = value;\n\n return result;\n }, {});\n}\n\n/**\n * Parse an event argument value.\n * @param value - The event argument value.\n * @returns The parsed event argument value.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction parseEventArgValue(value: any): Hex | Hex[] {\n if (Array.isArray(value)) {\n return value.map(parseEventArgValue) as Hex[];\n }\n\n return (value.toHexString?.() ?? value).toLowerCase();\n}\n\n/**\n * Generate token balance changes from parsed events.\n * @param request - The transaction that was simulated.\n * @param events - The parsed events.\n * @returns An array of token balance changes.\n */\nasync function getTokenBalanceChanges(\n request: GetSimulationDataRequest,\n events: ParsedEvent[],\n): Promise<SimulationTokenBalanceChange[]> {\n const balanceTransactionsByToken = getTokenBalanceTransactions(\n request,\n events,\n );\n\n const balanceTransactions = [...balanceTransactionsByToken.values()];\n\n log('Generated balance transactions', balanceTransactions);\n\n if (!balanceTransactions.length) {\n return [];\n }\n\n const response = await simulateTransactions(request.chainId as Hex, {\n transactions: [...balanceTransactions, request, ...balanceTransactions],\n });\n\n log('Balance simulation response', response);\n\n if (response.transactions.length !== balanceTransactions.length * 2 + 1) {\n throw new SimulationInvalidResponseError();\n }\n\n return [...balanceTransactionsByToken.keys()]\n .map((token, index) => {\n const previousBalance = normalizeReturnValue(\n response.transactions[index].return,\n );\n\n const newBalance = normalizeReturnValue(\n response.transactions[index + balanceTransactions.length + 1].return,\n );\n\n const balanceChange = getSimulationBalanceChange(\n previousBalance,\n newBalance,\n );\n\n if (!balanceChange) {\n return undefined;\n }\n\n return {\n ...token,\n ...balanceChange,\n };\n })\n .filter((change) => change !== undefined) as SimulationTokenBalanceChange[];\n}\n\n/**\n * Generate transactions to check token balances.\n * @param request - The transaction that was simulated.\n * @param events - The parsed events.\n * @returns A map of token balance transactions keyed by token.\n */\nfunction getTokenBalanceTransactions(\n request: GetSimulationDataRequest,\n events: ParsedEvent[],\n): Map<SimulationToken, SimulationRequestTransaction> {\n const tokenKeys = new Set();\n\n return events.reduce((result, event) => {\n if (\n !['Transfer', 'TransferSingle', 'TransferBatch'].includes(event.name) ||\n ![event.args.from, event.args.to].includes(request.from)\n ) {\n log('Ignoring event', event);\n return result;\n }\n\n // ERC-20 does not have a token ID so default to undefined.\n let tokenIds: (Hex | undefined)[] = [undefined];\n\n if (event.tokenStandard === SimulationTokenStandard.erc721) {\n tokenIds = [event.args.tokenId as Hex];\n }\n\n if (\n event.tokenStandard === SimulationTokenStandard.erc1155 &&\n event.name === 'TransferSingle'\n ) {\n tokenIds = [event.args.id as Hex];\n }\n\n if (\n event.tokenStandard === SimulationTokenStandard.erc1155 &&\n event.name === 'TransferBatch'\n ) {\n tokenIds = event.args.ids as Hex[];\n }\n\n log('Extracted token ids', tokenIds);\n\n for (const tokenId of tokenIds) {\n const simulationToken: SimulationToken = {\n address: event.contractAddress,\n standard: event.tokenStandard,\n id: tokenId,\n };\n\n const tokenKey = JSON.stringify(simulationToken);\n\n if (tokenKeys.has(tokenKey)) {\n log(\n 'Ignoring additional event with same contract and token ID',\n simulationToken,\n );\n continue;\n }\n\n tokenKeys.add(tokenKey);\n\n const parameters = [request.from];\n\n if (event.tokenStandard === SimulationTokenStandard.erc1155) {\n parameters.push(tokenId as Hex);\n }\n\n result.set(simulationToken, {\n from: request.from,\n to: event.contractAddress,\n data: new Interface(event.abi).encodeFunctionData(\n 'balanceOf',\n parameters,\n ) as Hex,\n });\n }\n\n return result;\n }, new Map<SimulationToken, SimulationRequestTransaction>());\n}\n\n/**\n * Parse a raw event log using known ABIs.\n * @param eventLog - The raw event log.\n * @param erc20 - The ERC-20 ABI interface.\n * @param erc721 - The ERC-721 ABI interface.\n * @param erc1155 - The ERC-1155 ABI interface.\n * @returns The parsed event log or undefined if it could not be parsed.\n */\nfunction parseLog(\n eventLog: SimulationResponseLog,\n erc20: Interface,\n erc721: Interface,\n erc1155: Interface,\n):\n | (LogDescription & { abi: ABI; standard: SimulationTokenStandard })\n | undefined {\n const abisByStandard = [\n {\n abi: abiERC20,\n contractInterface: erc20,\n standard: SimulationTokenStandard.erc20,\n },\n {\n abi: abiERC721,\n contractInterface: erc721,\n standard: SimulationTokenStandard.erc721,\n },\n {\n abi: abiERC1155,\n contractInterface: erc1155,\n standard: SimulationTokenStandard.erc1155,\n },\n ];\n\n for (const { abi, contractInterface, standard } of abisByStandard) {\n try {\n return {\n ...contractInterface.parseLog(eventLog),\n abi,\n standard,\n };\n } catch (e) {\n continue;\n }\n }\n\n return undefined;\n}\n\n/**\n * Extract all logs from a call trace tree.\n * @param call - The root call trace.\n * @returns An array of logs.\n */\nfunction extractLogs(\n call: SimulationResponseCallTrace,\n): SimulationResponseLog[] {\n /* istanbul ignore next */\n const logs = call.logs ?? [];\n\n /* istanbul ignore next */\n const nestedCalls = call.calls ?? [];\n\n return [\n ...logs,\n ...nestedCalls.map((nestedCall) => extractLogs(nestedCall)).flat(),\n ];\n}\n\n/**\n * Generate balance change data from previous and new balances.\n * @param previousBalance - The previous balance.\n * @param newBalance - The new balance.\n * @returns The balance change data or undefined if unchanged.\n */\nfunction getSimulationBalanceChange(\n previousBalance: Hex,\n newBalance: Hex,\n): SimulationBalanceChange | undefined {\n const differenceBN = hexToBN(newBalance).sub(hexToBN(previousBalance));\n const isDecrease = differenceBN.isNeg();\n const difference = toHex(differenceBN.abs());\n\n if (differenceBN.isZero()) {\n log('Balance change is zero');\n return undefined;\n }\n\n return {\n previousBalance,\n newBalance,\n difference,\n isDecrease,\n };\n}\n\n/**\n * Normalize a return value.\n * @param value - The return value to normalize.\n * @returns The normalized return value.\n */\nfunction normalizeReturnValue(value: Hex): Hex {\n return toHex(hexToBN(value));\n}\n"],"mappings":";;;;;;;;;;;;;AACA,SAAS,iBAAiB;AAC1B,SAAS,SAAS,aAAa;AAC/B,SAAS,UAAU,WAAW,kBAAkB;AAChD,SAAS,0BAAoC;AAuB7C,IAAM,MAAM,mBAAmB,eAAe,YAAY;AAE1D,IAAM,kBAAkB,CAAC,sBAAsB,4BAA4B;AA8B3E,eAAsB,kBACpB,SACyB;AACzB,QAAM,EAAE,SAAS,MAAM,IAAI,OAAO,KAAK,IAAI;AAE3C,MAAI,2BAA2B,OAAO;AAEtC,MAAI;AACF,UAAM,WAAW,MAAM,qBAAqB,SAAS;AAAA,MACnD,cAAc;AAAA,QACZ;AAAA,UACE;AAAA,UACA;AAAA,UACA,cAAc;AAAA,UACd,sBAAsB;AAAA,UACtB;AAAA,UACA;AAAA,QACF;AAAA,MACF;AAAA,MACA,eAAe;AAAA,MACf,UAAU;AAAA,IACZ,CAAC;AAED,UAAM,mBAAmB,SAAS,eAAe,CAAC,GAAG;AAErD,QAAI,gBAAgB,KAAK,CAAC,UAAU,kBAAkB,SAAS,KAAK,CAAC,GAAG;AACtE,YAAM,IAAI,wBAAwB;AAAA,IACpC;AAEA,QAAI,kBAAkB;AACpB,YAAM,IAAI,gBAAgB,gBAAgB;AAAA,IAC5C;AAEA,UAAM,sBAAsB,uBAAuB,QAAQ,MAAM,QAAQ;AACzE,UAAM,SAAS,UAAU,QAAQ;AAEjC,QAAI,iBAAiB,MAAM;AAE3B,UAAM,sBAAsB,MAAM,uBAAuB,SAAS,MAAM;AAExE,WAAO;AAAA,MACL;AAAA,MACA;AAAA,IACF;AAAA,EACF,SAAS,OAAO;AACd,QAAI,iCAAiC,OAAO,OAAO;AAEnD,UAAM,WAAW;AAEjB,WAAO;AAAA,MACL,qBAAqB,CAAC;AAAA,MACtB,OAAO;AAAA,QACL,MAAM,SAAS;AAAA,QACf,SAAS,SAAS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