@metamask-previews/transaction-controller 69.6.1-preview-4f4c98e → 69.6.1-preview-eb263b0ee

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.
Files changed (492) hide show
  1. package/CHANGELOG.md +0 -5
  2. package/dist/TransactionController-method-action-types.cjs +7 -0
  3. package/dist/TransactionController-method-action-types.cjs.map +1 -0
  4. package/dist/{TransactionController-method-action-types.d.ts → TransactionController-method-action-types.d.cts} +2 -2
  5. package/dist/TransactionController-method-action-types.d.cts.map +1 -0
  6. package/dist/TransactionController-method-action-types.d.mts +413 -0
  7. package/dist/TransactionController-method-action-types.d.mts.map +1 -0
  8. package/dist/{TransactionController-method-action-types.js → TransactionController-method-action-types.mjs} +1 -1
  9. package/dist/TransactionController-method-action-types.mjs.map +1 -0
  10. package/dist/TransactionController.cjs +2444 -0
  11. package/dist/TransactionController.cjs.map +1 -0
  12. package/dist/{TransactionController.d.ts → TransactionController.d.cts} +18 -18
  13. package/dist/TransactionController.d.cts.map +1 -0
  14. package/dist/TransactionController.d.mts +751 -0
  15. package/dist/TransactionController.d.mts.map +1 -0
  16. package/dist/{TransactionController.js → TransactionController.mjs} +50 -49
  17. package/dist/TransactionController.mjs.map +1 -0
  18. package/dist/api/accounts-api.cjs +57 -0
  19. package/dist/api/accounts-api.cjs.map +1 -0
  20. package/dist/api/{accounts-api.d.ts → accounts-api.d.cts} +1 -1
  21. package/dist/api/accounts-api.d.cts.map +1 -0
  22. package/dist/api/accounts-api.d.mts +44 -0
  23. package/dist/api/accounts-api.d.mts.map +1 -0
  24. package/dist/api/{accounts-api.js → accounts-api.mjs} +5 -5
  25. package/dist/api/accounts-api.mjs.map +1 -0
  26. package/dist/api/simulation-api.cjs +116 -0
  27. package/dist/api/simulation-api.cjs.map +1 -0
  28. package/dist/api/{simulation-api.d.ts → simulation-api.d.cts} +3 -3
  29. package/dist/api/simulation-api.d.cts.map +1 -0
  30. package/dist/api/simulation-api.d.mts +196 -0
  31. package/dist/api/simulation-api.d.mts.map +1 -0
  32. package/dist/api/{simulation-api.js → simulation-api.mjs} +8 -7
  33. package/dist/api/simulation-api.mjs.map +1 -0
  34. package/dist/constants.cjs +111 -0
  35. package/dist/constants.cjs.map +1 -0
  36. package/dist/{constants.d.ts → constants.d.cts} +37 -37
  37. package/dist/constants.d.cts.map +1 -0
  38. package/dist/constants.d.mts +78 -0
  39. package/dist/constants.d.mts.map +1 -0
  40. package/dist/{constants.js → constants.mjs} +1 -1
  41. package/dist/constants.mjs.map +1 -0
  42. package/dist/errors.cjs +37 -0
  43. package/dist/errors.cjs.map +1 -0
  44. package/dist/{errors.d.ts → errors.d.cts} +2 -2
  45. package/dist/errors.d.cts.map +1 -0
  46. package/dist/errors.d.mts +19 -0
  47. package/dist/errors.d.mts.map +1 -0
  48. package/dist/{errors.js → errors.mjs} +2 -2
  49. package/dist/errors.mjs.map +1 -0
  50. package/dist/gas-flows/DefaultGasFeeFlow.cjs +85 -0
  51. package/dist/gas-flows/{DefaultGasFeeFlow.js.map → DefaultGasFeeFlow.cjs.map} +1 -1
  52. package/dist/gas-flows/{DefaultGasFeeFlow.d.ts → DefaultGasFeeFlow.d.cts} +2 -2
  53. package/dist/gas-flows/DefaultGasFeeFlow.d.cts.map +1 -0
  54. package/dist/gas-flows/DefaultGasFeeFlow.d.mts +10 -0
  55. package/dist/gas-flows/DefaultGasFeeFlow.d.mts.map +1 -0
  56. package/dist/gas-flows/{DefaultGasFeeFlow.js → DefaultGasFeeFlow.mjs} +6 -6
  57. package/dist/gas-flows/DefaultGasFeeFlow.mjs.map +1 -0
  58. package/dist/gas-flows/LineaGasFeeFlow.cjs +111 -0
  59. package/dist/gas-flows/LineaGasFeeFlow.cjs.map +1 -0
  60. package/dist/gas-flows/{LineaGasFeeFlow.d.ts → LineaGasFeeFlow.d.cts} +3 -3
  61. package/dist/gas-flows/LineaGasFeeFlow.d.cts.map +1 -0
  62. package/dist/gas-flows/LineaGasFeeFlow.d.mts +16 -0
  63. package/dist/gas-flows/LineaGasFeeFlow.d.mts.map +1 -0
  64. package/dist/gas-flows/{LineaGasFeeFlow.js → LineaGasFeeFlow.mjs} +7 -7
  65. package/dist/gas-flows/LineaGasFeeFlow.mjs.map +1 -0
  66. package/dist/gas-flows/MantleLayer1GasFeeFlow.cjs +66 -0
  67. package/dist/gas-flows/MantleLayer1GasFeeFlow.cjs.map +1 -0
  68. package/dist/gas-flows/{MantleLayer1GasFeeFlow.d.ts → MantleLayer1GasFeeFlow.d.cts} +5 -5
  69. package/dist/gas-flows/MantleLayer1GasFeeFlow.d.cts.map +1 -0
  70. package/dist/gas-flows/MantleLayer1GasFeeFlow.d.mts +21 -0
  71. package/dist/gas-flows/MantleLayer1GasFeeFlow.d.mts.map +1 -0
  72. package/dist/gas-flows/{MantleLayer1GasFeeFlow.js → MantleLayer1GasFeeFlow.mjs} +6 -6
  73. package/dist/gas-flows/MantleLayer1GasFeeFlow.mjs.map +1 -0
  74. package/dist/gas-flows/OptimismLayer1GasFeeFlow.cjs +59 -0
  75. package/dist/gas-flows/OptimismLayer1GasFeeFlow.cjs.map +1 -0
  76. package/dist/gas-flows/{OptimismLayer1GasFeeFlow.d.ts → OptimismLayer1GasFeeFlow.d.cts} +4 -4
  77. package/dist/gas-flows/OptimismLayer1GasFeeFlow.d.cts.map +1 -0
  78. package/dist/gas-flows/OptimismLayer1GasFeeFlow.d.mts +14 -0
  79. package/dist/gas-flows/OptimismLayer1GasFeeFlow.d.mts.map +1 -0
  80. package/dist/gas-flows/{OptimismLayer1GasFeeFlow.js → OptimismLayer1GasFeeFlow.mjs} +5 -5
  81. package/dist/gas-flows/OptimismLayer1GasFeeFlow.mjs.map +1 -0
  82. package/dist/gas-flows/OracleLayer1GasFeeFlow.cjs +201 -0
  83. package/dist/gas-flows/OracleLayer1GasFeeFlow.cjs.map +1 -0
  84. package/dist/gas-flows/{OracleLayer1GasFeeFlow.d.ts → OracleLayer1GasFeeFlow.d.cts} +5 -5
  85. package/dist/gas-flows/OracleLayer1GasFeeFlow.d.cts.map +1 -0
  86. package/dist/gas-flows/OracleLayer1GasFeeFlow.d.mts +57 -0
  87. package/dist/gas-flows/OracleLayer1GasFeeFlow.d.mts.map +1 -0
  88. package/dist/gas-flows/{OracleLayer1GasFeeFlow.js → OracleLayer1GasFeeFlow.mjs} +15 -8
  89. package/dist/gas-flows/OracleLayer1GasFeeFlow.mjs.map +1 -0
  90. package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.cjs +123 -0
  91. package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.cjs.map +1 -0
  92. package/dist/gas-flows/{RandomisedEstimationsGasFeeFlow.d.ts → RandomisedEstimationsGasFeeFlow.d.cts} +4 -4
  93. package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.d.cts.map +1 -0
  94. package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.d.mts +28 -0
  95. package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.d.mts.map +1 -0
  96. package/dist/gas-flows/{RandomisedEstimationsGasFeeFlow.js → RandomisedEstimationsGasFeeFlow.mjs} +8 -8
  97. package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.mjs.map +1 -0
  98. package/dist/gas-flows/ScrollLayer1GasFeeFlow.cjs +24 -0
  99. package/dist/gas-flows/ScrollLayer1GasFeeFlow.cjs.map +1 -0
  100. package/dist/gas-flows/{ScrollLayer1GasFeeFlow.d.ts → ScrollLayer1GasFeeFlow.d.cts} +5 -5
  101. package/dist/gas-flows/ScrollLayer1GasFeeFlow.d.cts.map +1 -0
  102. package/dist/gas-flows/ScrollLayer1GasFeeFlow.d.mts +16 -0
  103. package/dist/gas-flows/ScrollLayer1GasFeeFlow.d.mts.map +1 -0
  104. package/dist/gas-flows/{ScrollLayer1GasFeeFlow.js → ScrollLayer1GasFeeFlow.mjs} +3 -3
  105. package/dist/gas-flows/ScrollLayer1GasFeeFlow.mjs.map +1 -0
  106. package/dist/gas-flows/TestGasFeeFlow.cjs +73 -0
  107. package/dist/gas-flows/TestGasFeeFlow.cjs.map +1 -0
  108. package/dist/gas-flows/{TestGasFeeFlow.d.ts → TestGasFeeFlow.d.cts} +2 -2
  109. package/dist/gas-flows/TestGasFeeFlow.d.cts.map +1 -0
  110. package/dist/gas-flows/TestGasFeeFlow.d.mts +12 -0
  111. package/dist/gas-flows/TestGasFeeFlow.d.mts.map +1 -0
  112. package/dist/gas-flows/{TestGasFeeFlow.js → TestGasFeeFlow.mjs} +3 -3
  113. package/dist/gas-flows/TestGasFeeFlow.mjs.map +1 -0
  114. package/dist/helpers/GasFeePoller.cjs +334 -0
  115. package/dist/helpers/GasFeePoller.cjs.map +1 -0
  116. package/dist/helpers/{GasFeePoller.d.ts → GasFeePoller.d.cts} +10 -7
  117. package/dist/helpers/GasFeePoller.d.cts.map +1 -0
  118. package/dist/helpers/GasFeePoller.d.mts +66 -0
  119. package/dist/helpers/GasFeePoller.d.mts.map +1 -0
  120. package/dist/helpers/{GasFeePoller.js → GasFeePoller.mjs} +9 -9
  121. package/dist/helpers/GasFeePoller.mjs.map +1 -0
  122. package/dist/helpers/MethodDataHelper.cjs +84 -0
  123. package/dist/helpers/MethodDataHelper.cjs.map +1 -0
  124. package/dist/helpers/{MethodDataHelper.d.ts → MethodDataHelper.d.cts} +7 -4
  125. package/dist/helpers/MethodDataHelper.d.cts.map +1 -0
  126. package/dist/helpers/MethodDataHelper.d.mts +16 -0
  127. package/dist/helpers/MethodDataHelper.d.mts.map +1 -0
  128. package/dist/helpers/{MethodDataHelper.js → MethodDataHelper.mjs} +7 -7
  129. package/dist/helpers/MethodDataHelper.mjs.map +1 -0
  130. package/dist/helpers/MultichainTrackingHelper.cjs +231 -0
  131. package/dist/helpers/MultichainTrackingHelper.cjs.map +1 -0
  132. package/dist/helpers/{MultichainTrackingHelper.d.ts → MultichainTrackingHelper.d.cts} +5 -5
  133. package/dist/helpers/MultichainTrackingHelper.d.cts.map +1 -0
  134. package/dist/helpers/MultichainTrackingHelper.d.mts +56 -0
  135. package/dist/helpers/MultichainTrackingHelper.d.mts.map +1 -0
  136. package/dist/helpers/{MultichainTrackingHelper.js → MultichainTrackingHelper.mjs} +8 -8
  137. package/dist/helpers/MultichainTrackingHelper.mjs.map +1 -0
  138. package/dist/helpers/PendingTransactionTracker.cjs +407 -0
  139. package/dist/helpers/PendingTransactionTracker.cjs.map +1 -0
  140. package/dist/helpers/{PendingTransactionTracker.d.ts → PendingTransactionTracker.d.cts} +8 -5
  141. package/dist/helpers/PendingTransactionTracker.d.cts.map +1 -0
  142. package/dist/helpers/PendingTransactionTracker.d.mts +54 -0
  143. package/dist/helpers/PendingTransactionTracker.d.mts.map +1 -0
  144. package/dist/helpers/{PendingTransactionTracker.js → PendingTransactionTracker.mjs} +15 -14
  145. package/dist/helpers/PendingTransactionTracker.mjs.map +1 -0
  146. package/dist/helpers/ResimulateHelper.cjs +274 -0
  147. package/dist/helpers/ResimulateHelper.cjs.map +1 -0
  148. package/dist/helpers/{ResimulateHelper.d.ts → ResimulateHelper.d.cts} +3 -3
  149. package/dist/helpers/ResimulateHelper.d.cts.map +1 -0
  150. package/dist/helpers/ResimulateHelper.d.mts +36 -0
  151. package/dist/helpers/ResimulateHelper.d.mts.map +1 -0
  152. package/dist/helpers/{ResimulateHelper.js → ResimulateHelper.mjs} +8 -7
  153. package/dist/helpers/ResimulateHelper.mjs.map +1 -0
  154. package/dist/helpers/TransactionPoller.cjs +175 -0
  155. package/dist/helpers/TransactionPoller.cjs.map +1 -0
  156. package/dist/helpers/{TransactionPoller.d.ts → TransactionPoller.d.cts} +5 -5
  157. package/dist/helpers/TransactionPoller.d.cts.map +1 -0
  158. package/dist/helpers/TransactionPoller.d.mts +37 -0
  159. package/dist/helpers/TransactionPoller.d.mts.map +1 -0
  160. package/dist/helpers/{TransactionPoller.js → TransactionPoller.mjs} +11 -10
  161. package/dist/helpers/TransactionPoller.mjs.map +1 -0
  162. package/dist/hooks/CollectPublishHook.cjs +94 -0
  163. package/dist/hooks/CollectPublishHook.cjs.map +1 -0
  164. package/dist/hooks/{CollectPublishHook.d.ts → CollectPublishHook.d.cts} +3 -3
  165. package/dist/hooks/CollectPublishHook.d.cts.map +1 -0
  166. package/dist/hooks/CollectPublishHook.d.mts +29 -0
  167. package/dist/hooks/CollectPublishHook.d.mts.map +1 -0
  168. package/dist/hooks/{CollectPublishHook.js → CollectPublishHook.mjs} +5 -4
  169. package/dist/hooks/CollectPublishHook.mjs.map +1 -0
  170. package/dist/hooks/ExtraTransactionsPublishHook.cjs +126 -0
  171. package/dist/hooks/ExtraTransactionsPublishHook.cjs.map +1 -0
  172. package/dist/hooks/{ExtraTransactionsPublishHook.d.ts → ExtraTransactionsPublishHook.d.cts} +3 -3
  173. package/dist/hooks/ExtraTransactionsPublishHook.d.cts.map +1 -0
  174. package/dist/hooks/ExtraTransactionsPublishHook.d.mts +19 -0
  175. package/dist/hooks/ExtraTransactionsPublishHook.d.mts.map +1 -0
  176. package/dist/hooks/{ExtraTransactionsPublishHook.js → ExtraTransactionsPublishHook.mjs} +3 -3
  177. package/dist/hooks/ExtraTransactionsPublishHook.mjs.map +1 -0
  178. package/dist/hooks/SequentialPublishBatchHook.cjs +112 -0
  179. package/dist/hooks/SequentialPublishBatchHook.cjs.map +1 -0
  180. package/dist/hooks/{SequentialPublishBatchHook.d.ts → SequentialPublishBatchHook.d.cts} +4 -4
  181. package/dist/hooks/SequentialPublishBatchHook.d.cts.map +1 -0
  182. package/dist/hooks/SequentialPublishBatchHook.d.mts +22 -0
  183. package/dist/hooks/SequentialPublishBatchHook.d.mts.map +1 -0
  184. package/dist/hooks/{SequentialPublishBatchHook.js → SequentialPublishBatchHook.mjs} +4 -4
  185. package/dist/hooks/SequentialPublishBatchHook.mjs.map +1 -0
  186. package/dist/index.cjs +40 -0
  187. package/dist/index.cjs.map +1 -0
  188. package/dist/{index.d.ts → index.d.cts} +16 -16
  189. package/dist/index.d.cts.map +1 -0
  190. package/dist/index.d.mts +16 -0
  191. package/dist/index.d.mts.map +1 -0
  192. package/dist/index.mjs +12 -0
  193. package/dist/index.mjs.map +1 -0
  194. package/dist/logger.cjs +9 -0
  195. package/dist/logger.cjs.map +1 -0
  196. package/dist/{logger.d.ts → logger.d.cts} +3 -2
  197. package/dist/logger.d.cts.map +1 -0
  198. package/dist/logger.d.mts +6 -0
  199. package/dist/logger.d.mts.map +1 -0
  200. package/dist/{logger.js → logger.mjs} +2 -2
  201. package/dist/logger.mjs.map +1 -0
  202. package/dist/types.cjs +382 -0
  203. package/dist/types.cjs.map +1 -0
  204. package/dist/{types.d.ts → types.d.cts} +8 -8
  205. package/dist/types.d.cts.map +1 -0
  206. package/dist/types.d.mts +1887 -0
  207. package/dist/types.d.mts.map +1 -0
  208. package/dist/{types.js → types.mjs} +1 -1
  209. package/dist/types.mjs.map +1 -0
  210. package/dist/utils/balance-changes.cjs +592 -0
  211. package/dist/utils/balance-changes.cjs.map +1 -0
  212. package/dist/utils/{balance-changes.d.ts → balance-changes.d.cts} +5 -5
  213. package/dist/utils/balance-changes.d.cts.map +1 -0
  214. package/dist/utils/balance-changes.d.mts +38 -0
  215. package/dist/utils/balance-changes.d.mts.map +1 -0
  216. package/dist/utils/{balance-changes.js → balance-changes.mjs} +20 -13
  217. package/dist/utils/balance-changes.mjs.map +1 -0
  218. package/dist/utils/balance.cjs +44 -0
  219. package/dist/utils/balance.cjs.map +1 -0
  220. package/dist/utils/{balance.d.ts → balance.d.cts} +5 -5
  221. package/dist/utils/balance.d.cts.map +1 -0
  222. package/dist/utils/balance.d.mts +26 -0
  223. package/dist/utils/balance.d.mts.map +1 -0
  224. package/dist/utils/{balance.js → balance.mjs} +3 -3
  225. package/dist/utils/balance.mjs.map +1 -0
  226. package/dist/utils/batch.cjs +712 -0
  227. package/dist/utils/batch.cjs.map +1 -0
  228. package/dist/utils/{batch.d.ts → batch.d.cts} +8 -8
  229. package/dist/utils/batch.d.cts.map +1 -0
  230. package/dist/utils/batch.d.mts +58 -0
  231. package/dist/utils/batch.d.mts.map +1 -0
  232. package/dist/utils/{batch.js → batch.mjs} +18 -18
  233. package/dist/utils/batch.mjs.map +1 -0
  234. package/dist/utils/eip7702.cjs +354 -0
  235. package/dist/utils/eip7702.cjs.map +1 -0
  236. package/dist/utils/{eip7702.d.ts → eip7702.d.cts} +5 -5
  237. package/dist/utils/eip7702.d.cts.map +1 -0
  238. package/dist/utils/eip7702.d.mts +137 -0
  239. package/dist/utils/eip7702.d.mts.map +1 -0
  240. package/dist/utils/{eip7702.js → eip7702.mjs} +12 -12
  241. package/dist/utils/eip7702.mjs.map +1 -0
  242. package/dist/utils/external-transactions.cjs +36 -0
  243. package/dist/utils/external-transactions.cjs.map +1 -0
  244. package/dist/utils/{external-transactions.d.ts → external-transactions.d.cts} +2 -2
  245. package/dist/utils/external-transactions.d.cts.map +1 -0
  246. package/dist/utils/external-transactions.d.mts +10 -0
  247. package/dist/utils/external-transactions.d.mts.map +1 -0
  248. package/dist/utils/{external-transactions.js → external-transactions.mjs} +3 -3
  249. package/dist/utils/external-transactions.mjs.map +1 -0
  250. package/dist/utils/feature-flags.cjs +255 -0
  251. package/dist/utils/feature-flags.cjs.map +1 -0
  252. package/dist/utils/{feature-flags.d.ts → feature-flags.d.cts} +3 -3
  253. package/dist/utils/feature-flags.d.cts.map +1 -0
  254. package/dist/utils/feature-flags.d.mts +313 -0
  255. package/dist/utils/feature-flags.d.mts.map +1 -0
  256. package/dist/utils/{feature-flags.js → feature-flags.mjs} +5 -5
  257. package/dist/utils/feature-flags.mjs.map +1 -0
  258. package/dist/utils/first-time-interaction.cjs +69 -0
  259. package/dist/utils/first-time-interaction.cjs.map +1 -0
  260. package/dist/utils/{first-time-interaction.d.ts → first-time-interaction.d.cts} +3 -3
  261. package/dist/utils/first-time-interaction.d.cts.map +1 -0
  262. package/dist/utils/first-time-interaction.d.mts +30 -0
  263. package/dist/utils/first-time-interaction.d.mts.map +1 -0
  264. package/dist/utils/{first-time-interaction.js → first-time-interaction.mjs} +6 -6
  265. package/dist/utils/first-time-interaction.mjs.map +1 -0
  266. package/dist/utils/gas-fee-tokens.cjs +174 -0
  267. package/dist/utils/gas-fee-tokens.cjs.map +1 -0
  268. package/dist/utils/{gas-fee-tokens.d.ts → gas-fee-tokens.d.cts} +5 -5
  269. package/dist/utils/gas-fee-tokens.d.cts.map +1 -0
  270. package/dist/utils/gas-fee-tokens.d.mts +46 -0
  271. package/dist/utils/gas-fee-tokens.d.mts.map +1 -0
  272. package/dist/utils/{gas-fee-tokens.js → gas-fee-tokens.mjs} +9 -9
  273. package/dist/utils/gas-fee-tokens.mjs.map +1 -0
  274. package/dist/utils/gas-fees.cjs +424 -0
  275. package/dist/utils/gas-fees.cjs.map +1 -0
  276. package/dist/utils/{gas-fees.d.ts → gas-fees.d.cts} +5 -5
  277. package/dist/utils/gas-fees.d.cts.map +1 -0
  278. package/dist/utils/gas-fees.d.mts +57 -0
  279. package/dist/utils/gas-fees.d.mts.map +1 -0
  280. package/dist/utils/{gas-fees.js → gas-fees.mjs} +9 -9
  281. package/dist/utils/gas-fees.mjs.map +1 -0
  282. package/dist/utils/gas-flow.cjs +81 -0
  283. package/dist/utils/gas-flow.cjs.map +1 -0
  284. package/dist/utils/{gas-flow.d.ts → gas-flow.d.cts} +6 -6
  285. package/dist/utils/gas-flow.d.cts.map +1 -0
  286. package/dist/utils/gas-flow.d.mts +29 -0
  287. package/dist/utils/gas-flow.d.mts.map +1 -0
  288. package/dist/utils/{gas-flow.js → gas-flow.mjs} +3 -3
  289. package/dist/utils/gas-flow.mjs.map +1 -0
  290. package/dist/utils/gas.cjs +545 -0
  291. package/dist/utils/gas.cjs.map +1 -0
  292. package/dist/utils/{gas.d.ts → gas.d.cts} +6 -5
  293. package/dist/utils/gas.d.cts.map +1 -0
  294. package/dist/utils/gas.d.mts +116 -0
  295. package/dist/utils/gas.d.mts.map +1 -0
  296. package/dist/utils/{gas.js → gas.mjs} +11 -11
  297. package/dist/utils/gas.mjs.map +1 -0
  298. package/dist/utils/layer1-gas-fee-flow.cjs +73 -0
  299. package/dist/utils/layer1-gas-fee-flow.cjs.map +1 -0
  300. package/dist/utils/{layer1-gas-fee-flow.d.ts → layer1-gas-fee-flow.d.cts} +4 -4
  301. package/dist/utils/layer1-gas-fee-flow.d.cts.map +1 -0
  302. package/dist/utils/layer1-gas-fee-flow.d.mts +28 -0
  303. package/dist/utils/layer1-gas-fee-flow.d.mts.map +1 -0
  304. package/dist/utils/{layer1-gas-fee-flow.js → layer1-gas-fee-flow.mjs} +3 -3
  305. package/dist/utils/layer1-gas-fee-flow.mjs.map +1 -0
  306. package/dist/utils/nonce.cjs +93 -0
  307. package/dist/utils/nonce.cjs.map +1 -0
  308. package/dist/utils/{nonce.d.ts → nonce.d.cts} +3 -3
  309. package/dist/utils/nonce.d.cts.map +1 -0
  310. package/dist/utils/nonce.d.mts +26 -0
  311. package/dist/utils/nonce.d.mts.map +1 -0
  312. package/dist/utils/{nonce.js → nonce.mjs} +4 -4
  313. package/dist/utils/nonce.mjs.map +1 -0
  314. package/dist/utils/prepare.cjs +97 -0
  315. package/dist/utils/prepare.cjs.map +1 -0
  316. package/dist/utils/{prepare.d.ts → prepare.d.cts} +5 -5
  317. package/dist/utils/prepare.d.cts.map +1 -0
  318. package/dist/utils/prepare.d.mts +22 -0
  319. package/dist/utils/prepare.d.mts.map +1 -0
  320. package/dist/utils/{prepare.js → prepare.mjs} +6 -5
  321. package/dist/utils/prepare.mjs.map +1 -0
  322. package/dist/utils/provider.cjs +106 -0
  323. package/dist/utils/provider.cjs.map +1 -0
  324. package/dist/utils/{provider.d.ts → provider.d.cts} +4 -4
  325. package/dist/utils/provider.d.cts.map +1 -0
  326. package/dist/utils/provider.d.mts +65 -0
  327. package/dist/utils/provider.d.mts.map +1 -0
  328. package/dist/utils/{provider.js → provider.mjs} +3 -3
  329. package/dist/utils/provider.mjs.map +1 -0
  330. package/dist/utils/recipient.cjs +31 -0
  331. package/dist/utils/recipient.cjs.map +1 -0
  332. package/dist/utils/{recipient.d.ts → recipient.d.cts} +2 -2
  333. package/dist/utils/recipient.d.cts.map +1 -0
  334. package/dist/utils/recipient.d.mts +13 -0
  335. package/dist/utils/recipient.d.mts.map +1 -0
  336. package/dist/utils/{recipient.js → recipient.mjs} +3 -3
  337. package/dist/utils/recipient.mjs.map +1 -0
  338. package/dist/utils/retry.cjs +93 -0
  339. package/dist/utils/retry.cjs.map +1 -0
  340. package/dist/utils/{retry.d.ts → retry.d.cts} +2 -2
  341. package/dist/utils/retry.d.cts.map +1 -0
  342. package/dist/utils/retry.d.mts +11 -0
  343. package/dist/utils/retry.d.mts.map +1 -0
  344. package/dist/utils/{retry.js → retry.mjs} +3 -3
  345. package/dist/utils/retry.mjs.map +1 -0
  346. package/dist/utils/revert-reason.cjs +192 -0
  347. package/dist/utils/revert-reason.cjs.map +1 -0
  348. package/dist/utils/{revert-reason.d.ts → revert-reason.d.cts} +5 -5
  349. package/dist/utils/revert-reason.d.cts.map +1 -0
  350. package/dist/utils/revert-reason.d.mts +57 -0
  351. package/dist/utils/revert-reason.d.mts.map +1 -0
  352. package/dist/utils/{revert-reason.js → revert-reason.mjs} +4 -4
  353. package/dist/utils/revert-reason.mjs.map +1 -0
  354. package/dist/utils/signature.cjs +26 -0
  355. package/dist/utils/signature.cjs.map +1 -0
  356. package/dist/utils/{signature.d.ts → signature.d.cts} +2 -2
  357. package/dist/utils/signature.d.cts.map +1 -0
  358. package/dist/utils/signature.d.mts +11 -0
  359. package/dist/utils/signature.d.mts.map +1 -0
  360. package/dist/utils/{signature.js → signature.mjs} +3 -3
  361. package/dist/utils/signature.mjs.map +1 -0
  362. package/dist/utils/swaps.cjs +332 -0
  363. package/dist/utils/swaps.cjs.map +1 -0
  364. package/dist/utils/{swaps.d.ts → swaps.d.cts} +5 -5
  365. package/dist/utils/swaps.d.cts.map +1 -0
  366. package/dist/utils/swaps.d.mts +90 -0
  367. package/dist/utils/swaps.d.mts.map +1 -0
  368. package/dist/utils/{swaps.js → swaps.mjs} +8 -7
  369. package/dist/utils/swaps.mjs.map +1 -0
  370. package/dist/utils/transaction-type.cjs +159 -0
  371. package/dist/utils/transaction-type.cjs.map +1 -0
  372. package/dist/utils/{transaction-type.d.ts → transaction-type.d.cts} +6 -6
  373. package/dist/utils/transaction-type.d.cts.map +1 -0
  374. package/dist/utils/transaction-type.d.mts +44 -0
  375. package/dist/utils/transaction-type.d.mts.map +1 -0
  376. package/dist/utils/{transaction-type.js → transaction-type.mjs} +6 -6
  377. package/dist/utils/transaction-type.mjs.map +1 -0
  378. package/dist/utils/utils.cjs +287 -0
  379. package/dist/utils/utils.cjs.map +1 -0
  380. package/dist/utils/{utils.d.ts → utils.d.cts} +4 -4
  381. package/dist/utils/utils.d.cts.map +1 -0
  382. package/dist/utils/utils.d.mts +101 -0
  383. package/dist/utils/utils.d.mts.map +1 -0
  384. package/dist/utils/{utils.js → utils.mjs} +12 -5
  385. package/dist/utils/utils.mjs.map +1 -0
  386. package/dist/utils/validation.cjs +389 -0
  387. package/dist/utils/validation.cjs.map +1 -0
  388. package/dist/utils/{validation.d.ts → validation.d.cts} +4 -4
  389. package/dist/utils/validation.d.cts.map +1 -0
  390. package/dist/utils/validation.d.mts +66 -0
  391. package/dist/utils/validation.d.mts.map +1 -0
  392. package/dist/utils/{validation.js → validation.mjs} +8 -8
  393. package/dist/utils/validation.mjs.map +1 -0
  394. package/package.json +19 -15
  395. package/dist/TransactionController-method-action-types.d.ts.map +0 -1
  396. package/dist/TransactionController-method-action-types.js.map +0 -1
  397. package/dist/TransactionController.d.ts.map +0 -1
  398. package/dist/TransactionController.js.map +0 -1
  399. package/dist/api/accounts-api.d.ts.map +0 -1
  400. package/dist/api/accounts-api.js.map +0 -1
  401. package/dist/api/simulation-api.d.ts.map +0 -1
  402. package/dist/api/simulation-api.js.map +0 -1
  403. package/dist/constants.d.ts.map +0 -1
  404. package/dist/constants.js.map +0 -1
  405. package/dist/errors.d.ts.map +0 -1
  406. package/dist/errors.js.map +0 -1
  407. package/dist/gas-flows/DefaultGasFeeFlow.d.ts.map +0 -1
  408. package/dist/gas-flows/LineaGasFeeFlow.d.ts.map +0 -1
  409. package/dist/gas-flows/LineaGasFeeFlow.js.map +0 -1
  410. package/dist/gas-flows/MantleLayer1GasFeeFlow.d.ts.map +0 -1
  411. package/dist/gas-flows/MantleLayer1GasFeeFlow.js.map +0 -1
  412. package/dist/gas-flows/OptimismLayer1GasFeeFlow.d.ts.map +0 -1
  413. package/dist/gas-flows/OptimismLayer1GasFeeFlow.js.map +0 -1
  414. package/dist/gas-flows/OracleLayer1GasFeeFlow.d.ts.map +0 -1
  415. package/dist/gas-flows/OracleLayer1GasFeeFlow.js.map +0 -1
  416. package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.d.ts.map +0 -1
  417. package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.js.map +0 -1
  418. package/dist/gas-flows/ScrollLayer1GasFeeFlow.d.ts.map +0 -1
  419. package/dist/gas-flows/ScrollLayer1GasFeeFlow.js.map +0 -1
  420. package/dist/gas-flows/TestGasFeeFlow.d.ts.map +0 -1
  421. package/dist/gas-flows/TestGasFeeFlow.js.map +0 -1
  422. package/dist/helpers/GasFeePoller.d.ts.map +0 -1
  423. package/dist/helpers/GasFeePoller.js.map +0 -1
  424. package/dist/helpers/MethodDataHelper.d.ts.map +0 -1
  425. package/dist/helpers/MethodDataHelper.js.map +0 -1
  426. package/dist/helpers/MultichainTrackingHelper.d.ts.map +0 -1
  427. package/dist/helpers/MultichainTrackingHelper.js.map +0 -1
  428. package/dist/helpers/PendingTransactionTracker.d.ts.map +0 -1
  429. package/dist/helpers/PendingTransactionTracker.js.map +0 -1
  430. package/dist/helpers/ResimulateHelper.d.ts.map +0 -1
  431. package/dist/helpers/ResimulateHelper.js.map +0 -1
  432. package/dist/helpers/TransactionPoller.d.ts.map +0 -1
  433. package/dist/helpers/TransactionPoller.js.map +0 -1
  434. package/dist/hooks/CollectPublishHook.d.ts.map +0 -1
  435. package/dist/hooks/CollectPublishHook.js.map +0 -1
  436. package/dist/hooks/ExtraTransactionsPublishHook.d.ts.map +0 -1
  437. package/dist/hooks/ExtraTransactionsPublishHook.js.map +0 -1
  438. package/dist/hooks/SequentialPublishBatchHook.d.ts.map +0 -1
  439. package/dist/hooks/SequentialPublishBatchHook.js.map +0 -1
  440. package/dist/index.d.ts.map +0 -1
  441. package/dist/index.js +0 -12
  442. package/dist/index.js.map +0 -1
  443. package/dist/logger.d.ts.map +0 -1
  444. package/dist/logger.js.map +0 -1
  445. package/dist/types.d.ts.map +0 -1
  446. package/dist/types.js.map +0 -1
  447. package/dist/utils/balance-changes.d.ts.map +0 -1
  448. package/dist/utils/balance-changes.js.map +0 -1
  449. package/dist/utils/balance.d.ts.map +0 -1
  450. package/dist/utils/balance.js.map +0 -1
  451. package/dist/utils/batch.d.ts.map +0 -1
  452. package/dist/utils/batch.js.map +0 -1
  453. package/dist/utils/eip7702.d.ts.map +0 -1
  454. package/dist/utils/eip7702.js.map +0 -1
  455. package/dist/utils/external-transactions.d.ts.map +0 -1
  456. package/dist/utils/external-transactions.js.map +0 -1
  457. package/dist/utils/feature-flags.d.ts.map +0 -1
  458. package/dist/utils/feature-flags.js.map +0 -1
  459. package/dist/utils/first-time-interaction.d.ts.map +0 -1
  460. package/dist/utils/first-time-interaction.js.map +0 -1
  461. package/dist/utils/gas-fee-tokens.d.ts.map +0 -1
  462. package/dist/utils/gas-fee-tokens.js.map +0 -1
  463. package/dist/utils/gas-fees.d.ts.map +0 -1
  464. package/dist/utils/gas-fees.js.map +0 -1
  465. package/dist/utils/gas-flow.d.ts.map +0 -1
  466. package/dist/utils/gas-flow.js.map +0 -1
  467. package/dist/utils/gas.d.ts.map +0 -1
  468. package/dist/utils/gas.js.map +0 -1
  469. package/dist/utils/layer1-gas-fee-flow.d.ts.map +0 -1
  470. package/dist/utils/layer1-gas-fee-flow.js.map +0 -1
  471. package/dist/utils/nonce.d.ts.map +0 -1
  472. package/dist/utils/nonce.js.map +0 -1
  473. package/dist/utils/prepare.d.ts.map +0 -1
  474. package/dist/utils/prepare.js.map +0 -1
  475. package/dist/utils/provider.d.ts.map +0 -1
  476. package/dist/utils/provider.js.map +0 -1
  477. package/dist/utils/recipient.d.ts.map +0 -1
  478. package/dist/utils/recipient.js.map +0 -1
  479. package/dist/utils/retry.d.ts.map +0 -1
  480. package/dist/utils/retry.js.map +0 -1
  481. package/dist/utils/revert-reason.d.ts.map +0 -1
  482. package/dist/utils/revert-reason.js.map +0 -1
  483. package/dist/utils/signature.d.ts.map +0 -1
  484. package/dist/utils/signature.js.map +0 -1
  485. package/dist/utils/swaps.d.ts.map +0 -1
  486. package/dist/utils/swaps.js.map +0 -1
  487. package/dist/utils/transaction-type.d.ts.map +0 -1
  488. package/dist/utils/transaction-type.js.map +0 -1
  489. package/dist/utils/utils.d.ts.map +0 -1
  490. package/dist/utils/utils.js.map +0 -1
  491. package/dist/utils/validation.d.ts.map +0 -1
  492. package/dist/utils/validation.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.mjs","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,OAAO,EAAE,KAAK;IACd,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,QAAQ;IACd,YAAY,EAAE,SAAS;IACvB,GAAG,EAAE,MAAM;IACX,WAAW,EAAE,MAAM;IACnB,QAAQ,EAAE,OAAO;IACjB,QAAQ,EAAE,KAAK;IACf,gBAAgB,EAAE,OAAO;IACzB,KAAK,EAAE,MAAM;IACb,aAAa,EAAE,QAAQ;IACvB,gBAAgB,EAAE,UAAU;IAC5B,OAAO,EAAE,MAAM;IACf,eAAe,EAAE,SAAS;IAC1B,SAAS,EAAE,QAAQ;IACnB,iBAAiB,EAAE,QAAQ;IAC3B,MAAM,EAAE,MAAM;IACd,cAAc,EAAE,OAAO;IACvB,OAAO,EAAE,UAAU;IACnB,YAAY,EAAE,QAAQ;IACtB,aAAa,EAAE,QAAQ;IACvB,aAAa,E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AAS;aAChB;YACD;gBACE,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,SAAS;aAChB;SACF;QACD,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,OAAO;KACd;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B;QACE,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,SAAS;QACf,MAAM,EAAE;YACN,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE;YAC3D,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE;SAChE;QACD,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,SAAS;KAC3B;IACD;QACE,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,uBAAuB;QAC7B,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC;QACrE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC;QAC3D,eAAe,EAAE,MAAM;KACxB;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,4CAA4C;CAC7C,CAAC;AAEF,MAAM,CAAC,MAAM,2CAA2C,GACtD,kxsBAAkxsB,CAAC","sourcesContent":["export const CHAIN_IDS = {\n MAINNET: '0x1',\n GOERLI: '0x5',\n BASE: '0x2105',\n BASE_TESTNET: '0x14a33',\n BSC: '0x38',\n BSC_TESTNET: '0x61',\n HYPEREVM: '0x3e7',\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 MONAD: '0x8f',\n GNOSIS: '0x64',\n ARBITRUM: '0xa4b1',\n ZKSYNC_ERA: '0x144',\n ZORA: '0x76adf1',\n SCROLL: '0x82750',\n SCROLL_SEPOLIA: '0x8274f',\n MEGAETH_TESTNET: '0x18c6',\n SEI: '0x531',\n MANTLE: '0x1388',\n MANTLE_SEPOLIA: '0x138b',\n} as const;\n\n/** Extract of the Wrapped ERC-20 ABI required for simulation. */\nexport const ABI_SIMULATION_ERC20_WRAPPED = [\n {\n anonymous: false,\n inputs: [\n { indexed: true, name: 'to', type: 'address' },\n { indexed: false, name: 'wad', type: 'uint256' },\n ],\n name: 'Deposit',\n type: 'event',\n },\n {\n anonymous: false,\n inputs: [\n { indexed: true, name: 'from', type: 'address' },\n { indexed: false, name: 'wad', type: 'uint256' },\n ],\n name: 'Withdrawal',\n type: 'event',\n },\n];\n\n/** Extract of the legacy ERC-721 ABI required for simulation. */\nexport const ABI_SIMULATION_ERC721_LEGACY = [\n {\n anonymous: false,\n inputs: [\n {\n indexed: false,\n name: '_from',\n type: 'address',\n },\n {\n indexed: false,\n name: '_to',\n type: 'address',\n },\n {\n indexed: false,\n name: '_tokenId',\n type: 'uint256',\n },\n ],\n name: 'Transfer',\n type: 'event',\n },\n];\n\nexport const ABI_IERC7821 = [\n {\n type: 'function',\n name: 'execute',\n inputs: [\n { name: 'mode', type: 'bytes32', internalType: 'ModeCode' },\n { name: 'executionData', type: 'bytes', internalType: 'bytes' },\n ],\n outputs: [],\n stateMutability: 'payable',\n },\n {\n type: 'function',\n name: 'supportsExecutionMode',\n inputs: [{ name: 'mode', type: 'bytes32', internalType: 'ModeCode' }],\n outputs: [{ name: '', type: 'bool', internalType: 'bool' }],\n stateMutability: 'view',\n },\n];\n\nexport const DELEGATION_MANAGER_ADDRESSES = [\n '0xdb9b1e94b5b69df7e401ddbede43491141047db3',\n];\n\nexport const CODE_DELEGATION_MANAGER_NO_SIGNATURE_ERRORS =\n '0x608060405234801561001057600080fd5b506004361061012c5760003560e01c806383ebb771116100ad578063acb8cc4911610071578063acb8cc491461027f578063cef6d2091461029f578063e30c3978146102b2578063f2fde38b146102c3578063ffa1ad74146102d657600080fd5b806383ebb771146102065780638456cb591461020e57806384b0196e146102165780638da5cb5b14610231578063a3f4df7e1461024257600080fd5b806358909ebc116100f457806358909ebc146101b05780635c975abb146101d157806366134607146101e3578063715018a6146101f657806379ba5097146101fe57600080fd5b80631b13cac2146101315780632d40d0521461014d5780633ed01015146101805780633f4ba83a14610195578063499340471461019d575b600080fd5b61013a60001981565b6040519081526020015b60405180910390f35b61017061015b36600461207e565b60046020526000908152604090205460ff1681565b6040519015158152602001610144565b61019361018e366004612097565b6102fa565b005b6101936103f4565b6101936101ab366004612097565b610406565b6101b9610a1181565b6040516001600160a01b039091168152602001610144565b600154600160a01b900460ff16610170565b61013a6101f1366004612097565b6104f6565b61019361050f565b610193610521565b61013a61056a565b610193610579565b61021e610589565b6040516101449796959493929190612128565b6000546001600160a01b03166101b9565b610272604051806040016040528060118152602001702232b632b3b0ba34b7b726b0b730b3b2b960791b81525081565b60405161014491906121c1565b610272604051806040016040528060018152602001603160f81b81525081565b6101936102ad36600461221f565b6105cf565b6001546001600160a01b03166101b9565b6101936102d13660046122d4565b611829565b610272604051806040016040528060058152602001640312e332e360dc1b81525081565b61030a60408201602083016122d4565b6001600160a01b03811633146103335760405163b9f0f17160e01b815260040160405180910390fd5b600061033e836104f6565b60008181526004602052604090205490915060ff1661037057604051637952fbad60e11b815260040160405180910390fd5b6000818152600460209081526040909120805460ff19169055610395908401846122d4565b6001600160a01b03166103ae60408501602086016122d4565b6001600160a01b0316827f3feadce88fc1b49db633a56fd5307ed6ee18734df83bcc4011daa720c9cd95f1866040516103e7919061241c565b60405180910390a4505050565b6103fc61189a565b6104046118c7565b565b61041660408201602083016122d4565b6001600160a01b038116331461043f5760405163b9f0f17160e01b815260040160405180910390fd5b600061044a836104f6565b60008181526004602052604090205490915060ff161561047c57604051625ecddb60e01b815260040160405180910390fd5b6000818152600460209081526040909120805460ff191660011790556104a4908401846122d4565b6001600160a01b03166104bd60408501602086016122d4565b6001600160a01b0316827fea589ba9473ee1fe77d352c7ed919747715a5d22931b972de9b02a907c66d5dd866040516103e7919061241c565b6000610509610504836127bb565b61191c565b92915050565b61051761189a565b61040460006119b7565b60015433906001600160a01b0316811461055e5760405163118cdaa760e01b81526001600160a01b03821660048201526024015b60405180910390fd5b610567816119b7565b50565b60006105746119d0565b905090565b61058161189a565b610404611afb565b60006060806000806000606061059d611b3e565b6105a5611b6b565b60408051600080825260208201909252600f60f81b9b939a50919850469750309650945092509050565b6105d7611b98565b8481811415806105e75750808414155b1561060557604051631bcaf69f60e01b815260040160405180910390fd5b6000816001600160401b0381111561061f5761061f6124ed565b60405190808252806020026020018201604052801561065257816020015b606081526020019060019003908161063d5790505b5090506000826001600160401b0381111561066f5761066f6124ed565b6040519080825280602002602001820160405280156106a257816020015b606081526020019060019003908161068d5790505b50905060005b83811015610c195760008a8a838181106106c4576106c46127c7565b90506020028101906106d691906127dd565b8101906106e39190612823565b905080516000036107d1576040805160008082526020820190925290610765565b6107526040518060c0016040528060006001600160a01b0316815260200160006001600160a01b03168152602001600080191681526020016060815260200160008152602001606081525090565b8152602001906001900390816107045790505b50848381518110610778576107786127c7565b602090810291909101015260006040519080825280602002602001820160405280156107ae578160200160208202803683370190505b508383815181106107c1576107c16127c7565b6020026020010181905250610c10565b808483815181106107e4576107e46127c7565b6020026020010181905250600081516001600160401b0381111561080a5761080a6124ed565b604051908082528060200260200182016040528015610833578160200160208202803683370190505b50905080848481518110610849576108496127c7565b6020026020010181905250336001600160a01b031682600081518110610871576108716127c7565b6020026020010151600001516001600160a01b0316141580156108c65750610a116001600160a01b0316826000815181106108ae576108ae6127c7565b6020026020010151600001516001600160a01b031614155b156108e457604051632d618d8160e21b815260040160405180910390fd5b60005b8251811015610a4d576000838281518110610904576109046127c7565b602002602001015190506109178161191c565b838381518110610929576109296127c7565b60200260200101818152505080602001516001600160a01b03163b6000036109a657600061099e61099461095b61056a565b86868151811061096d5761096d6127c7565b602002602001015160405161190160f01b8152600281019290925260228201526042902090565b8360a00151611bc3565b905050610a44565b60006109c56109b361056a565b85858151811061096d5761096d6127c7565b9050600082602001516001600160a01b0316631626ba7e838560a001516040518363ffffffff1660e01b81526004016109ff9291906128d3565b602060405180830381865afa158015610a1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a4091906128f4565b5050505b506001016108e7565b5060005b8251811015610c0d5760046000838381518110610a7057610a706127c7565b60209081029190910181015182528101919091526040016000205460ff1615610aac576040516302dd502960e11b815260040160405180910390fd5b60018351610aba9190612934565b8114610bc35781610acc826001612947565b81518110610adc57610adc6127c7565b6020026020010151838281518110610af657610af66127c7565b60200260200101516040015114610b2057604051636f6a1b8760e11b815260040160405180910390fd5b600083610b2e836001612947565b81518110610b3e57610b3e6127c7565b6020026020010151600001519050610a116001600160a01b0316816001600160a01b031614158015610b9f5750806001600160a01b0316848381518110610b8757610b876127c7565b6020026020010151602001516001600160a01b031614155b15610bbd57604051632d618d8160e21b815260040160405180910390fd5b50610c05565b60001960001b838281518110610bdb57610bdb6127c7565b60200260200101516040015114610c0557604051636f6a1b8760e11b815260040160405180910390fd5b600101610a51565b50505b506001016106a8565b5060005b83811015610e3e576000838281518110610c3957610c396127c7565b6020026020010151511115610e365760005b838281518110610c5d57610c5d6127c7565b602002602001015151811015610e34576000848381518110610c8157610c816127c7565b60200260200101518281518110610c9a57610c9a6127c7565b602002602001015160600151905060005b8151811015610e2a576000828281518110610cc857610cc86127c7565b6020026020010151600001519050806001600160a01b031663414c3e33848481518110610cf757610cf76127c7565b602002602001015160200151858581518110610d1557610d156127c7565b6020026020010151604001518f8f8a818110610d3357610d336127c7565b905060200201358e8e8b818110610d4c57610d4c6127c7565b9050602002810190610d5e91906127dd565b8c8c81518110610d7057610d706127c7565b60200260200101518b81518110610d8957610d896127c7565b60200260200101518e8d81518110610da357610da36127c7565b60200260200101518c81518110610dbc57610dbc6127c7565b602002602001015160200151336040518963ffffffff1660e01b8152600401610dec98979695949392919061295a565b600060405180830381600087803b158015610e0657600080fd5b505af1158015610e1a573d6000803e3d6000fd5b5050505050806001019050610cab565b5050600101610c4b565b505b600101610c1d565b5060005b8381101561146257828181518110610e5c57610e5c6127c7565b602002602001015151600003610f1a573363d691c964898984818110610e8457610e846127c7565b90506020020135888885818110610e9d57610e9d6127c7565b9050602002810190610eaf91906127dd565b6040518463ffffffff1660e01b8152600401610ecd939291906129c5565b6000604051808303816000875af1158015610eec573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610f1491908101906129e8565b5061145a565b60005b838281518110610f2f57610f2f6127c7565b602002602001015151811015611106576000848381518110610f5357610f536127c7565b60200260200101518281518110610f6c57610f6c6127c7565b602002602001015160600151905060005b81518110156110fc576000828281518110610f9a57610f9a6127c7565b6020026020010151600001519050806001600160a01b031663a145832a848481518110610fc957610fc96127c7565b602002602001015160200151858581518110610fe757610fe76127c7565b6020026020010151604001518f8f8a818110611005576110056127c7565b905060200201358e8e8b81811061101e5761101e6127c7565b905060200281019061103091906127dd565b8c8c81518110611042576110426127c7565b60200260200101518b8151811061105b5761105b6127c7565b60200260200101518e8d81518110611075576110756127c7565b60200260200101518c8151811061108e5761108e6127c7565b602002602001015160200151336040518963ffffffff1660e01b81526004016110be98979695949392919061295a565b600060405180830381600087803b1580156110d857600080fd5b505af11580156110ec573d6000803e3d6000fd5b5050505050806001019050610f7d565b5050600101610f1d565b50828181518110611119576111196127c7565b60200260200101516001848381518110611135576111356127c7565b6020026020010151516111489190612934565b81518110611158576111586127c7565b6020026020010151602001516001600160a01b031663d691c964898984818110611184576111846127c7565b9050602002013588888581811061119d5761119d6127c7565b90506020028101906111af91906127dd565b6040518463ffffffff1660e01b81526004016111cd939291906129c5565b6000604051808303816000875af11580156111ec573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261121491908101906129e8565b506000838281518110611229576112296127c7565b60200260200101515190505b801561145857600084838151811061124f5761124f6127c7565b60200260200101516001836112649190612934565b81518110611274576112746127c7565b60200260200101516060015190506000815190505b80156114455760008261129d600184612934565b815181106112ad576112ad6127c7565b6020026020010151600001519050806001600160a01b031663d3eddcc5846001856112d89190612934565b815181106112e8576112e86127c7565b602002602001015160200151856001866113029190612934565b81518110611312576113126127c7565b6020026020010151604001518f8f8a818110611330576113306127c7565b905060200201358e8e8b818110611349576113496127c7565b905060200281019061135b91906127dd565b8c8c8151811061136d5761136d6127c7565b602002602001015160018c6113829190612934565b81518110611392576113926127c7565b60200260200101518e8d815181106113ac576113ac6127c7565b602002602001015160018d6113c19190612934565b815181106113d1576113d16127c7565b602002602001015160200151336040518963ffffffff1660e01b815260040161140198979695949392919061295a565b600060405180830381600087803b15801561141b57600080fd5b505af115801561142f573d6000803e3d6000fd5b50505050508061143e90612ac7565b9050611289565b50508061145190612ac7565b9050611235565b505b600101610e42565b5060005b838110156116de576000838281518110611482576114826127c7565b60200260200101515111156116d65760008382815181106114a5576114a56127c7565b60200260200101515190505b80156116d45760008483815181106114cb576114cb6127c7565b60200260200101516001836114e09190612934565b815181106114f0576114f06127c7565b60200260200101516060015190506000815190505b80156116c157600082611519600184612934565b81518110611529576115296127c7565b6020026020010151600001519050806001600160a01b031663ed463367846001856115549190612934565b81518110611564576115646127c7565b6020026020010151602001518560018661157e9190612934565b8151811061158e5761158e6127c7565b6020026020010151604001518f8f8a8181106115ac576115ac6127c7565b905060200201358e8e8b8181106115c5576115c56127c7565b90506020028101906115d791906127dd565b8c8c815181106115e9576115e96127c7565b602002602001015160018c6115fe9190612934565b8151811061160e5761160e6127c7565b60200260200101518e8d81518110611628576116286127c7565b602002602001015160018d61163d9190612934565b8151811061164d5761164d6127c7565b602002602001015160200151336040518963ffffffff1660e01b815260040161167d98979695949392919061295a565b600060405180830381600087803b15801561169757600080fd5b505af11580156116ab573d6000803e3d6000fd5b5050505050806116ba90612ac7565b9050611505565b5050806116cd90612ac7565b90506114b1565b505b600101611466565b5060005b8381101561181d5760008382815181106116fe576116fe6127c7565b60200260200101515111156118155760005b838281518110611722576117226127c7565b60200260200101515181101561181357336001600160a01b031684838151811061174e5761174e6127c7565b6020026020010151600186858151811061176a5761176a6127c7565b60200260200101515161177d9190612934565b8151811061178d5761178d6127c7565b6020026020010151602001516001600160a01b03167f40dadaa36c6c2e3d7317e24757451ffb2d603d875f0ad5e92c5dd156573b18738685815181106117d5576117d56127c7565b602002602001015184815181106117ee576117ee6127c7565b60200260200101516040516118039190612ade565b60405180910390a3600101611710565b505b6001016116e2565b50505050505050505050565b61183161189a565b600180546001600160a01b0383166001600160a01b031990911681179091556118626000546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6000546001600160a01b031633146104045760405163118cdaa760e01b8152336004820152602401610555565b6118cf611bed565b6001805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6000807f88c1d2ecf185adf710588203a5f263f0ff61be0d33da39792cde19ba9aa4331e83600001518460200151856040015161195c8760600151611c17565b6080808901516040805160208101989098526001600160a01b03968716908801529490931660608601529184015260a083015260c082015260e0015b60408051601f1981840301815291905280516020909101209392505050565b600180546001600160a01b031916905561056781611ce2565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148015611a2957507f000000000000000000000000000000000000000000000000000000000000000046145b15611a5357507f000000000000000000000000000000000000000000000000000000000000000090565b610574604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f0000000000000000000000000000000000000000000000000000000000000000918101919091527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b611b03611b98565b6001805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586118ff3390565b60606105747f00000000000000000000000000000000000000000000000000000000000000006002611d32565b60606105747f00000000000000000000000000000000000000000000000000000000000000006003611d32565b600154600160a01b900460ff16156104045760405163d93c066560e01b815260040160405180910390fd5b600080600080611bd38686611ddd565b925092509250611be38282611e2a565b5090949350505050565b600154600160a01b900460ff1661040457604051638dfc202b60e01b815260040160405180910390fd5b60008082516001600160401b03811115611c3357611c336124ed565b604051908082528060200260200182016040528015611c5c578160200160208202803683370190505b50905060005b8351811015611cb257611c8d848281518110611c8057611c806127c7565b6020026020010151611ee7565b828281518110611c9f57611c9f6127c7565b6020908102919091010152600101611c62565b5080604051602001611cc49190612bcb565b60405160208183030381529060405280519060200120915050919050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b606060ff8314611d4c57611d4583611f48565b9050610509565b818054611d5890612c01565b80601f0160208091040260200160405190810160405280929190818152602001828054611d8490612c01565b8015611dd15780601f10611da657610100808354040283529160200191611dd1565b820191906000526020600020905b815481529060010190602001808311611db457829003601f168201915b50505050509050610509565b60008060008351604103611e175760208401516040850151606086015160001a611e0988828585611f87565b955095509550505050611e23565b50508151600091506002905b9250925092565b6000826003811115611e3e57611e3e612c3b565b03611e47575050565b6001826003811115611e5b57611e5b612c3b565b03611e795760405163f645eedf60e01b815260040160405180910390fd5b6002826003811115611e8d57611e8d612c3b565b03611eae5760405163fce698f760e01b815260048101829052602401610555565b6003826003811115611ec257611ec2612c3b565b03611ee3576040516335e2f38360e21b815260048101829052602401610555565b5050565b6000807f80ad7e1b04ee6d994a125f4714ca0720908bd80ed16063ec8aee4b88e9253e2d8360000151846020015180519060200120604051602001611998939291909283526001600160a01b03919091166020830152604082015260600190565b60606000611f5583612056565b604080516020808252818301909252919250600091906020820181803683375050509182525060208101929092525090565b600080807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841115611fc2575060009150600390508261204c565b604080516000808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015612016573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166120425750600092506001915082905061204c565b9250600091508190505b9450945094915050565b600060ff8216601f81111561050957604051632cd44ac360e21b815260040160405180910390fd5b60006020828403121561209057600080fd5b5035919050565b6000602082840312156120a957600080fd5b81356001600160401b038111156120bf57600080fd5b820160c081850312156120d157600080fd5b9392505050565b60005b838110156120f35781810151838201526020016120db565b50506000910152565b600081518084526121148160208601602086016120d8565b601f01601f19169290920160200192915050565b60ff60f81b881681526000602060e0602084015261214960e084018a6120fc565b838103604085015261215b818a6120fc565b606085018990526001600160a01b038816608086015260a0850187905284810360c08601528551808252602080880193509091019060005b818110156121af57835183529284019291840191600101612193565b50909c9b505050505050505050505050565b6020815260006120d160208301846120fc565b60008083601f8401126121e657600080fd5b5081356001600160401b038111156121fd57600080fd5b6020830191508360208260051b850101111561221857600080fd5b9250929050565b6000806000806000806060878903121561223857600080fd5b86356001600160401b038082111561224f57600080fd5b61225b8a838b016121d4565b9098509650602089013591508082111561227457600080fd5b6122808a838b016121d4565b9096509450604089013591508082111561229957600080fd5b506122a689828a016121d4565b979a9699509497509295939492505050565b80356001600160a01b03811681146122cf57600080fd5b919050565b6000602082840312156122e657600080fd5b6120d1826122b8565b6000808335601e1984360301811261230657600080fd5b83016020810192503590506001600160401b0381111561232557600080fd5b80360382131561221857600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60008383855260208086019550808560051b830101846000805b8881101561240e57858403601f19018a52823536899003605e1901811261239c578283fd5b880160606001600160a01b036123b1836122b8565b1686526123c0878301836122ef565b82898901526123d28389018284612334565b9250505060406123e4818401846122ef565b9350878303828901526123f8838583612334565b9d89019d97505050938601935050600101612377565b509198975050505050505050565b6020815260006001600160a01b0380612434856122b8565b16602084015280612447602086016122b8565b16604084015250604083013560608301526060830135601e1984360301811261246f57600080fd5b83016020810190356001600160401b0381111561248b57600080fd5b8060051b360382131561249d57600080fd5b60c060808501526124b260e08501828461235d565b915050608084013560a08401526124cc60a08501856122ef565b848303601f190160c08601526124e3838284612334565b9695505050505050565b634e487b7160e01b600052604160045260246000fd5b604051606081016001600160401b0381118282101715612525576125256124ed565b60405290565b60405160c081016001600160401b0381118282101715612525576125256124ed565b604051601f8201601f191681016001600160401b0381118282101715612575576125756124ed565b604052919050565b60006001600160401b03821115612596576125966124ed565b5060051b60200190565b60006001600160401b038211156125b9576125b96124ed565b50601f01601f191660200190565b600082601f8301126125d857600080fd5b81356125eb6125e6826125a0565b61254d565b81815284602083860101111561260057600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f83011261262e57600080fd5b8135602061263e6125e68361257d565b82815260059290921b8401810191818101908684111561265d57600080fd5b8286015b8481101561270c5780356001600160401b03808211156126815760008081fd5b908801906060828b03601f190181131561269b5760008081fd5b6126a3612503565b6126ae8885016122b8565b8152604080850135848111156126c45760008081fd5b6126d28e8b838901016125c7565b838b0152509184013591838311156126ea5760008081fd5b6126f88d8a858801016125c7565b908201528652505050918301918301612661565b509695505050505050565b600060c0828403121561272957600080fd5b61273161252b565b905061273c826122b8565b815261274a602083016122b8565b60208201526040820135604082015260608201356001600160401b038082111561277357600080fd5b61277f8583860161261d565b60608401526080840135608084015260a08401359150808211156127a257600080fd5b506127af848285016125c7565b60a08301525092915050565b60006105093683612717565b634e487b7160e01b600052603260045260246000fd5b6000808335601e198436030181126127f457600080fd5b8301803591506001600160401b0382111561280e57600080fd5b60200191503681900382131561221857600080fd5b6000602080838503121561283657600080fd5b82356001600160401b038082111561284d57600080fd5b818501915085601f83011261286157600080fd5b813561286f6125e68261257d565b81815260059190911b8301840190848101908883111561288e57600080fd5b8585015b838110156128c6578035858111156128aa5760008081fd5b6128b88b89838a0101612717565b845250918601918601612892565b5098975050505050505050565b8281526040602082015260006128ec60408301846120fc565b949350505050565b60006020828403121561290657600080fd5b81516001600160e01b0319811681146120d157600080fd5b634e487b7160e01b600052601160045260246000fd5b818103818111156105095761050961291e565b808201808211156105095761050961291e565b60e08152600061296d60e083018b6120fc565b828103602084015261297f818b6120fc565b9050886040840152828103606084015261299a81888a612334565b608084019690965250506001600160a01b0392831660a0820152911660c09091015295945050505050565b8381526040602082015260006129df604083018486612334565b95945050505050565b600060208083850312156129fb57600080fd5b82516001600160401b0380821115612a1257600080fd5b818501915085601f830112612a2657600080fd5b8151612a346125e68261257d565b81815260059190911b83018401908481019088831115612a5357600080fd5b8585015b838110156128c657805185811115612a6f5760008081fd5b8601603f81018b13612a815760008081fd5b878101516040612a936125e6836125a0565b8281528d82848601011115612aa85760008081fd5b612ab7838c83018487016120d8565b8652505050918601918601612a57565b600081612ad657612ad661291e565b506000190190565b602080825282516001600160a01b0390811683830152838201518116604080850191909152808501516060808601919091528086015160c06080870152805160e0870181905260009594610100600583901b8901810195919493870193919290890190885b81811015612b9d5760ff198b8903018352855187815116895289810151858b8b0152612b71868b01826120fc565b918701518a83038b890152919050612b8981836120fc565b995050509488019491880191600101612b43565b50505050505050608085015160a085015260a08501519150601f198482030160c08501526129df81836120fc565b815160009082906020808601845b83811015612bf557815185529382019390820190600101612bd9565b50929695505050505050565b600181811c90821680612c1557607f821691505b602082108103612c3557634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052602160045260246000fdfea264697066735822122073f8fd2b36b643aff6f988638bc7c8ab2f41546c01a777524170b479e36618c564736f6c63430008170033';\n"]}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SimulationRevertedError = exports.SimulationInvalidResponseError = exports.SimulationChainNotSupportedError = exports.FirstTimeInteractionError = exports.SimulationError = void 0;
4
+ const types_js_1 = require("./types.cjs");
5
+ class SimulationError extends Error {
6
+ constructor(message, code) {
7
+ super(message ?? 'Simulation failed');
8
+ this.code = code;
9
+ }
10
+ }
11
+ exports.SimulationError = SimulationError;
12
+ class FirstTimeInteractionError extends Error {
13
+ constructor(message, code) {
14
+ super(message ?? 'Error checking first time interaction');
15
+ this.code = code;
16
+ }
17
+ }
18
+ exports.FirstTimeInteractionError = FirstTimeInteractionError;
19
+ class SimulationChainNotSupportedError extends SimulationError {
20
+ constructor(chainId) {
21
+ super(`Chain is not supported: ${chainId}`, types_js_1.SimulationErrorCode.ChainNotSupported);
22
+ }
23
+ }
24
+ exports.SimulationChainNotSupportedError = SimulationChainNotSupportedError;
25
+ class SimulationInvalidResponseError extends SimulationError {
26
+ constructor() {
27
+ super('Invalid response from simulation API', types_js_1.SimulationErrorCode.InvalidResponse);
28
+ }
29
+ }
30
+ exports.SimulationInvalidResponseError = SimulationInvalidResponseError;
31
+ class SimulationRevertedError extends SimulationError {
32
+ constructor() {
33
+ super('Transaction was reverted', types_js_1.SimulationErrorCode.Reverted);
34
+ }
35
+ }
36
+ exports.SimulationRevertedError = SimulationRevertedError;
37
+ //# sourceMappingURL=errors.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.cjs","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";;;AAEA,0CAAiD;AAEjD,MAAa,eAAgB,SAAQ,KAAK;IAGxC,YAAY,OAAgB,EAAE,IAAsB;QAClD,KAAK,CAAC,OAAO,IAAI,mBAAmB,CAAC,CAAC;QAEtC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AARD,0CAQC;AAED,MAAa,yBAA0B,SAAQ,KAAK;IAGlD,YAAY,OAAgB,EAAE,IAAsB;QAClD,KAAK,CAAC,OAAO,IAAI,uCAAuC,CAAC,CAAC;QAE1D,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AARD,8DAQC;AAED,MAAa,gCAAiC,SAAQ,eAAe;IACnE,YAAY,OAAY;QACtB,KAAK,CACH,2BAA2B,OAAO,EAAE,EACpC,8BAAmB,CAAC,iBAAiB,CACtC,CAAC;IACJ,CAAC;CACF;AAPD,4EAOC;AAED,MAAa,8BAA+B,SAAQ,eAAe;IACjE;QACE,KAAK,CACH,sCAAsC,EACtC,8BAAmB,CAAC,eAAe,CACpC,CAAC;IACJ,CAAC;CACF;AAPD,wEAOC;AAED,MAAa,uBAAwB,SAAQ,eAAe;IAC1D;QACE,KAAK,CAAC,0BAA0B,EAAE,8BAAmB,CAAC,QAAQ,CAAC,CAAC;IAClE,CAAC;CACF;AAJD,0DAIC","sourcesContent":["import type { Hex } from '@metamask/utils';\n\nimport { SimulationErrorCode } from './types.js';\n\nexport class SimulationError extends Error {\n code?: string | number;\n\n constructor(message?: string, code?: string | number) {\n super(message ?? 'Simulation failed');\n\n this.code = code;\n }\n}\n\nexport class FirstTimeInteractionError extends Error {\n code?: string | number;\n\n constructor(message?: string, code?: string | number) {\n super(message ?? 'Error checking first time interaction');\n\n this.code = code;\n }\n}\n\nexport class SimulationChainNotSupportedError extends SimulationError {\n constructor(chainId: Hex) {\n super(\n `Chain is not supported: ${chainId}`,\n SimulationErrorCode.ChainNotSupported,\n );\n }\n}\n\nexport class SimulationInvalidResponseError extends SimulationError {\n constructor() {\n super(\n 'Invalid response from simulation API',\n SimulationErrorCode.InvalidResponse,\n );\n }\n}\n\nexport class SimulationRevertedError extends SimulationError {\n constructor() {\n super('Transaction was reverted', SimulationErrorCode.Reverted);\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { Hex } from '@metamask/utils';
1
+ import type { Hex } from "@metamask/utils";
2
2
  export declare class SimulationError extends Error {
3
3
  code?: string | number;
4
4
  constructor(message?: string, code?: string | number);
@@ -16,4 +16,4 @@ export declare class SimulationInvalidResponseError extends SimulationError {
16
16
  export declare class SimulationRevertedError extends SimulationError {
17
17
  constructor();
18
18
  }
19
- //# sourceMappingURL=errors.d.ts.map
19
+ //# sourceMappingURL=errors.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.cts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,wBAAwB;AAI3C,qBAAa,eAAgB,SAAQ,KAAK;IACxC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;gBAEX,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM;CAKrD;AAED,qBAAa,yBAA0B,SAAQ,KAAK;IAClD,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;gBAEX,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM;CAKrD;AAED,qBAAa,gCAAiC,SAAQ,eAAe;gBACvD,OAAO,EAAE,GAAG;CAMzB;AAED,qBAAa,8BAA+B,SAAQ,eAAe;;CAOlE;AAED,qBAAa,uBAAwB,SAAQ,eAAe;;CAI3D"}
@@ -0,0 +1,19 @@
1
+ import type { Hex } from "@metamask/utils";
2
+ export declare class SimulationError extends Error {
3
+ code?: string | number;
4
+ constructor(message?: string, code?: string | number);
5
+ }
6
+ export declare class FirstTimeInteractionError extends Error {
7
+ code?: string | number;
8
+ constructor(message?: string, code?: string | number);
9
+ }
10
+ export declare class SimulationChainNotSupportedError extends SimulationError {
11
+ constructor(chainId: Hex);
12
+ }
13
+ export declare class SimulationInvalidResponseError extends SimulationError {
14
+ constructor();
15
+ }
16
+ export declare class SimulationRevertedError extends SimulationError {
17
+ constructor();
18
+ }
19
+ //# sourceMappingURL=errors.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.mts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,wBAAwB;AAI3C,qBAAa,eAAgB,SAAQ,KAAK;IACxC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;gBAEX,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM;CAKrD;AAED,qBAAa,yBAA0B,SAAQ,KAAK;IAClD,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;gBAEX,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM;CAKrD;AAED,qBAAa,gCAAiC,SAAQ,eAAe;gBACvD,OAAO,EAAE,GAAG;CAMzB;AAED,qBAAa,8BAA+B,SAAQ,eAAe;;CAOlE;AAED,qBAAa,uBAAwB,SAAQ,eAAe;;CAI3D"}
@@ -1,4 +1,4 @@
1
- import { SimulationErrorCode } from './types.js';
1
+ import { SimulationErrorCode } from "./types.mjs";
2
2
  export class SimulationError extends Error {
3
3
  constructor(message, code) {
4
4
  super(message ?? 'Simulation failed');
@@ -26,4 +26,4 @@ export class SimulationRevertedError extends SimulationError {
26
26
  super('Transaction was reverted', SimulationErrorCode.Reverted);
27
27
  }
28
28
  }
29
- //# sourceMappingURL=errors.js.map
29
+ //# sourceMappingURL=errors.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.mjs","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,oBAAmB;AAEjD,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAGxC,YAAY,OAAgB,EAAE,IAAsB;QAClD,KAAK,CAAC,OAAO,IAAI,mBAAmB,CAAC,CAAC;QAEtC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAED,MAAM,OAAO,yBAA0B,SAAQ,KAAK;IAGlD,YAAY,OAAgB,EAAE,IAAsB;QAClD,KAAK,CAAC,OAAO,IAAI,uCAAuC,CAAC,CAAC;QAE1D,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAED,MAAM,OAAO,gCAAiC,SAAQ,eAAe;IACnE,YAAY,OAAY;QACtB,KAAK,CACH,2BAA2B,OAAO,EAAE,EACpC,mBAAmB,CAAC,iBAAiB,CACtC,CAAC;IACJ,CAAC;CACF;AAED,MAAM,OAAO,8BAA+B,SAAQ,eAAe;IACjE;QACE,KAAK,CACH,sCAAsC,EACtC,mBAAmB,CAAC,eAAe,CACpC,CAAC;IACJ,CAAC;CACF;AAED,MAAM,OAAO,uBAAwB,SAAQ,eAAe;IAC1D;QACE,KAAK,CAAC,0BAA0B,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IAClE,CAAC;CACF","sourcesContent":["import type { Hex } from '@metamask/utils';\n\nimport { SimulationErrorCode } from './types.js';\n\nexport class SimulationError extends Error {\n code?: string | number;\n\n constructor(message?: string, code?: string | number) {\n super(message ?? 'Simulation failed');\n\n this.code = code;\n }\n}\n\nexport class FirstTimeInteractionError extends Error {\n code?: string | number;\n\n constructor(message?: string, code?: string | number) {\n super(message ?? 'Error checking first time interaction');\n\n this.code = code;\n }\n}\n\nexport class SimulationChainNotSupportedError extends SimulationError {\n constructor(chainId: Hex) {\n super(\n `Chain is not supported: ${chainId}`,\n SimulationErrorCode.ChainNotSupported,\n );\n }\n}\n\nexport class SimulationInvalidResponseError extends SimulationError {\n constructor() {\n super(\n 'Invalid response from simulation API',\n SimulationErrorCode.InvalidResponse,\n );\n }\n}\n\nexport class SimulationRevertedError extends SimulationError {\n constructor() {\n super('Transaction was reverted', SimulationErrorCode.Reverted);\n }\n}\n"]}
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
+ };
7
+ var _DefaultGasFeeFlow_instances, _DefaultGasFeeFlow_getFeeMarkEstimates, _DefaultGasFeeFlow_getLegacyEstimates, _DefaultGasFeeFlow_getGasPriceEstimates, _DefaultGasFeeFlow_getFeeMarketLevel, _DefaultGasFeeFlow_getLegacyLevel;
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.DefaultGasFeeFlow = void 0;
10
+ const gas_fee_controller_1 = require("@metamask/gas-fee-controller");
11
+ const utils_1 = require("@metamask/utils");
12
+ const logger_js_1 = require("../logger.cjs");
13
+ const types_js_1 = require("../types.cjs");
14
+ const gas_fees_js_1 = require("../utils/gas-fees.cjs");
15
+ const log = (0, utils_1.createModuleLogger)(logger_js_1.projectLogger, 'default-gas-fee-flow');
16
+ /**
17
+ * The standard implementation of a gas fee flow that obtains gas fee estimates using only the GasFeeController.
18
+ */
19
+ class DefaultGasFeeFlow {
20
+ constructor() {
21
+ _DefaultGasFeeFlow_instances.add(this);
22
+ }
23
+ matchesTransaction() {
24
+ return true;
25
+ }
26
+ async getGasFees(request) {
27
+ const { gasFeeControllerData } = request;
28
+ const { gasEstimateType, gasFeeEstimates } = gasFeeControllerData;
29
+ let response;
30
+ switch (gasEstimateType) {
31
+ case gas_fee_controller_1.GAS_ESTIMATE_TYPES.FEE_MARKET:
32
+ log('Using fee market estimates', gasFeeEstimates);
33
+ response = __classPrivateFieldGet(this, _DefaultGasFeeFlow_instances, "m", _DefaultGasFeeFlow_getFeeMarkEstimates).call(this, gasFeeEstimates);
34
+ break;
35
+ case gas_fee_controller_1.GAS_ESTIMATE_TYPES.LEGACY:
36
+ log('Using legacy estimates', gasFeeEstimates);
37
+ response = __classPrivateFieldGet(this, _DefaultGasFeeFlow_instances, "m", _DefaultGasFeeFlow_getLegacyEstimates).call(this, gasFeeEstimates);
38
+ break;
39
+ case gas_fee_controller_1.GAS_ESTIMATE_TYPES.ETH_GASPRICE:
40
+ log('Using eth_gasPrice estimates', gasFeeEstimates);
41
+ response = __classPrivateFieldGet(this, _DefaultGasFeeFlow_instances, "m", _DefaultGasFeeFlow_getGasPriceEstimates).call(this, gasFeeEstimates);
42
+ break;
43
+ default:
44
+ throw new Error(`Unsupported gas estimate type: ${gasEstimateType}`);
45
+ }
46
+ return {
47
+ estimates: response,
48
+ };
49
+ }
50
+ }
51
+ exports.DefaultGasFeeFlow = DefaultGasFeeFlow;
52
+ _DefaultGasFeeFlow_instances = new WeakSet(), _DefaultGasFeeFlow_getFeeMarkEstimates = function _DefaultGasFeeFlow_getFeeMarkEstimates(gasFeeEstimates) {
53
+ const levels = Object.values(types_js_1.GasFeeEstimateLevel).reduce((result, level) => ({
54
+ ...result,
55
+ [level]: __classPrivateFieldGet(this, _DefaultGasFeeFlow_instances, "m", _DefaultGasFeeFlow_getFeeMarketLevel).call(this, gasFeeEstimates, level),
56
+ }), {});
57
+ return {
58
+ type: types_js_1.GasFeeEstimateType.FeeMarket,
59
+ ...levels,
60
+ };
61
+ }, _DefaultGasFeeFlow_getLegacyEstimates = function _DefaultGasFeeFlow_getLegacyEstimates(gasFeeEstimates) {
62
+ const levels = Object.values(types_js_1.GasFeeEstimateLevel).reduce((result, level) => ({
63
+ ...result,
64
+ [level]: __classPrivateFieldGet(this, _DefaultGasFeeFlow_instances, "m", _DefaultGasFeeFlow_getLegacyLevel).call(this, gasFeeEstimates, level),
65
+ }), {});
66
+ return {
67
+ type: types_js_1.GasFeeEstimateType.Legacy,
68
+ ...levels,
69
+ };
70
+ }, _DefaultGasFeeFlow_getGasPriceEstimates = function _DefaultGasFeeFlow_getGasPriceEstimates(gasFeeEstimates) {
71
+ return {
72
+ type: types_js_1.GasFeeEstimateType.GasPrice,
73
+ gasPrice: (0, gas_fees_js_1.gweiDecimalToWeiHex)(gasFeeEstimates.gasPrice),
74
+ };
75
+ }, _DefaultGasFeeFlow_getFeeMarketLevel = function _DefaultGasFeeFlow_getFeeMarketLevel(gasFeeEstimates, level) {
76
+ const maxFeePerGas = (0, gas_fees_js_1.gweiDecimalToWeiHex)(gasFeeEstimates[level].suggestedMaxFeePerGas);
77
+ const maxPriorityFeePerGas = (0, gas_fees_js_1.gweiDecimalToWeiHex)(gasFeeEstimates[level].suggestedMaxPriorityFeePerGas);
78
+ return {
79
+ maxFeePerGas,
80
+ maxPriorityFeePerGas,
81
+ };
82
+ }, _DefaultGasFeeFlow_getLegacyLevel = function _DefaultGasFeeFlow_getLegacyLevel(gasFeeEstimates, level) {
83
+ return (0, gas_fees_js_1.gweiDecimalToWeiHex)(gasFeeEstimates[level]);
84
+ };
85
+ //# sourceMappingURL=DefaultGasFeeFlow.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"DefaultGasFeeFlow.js","sourceRoot":"","sources":["../../src/gas-flows/DefaultGasFeeFlow.ts"],"names":[],"mappings":";;;;;;AAKA,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAW7C,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D,MAAM,GAAG,GAAG,kBAAkB,CAAC,aAAa,EAAE,sBAAsB,CAAC,CAAC;AAEtE;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAA9B;;IAoGA,CAAC;IAnGC,kBAAkB;QAChB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,OAA0B;QACzC,MAAM,EAAE,oBAAoB,EAAE,GAAG,OAAO,CAAC;QACzC,MAAM,EAAE,eAAe,EAAE,eAAe,EAAE,GAAG,oBAAoB,CAAC;QAElE,IAAI,QAAyB,CAAC;QAE9B,QAAQ,eAAe,EAAE,CAAC;YACxB,KAAK,kBAAkB,CAAC,UAAU;gBAChC,GAAG,CAAC,4BAA4B,EAAE,e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AAe,EAAE,KAAK,CAAC;KACtD,CAAC,EACF,EAAyC,CAC1C,CAAC;IAEF,OAAO;QACL,IAAI,EAAE,kBAAkB,CAAC,MAAM;QAC/B,GAAG,MAAM;KACV,CAAC;AACJ,CAAC,6FAGC,eAAoC;IAEpC,OAAO;QACL,IAAI,EAAE,kBAAkB,CAAC,QAAQ;QACjC,QAAQ,EAAE,mBAAmB,CAAC,eAAe,CAAC,QAAQ,CAAC;KACxD,CAAC;AACJ,CAAC,uFAGC,eAA0C,EAC1C,KAA0B;IAE1B,MAAM,YAAY,GAAG,mBAAmB,CACtC,eAAe,CAAC,KAAK,CAAC,CAAC,qBAAqB,CAC7C,CAAC;IAEF,MAAM,oBAAoB,GAAG,mBAAmB,CAC9C,eAAe,CAAC,KAAK,CAAC,CAAC,6BAA6B,CACrD,CAAC;IAEF,OAAO;QACL,YAAY;QACZ,oBAAoB;KACrB,CAAC;AACJ,CAAC,iFAGC,eAAuC,EACvC,KAA0B;IAE1B,OAAO,mBAAmB,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;AACrD,CAAC","sourcesContent":["import type {\n LegacyGasPriceEstimate,\n GasFeeEstimates as FeeMarketGasPriceEstimate,\n EthGasPriceEstimate,\n} from '@metamask/gas-fee-controller';\nimport { GAS_ESTIMATE_TYPES } from '@metamask/gas-fee-controller';\nimport type { Hex } from '@metamask/utils';\nimport { createModuleLogger } from '@metamask/utils';\n\nimport { projectLogger } from '../logger.js';\nimport type {\n FeeMarketGasFeeEstimateForLevel,\n FeeMarketGasFeeEstimates,\n GasFeeEstimates,\n GasFeeFlow,\n GasFeeFlowRequest,\n GasFeeFlowResponse,\n GasPriceGasFeeEstimates,\n LegacyGasFeeEstimates,\n} from '../types.js';\nimport { GasFeeEstimateLevel, GasFeeEstimateType } from '../types.js';\nimport { gweiDecimalToWeiHex } from '../utils/gas-fees.js';\n\nconst log = createModuleLogger(projectLogger, 'default-gas-fee-flow');\n\n/**\n * The standard implementation of a gas fee flow that obtains gas fee estimates using only the GasFeeController.\n */\nexport class DefaultGasFeeFlow implements GasFeeFlow {\n matchesTransaction(): boolean {\n return true;\n }\n\n async getGasFees(request: GasFeeFlowRequest): Promise<GasFeeFlowResponse> {\n const { gasFeeControllerData } = request;\n const { gasEstimateType, gasFeeEstimates } = gasFeeControllerData;\n\n let response: GasFeeEstimates;\n\n switch (gasEstimateType) {\n case GAS_ESTIMATE_TYPES.FEE_MARKET:\n log('Using fee market estimates', gasFeeEstimates);\n response = this.#getFeeMarkEstimates(gasFeeEstimates);\n break;\n case GAS_ESTIMATE_TYPES.LEGACY:\n log('Using legacy estimates', gasFeeEstimates);\n response = this.#getLegacyEstimates(gasFeeEstimates);\n break;\n case GAS_ESTIMATE_TYPES.ETH_GASPRICE:\n log('Using eth_gasPrice estimates', gasFeeEstimates);\n response = this.#getGasPriceEstimates(gasFeeEstimates);\n break;\n default:\n throw new Error(`Unsupported gas estimate type: ${gasEstimateType}`);\n }\n\n return {\n estimates: response,\n };\n }\n\n #getFeeMarkEstimates(\n gasFeeEstimates: FeeMarketGasPriceEstimate,\n ): FeeMarketGasFeeEstimates {\n const levels = Object.values(GasFeeEstimateLevel).reduce(\n (result, level) => ({\n ...result,\n [level]: this.#getFeeMarketLevel(gasFeeEstimates, level),\n }),\n {} as Omit<FeeMarketGasFeeEstimates, 'type'>,\n );\n\n return {\n type: GasFeeEstimateType.FeeMarket,\n ...levels,\n };\n }\n\n #getLegacyEstimates(\n gasFeeEstimates: LegacyGasPriceEstimate,\n ): LegacyGasFeeEstimates {\n const levels = Object.values(GasFeeEstimateLevel).reduce(\n (result, level) => ({\n ...result,\n [level]: this.#getLegacyLevel(gasFeeEstimates, level),\n }),\n {} as Omit<LegacyGasFeeEstimates, 'type'>,\n );\n\n return {\n type: GasFeeEstimateType.Legacy,\n ...levels,\n };\n }\n\n #getGasPriceEstimates(\n gasFeeEstimates: EthGasPriceEstimate,\n ): GasPriceGasFeeEstimates {\n return {\n type: GasFeeEstimateType.GasPrice,\n gasPrice: gweiDecimalToWeiHex(gasFeeEstimates.gasPrice),\n };\n }\n\n #getFeeMarketLevel(\n gasFeeEstimates: FeeMarketGasPriceEstimate,\n level: GasFeeEstimateLevel,\n ): FeeMarketGasFeeEstimateForLevel {\n const maxFeePerGas = gweiDecimalToWeiHex(\n gasFeeEstimates[level].suggestedMaxFeePerGas,\n );\n\n const maxPriorityFeePerGas = gweiDecimalToWeiHex(\n gasFeeEstimates[level].suggestedMaxPriorityFeePerGas,\n );\n\n return {\n maxFeePerGas,\n maxPriorityFeePerGas,\n };\n }\n\n #getLegacyLevel(\n gasFeeEstimates: LegacyGasPriceEstimate,\n level: GasFeeEstimateLevel,\n ): Hex {\n return gweiDecimalToWeiHex(gasFeeEstimates[level]);\n }\n}\n"]}
1
+ {"version":3,"file":"DefaultGasFeeFlow.cjs","sourceRoot":"","sources":["../../src/gas-flows/DefaultGasFeeFlow.ts"],"names":[],"mappings":";;;;;;;;;AAKA,qEAAkE;AAElE,2CAAqD;AAErD,6CAA6C;AAW7C,2CAAsE;AACtE,uDAA2D;AAE3D,MAAM,GAAG,GAAG,IAAA,0BAAkB,EAAC,yBAAa,EAAE,sBAAsB,CAAC,CAAC;AAEtE;;GAEG;AACH,MAAa,iBAAiB;IAA9B;;IAoGA,CAAC;IAnGC,kBAAkB;QAChB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,OAA0B;QACzC,MAAM,EAAE,oBAAoB,EAAE,GAAG,OAAO,CAAC;QACzC,MAAM,EAAE,eAAe,EAAE,eAAe,EAAE,GAAG,oBAAoB,CAAC;QAElE,IAAI,QAAyB,CAAC;QAE9B,QAAQ,eAAe,EAAE,CAAC;YACxB,KAAK,uCAAkB,CAAC,UAAU;gBAChC,GAAG,CAAC,4BAA4B,EAAE,eAAe,CAAC,CAAC;gBACnD,QAAQ,GAAG,uBAAA,IAAI,4EAAqB,MAAzB,IAAI,EAAsB,eAAe,CAAC,CAAC;gBACtD,MAAM;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,CAAC,MAAM;QAC/B,GAAG,MAAM;KACV,CAAC;AACJ,CAAC,6FAGC,eAAoC;IAEpC,OAAO;QACL,IAAI,EAAE,6BAAkB,CAAC,QAAQ;QACjC,QAAQ,EAAE,IAAA,iCAAmB,EAAC,eAAe,CAAC,QAAQ,CAAC;KACxD,CAAC;AACJ,CAAC,uFAGC,eAA0C,EAC1C,KAA0B;IAE1B,MAAM,YAAY,GAAG,IAAA,iCAAmB,EACtC,eAAe,CAAC,KAAK,CAAC,CAAC,qBAAqB,CAC7C,CAAC;IAEF,MAAM,oBAAoB,GAAG,IAAA,iCAAmB,EAC9C,eAAe,CAAC,KAAK,CAAC,CAAC,6BAA6B,CACrD,CAAC;IAEF,OAAO;QACL,YAAY;QACZ,oBAAoB;KACrB,CAAC;AACJ,CAAC,iFAGC,eAAuC,EACvC,KAA0B;IAE1B,OAAO,IAAA,iCAAmB,EAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;AACrD,CAAC","sourcesContent":["import type {\n LegacyGasPriceEstimate,\n GasFeeEstimates as FeeMarketGasPriceEstimate,\n EthGasPriceEstimate,\n} from '@metamask/gas-fee-controller';\nimport { GAS_ESTIMATE_TYPES } from '@metamask/gas-fee-controller';\nimport type { Hex } from '@metamask/utils';\nimport { createModuleLogger } from '@metamask/utils';\n\nimport { projectLogger } from '../logger.js';\nimport type {\n FeeMarketGasFeeEstimateForLevel,\n FeeMarketGasFeeEstimates,\n GasFeeEstimates,\n GasFeeFlow,\n GasFeeFlowRequest,\n GasFeeFlowResponse,\n GasPriceGasFeeEstimates,\n LegacyGasFeeEstimates,\n} from '../types.js';\nimport { GasFeeEstimateLevel, GasFeeEstimateType } from '../types.js';\nimport { gweiDecimalToWeiHex } from '../utils/gas-fees.js';\n\nconst log = createModuleLogger(projectLogger, 'default-gas-fee-flow');\n\n/**\n * The standard implementation of a gas fee flow that obtains gas fee estimates using only the GasFeeController.\n */\nexport class DefaultGasFeeFlow implements GasFeeFlow {\n matchesTransaction(): boolean {\n return true;\n }\n\n async getGasFees(request: GasFeeFlowRequest): Promise<GasFeeFlowResponse> {\n const { gasFeeControllerData } = request;\n const { gasEstimateType, gasFeeEstimates } = gasFeeControllerData;\n\n let response: GasFeeEstimates;\n\n switch (gasEstimateType) {\n case GAS_ESTIMATE_TYPES.FEE_MARKET:\n log('Using fee market estimates', gasFeeEstimates);\n response = this.#getFeeMarkEstimates(gasFeeEstimates);\n break;\n case GAS_ESTIMATE_TYPES.LEGACY:\n log('Using legacy estimates', gasFeeEstimates);\n response = this.#getLegacyEstimates(gasFeeEstimates);\n break;\n case GAS_ESTIMATE_TYPES.ETH_GASPRICE:\n log('Using eth_gasPrice estimates', gasFeeEstimates);\n response = this.#getGasPriceEstimates(gasFeeEstimates);\n break;\n default:\n throw new Error(`Unsupported gas estimate type: ${gasEstimateType}`);\n }\n\n return {\n estimates: response,\n };\n }\n\n #getFeeMarkEstimates(\n gasFeeEstimates: FeeMarketGasPriceEstimate,\n ): FeeMarketGasFeeEstimates {\n const levels = Object.values(GasFeeEstimateLevel).reduce(\n (result, level) => ({\n ...result,\n [level]: this.#getFeeMarketLevel(gasFeeEstimates, level),\n }),\n {} as Omit<FeeMarketGasFeeEstimates, 'type'>,\n );\n\n return {\n type: GasFeeEstimateType.FeeMarket,\n ...levels,\n };\n }\n\n #getLegacyEstimates(\n gasFeeEstimates: LegacyGasPriceEstimate,\n ): LegacyGasFeeEstimates {\n const levels = Object.values(GasFeeEstimateLevel).reduce(\n (result, level) => ({\n ...result,\n [level]: this.#getLegacyLevel(gasFeeEstimates, level),\n }),\n {} as Omit<LegacyGasFeeEstimates, 'type'>,\n );\n\n return {\n type: GasFeeEstimateType.Legacy,\n ...levels,\n };\n }\n\n #getGasPriceEstimates(\n gasFeeEstimates: EthGasPriceEstimate,\n ): GasPriceGasFeeEstimates {\n return {\n type: GasFeeEstimateType.GasPrice,\n gasPrice: gweiDecimalToWeiHex(gasFeeEstimates.gasPrice),\n };\n }\n\n #getFeeMarketLevel(\n gasFeeEstimates: FeeMarketGasPriceEstimate,\n level: GasFeeEstimateLevel,\n ): FeeMarketGasFeeEstimateForLevel {\n const maxFeePerGas = gweiDecimalToWeiHex(\n gasFeeEstimates[level].suggestedMaxFeePerGas,\n );\n\n const maxPriorityFeePerGas = gweiDecimalToWeiHex(\n gasFeeEstimates[level].suggestedMaxPriorityFeePerGas,\n );\n\n return {\n maxFeePerGas,\n maxPriorityFeePerGas,\n };\n }\n\n #getLegacyLevel(\n gasFeeEstimates: LegacyGasPriceEstimate,\n level: GasFeeEstimateLevel,\n ): Hex {\n return gweiDecimalToWeiHex(gasFeeEstimates[level]);\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { GasFeeFlow, GasFeeFlowRequest, GasFeeFlowResponse } from '../types.js';
1
+ import type { GasFeeFlow, GasFeeFlowRequest, GasFeeFlowResponse } from "../types.cjs";
2
2
  /**
3
3
  * The standard implementation of a gas fee flow that obtains gas fee estimates using only the GasFeeController.
4
4
  */
@@ -7,4 +7,4 @@ export declare class DefaultGasFeeFlow implements GasFeeFlow {
7
7
  matchesTransaction(): boolean;
8
8
  getGasFees(request: GasFeeFlowRequest): Promise<GasFeeFlowResponse>;
9
9
  }
10
- //# sourceMappingURL=DefaultGasFeeFlow.d.ts.map
10
+ //# sourceMappingURL=DefaultGasFeeFlow.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DefaultGasFeeFlow.d.cts","sourceRoot":"","sources":["../../src/gas-flows/DefaultGasFeeFlow.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAIV,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAGnB,qBAAoB;AAMrB;;GAEG;AACH,qBAAa,iBAAkB,YAAW,UAAU;;IAClD,kBAAkB,IAAI,OAAO;IAIvB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;CA+F1E"}
@@ -0,0 +1,10 @@
1
+ import type { GasFeeFlow, GasFeeFlowRequest, GasFeeFlowResponse } from "../types.mjs";
2
+ /**
3
+ * The standard implementation of a gas fee flow that obtains gas fee estimates using only the GasFeeController.
4
+ */
5
+ export declare class DefaultGasFeeFlow implements GasFeeFlow {
6
+ #private;
7
+ matchesTransaction(): boolean;
8
+ getGasFees(request: GasFeeFlowRequest): Promise<GasFeeFlowResponse>;
9
+ }
10
+ //# sourceMappingURL=DefaultGasFeeFlow.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DefaultGasFeeFlow.d.mts","sourceRoot":"","sources":["../../src/gas-flows/DefaultGasFeeFlow.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAIV,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAGnB,qBAAoB;AAMrB;;GAEG;AACH,qBAAa,iBAAkB,YAAW,UAAU;;IAClD,kBAAkB,IAAI,OAAO;IAIvB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;CA+F1E"}
@@ -4,11 +4,11 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
4
4
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
5
  };
6
6
  var _DefaultGasFeeFlow_instances, _DefaultGasFeeFlow_getFeeMarkEstimates, _DefaultGasFeeFlow_getLegacyEstimates, _DefaultGasFeeFlow_getGasPriceEstimates, _DefaultGasFeeFlow_getFeeMarketLevel, _DefaultGasFeeFlow_getLegacyLevel;
7
- import { GAS_ESTIMATE_TYPES } from '@metamask/gas-fee-controller';
8
- import { createModuleLogger } from '@metamask/utils';
9
- import { projectLogger } from '../logger.js';
10
- import { GasFeeEstimateLevel, GasFeeEstimateType } from '../types.js';
11
- import { gweiDecimalToWeiHex } from '../utils/gas-fees.js';
7
+ import { GAS_ESTIMATE_TYPES } from "@metamask/gas-fee-controller";
8
+ import { createModuleLogger } from "@metamask/utils";
9
+ import { projectLogger } from "../logger.mjs";
10
+ import { GasFeeEstimateLevel, GasFeeEstimateType } from "../types.mjs";
11
+ import { gweiDecimalToWeiHex } from "../utils/gas-fees.mjs";
12
12
  const log = createModuleLogger(projectLogger, 'default-gas-fee-flow');
13
13
  /**
14
14
  * The standard implementation of a gas fee flow that obtains gas fee estimates using only the GasFeeController.
@@ -78,4 +78,4 @@ _DefaultGasFeeFlow_instances = new WeakSet(), _DefaultGasFeeFlow_getFeeMarkEstim
78
78
  }, _DefaultGasFeeFlow_getLegacyLevel = function _DefaultGasFeeFlow_getLegacyLevel(gasFeeEstimates, level) {
79
79
  return gweiDecimalToWeiHex(gasFeeEstimates[level]);
80
80
  };
81
- //# sourceMappingURL=DefaultGasFeeFlow.js.map
81
+ //# sourceMappingURL=DefaultGasFeeFlow.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DefaultGasFeeFlow.mjs","sourceRoot":"","sources":["../../src/gas-flows/DefaultGasFeeFlow.ts"],"names":[],"mappings":";;;;;;AAKA,OAAO,EAAE,kBAAkB,EAAE,qCAAqC;AAElE,OAAO,EAAE,kBAAkB,EAAE,wBAAwB;AAErD,OAAO,EAAE,aAAa,EAAE,sBAAqB;AAW7C,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,qBAAoB;AACtE,OAAO,EAAE,mBAAmB,EAAE,8BAA6B;AAE3D,MAAM,GAAG,GAAG,kBAAkB,CAAC,aAAa,EAAE,sBAAsB,CAAC,CAAC;AAEtE;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAA9B;;IAoGA,CAAC;IAnGC,kBAAkB;QAChB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,OAA0B;QACzC,MAAM,EAAE,oBAAoB,EAAE,GAAG,OAAO,CAAC;QACzC,MAAM,EAAE,eAAe,EAAE,eAAe,EAAE,GAAG,oBAAoB,CAAC;QAElE,IAAI,QAAyB,CAAC;QAE9B,QAAQ,eAAe,EAAE,CAAC;YACxB,KAAK,kBAAkB,CAAC,UAAU;gBAChC,GAAG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B,MAApB,IAAI,EAAiB,eAAe,EAAE,KAAK,CAAC;KACtD,CAAC,EACF,EAAyC,CAC1C,CAAC;IAEF,OAAO;QACL,IAAI,EAAE,kBAAkB,CAAC,MAAM;QAC/B,GAAG,MAAM;KACV,CAAC;AACJ,CAAC,6FAGC,eAAoC;IAEpC,OAAO;QACL,IAAI,EAAE,kBAAkB,CAAC,QAAQ;QACjC,QAAQ,EAAE,mBAAmB,CAAC,eAAe,CAAC,QAAQ,CAAC;KACxD,CAAC;AACJ,CAAC,uFAGC,eAA0C,EAC1C,KAA0B;IAE1B,MAAM,YAAY,GAAG,mBAAmB,CACtC,eAAe,CAAC,KAAK,CAAC,CAAC,qBAAqB,CAC7C,CAAC;IAEF,MAAM,oBAAoB,GAAG,mBAAmB,CAC9C,eAAe,CAAC,KAAK,CAAC,CAAC,6BAA6B,CACrD,CAAC;IAEF,OAAO;QACL,YAAY;QACZ,oBAAoB;KACrB,CAAC;AACJ,CAAC,iFAGC,eAAuC,EACvC,KAA0B;IAE1B,OAAO,mBAAmB,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;AACrD,CAAC","sourcesContent":["import type {\n LegacyGasPriceEstimate,\n GasFeeEstimates as FeeMarketGasPriceEstimate,\n EthGasPriceEstimate,\n} from '@metamask/gas-fee-controller';\nimport { GAS_ESTIMATE_TYPES } from '@metamask/gas-fee-controller';\nimport type { Hex } from '@metamask/utils';\nimport { createModuleLogger } from '@metamask/utils';\n\nimport { projectLogger } from '../logger.js';\nimport type {\n FeeMarketGasFeeEstimateForLevel,\n FeeMarketGasFeeEstimates,\n GasFeeEstimates,\n GasFeeFlow,\n GasFeeFlowRequest,\n GasFeeFlowResponse,\n GasPriceGasFeeEstimates,\n LegacyGasFeeEstimates,\n} from '../types.js';\nimport { GasFeeEstimateLevel, GasFeeEstimateType } from '../types.js';\nimport { gweiDecimalToWeiHex } from '../utils/gas-fees.js';\n\nconst log = createModuleLogger(projectLogger, 'default-gas-fee-flow');\n\n/**\n * The standard implementation of a gas fee flow that obtains gas fee estimates using only the GasFeeController.\n */\nexport class DefaultGasFeeFlow implements GasFeeFlow {\n matchesTransaction(): boolean {\n return true;\n }\n\n async getGasFees(request: GasFeeFlowRequest): Promise<GasFeeFlowResponse> {\n const { gasFeeControllerData } = request;\n const { gasEstimateType, gasFeeEstimates } = gasFeeControllerData;\n\n let response: GasFeeEstimates;\n\n switch (gasEstimateType) {\n case GAS_ESTIMATE_TYPES.FEE_MARKET:\n log('Using fee market estimates', gasFeeEstimates);\n response = this.#getFeeMarkEstimates(gasFeeEstimates);\n break;\n case GAS_ESTIMATE_TYPES.LEGACY:\n log('Using legacy estimates', gasFeeEstimates);\n response = this.#getLegacyEstimates(gasFeeEstimates);\n break;\n case GAS_ESTIMATE_TYPES.ETH_GASPRICE:\n log('Using eth_gasPrice estimates', gasFeeEstimates);\n response = this.#getGasPriceEstimates(gasFeeEstimates);\n break;\n default:\n throw new Error(`Unsupported gas estimate type: ${gasEstimateType}`);\n }\n\n return {\n estimates: response,\n };\n }\n\n #getFeeMarkEstimates(\n gasFeeEstimates: FeeMarketGasPriceEstimate,\n ): FeeMarketGasFeeEstimates {\n const levels = Object.values(GasFeeEstimateLevel).reduce(\n (result, level) => ({\n ...result,\n [level]: this.#getFeeMarketLevel(gasFeeEstimates, level),\n }),\n {} as Omit<FeeMarketGasFeeEstimates, 'type'>,\n );\n\n return {\n type: GasFeeEstimateType.FeeMarket,\n ...levels,\n };\n }\n\n #getLegacyEstimates(\n gasFeeEstimates: LegacyGasPriceEstimate,\n ): LegacyGasFeeEstimates {\n const levels = Object.values(GasFeeEstimateLevel).reduce(\n (result, level) => ({\n ...result,\n [level]: this.#getLegacyLevel(gasFeeEstimates, level),\n }),\n {} as Omit<LegacyGasFeeEstimates, 'type'>,\n );\n\n return {\n type: GasFeeEstimateType.Legacy,\n ...levels,\n };\n }\n\n #getGasPriceEstimates(\n gasFeeEstimates: EthGasPriceEstimate,\n ): GasPriceGasFeeEstimates {\n return {\n type: GasFeeEstimateType.GasPrice,\n gasPrice: gweiDecimalToWeiHex(gasFeeEstimates.gasPrice),\n };\n }\n\n #getFeeMarketLevel(\n gasFeeEstimates: FeeMarketGasPriceEstimate,\n level: GasFeeEstimateLevel,\n ): FeeMarketGasFeeEstimateForLevel {\n const maxFeePerGas = gweiDecimalToWeiHex(\n gasFeeEstimates[level].suggestedMaxFeePerGas,\n );\n\n const maxPriorityFeePerGas = gweiDecimalToWeiHex(\n gasFeeEstimates[level].suggestedMaxPriorityFeePerGas,\n );\n\n return {\n maxFeePerGas,\n maxPriorityFeePerGas,\n };\n }\n\n #getLegacyLevel(\n gasFeeEstimates: LegacyGasPriceEstimate,\n level: GasFeeEstimateLevel,\n ): Hex {\n return gweiDecimalToWeiHex(gasFeeEstimates[level]);\n }\n}\n"]}
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
+ };
7
+ var _LineaGasFeeFlow_instances, _LineaGasFeeFlow_getLineaGasFees, _LineaGasFeeFlow_getLineaResponse, _LineaGasFeeFlow_getValuesFromMultipliers, _LineaGasFeeFlow_getMaxFees, _LineaGasFeeFlow_feesToString;
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.LineaGasFeeFlow = void 0;
10
+ const controller_utils_1 = require("@metamask/controller-utils");
11
+ const utils_1 = require("@metamask/utils");
12
+ const logger_js_1 = require("../logger.cjs");
13
+ const types_js_1 = require("../types.cjs");
14
+ const provider_js_1 = require("../utils/provider.cjs");
15
+ const DefaultGasFeeFlow_js_1 = require("./DefaultGasFeeFlow.cjs");
16
+ const log = (0, utils_1.createModuleLogger)(logger_js_1.projectLogger, 'linea-gas-fee-flow');
17
+ const LINEA_CHAIN_IDS = [
18
+ controller_utils_1.ChainId['linea-mainnet'],
19
+ controller_utils_1.ChainId['linea-goerli'],
20
+ controller_utils_1.ChainId['linea-sepolia'],
21
+ ];
22
+ const BASE_FEE_MULTIPLIERS = {
23
+ low: 1,
24
+ medium: 1.35,
25
+ high: 1.7,
26
+ };
27
+ const PRIORITY_FEE_MULTIPLIERS = {
28
+ low: 1,
29
+ medium: 1.05,
30
+ high: 1.1,
31
+ };
32
+ /**
33
+ * Implementation of a gas fee flow specific to Linea networks that obtains gas fee estimates using:
34
+ * - The `linea_estimateGas` RPC method to obtain the base fee and lowest priority fee.
35
+ * - Static multipliers to increase the base and priority fees.
36
+ */
37
+ class LineaGasFeeFlow {
38
+ constructor() {
39
+ _LineaGasFeeFlow_instances.add(this);
40
+ }
41
+ matchesTransaction({ transactionMeta, }) {
42
+ return LINEA_CHAIN_IDS.includes(transactionMeta.chainId);
43
+ }
44
+ async getGasFees(request) {
45
+ try {
46
+ return await __classPrivateFieldGet(this, _LineaGasFeeFlow_instances, "m", _LineaGasFeeFlow_getLineaGasFees).call(this, request);
47
+ }
48
+ catch (error) {
49
+ log('Using default flow as fallback due to error', error);
50
+ return new DefaultGasFeeFlow_js_1.DefaultGasFeeFlow().getGasFees(request);
51
+ }
52
+ }
53
+ }
54
+ exports.LineaGasFeeFlow = LineaGasFeeFlow;
55
+ _LineaGasFeeFlow_instances = new WeakSet(), _LineaGasFeeFlow_getLineaGasFees = async function _LineaGasFeeFlow_getLineaGasFees(request) {
56
+ const { messenger, transactionMeta } = request;
57
+ const { networkClientId } = transactionMeta;
58
+ const lineaResponse = await __classPrivateFieldGet(this, _LineaGasFeeFlow_instances, "m", _LineaGasFeeFlow_getLineaResponse).call(this, transactionMeta, messenger, networkClientId);
59
+ log('Received Linea response', lineaResponse);
60
+ const baseFees = __classPrivateFieldGet(this, _LineaGasFeeFlow_instances, "m", _LineaGasFeeFlow_getValuesFromMultipliers).call(this, lineaResponse.baseFeePerGas, BASE_FEE_MULTIPLIERS);
61
+ log('Generated base fees', __classPrivateFieldGet(this, _LineaGasFeeFlow_instances, "m", _LineaGasFeeFlow_feesToString).call(this, baseFees));
62
+ const priorityFees = __classPrivateFieldGet(this, _LineaGasFeeFlow_instances, "m", _LineaGasFeeFlow_getValuesFromMultipliers).call(this, lineaResponse.priorityFeePerGas, PRIORITY_FEE_MULTIPLIERS);
63
+ log('Generated priority fees', __classPrivateFieldGet(this, _LineaGasFeeFlow_instances, "m", _LineaGasFeeFlow_feesToString).call(this, priorityFees));
64
+ const maxFees = __classPrivateFieldGet(this, _LineaGasFeeFlow_instances, "m", _LineaGasFeeFlow_getMaxFees).call(this, baseFees, priorityFees);
65
+ log('Generated max fees', __classPrivateFieldGet(this, _LineaGasFeeFlow_instances, "m", _LineaGasFeeFlow_feesToString).call(this, maxFees));
66
+ const estimates = Object.values(types_js_1.GasFeeEstimateLevel).reduce((result, level) => ({
67
+ ...result,
68
+ [level]: {
69
+ maxFeePerGas: (0, controller_utils_1.toHex)(maxFees[level]),
70
+ maxPriorityFeePerGas: (0, controller_utils_1.toHex)(priorityFees[level]),
71
+ },
72
+ }), { type: types_js_1.GasFeeEstimateType.FeeMarket });
73
+ return { estimates };
74
+ }, _LineaGasFeeFlow_getLineaResponse = function _LineaGasFeeFlow_getLineaResponse(transactionMeta, messenger, networkClientId) {
75
+ const { from, to, value, data } = transactionMeta.txParams;
76
+ const params = { from };
77
+ if (to) {
78
+ params.to = to;
79
+ }
80
+ if (value) {
81
+ params.value = value;
82
+ }
83
+ if (data) {
84
+ params.input = data;
85
+ }
86
+ return (0, provider_js_1.rpcRequest)({
87
+ messenger,
88
+ networkClientId,
89
+ method: 'linea_estimateGas',
90
+ params: [params],
91
+ });
92
+ }, _LineaGasFeeFlow_getValuesFromMultipliers = function _LineaGasFeeFlow_getValuesFromMultipliers(value, multipliers) {
93
+ const base = (0, controller_utils_1.hexToBN)(value);
94
+ const low = base.muln(multipliers.low);
95
+ const medium = base.muln(multipliers.medium);
96
+ const high = base.muln(multipliers.high);
97
+ return {
98
+ low,
99
+ medium,
100
+ high,
101
+ };
102
+ }, _LineaGasFeeFlow_getMaxFees = function _LineaGasFeeFlow_getMaxFees(baseFees, priorityFees) {
103
+ return {
104
+ low: baseFees.low.add(priorityFees.low),
105
+ medium: baseFees.medium.add(priorityFees.medium),
106
+ high: baseFees.high.add(priorityFees.high),
107
+ };
108
+ }, _LineaGasFeeFlow_feesToString = function _LineaGasFeeFlow_feesToString(fees) {
109
+ return Object.values(types_js_1.GasFeeEstimateLevel).map((level) => fees[level].toString(10));
110
+ };
111
+ //# sourceMappingURL=LineaGasFeeFlow.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LineaGasFeeFlow.cjs","sourceRoot":"","sources":["../../src/gas-flows/LineaGasFeeFlow.ts"],"names":[],"mappings":";;;;;;;;;AAAA,iEAAqE;AAErE,2CAAqD;AAIrD,6CAA6C;AAS7C,2CAAsE;AACtE,uDAAkD;AAClD,kEAA2D;AAW3D,MAAM,GAAG,GAAG,IAAA,0BAAkB,EAAC,yBAAa,EAAE,oBAAoB,CAAC,CAAC;AAEpE,MAAM,eAAe,GAAU;IAC7B,0BAAO,CAAC,eAAe,CAAC;IACxB,0BAAO,CAAC,cAAc,CAAC;IACvB,0BAAO,CAAC,eAAe,CAAC;CACzB,CAAC;AAEF,MAAM,oBAAoB,GAAG;IAC3B,GAAG,EAAE,CAAC;IACN,MAAM,EAAE,IAAI;IACZ,IAAI,EAAE,GAAG;CACV,CAAC;AAEF,MAAM,wBAAwB,GAAG;IAC/B,GAAG,EAAE,CAAC;IACN,MAAM,EAAE,IAAI;IACZ,IAAI,EAAE,GAAG;CACV,CAAC;AAEF;;;;GAIG;AACH,MAAa,eAAe;IAA5B;;IA8HA,CAAC;IA7HC,kBAAkB,CAAC,EACjB,eAAe,GAIhB;QACC,OAAO,eAAe,CAAC,QAAQ,CAAC,eAAe,CAAC,OAA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,CAAC,CAAC;IACvC,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAC7C,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAEzC,OAAO;QACL,GAAG;QACH,MAAM;QACN,IAAI;KACL,CAAC;AACJ,CAAC,qEAGC,QAAyC,EACzC,YAA6C;IAE7C,OAAO;QACL,GAAG,EAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC;QACvC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC;QAChD,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,CAAC;KAC3C,CAAC;AACJ,CAAC,yEAEa,IAAiB;IAC7B,OAAO,MAAM,CAAC,MAAM,CAAC,8BAAmB,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CACtD,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CACzB,CAAC;AACJ,CAAC","sourcesContent":["import { ChainId, hexToBN, toHex } from '@metamask/controller-utils';\nimport type { NetworkClientId } from '@metamask/network-controller';\nimport { createModuleLogger } from '@metamask/utils';\nimport type { Hex } from '@metamask/utils';\nimport type BN from 'bn.js';\n\nimport { projectLogger } from '../logger.js';\nimport type { TransactionControllerMessenger } from '../TransactionController.js';\nimport type {\n GasFeeEstimates,\n GasFeeFlow,\n GasFeeFlowRequest,\n GasFeeFlowResponse,\n TransactionMeta,\n} from '../types.js';\nimport { GasFeeEstimateLevel, GasFeeEstimateType } from '../types.js';\nimport { rpcRequest } from '../utils/provider.js';\nimport { DefaultGasFeeFlow } from './DefaultGasFeeFlow.js';\n\ntype LineaEstimateGasResponse = {\n baseFeePerGas: Hex;\n priorityFeePerGas: Hex;\n};\n\ntype FeesByLevel = {\n [key in GasFeeEstimateLevel]: BN;\n};\n\nconst log = createModuleLogger(projectLogger, 'linea-gas-fee-flow');\n\nconst LINEA_CHAIN_IDS: Hex[] = [\n ChainId['linea-mainnet'],\n ChainId['linea-goerli'],\n ChainId['linea-sepolia'],\n];\n\nconst BASE_FEE_MULTIPLIERS = {\n low: 1,\n medium: 1.35,\n high: 1.7,\n};\n\nconst PRIORITY_FEE_MULTIPLIERS = {\n low: 1,\n medium: 1.05,\n high: 1.1,\n};\n\n/**\n * Implementation of a gas fee flow specific to Linea networks that obtains gas fee estimates using:\n * - The `linea_estimateGas` RPC method to obtain the base fee and lowest priority fee.\n * - Static multipliers to increase the base and priority fees.\n */\nexport class LineaGasFeeFlow implements GasFeeFlow {\n matchesTransaction({\n transactionMeta,\n }: {\n transactionMeta: TransactionMeta;\n messenger: TransactionControllerMessenger;\n }): boolean {\n return LINEA_CHAIN_IDS.includes(transactionMeta.chainId);\n }\n\n async getGasFees(request: GasFeeFlowRequest): Promise<GasFeeFlowResponse> {\n try {\n return await this.#getLineaGasFees(request);\n } catch (error) {\n log('Using default flow as fallback due to error', error);\n return new DefaultGasFeeFlow().getGasFees(request);\n }\n }\n\n async #getLineaGasFees(\n request: GasFeeFlowRequest,\n ): Promise<GasFeeFlowResponse> {\n const { messenger, transactionMeta } = request;\n const { networkClientId } = transactionMeta;\n\n const lineaResponse = await this.#getLineaResponse(\n transactionMeta,\n messenger,\n networkClientId,\n );\n\n log('Received Linea response', lineaResponse);\n\n const baseFees = this.#getValuesFromMultipliers(\n lineaResponse.baseFeePerGas,\n BASE_FEE_MULTIPLIERS,\n );\n\n log('Generated base fees', this.#feesToString(baseFees));\n\n const priorityFees = this.#getValuesFromMultipliers(\n lineaResponse.priorityFeePerGas,\n PRIORITY_FEE_MULTIPLIERS,\n );\n\n log('Generated priority fees', this.#feesToString(priorityFees));\n\n const maxFees = this.#getMaxFees(baseFees, priorityFees);\n\n log('Generated max fees', this.#feesToString(maxFees));\n\n const estimates = Object.values(GasFeeEstimateLevel).reduce(\n (result, level) => ({\n ...result,\n [level]: {\n maxFeePerGas: toHex(maxFees[level]),\n maxPriorityFeePerGas: toHex(priorityFees[level]),\n },\n }),\n { type: GasFeeEstimateType.FeeMarket } as GasFeeEstimates,\n );\n\n return { estimates };\n }\n\n #getLineaResponse(\n transactionMeta: TransactionMeta,\n messenger: TransactionControllerMessenger,\n networkClientId: NetworkClientId,\n ): Promise<LineaEstimateGasResponse> {\n const { from, to, value, data } = transactionMeta.txParams;\n\n const params: Record<string, string> = { from };\n\n if (to) {\n params.to = to;\n }\n\n if (value) {\n params.value = value;\n }\n\n if (data) {\n params.input = data;\n }\n\n return rpcRequest({\n messenger,\n networkClientId,\n method: 'linea_estimateGas',\n params: [params],\n }) as Promise<LineaEstimateGasResponse>;\n }\n\n #getValuesFromMultipliers(\n value: Hex,\n multipliers: { low: number; medium: number; high: number },\n ): FeesByLevel {\n const base = hexToBN(value);\n const low = base.muln(multipliers.low);\n const medium = base.muln(multipliers.medium);\n const high = base.muln(multipliers.high);\n\n return {\n low,\n medium,\n high,\n };\n }\n\n #getMaxFees(\n baseFees: Record<GasFeeEstimateLevel, BN>,\n priorityFees: Record<GasFeeEstimateLevel, BN>,\n ): FeesByLevel {\n return {\n low: baseFees.low.add(priorityFees.low),\n medium: baseFees.medium.add(priorityFees.medium),\n high: baseFees.high.add(priorityFees.high),\n };\n }\n\n #feesToString(fees: FeesByLevel): string[] {\n return Object.values(GasFeeEstimateLevel).map((level) =>\n fees[level].toString(10),\n );\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
- import type { TransactionControllerMessenger } from '../TransactionController.js';
2
- import type { GasFeeFlow, GasFeeFlowRequest, GasFeeFlowResponse, TransactionMeta } from '../types.js';
1
+ import type { TransactionControllerMessenger } from "../TransactionController.cjs";
2
+ import type { GasFeeFlow, GasFeeFlowRequest, GasFeeFlowResponse, TransactionMeta } from "../types.cjs";
3
3
  /**
4
4
  * Implementation of a gas fee flow specific to Linea networks that obtains gas fee estimates using:
5
5
  * - The `linea_estimateGas` RPC method to obtain the base fee and lowest priority fee.
@@ -13,4 +13,4 @@ export declare class LineaGasFeeFlow implements GasFeeFlow {
13
13
  }): boolean;
14
14
  getGasFees(request: GasFeeFlowRequest): Promise<GasFeeFlowResponse>;
15
15
  }
16
- //# sourceMappingURL=LineaGasFeeFlow.d.ts.map
16
+ //# sourceMappingURL=LineaGasFeeFlow.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LineaGasFeeFlow.d.cts","sourceRoot":"","sources":["../../src/gas-flows/LineaGasFeeFlow.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,8BAA8B,EAAE,qCAAoC;AAClF,OAAO,KAAK,EAEV,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EAChB,qBAAoB;AAkCrB;;;;GAIG;AACH,qBAAa,eAAgB,YAAW,UAAU;;IAChD,kBAAkB,CAAC,EACjB,eAAe,GAChB,EAAE;QACD,eAAe,EAAE,eAAe,CAAC;QACjC,SAAS,EAAE,8BAA8B,CAAC;KAC3C,GAAG,OAAO;IAIL,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAoH1E"}
@@ -0,0 +1,16 @@
1
+ import type { TransactionControllerMessenger } from "../TransactionController.mjs";
2
+ import type { GasFeeFlow, GasFeeFlowRequest, GasFeeFlowResponse, TransactionMeta } from "../types.mjs";
3
+ /**
4
+ * Implementation of a gas fee flow specific to Linea networks that obtains gas fee estimates using:
5
+ * - The `linea_estimateGas` RPC method to obtain the base fee and lowest priority fee.
6
+ * - Static multipliers to increase the base and priority fees.
7
+ */
8
+ export declare class LineaGasFeeFlow implements GasFeeFlow {
9
+ #private;
10
+ matchesTransaction({ transactionMeta, }: {
11
+ transactionMeta: TransactionMeta;
12
+ messenger: TransactionControllerMessenger;
13
+ }): boolean;
14
+ getGasFees(request: GasFeeFlowRequest): Promise<GasFeeFlowResponse>;
15
+ }
16
+ //# sourceMappingURL=LineaGasFeeFlow.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LineaGasFeeFlow.d.mts","sourceRoot":"","sources":["../../src/gas-flows/LineaGasFeeFlow.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,8BAA8B,EAAE,qCAAoC;AAClF,OAAO,KAAK,EAEV,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EAChB,qBAAoB;AAkCrB;;;;GAIG;AACH,qBAAa,eAAgB,YAAW,UAAU;;IAChD,kBAAkB,CAAC,EACjB,eAAe,GAChB,EAAE;QACD,eAAe,EAAE,eAAe,CAAC;QACjC,SAAS,EAAE,8BAA8B,CAAC;KAC3C,GAAG,OAAO;IAIL,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAoH1E"}
@@ -4,12 +4,12 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
4
4
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
5
  };
6
6
  var _LineaGasFeeFlow_instances, _LineaGasFeeFlow_getLineaGasFees, _LineaGasFeeFlow_getLineaResponse, _LineaGasFeeFlow_getValuesFromMultipliers, _LineaGasFeeFlow_getMaxFees, _LineaGasFeeFlow_feesToString;
7
- import { ChainId, hexToBN, toHex } from '@metamask/controller-utils';
8
- import { createModuleLogger } from '@metamask/utils';
9
- import { projectLogger } from '../logger.js';
10
- import { GasFeeEstimateLevel, GasFeeEstimateType } from '../types.js';
11
- import { rpcRequest } from '../utils/provider.js';
12
- import { DefaultGasFeeFlow } from './DefaultGasFeeFlow.js';
7
+ import { ChainId, hexToBN, toHex } from "@metamask/controller-utils";
8
+ import { createModuleLogger } from "@metamask/utils";
9
+ import { projectLogger } from "../logger.mjs";
10
+ import { GasFeeEstimateLevel, GasFeeEstimateType } from "../types.mjs";
11
+ import { rpcRequest } from "../utils/provider.mjs";
12
+ import { DefaultGasFeeFlow } from "./DefaultGasFeeFlow.mjs";
13
13
  const log = createModuleLogger(projectLogger, 'linea-gas-fee-flow');
14
14
  const LINEA_CHAIN_IDS = [
15
15
  ChainId['linea-mainnet'],
@@ -104,4 +104,4 @@ _LineaGasFeeFlow_instances = new WeakSet(), _LineaGasFeeFlow_getLineaGasFees = a
104
104
  }, _LineaGasFeeFlow_feesToString = function _LineaGasFeeFlow_feesToString(fees) {
105
105
  return Object.values(GasFeeEstimateLevel).map((level) => fees[level].toString(10));
106
106
  };
107
- //# sourceMappingURL=LineaGasFeeFlow.js.map
107
+ //# sourceMappingURL=LineaGasFeeFlow.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LineaGasFeeFlow.mjs","sourceRoot":"","sources":["../../src/gas-flows/LineaGasFeeFlow.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,mCAAmC;AAErE,OAAO,EAAE,kBAAkB,EAAE,wBAAwB;AAIrD,OAAO,EAAE,aAAa,EAAE,sBAAqB;AAS7C,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,qBAAoB;AACtE,OAAO,EAAE,UAAU,EAAE,8BAA6B;AAClD,OAAO,EAAE,iBAAiB,EAAE,gCAA+B;AAW3D,MAAM,GAAG,GAAG,kBAAkB,CAAC,aAAa,EAAE,oBAAoB,CAAC,CAAC;AAEpE,MAAM,eAAe,GAAU;IAC7B,OAAO,CAAC,eAAe,CAAC;IACxB,OAAO,CAAC,cAAc,CAAC;IACvB,OAAO,CAAC,eAAe,CAAC;CACzB,CAAC;AAEF,MAAM,oBAAoB,GAAG;IAC3B,GAAG,EAAE,CAAC;IACN,MAAM,EAAE,IAAI;IACZ,IAAI,EAAE,GAAG;CACV,CAAC;AAEF,MAAM,wBAAwB,GAAG;IAC/B,GAAG,EAAE,CAAC;IACN,MAAM,EAAE,IAAI;IACZ,IAAI,EAAE,GAAG;CACV,CAAC;AAEF;;;;GAIG;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O,CAAC,KAAK,CAAC,CAAC;IAC5B,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACvC,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAC7C,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAEzC,OAAO;QACL,GAAG;QACH,MAAM;QACN,IAAI;KACL,CAAC;AACJ,CAAC,qEAGC,QAAyC,EACzC,YAA6C;IAE7C,OAAO;QACL,GAAG,EAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC;QACvC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC;QAChD,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,CAAC;KAC3C,CAAC;AACJ,CAAC,yEAEa,IAAiB;IAC7B,OAAO,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CACtD,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CACzB,CAAC;AACJ,CAAC","sourcesContent":["import { ChainId, hexToBN, toHex } from '@metamask/controller-utils';\nimport type { NetworkClientId } from '@metamask/network-controller';\nimport { createModuleLogger } from '@metamask/utils';\nimport type { Hex } from '@metamask/utils';\nimport type BN from 'bn.js';\n\nimport { projectLogger } from '../logger.js';\nimport type { TransactionControllerMessenger } from '../TransactionController.js';\nimport type {\n GasFeeEstimates,\n GasFeeFlow,\n GasFeeFlowRequest,\n GasFeeFlowResponse,\n TransactionMeta,\n} from '../types.js';\nimport { GasFeeEstimateLevel, GasFeeEstimateType } from '../types.js';\nimport { rpcRequest } from '../utils/provider.js';\nimport { DefaultGasFeeFlow } from './DefaultGasFeeFlow.js';\n\ntype LineaEstimateGasResponse = {\n baseFeePerGas: Hex;\n priorityFeePerGas: Hex;\n};\n\ntype FeesByLevel = {\n [key in GasFeeEstimateLevel]: BN;\n};\n\nconst log = createModuleLogger(projectLogger, 'linea-gas-fee-flow');\n\nconst LINEA_CHAIN_IDS: Hex[] = [\n ChainId['linea-mainnet'],\n ChainId['linea-goerli'],\n ChainId['linea-sepolia'],\n];\n\nconst BASE_FEE_MULTIPLIERS = {\n low: 1,\n medium: 1.35,\n high: 1.7,\n};\n\nconst PRIORITY_FEE_MULTIPLIERS = {\n low: 1,\n medium: 1.05,\n high: 1.1,\n};\n\n/**\n * Implementation of a gas fee flow specific to Linea networks that obtains gas fee estimates using:\n * - The `linea_estimateGas` RPC method to obtain the base fee and lowest priority fee.\n * - Static multipliers to increase the base and priority fees.\n */\nexport class LineaGasFeeFlow implements GasFeeFlow {\n matchesTransaction({\n transactionMeta,\n }: {\n transactionMeta: TransactionMeta;\n messenger: TransactionControllerMessenger;\n }): boolean {\n return LINEA_CHAIN_IDS.includes(transactionMeta.chainId);\n }\n\n async getGasFees(request: GasFeeFlowRequest): Promise<GasFeeFlowResponse> {\n try {\n return await this.#getLineaGasFees(request);\n } catch (error) {\n log('Using default flow as fallback due to error', error);\n return new DefaultGasFeeFlow().getGasFees(request);\n }\n }\n\n async #getLineaGasFees(\n request: GasFeeFlowRequest,\n ): Promise<GasFeeFlowResponse> {\n const { messenger, transactionMeta } = request;\n const { networkClientId } = transactionMeta;\n\n const lineaResponse = await this.#getLineaResponse(\n transactionMeta,\n messenger,\n networkClientId,\n );\n\n log('Received Linea response', lineaResponse);\n\n const baseFees = this.#getValuesFromMultipliers(\n lineaResponse.baseFeePerGas,\n BASE_FEE_MULTIPLIERS,\n );\n\n log('Generated base fees', this.#feesToString(baseFees));\n\n const priorityFees = this.#getValuesFromMultipliers(\n lineaResponse.priorityFeePerGas,\n PRIORITY_FEE_MULTIPLIERS,\n );\n\n log('Generated priority fees', this.#feesToString(priorityFees));\n\n const maxFees = this.#getMaxFees(baseFees, priorityFees);\n\n log('Generated max fees', this.#feesToString(maxFees));\n\n const estimates = Object.values(GasFeeEstimateLevel).reduce(\n (result, level) => ({\n ...result,\n [level]: {\n maxFeePerGas: toHex(maxFees[level]),\n maxPriorityFeePerGas: toHex(priorityFees[level]),\n },\n }),\n { type: GasFeeEstimateType.FeeMarket } as GasFeeEstimates,\n );\n\n return { estimates };\n }\n\n #getLineaResponse(\n transactionMeta: TransactionMeta,\n messenger: TransactionControllerMessenger,\n networkClientId: NetworkClientId,\n ): Promise<LineaEstimateGasResponse> {\n const { from, to, value, data } = transactionMeta.txParams;\n\n const params: Record<string, string> = { from };\n\n if (to) {\n params.to = to;\n }\n\n if (value) {\n params.value = value;\n }\n\n if (data) {\n params.input = data;\n }\n\n return rpcRequest({\n messenger,\n networkClientId,\n method: 'linea_estimateGas',\n params: [params],\n }) as Promise<LineaEstimateGasResponse>;\n }\n\n #getValuesFromMultipliers(\n value: Hex,\n multipliers: { low: number; medium: number; high: number },\n ): FeesByLevel {\n const base = hexToBN(value);\n const low = base.muln(multipliers.low);\n const medium = base.muln(multipliers.medium);\n const high = base.muln(multipliers.high);\n\n return {\n low,\n medium,\n high,\n };\n }\n\n #getMaxFees(\n baseFees: Record<GasFeeEstimateLevel, BN>,\n priorityFees: Record<GasFeeEstimateLevel, BN>,\n ): FeesByLevel {\n return {\n low: baseFees.low.add(priorityFees.low),\n medium: baseFees.medium.add(priorityFees.medium),\n high: baseFees.high.add(priorityFees.high),\n };\n }\n\n #feesToString(fees: FeesByLevel): string[] {\n return Object.values(GasFeeEstimateLevel).map((level) =>\n fees[level].toString(10),\n );\n }\n}\n"]}