Commit 5d4a7c1
committed
fix: include gas in simulation requests (#5754)
Include gas limit and gas fees in balance change simulation requests.
Specifically:
- Create alternate simulation request specifically for gas fee tokens in
new `utils/gas-fee-tokens.ts`.
- Rename `utils/simulation.ts` to `utils/balance-changes.ts`.
- Add `withGas` and `withDefaultBlockOverrides` to balance change
simulation requests.
- Override balance in balance change requests if insufficient balance.
- Subtract gas cost from native balance change.
- Replace code override with `authorizationList` including `from`
property.
- Retrieve MetaMask fee from simulation API.
- [x] I've updated the test suite for new or updated code as appropriate
- [x] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [x] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs),
highlighting breaking changes as necessary
- [x] I've prepared draft pull requests for clients and consumer
packages to resolve any breaking changes1 parent 667d223 commit 5d4a7c1
File tree
8 files changed
+981
-713
lines changed- packages/transaction-controller/src
- api
- utils
8 files changed
+981
-713
lines changedLines changed: 60 additions & 226 deletions
Large diffs are not rendered by default.
Lines changed: 31 additions & 118 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| 127 | + | |
| 128 | + | |
127 | 129 | | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | 130 | | |
137 | 131 | | |
138 | 132 | | |
139 | 133 | | |
140 | 134 | | |
141 | | - | |
142 | 135 | | |
| 136 | + | |
143 | 137 | | |
144 | 138 | | |
145 | 139 | | |
| |||
156 | 150 | | |
157 | 151 | | |
158 | 152 | | |
159 | | - | |
160 | | - | |
161 | 153 | | |
162 | 154 | | |
163 | 155 | | |
| |||
4031 | 4023 | | |
4032 | 4024 | | |
4033 | 4025 | | |
4034 | | - | |
4035 | | - | |
| 4026 | + | |
| 4027 | + | |
| 4028 | + | |
| 4029 | + | |
| 4030 | + | |
| 4031 | + | |
| 4032 | + | |
| 4033 | + | |
4036 | 4034 | | |
4037 | 4035 | | |
4038 | 4036 | | |
| |||
4045 | 4043 | | |
4046 | 4044 | | |
4047 | 4045 | | |
4048 | | - | |
4049 | | - | |
4050 | | - | |
4051 | | - | |
4052 | | - | |
4053 | | - | |
4054 | | - | |
4055 | | - | |
| 4046 | + | |
| 4047 | + | |
| 4048 | + | |
| 4049 | + | |
| 4050 | + | |
| 4051 | + | |
| 4052 | + | |
| 4053 | + | |
| 4054 | + | |
| 4055 | + | |
| 4056 | + | |
4056 | 4057 | | |
4057 | 4058 | | |
4058 | 4059 | | |
| |||
4064 | 4065 | | |
4065 | 4066 | | |
4066 | 4067 | | |
| 4068 | + | |
| 4069 | + | |
| 4070 | + | |
| 4071 | + | |
| 4072 | + | |
| 4073 | + | |
| 4074 | + | |
| 4075 | + | |
4067 | 4076 | | |
4068 | 4077 | | |
4069 | 4078 | | |
| |||
4281 | 4290 | | |
4282 | 4291 | | |
4283 | 4292 | | |
4284 | | - | |
4285 | | - | |
4286 | | - | |
4287 | | - | |
4288 | | - | |
4289 | | - | |
4290 | | - | |
4291 | | - | |
4292 | | - | |
4293 | | - | |
4294 | | - | |
4295 | | - | |
4296 | | - | |
4297 | | - | |
4298 | | - | |
4299 | | - | |
4300 | | - | |
4301 | | - | |
4302 | | - | |
4303 | | - | |
4304 | | - | |
4305 | | - | |
4306 | | - | |
4307 | | - | |
4308 | | - | |
4309 | | - | |
4310 | | - | |
4311 | | - | |
4312 | | - | |
4313 | | - | |
4314 | | - | |
4315 | | - | |
4316 | | - | |
4317 | | - | |
4318 | | - | |
4319 | | - | |
4320 | | - | |
4321 | | - | |
4322 | | - | |
4323 | | - | |
4324 | | - | |
4325 | | - | |
4326 | | - | |
4327 | | - | |
4328 | | - | |
4329 | | - | |
4330 | | - | |
4331 | | - | |
4332 | | - | |
4333 | | - | |
4334 | | - | |
4335 | | - | |
4336 | | - | |
4337 | | - | |
4338 | | - | |
4339 | | - | |
4340 | | - | |
4341 | | - | |
4342 | | - | |
4343 | | - | |
4344 | | - | |
4345 | | - | |
4346 | | - | |
4347 | | - | |
4348 | | - | |
4349 | | - | |
4350 | | - | |
4351 | | - | |
4352 | | - | |
4353 | | - | |
4354 | | - | |
4355 | | - | |
4356 | | - | |
4357 | | - | |
4358 | | - | |
4359 | | - | |
4360 | | - | |
4361 | | - | |
4362 | | - | |
4363 | | - | |
4364 | | - | |
4365 | | - | |
4366 | | - | |
4367 | | - | |
4368 | | - | |
4369 | | - | |
4370 | | - | |
4371 | | - | |
4372 | | - | |
4373 | | - | |
4374 | | - | |
4375 | | - | |
4376 | | - | |
4377 | | - | |
4378 | | - | |
4379 | | - | |
4380 | 4293 | | |
Lines changed: 27 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | 47 | | |
54 | 48 | | |
55 | 49 | | |
| |||
83 | 77 | | |
84 | 78 | | |
85 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
92 | 104 | | |
93 | 105 | | |
94 | 106 | | |
| |||
161 | 173 | | |
162 | 174 | | |
163 | 175 | | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
164 | 179 | | |
165 | 180 | | |
166 | 181 | | |
| |||
188 | 203 | | |
189 | 204 | | |
190 | 205 | | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
191 | 212 | | |
192 | 213 | | |
193 | 214 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1723 | 1723 | | |
1724 | 1724 | | |
1725 | 1725 | | |
| 1726 | + | |
| 1727 | + | |
| 1728 | + | |
1726 | 1729 | | |
1727 | 1730 | | |
1728 | 1731 | | |
| |||
0 commit comments