@metamask-previews/transaction-controller 36.1.0-preview-367cb1da → 36.1.0-preview-cf09c0a

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (479) hide show
  1. package/dist/TransactionController.cjs +2026 -0
  2. package/dist/TransactionController.cjs.map +1 -0
  3. package/dist/{types/TransactionController.d.ts → TransactionController.d.cts} +15 -15
  4. package/dist/TransactionController.d.cts.map +1 -0
  5. package/dist/TransactionController.d.mts +827 -0
  6. package/dist/TransactionController.d.mts.map +1 -0
  7. package/dist/TransactionController.mjs +2027 -44
  8. package/dist/TransactionController.mjs.map +1 -1
  9. package/dist/constants.cjs +170 -0
  10. package/dist/constants.cjs.map +1 -0
  11. package/dist/{types/constants.d.ts → constants.d.cts} +1 -1
  12. package/dist/constants.d.cts.map +1 -0
  13. package/dist/constants.d.mts +143 -0
  14. package/dist/constants.d.mts.map +1 -0
  15. package/dist/constants.mjs +165 -18
  16. package/dist/constants.mjs.map +1 -1
  17. package/dist/errors.cjs +30 -0
  18. package/dist/{chunk-HMOSP33F.js.map → errors.cjs.map} +1 -1
  19. package/dist/{types/errors.d.ts → errors.d.cts} +2 -2
  20. package/dist/errors.d.cts.map +1 -0
  21. package/dist/errors.d.mts +15 -0
  22. package/dist/errors.d.mts.map +1 -0
  23. package/dist/errors.mjs +22 -14
  24. package/dist/errors.mjs.map +1 -1
  25. package/dist/gas-flows/DefaultGasFeeFlow.cjs +87 -0
  26. package/dist/gas-flows/DefaultGasFeeFlow.cjs.map +1 -0
  27. package/dist/{types/gas-flows/DefaultGasFeeFlow.d.ts → gas-flows/DefaultGasFeeFlow.d.cts} +2 -2
  28. package/dist/gas-flows/DefaultGasFeeFlow.d.cts.map +1 -0
  29. package/dist/gas-flows/DefaultGasFeeFlow.d.mts +10 -0
  30. package/dist/gas-flows/DefaultGasFeeFlow.d.mts.map +1 -0
  31. package/dist/gas-flows/DefaultGasFeeFlow.mjs +81 -13
  32. package/dist/gas-flows/DefaultGasFeeFlow.mjs.map +1 -1
  33. package/dist/gas-flows/LineaGasFeeFlow.cjs +102 -0
  34. package/dist/gas-flows/LineaGasFeeFlow.cjs.map +1 -0
  35. package/dist/{types/gas-flows/LineaGasFeeFlow.d.ts → gas-flows/LineaGasFeeFlow.d.cts} +2 -2
  36. package/dist/gas-flows/LineaGasFeeFlow.d.cts.map +1 -0
  37. package/dist/gas-flows/LineaGasFeeFlow.d.mts +12 -0
  38. package/dist/gas-flows/LineaGasFeeFlow.d.mts.map +1 -0
  39. package/dist/gas-flows/LineaGasFeeFlow.mjs +96 -14
  40. package/dist/gas-flows/LineaGasFeeFlow.mjs.map +1 -1
  41. package/dist/gas-flows/OptimismLayer1GasFeeFlow.cjs +29 -0
  42. package/dist/gas-flows/OptimismLayer1GasFeeFlow.cjs.map +1 -0
  43. package/dist/{types/gas-flows/OptimismLayer1GasFeeFlow.d.ts → gas-flows/OptimismLayer1GasFeeFlow.d.cts} +3 -3
  44. package/dist/gas-flows/OptimismLayer1GasFeeFlow.d.cts.map +1 -0
  45. package/dist/gas-flows/OptimismLayer1GasFeeFlow.d.mts +10 -0
  46. package/dist/gas-flows/OptimismLayer1GasFeeFlow.d.mts.map +1 -0
  47. package/dist/gas-flows/OptimismLayer1GasFeeFlow.mjs +24 -10
  48. package/dist/gas-flows/OptimismLayer1GasFeeFlow.mjs.map +1 -1
  49. package/dist/gas-flows/OracleLayer1GasFeeFlow.cjs +92 -0
  50. package/dist/gas-flows/OracleLayer1GasFeeFlow.cjs.map +1 -0
  51. package/dist/{types/gas-flows/OracleLayer1GasFeeFlow.d.ts → gas-flows/OracleLayer1GasFeeFlow.d.cts} +3 -3
  52. package/dist/gas-flows/OracleLayer1GasFeeFlow.d.cts.map +1 -0
  53. package/dist/gas-flows/OracleLayer1GasFeeFlow.d.mts +12 -0
  54. package/dist/gas-flows/OracleLayer1GasFeeFlow.d.mts.map +1 -0
  55. package/dist/gas-flows/OracleLayer1GasFeeFlow.mjs +88 -7
  56. package/dist/gas-flows/OracleLayer1GasFeeFlow.mjs.map +1 -1
  57. package/dist/gas-flows/ScrollLayer1GasFeeFlow.cjs +21 -0
  58. package/dist/gas-flows/ScrollLayer1GasFeeFlow.cjs.map +1 -0
  59. package/dist/{types/gas-flows/ScrollLayer1GasFeeFlow.d.ts → gas-flows/ScrollLayer1GasFeeFlow.d.cts} +3 -3
  60. package/dist/gas-flows/ScrollLayer1GasFeeFlow.d.cts.map +1 -0
  61. package/dist/gas-flows/ScrollLayer1GasFeeFlow.d.mts +10 -0
  62. package/dist/gas-flows/ScrollLayer1GasFeeFlow.d.mts.map +1 -0
  63. package/dist/gas-flows/ScrollLayer1GasFeeFlow.mjs +16 -10
  64. package/dist/gas-flows/ScrollLayer1GasFeeFlow.mjs.map +1 -1
  65. package/dist/gas-flows/TestGasFeeFlow.cjs +73 -0
  66. package/dist/{chunk-FMRLPVFZ.mjs.map → gas-flows/TestGasFeeFlow.cjs.map} +1 -1
  67. package/dist/{types/gas-flows/TestGasFeeFlow.d.ts → gas-flows/TestGasFeeFlow.d.cts} +2 -2
  68. package/dist/gas-flows/TestGasFeeFlow.d.cts.map +1 -0
  69. package/dist/gas-flows/TestGasFeeFlow.d.mts +12 -0
  70. package/dist/gas-flows/TestGasFeeFlow.d.mts.map +1 -0
  71. package/dist/gas-flows/TestGasFeeFlow.mjs +67 -7
  72. package/dist/gas-flows/TestGasFeeFlow.mjs.map +1 -1
  73. package/dist/helpers/EtherscanRemoteTransactionSource.cjs +149 -0
  74. package/dist/helpers/EtherscanRemoteTransactionSource.cjs.map +1 -0
  75. package/dist/{types/helpers/EtherscanRemoteTransactionSource.d.ts → helpers/EtherscanRemoteTransactionSource.d.cts} +3 -3
  76. package/dist/helpers/EtherscanRemoteTransactionSource.d.cts.map +1 -0
  77. package/dist/helpers/EtherscanRemoteTransactionSource.d.mts +15 -0
  78. package/dist/helpers/EtherscanRemoteTransactionSource.d.mts.map +1 -0
  79. package/dist/helpers/EtherscanRemoteTransactionSource.mjs +147 -10
  80. package/dist/helpers/EtherscanRemoteTransactionSource.mjs.map +1 -1
  81. package/dist/helpers/GasFeePoller.cjs +185 -0
  82. package/dist/helpers/GasFeePoller.cjs.map +1 -0
  83. package/dist/{types/helpers/GasFeePoller.d.ts → helpers/GasFeePoller.d.cts} +7 -7
  84. package/dist/helpers/GasFeePoller.d.cts.map +1 -0
  85. package/dist/helpers/GasFeePoller.d.mts +35 -0
  86. package/dist/helpers/GasFeePoller.d.mts.map +1 -0
  87. package/dist/helpers/GasFeePoller.mjs +183 -10
  88. package/dist/helpers/GasFeePoller.mjs.map +1 -1
  89. package/dist/helpers/IncomingTransactionHelper.cjs +199 -0
  90. package/dist/helpers/IncomingTransactionHelper.cjs.map +1 -0
  91. package/dist/{types/helpers/IncomingTransactionHelper.d.ts → helpers/IncomingTransactionHelper.d.cts} +6 -6
  92. package/dist/helpers/IncomingTransactionHelper.d.cts.map +1 -0
  93. package/dist/helpers/IncomingTransactionHelper.d.mts +40 -0
  94. package/dist/helpers/IncomingTransactionHelper.d.mts.map +1 -0
  95. package/dist/helpers/IncomingTransactionHelper.mjs +190 -7
  96. package/dist/helpers/IncomingTransactionHelper.mjs.map +1 -1
  97. package/dist/helpers/MultichainTrackingHelper.cjs +284 -0
  98. package/dist/helpers/MultichainTrackingHelper.cjs.map +1 -0
  99. package/dist/{types/helpers/MultichainTrackingHelper.d.ts → helpers/MultichainTrackingHelper.d.cts} +8 -8
  100. package/dist/helpers/MultichainTrackingHelper.d.cts.map +1 -0
  101. package/dist/helpers/MultichainTrackingHelper.d.mts +76 -0
  102. package/dist/helpers/MultichainTrackingHelper.d.mts.map +1 -0
  103. package/dist/helpers/MultichainTrackingHelper.mjs +282 -11
  104. package/dist/helpers/MultichainTrackingHelper.mjs.map +1 -1
  105. package/dist/helpers/PendingTransactionTracker.cjs +328 -0
  106. package/dist/helpers/PendingTransactionTracker.cjs.map +1 -0
  107. package/dist/{types/helpers/PendingTransactionTracker.d.ts → helpers/PendingTransactionTracker.d.cts} +5 -5
  108. package/dist/helpers/PendingTransactionTracker.d.cts.map +1 -0
  109. package/dist/helpers/PendingTransactionTracker.d.mts +42 -0
  110. package/dist/helpers/PendingTransactionTracker.d.mts.map +1 -0
  111. package/dist/helpers/PendingTransactionTracker.mjs +320 -8
  112. package/dist/helpers/PendingTransactionTracker.mjs.map +1 -1
  113. package/dist/index.cjs +28 -0
  114. package/dist/index.cjs.map +1 -0
  115. package/dist/{types/index.d.ts → index.d.cts} +10 -10
  116. package/dist/index.d.cts.map +1 -0
  117. package/dist/index.d.mts +10 -0
  118. package/dist/index.d.mts.map +1 -0
  119. package/dist/index.mjs +6 -76
  120. package/dist/index.mjs.map +1 -1
  121. package/dist/logger.cjs +9 -0
  122. package/dist/logger.cjs.map +1 -0
  123. package/dist/{types/logger.d.ts → logger.d.cts} +2 -2
  124. package/dist/logger.d.cts.map +1 -0
  125. package/dist/logger.d.mts +6 -0
  126. package/dist/logger.d.mts.map +1 -0
  127. package/dist/logger.mjs +5 -11
  128. package/dist/logger.mjs.map +1 -1
  129. package/dist/types.cjs +308 -0
  130. package/dist/types.cjs.map +1 -0
  131. package/dist/{types/types.d.ts → types.d.cts} +7 -7
  132. package/dist/types.d.cts.map +1 -0
  133. package/dist/types.d.mts +999 -0
  134. package/dist/types.d.mts.map +1 -0
  135. package/dist/types.mjs +304 -23
  136. package/dist/types.mjs.map +1 -1
  137. package/dist/utils/etherscan.cjs +111 -0
  138. package/dist/utils/etherscan.cjs.map +1 -0
  139. package/dist/{types/utils/etherscan.d.ts → utils/etherscan.d.cts} +2 -2
  140. package/dist/utils/etherscan.d.cts.map +1 -0
  141. package/dist/utils/etherscan.d.mts +71 -0
  142. package/dist/utils/etherscan.d.mts.map +1 -0
  143. package/dist/utils/etherscan.mjs +104 -13
  144. package/dist/utils/etherscan.mjs.map +1 -1
  145. package/dist/utils/external-transactions.cjs +36 -0
  146. package/dist/utils/external-transactions.cjs.map +1 -0
  147. package/dist/{types/utils/external-transactions.d.ts → utils/external-transactions.d.cts} +2 -2
  148. package/dist/utils/external-transactions.d.cts.map +1 -0
  149. package/dist/utils/external-transactions.d.mts +10 -0
  150. package/dist/utils/external-transactions.d.mts.map +1 -0
  151. package/dist/utils/external-transactions.mjs +31 -8
  152. package/dist/utils/external-transactions.mjs.map +1 -1
  153. package/dist/utils/gas-fees.cjs +208 -0
  154. package/dist/utils/gas-fees.cjs.map +1 -0
  155. package/dist/{types/utils/gas-fees.d.ts → utils/gas-fees.d.cts} +5 -5
  156. package/dist/utils/gas-fees.d.cts.map +1 -0
  157. package/dist/utils/gas-fees.d.mts +26 -0
  158. package/dist/utils/gas-fees.d.mts.map +1 -0
  159. package/dist/utils/gas-fees.mjs +202 -15
  160. package/dist/utils/gas-fees.mjs.map +1 -1
  161. package/dist/utils/gas-flow.cjs +76 -0
  162. package/dist/utils/gas-flow.cjs.map +1 -0
  163. package/dist/{types/utils/gas-flow.d.ts → utils/gas-flow.d.cts} +5 -5
  164. package/dist/utils/gas-flow.d.cts.map +1 -0
  165. package/dist/utils/gas-flow.d.mts +26 -0
  166. package/dist/utils/gas-flow.d.mts.map +1 -0
  167. package/dist/utils/gas-flow.mjs +70 -10
  168. package/dist/utils/gas-flow.mjs.map +1 -1
  169. package/dist/utils/gas.cjs +112 -0
  170. package/dist/utils/gas.cjs.map +1 -0
  171. package/dist/{types/utils/gas.d.ts → utils/gas.d.cts} +4 -4
  172. package/dist/utils/gas.d.cts.map +1 -0
  173. package/dist/utils/gas.d.mts +28 -0
  174. package/dist/utils/gas.d.mts.map +1 -0
  175. package/dist/utils/gas.mjs +105 -19
  176. package/dist/utils/gas.mjs.map +1 -1
  177. package/dist/utils/history.cjs +164 -0
  178. package/dist/utils/history.cjs.map +1 -0
  179. package/dist/{types/utils/history.d.ts → utils/history.d.cts} +2 -2
  180. package/dist/utils/history.d.cts.map +1 -0
  181. package/dist/utils/history.d.mts +29 -0
  182. package/dist/utils/history.d.mts.map +1 -0
  183. package/dist/utils/history.mjs +163 -13
  184. package/dist/utils/history.mjs.map +1 -1
  185. package/dist/utils/layer1-gas-fee-flow.cjs +59 -0
  186. package/dist/utils/layer1-gas-fee-flow.cjs.map +1 -0
  187. package/dist/{types/utils/layer1-gas-fee-flow.d.ts → utils/layer1-gas-fee-flow.d.cts} +4 -4
  188. package/dist/utils/layer1-gas-fee-flow.d.cts.map +1 -0
  189. package/dist/utils/layer1-gas-fee-flow.d.mts +25 -0
  190. package/dist/utils/layer1-gas-fee-flow.d.mts.map +1 -0
  191. package/dist/utils/layer1-gas-fee-flow.mjs +53 -10
  192. package/dist/utils/layer1-gas-fee-flow.mjs.map +1 -1
  193. package/dist/utils/nonce.cjs +66 -0
  194. package/dist/utils/nonce.cjs.map +1 -0
  195. package/dist/{types/utils/nonce.d.ts → utils/nonce.d.cts} +3 -3
  196. package/dist/utils/nonce.d.cts.map +1 -0
  197. package/dist/utils/nonce.d.mts +21 -0
  198. package/dist/utils/nonce.d.mts.map +1 -0
  199. package/dist/utils/nonce.mjs +60 -10
  200. package/dist/utils/nonce.mjs.map +1 -1
  201. package/dist/utils/retry.cjs +89 -0
  202. package/dist/utils/retry.cjs.map +1 -0
  203. package/dist/{types/utils/retry.d.ts → utils/retry.d.cts} +3 -3
  204. package/dist/utils/retry.d.cts.map +1 -0
  205. package/dist/utils/retry.d.mts +11 -0
  206. package/dist/utils/retry.d.mts.map +1 -0
  207. package/dist/utils/retry.mjs +84 -7
  208. package/dist/utils/retry.mjs.map +1 -1
  209. package/dist/utils/simulation-api.cjs +72 -0
  210. package/dist/utils/simulation-api.cjs.map +1 -0
  211. package/dist/{types/utils/simulation-api.d.ts → utils/simulation-api.d.cts} +2 -2
  212. package/dist/utils/simulation-api.d.cts.map +1 -0
  213. package/dist/utils/simulation-api.d.mts +107 -0
  214. package/dist/utils/simulation-api.d.mts.map +1 -0
  215. package/dist/utils/simulation-api.mjs +67 -10
  216. package/dist/utils/simulation-api.mjs.map +1 -1
  217. package/dist/utils/simulation.cjs +443 -0
  218. package/dist/utils/simulation.cjs.map +1 -0
  219. package/dist/{types/utils/simulation.d.ts → utils/simulation.d.cts} +6 -6
  220. package/dist/utils/simulation.d.cts.map +1 -0
  221. package/dist/utils/simulation.d.mts +46 -0
  222. package/dist/utils/simulation.d.mts.map +1 -0
  223. package/dist/utils/simulation.mjs +436 -15
  224. package/dist/utils/simulation.mjs.map +1 -1
  225. package/dist/utils/swaps.cjs +309 -0
  226. package/dist/utils/swaps.cjs.map +1 -0
  227. package/dist/{types/utils/swaps.d.ts → utils/swaps.d.cts} +5 -5
  228. package/dist/utils/swaps.d.cts.map +1 -0
  229. package/dist/utils/swaps.d.mts +84 -0
  230. package/dist/utils/swaps.d.mts.map +1 -0
  231. package/dist/utils/swaps.mjs +303 -22
  232. package/dist/utils/swaps.mjs.map +1 -1
  233. package/dist/utils/transaction-type.cjs +115 -0
  234. package/dist/utils/transaction-type.cjs.map +1 -0
  235. package/dist/{types/utils/transaction-type.d.ts → utils/transaction-type.d.cts} +3 -3
  236. package/dist/utils/transaction-type.d.cts.map +1 -0
  237. package/dist/utils/transaction-type.d.mts +14 -0
  238. package/dist/utils/transaction-type.d.mts.map +1 -0
  239. package/dist/utils/transaction-type.mjs +110 -10
  240. package/dist/utils/transaction-type.mjs.map +1 -1
  241. package/dist/utils/utils.cjs +151 -0
  242. package/dist/utils/utils.cjs.map +1 -0
  243. package/dist/{types/utils/utils.d.ts → utils/utils.d.cts} +2 -2
  244. package/dist/utils/utils.d.cts.map +1 -0
  245. package/dist/utils/utils.d.mts +52 -0
  246. package/dist/utils/utils.d.mts.map +1 -0
  247. package/dist/utils/utils.mjs +139 -21
  248. package/dist/utils/utils.mjs.map +1 -1
  249. package/dist/utils/validation.cjs +267 -0
  250. package/dist/{chunk-DIPBZJ5G.js.map → utils/validation.cjs.map} +1 -1
  251. package/dist/{types/utils/validation.d.ts → utils/validation.d.cts} +2 -2
  252. package/dist/utils/validation.d.cts.map +1 -0
  253. package/dist/utils/validation.d.mts +20 -0
  254. package/dist/utils/validation.d.mts.map +1 -0
  255. package/dist/utils/validation.mjs +261 -11
  256. package/dist/utils/validation.mjs.map +1 -1
  257. package/package.json +12 -7
  258. package/dist/TransactionController.js +0 -46
  259. package/dist/TransactionController.js.map +0 -1
  260. package/dist/chunk-2XKEAKQG.js +0 -55
  261. package/dist/chunk-2XKEAKQG.js.map +0 -1
  262. package/dist/chunk-3AVRGHUO.mjs +0 -360
  263. package/dist/chunk-3AVRGHUO.mjs.map +0 -1
  264. package/dist/chunk-3ZV5YEUV.mjs +0 -239
  265. package/dist/chunk-3ZV5YEUV.mjs.map +0 -1
  266. package/dist/chunk-4SYKJQLR.js +0 -228
  267. package/dist/chunk-4SYKJQLR.js.map +0 -1
  268. package/dist/chunk-4V4XIPCI.mjs +0 -338
  269. package/dist/chunk-4V4XIPCI.mjs.map +0 -1
  270. package/dist/chunk-4ZOE2ACZ.js +0 -67
  271. package/dist/chunk-4ZOE2ACZ.js.map +0 -1
  272. package/dist/chunk-5G6OHAXI.mjs +0 -137
  273. package/dist/chunk-5G6OHAXI.mjs.map +0 -1
  274. package/dist/chunk-5QVDIVJH.js +0 -68
  275. package/dist/chunk-5QVDIVJH.js.map +0 -1
  276. package/dist/chunk-6DDVVUJC.mjs +0 -50
  277. package/dist/chunk-6DDVVUJC.mjs.map +0 -1
  278. package/dist/chunk-6DODV6OV.js +0 -390
  279. package/dist/chunk-6DODV6OV.js.map +0 -1
  280. package/dist/chunk-6JO6EU6Z.mjs +0 -67
  281. package/dist/chunk-6JO6EU6Z.mjs.map +0 -1
  282. package/dist/chunk-6OLJWLKK.js +0 -338
  283. package/dist/chunk-6OLJWLKK.js.map +0 -1
  284. package/dist/chunk-7LXE4KHV.js +0 -40
  285. package/dist/chunk-7LXE4KHV.js.map +0 -1
  286. package/dist/chunk-7M2R5AHC.mjs +0 -390
  287. package/dist/chunk-7M2R5AHC.mjs.map +0 -1
  288. package/dist/chunk-7NMV2NPM.js +0 -172
  289. package/dist/chunk-7NMV2NPM.js.map +0 -1
  290. package/dist/chunk-ASTXVFGJ.mjs +0 -92
  291. package/dist/chunk-ASTXVFGJ.mjs.map +0 -1
  292. package/dist/chunk-CKRPGICI.js +0 -2499
  293. package/dist/chunk-CKRPGICI.js.map +0 -1
  294. package/dist/chunk-DIPBZJ5G.js +0 -201
  295. package/dist/chunk-EGQCE3FK.mjs +0 -85
  296. package/dist/chunk-EGQCE3FK.mjs.map +0 -1
  297. package/dist/chunk-EHIRNR33.mjs +0 -228
  298. package/dist/chunk-EHIRNR33.mjs.map +0 -1
  299. package/dist/chunk-EKJXGERC.mjs +0 -172
  300. package/dist/chunk-EKJXGERC.mjs.map +0 -1
  301. package/dist/chunk-FG74Z3F5.mjs +0 -102
  302. package/dist/chunk-FG74Z3F5.mjs.map +0 -1
  303. package/dist/chunk-FMRLPVFZ.mjs +0 -66
  304. package/dist/chunk-FRKQ3Z2L.mjs +0 -40
  305. package/dist/chunk-FRKQ3Z2L.mjs.map +0 -1
  306. package/dist/chunk-H5MYUJHR.js +0 -92
  307. package/dist/chunk-H5MYUJHR.js.map +0 -1
  308. package/dist/chunk-HAW3IWCX.mjs +0 -201
  309. package/dist/chunk-HAW3IWCX.mjs.map +0 -1
  310. package/dist/chunk-HMOSP33F.js +0 -36
  311. package/dist/chunk-HQSNKCXI.mjs +0 -36
  312. package/dist/chunk-HQSNKCXI.mjs.map +0 -1
  313. package/dist/chunk-JIFPK37W.mjs +0 -257
  314. package/dist/chunk-JIFPK37W.mjs.map +0 -1
  315. package/dist/chunk-JOQK7A5G.mjs +0 -68
  316. package/dist/chunk-JOQK7A5G.mjs.map +0 -1
  317. package/dist/chunk-K4KOSAGM.mjs +0 -61
  318. package/dist/chunk-K4KOSAGM.mjs.map +0 -1
  319. package/dist/chunk-KG4UW4K4.mjs +0 -88
  320. package/dist/chunk-KG4UW4K4.mjs.map +0 -1
  321. package/dist/chunk-KT6UAKBB.js +0 -61
  322. package/dist/chunk-KT6UAKBB.js.map +0 -1
  323. package/dist/chunk-KTGMNUTQ.js +0 -106
  324. package/dist/chunk-KTGMNUTQ.js.map +0 -1
  325. package/dist/chunk-NNCUD3QF.js +0 -360
  326. package/dist/chunk-NNCUD3QF.js.map +0 -1
  327. package/dist/chunk-NOHEXQ7Y.mjs +0 -55
  328. package/dist/chunk-NOHEXQ7Y.mjs.map +0 -1
  329. package/dist/chunk-NYKRCWBG.js +0 -31
  330. package/dist/chunk-NYKRCWBG.js.map +0 -1
  331. package/dist/chunk-O6ZZVIFH.mjs +0 -176
  332. package/dist/chunk-O6ZZVIFH.mjs.map +0 -1
  333. package/dist/chunk-ORWR5LSG.js +0 -112
  334. package/dist/chunk-ORWR5LSG.js.map +0 -1
  335. package/dist/chunk-PRUNMTRD.js +0 -50
  336. package/dist/chunk-PRUNMTRD.js.map +0 -1
  337. package/dist/chunk-Q44JQKVP.mjs +0 -112
  338. package/dist/chunk-Q44JQKVP.mjs.map +0 -1
  339. package/dist/chunk-QKV7E5BO.js +0 -257
  340. package/dist/chunk-QKV7E5BO.js.map +0 -1
  341. package/dist/chunk-REFVF44I.mjs +0 -2499
  342. package/dist/chunk-REFVF44I.mjs.map +0 -1
  343. package/dist/chunk-RGWMNCTE.mjs +0 -121
  344. package/dist/chunk-RGWMNCTE.mjs.map +0 -1
  345. package/dist/chunk-RHDPOIS4.js +0 -239
  346. package/dist/chunk-RHDPOIS4.js.map +0 -1
  347. package/dist/chunk-S6VGOPUY.js +0 -14
  348. package/dist/chunk-S6VGOPUY.js.map +0 -1
  349. package/dist/chunk-SD6CWFDF.js +0 -88
  350. package/dist/chunk-SD6CWFDF.js.map +0 -1
  351. package/dist/chunk-SMC5Q6ZH.mjs +0 -120
  352. package/dist/chunk-SMC5Q6ZH.mjs.map +0 -1
  353. package/dist/chunk-TIE3CPF7.js +0 -120
  354. package/dist/chunk-TIE3CPF7.js.map +0 -1
  355. package/dist/chunk-TJMQEH57.js +0 -66
  356. package/dist/chunk-TJMQEH57.js.map +0 -1
  357. package/dist/chunk-UGN7PBON.js +0 -176
  358. package/dist/chunk-UGN7PBON.js.map +0 -1
  359. package/dist/chunk-UHSRHP55.mjs +0 -106
  360. package/dist/chunk-UHSRHP55.mjs.map +0 -1
  361. package/dist/chunk-UQQWZT6C.mjs +0 -14
  362. package/dist/chunk-UQQWZT6C.mjs.map +0 -1
  363. package/dist/chunk-V2OWJ7RY.mjs +0 -226
  364. package/dist/chunk-V2OWJ7RY.mjs.map +0 -1
  365. package/dist/chunk-V72C4MCR.js +0 -137
  366. package/dist/chunk-V72C4MCR.js.map +0 -1
  367. package/dist/chunk-VEVVBHP3.mjs +0 -31
  368. package/dist/chunk-VEVVBHP3.mjs.map +0 -1
  369. package/dist/chunk-WFRHYZIO.js +0 -226
  370. package/dist/chunk-WFRHYZIO.js.map +0 -1
  371. package/dist/chunk-WR5F34OW.js +0 -23
  372. package/dist/chunk-WR5F34OW.js.map +0 -1
  373. package/dist/chunk-XUI43LEZ.mjs +0 -30
  374. package/dist/chunk-XUI43LEZ.mjs.map +0 -1
  375. package/dist/chunk-XVYXRCRL.js +0 -85
  376. package/dist/chunk-XVYXRCRL.js.map +0 -1
  377. package/dist/chunk-YAFENU6Y.js +0 -121
  378. package/dist/chunk-YAFENU6Y.js.map +0 -1
  379. package/dist/chunk-YVCX6Z75.js +0 -102
  380. package/dist/chunk-YVCX6Z75.js.map +0 -1
  381. package/dist/chunk-Z4BLTVTB.js +0 -30
  382. package/dist/chunk-Z4BLTVTB.js.map +0 -1
  383. package/dist/chunk-Z4GV3YQQ.mjs +0 -23
  384. package/dist/chunk-Z4GV3YQQ.mjs.map +0 -1
  385. package/dist/constants.js +0 -20
  386. package/dist/constants.js.map +0 -1
  387. package/dist/errors.js +0 -15
  388. package/dist/errors.js.map +0 -1
  389. package/dist/gas-flows/DefaultGasFeeFlow.js +0 -15
  390. package/dist/gas-flows/DefaultGasFeeFlow.js.map +0 -1
  391. package/dist/gas-flows/LineaGasFeeFlow.js +0 -16
  392. package/dist/gas-flows/LineaGasFeeFlow.js.map +0 -1
  393. package/dist/gas-flows/OptimismLayer1GasFeeFlow.js +0 -11
  394. package/dist/gas-flows/OptimismLayer1GasFeeFlow.js.map +0 -1
  395. package/dist/gas-flows/OracleLayer1GasFeeFlow.js +0 -9
  396. package/dist/gas-flows/OracleLayer1GasFeeFlow.js.map +0 -1
  397. package/dist/gas-flows/ScrollLayer1GasFeeFlow.js +0 -11
  398. package/dist/gas-flows/ScrollLayer1GasFeeFlow.js.map +0 -1
  399. package/dist/gas-flows/TestGasFeeFlow.js +0 -9
  400. package/dist/gas-flows/TestGasFeeFlow.js.map +0 -1
  401. package/dist/helpers/EtherscanRemoteTransactionSource.js +0 -12
  402. package/dist/helpers/EtherscanRemoteTransactionSource.js.map +0 -1
  403. package/dist/helpers/GasFeePoller.js +0 -12
  404. package/dist/helpers/GasFeePoller.js.map +0 -1
  405. package/dist/helpers/IncomingTransactionHelper.js +0 -9
  406. package/dist/helpers/IncomingTransactionHelper.js.map +0 -1
  407. package/dist/helpers/MultichainTrackingHelper.js +0 -13
  408. package/dist/helpers/MultichainTrackingHelper.js.map +0 -1
  409. package/dist/helpers/PendingTransactionTracker.js +0 -10
  410. package/dist/helpers/PendingTransactionTracker.js.map +0 -1
  411. package/dist/index.js +0 -77
  412. package/dist/index.js.map +0 -1
  413. package/dist/logger.js +0 -12
  414. package/dist/logger.js.map +0 -1
  415. package/dist/tsconfig.build.tsbuildinfo +0 -1
  416. package/dist/types/TransactionController.d.ts.map +0 -1
  417. package/dist/types/constants.d.ts.map +0 -1
  418. package/dist/types/errors.d.ts.map +0 -1
  419. package/dist/types/gas-flows/DefaultGasFeeFlow.d.ts.map +0 -1
  420. package/dist/types/gas-flows/LineaGasFeeFlow.d.ts.map +0 -1
  421. package/dist/types/gas-flows/OptimismLayer1GasFeeFlow.d.ts.map +0 -1
  422. package/dist/types/gas-flows/OracleLayer1GasFeeFlow.d.ts.map +0 -1
  423. package/dist/types/gas-flows/ScrollLayer1GasFeeFlow.d.ts.map +0 -1
  424. package/dist/types/gas-flows/TestGasFeeFlow.d.ts.map +0 -1
  425. package/dist/types/helpers/EtherscanRemoteTransactionSource.d.ts.map +0 -1
  426. package/dist/types/helpers/GasFeePoller.d.ts.map +0 -1
  427. package/dist/types/helpers/IncomingTransactionHelper.d.ts.map +0 -1
  428. package/dist/types/helpers/MultichainTrackingHelper.d.ts.map +0 -1
  429. package/dist/types/helpers/PendingTransactionTracker.d.ts.map +0 -1
  430. package/dist/types/index.d.ts.map +0 -1
  431. package/dist/types/logger.d.ts.map +0 -1
  432. package/dist/types/types.d.ts.map +0 -1
  433. package/dist/types/utils/etherscan.d.ts.map +0 -1
  434. package/dist/types/utils/external-transactions.d.ts.map +0 -1
  435. package/dist/types/utils/gas-fees.d.ts.map +0 -1
  436. package/dist/types/utils/gas-flow.d.ts.map +0 -1
  437. package/dist/types/utils/gas.d.ts.map +0 -1
  438. package/dist/types/utils/history.d.ts.map +0 -1
  439. package/dist/types/utils/layer1-gas-fee-flow.d.ts.map +0 -1
  440. package/dist/types/utils/nonce.d.ts.map +0 -1
  441. package/dist/types/utils/retry.d.ts.map +0 -1
  442. package/dist/types/utils/simulation-api.d.ts.map +0 -1
  443. package/dist/types/utils/simulation.d.ts.map +0 -1
  444. package/dist/types/utils/swaps.d.ts.map +0 -1
  445. package/dist/types/utils/transaction-type.d.ts.map +0 -1
  446. package/dist/types/utils/utils.d.ts.map +0 -1
  447. package/dist/types/utils/validation.d.ts.map +0 -1
  448. package/dist/types.js +0 -24
  449. package/dist/types.js.map +0 -1
  450. package/dist/utils/etherscan.js +0 -14
  451. package/dist/utils/etherscan.js.map +0 -1
  452. package/dist/utils/external-transactions.js +0 -9
  453. package/dist/utils/external-transactions.js.map +0 -1
  454. package/dist/utils/gas-fees.js +0 -16
  455. package/dist/utils/gas-fees.js.map +0 -1
  456. package/dist/utils/gas-flow.js +0 -11
  457. package/dist/utils/gas-flow.js.map +0 -1
  458. package/dist/utils/gas.js +0 -20
  459. package/dist/utils/gas.js.map +0 -1
  460. package/dist/utils/history.js +0 -14
  461. package/dist/utils/history.js.map +0 -1
  462. package/dist/utils/layer1-gas-fee-flow.js +0 -11
  463. package/dist/utils/layer1-gas-fee-flow.js.map +0 -1
  464. package/dist/utils/nonce.js +0 -11
  465. package/dist/utils/nonce.js.map +0 -1
  466. package/dist/utils/retry.js +0 -8
  467. package/dist/utils/retry.js.map +0 -1
  468. package/dist/utils/simulation-api.js +0 -11
  469. package/dist/utils/simulation-api.js.map +0 -1
  470. package/dist/utils/simulation.js +0 -17
  471. package/dist/utils/simulation.js.map +0 -1
  472. package/dist/utils/swaps.js +0 -24
  473. package/dist/utils/swaps.js.map +0 -1
  474. package/dist/utils/transaction-type.js +0 -11
  475. package/dist/utils/transaction-type.js.map +0 -1
  476. package/dist/utils/utils.js +0 -23
  477. package/dist/utils/utils.js.map +0 -1
  478. package/dist/utils/validation.js +0 -12
  479. package/dist/utils/validation.js.map +0 -1
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getTransactionLayer1GasFee = exports.updateTransactionLayer1GasFee = void 0;
4
+ const utils_1 = require("@metamask/utils");
5
+ const logger_1 = require("../logger.cjs");
6
+ const log = (0, utils_1.createModuleLogger)(logger_1.projectLogger, 'layer-1-gas-fee-flow');
7
+ /**
8
+ * Updates the given transactionMeta with the layer 1 gas fee.
9
+ * @param request - The request to use when getting the layer 1 gas fee.
10
+ * @param request.provider - Provider used to create a new underlying EthQuery instance
11
+ * @param request.transactionMeta - The transaction to get the layer 1 gas fee for.
12
+ * @param request.layer1GasFeeFlows - The layer 1 gas fee flows to search.
13
+ */
14
+ async function updateTransactionLayer1GasFee(request) {
15
+ const layer1GasFee = await getTransactionLayer1GasFee(request);
16
+ if (!layer1GasFee) {
17
+ return;
18
+ }
19
+ const { transactionMeta } = request;
20
+ transactionMeta.layer1GasFee = layer1GasFee;
21
+ log('Updated layer 1 gas fee', layer1GasFee, transactionMeta.id);
22
+ }
23
+ exports.updateTransactionLayer1GasFee = updateTransactionLayer1GasFee;
24
+ /**
25
+ * Get the layer 1 gas fee flow for a transaction.
26
+ * @param transactionMeta - The transaction to get the layer 1 gas fee flow for.
27
+ * @param layer1GasFeeFlows - The layer 1 gas fee flows to search.
28
+ * @returns The layer 1 gas fee flow for the transaction, or undefined if none match.
29
+ */
30
+ function getLayer1GasFeeFlow(transactionMeta, layer1GasFeeFlows) {
31
+ return layer1GasFeeFlows.find((layer1GasFeeFlow) => layer1GasFeeFlow.matchesTransaction(transactionMeta));
32
+ }
33
+ /**
34
+ * Get the layer 1 gas fee for a transaction and return the layer1Fee.
35
+ * @param request - The request to use when getting the layer 1 gas fee.
36
+ * @param request.layer1GasFeeFlows - The layer 1 gas fee flows to search.
37
+ * @param request.provider - The provider to use to get the layer 1 gas fee.
38
+ * @param request.transactionMeta - The transaction to get the layer 1 gas fee for.
39
+ */
40
+ async function getTransactionLayer1GasFee({ layer1GasFeeFlows, provider, transactionMeta, }) {
41
+ const layer1GasFeeFlow = getLayer1GasFeeFlow(transactionMeta, layer1GasFeeFlows);
42
+ if (!layer1GasFeeFlow) {
43
+ return undefined;
44
+ }
45
+ log('Found layer 1 gas fee flow', layer1GasFeeFlow.constructor.name, transactionMeta.id);
46
+ try {
47
+ const { layer1Fee } = await layer1GasFeeFlow.getLayer1Fee({
48
+ provider,
49
+ transactionMeta,
50
+ });
51
+ return layer1Fee;
52
+ }
53
+ catch (error) {
54
+ log('Failed to get layer 1 gas fee', transactionMeta.id, error);
55
+ return undefined;
56
+ }
57
+ }
58
+ exports.getTransactionLayer1GasFee = getTransactionLayer1GasFee;
59
+ //# sourceMappingURL=layer1-gas-fee-flow.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layer1-gas-fee-flow.cjs","sourceRoot":"","sources":["../../src/utils/layer1-gas-fee-flow.ts"],"names":[],"mappings":";;;AACA,2CAA+D;AAE/D,0CAA0C;AAG1C,MAAM,GAAG,GAAG,IAAA,0BAAkB,EAAC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esContent":["import type { Provider } from '@metamask/network-controller';\nimport { createModuleLogger, type Hex } from '@metamask/utils';\n\nimport { projectLogger } from '../logger';\nimport type { Layer1GasFeeFlow, TransactionMeta } from '../types';\n\nconst log = createModuleLogger(projectLogger, 'layer-1-gas-fee-flow');\n\nexport type UpdateLayer1GasFeeRequest = {\n layer1GasFeeFlows: Layer1GasFeeFlow[];\n provider: Provider;\n transactionMeta: TransactionMeta;\n};\n\n/**\n * Updates the given transactionMeta with the layer 1 gas fee.\n * @param request - The request to use when getting the layer 1 gas fee.\n * @param request.provider - Provider used to create a new underlying EthQuery instance\n * @param request.transactionMeta - The transaction to get the layer 1 gas fee for.\n * @param request.layer1GasFeeFlows - The layer 1 gas fee flows to search.\n */\nexport async function updateTransactionLayer1GasFee(\n request: UpdateLayer1GasFeeRequest,\n) {\n const layer1GasFee = await getTransactionLayer1GasFee(request);\n\n if (!layer1GasFee) {\n return;\n }\n\n const { transactionMeta } = request;\n\n transactionMeta.layer1GasFee = layer1GasFee;\n\n log('Updated layer 1 gas fee', layer1GasFee, transactionMeta.id);\n}\n\n/**\n * Get the layer 1 gas fee flow for a transaction.\n * @param transactionMeta - The transaction to get the layer 1 gas fee flow for.\n * @param layer1GasFeeFlows - The layer 1 gas fee flows to search.\n * @returns The layer 1 gas fee flow for the transaction, or undefined if none match.\n */\nfunction getLayer1GasFeeFlow(\n transactionMeta: TransactionMeta,\n layer1GasFeeFlows: Layer1GasFeeFlow[],\n): Layer1GasFeeFlow | undefined {\n return layer1GasFeeFlows.find((layer1GasFeeFlow) =>\n layer1GasFeeFlow.matchesTransaction(transactionMeta),\n );\n}\n\n/**\n * Get the layer 1 gas fee for a transaction and return the layer1Fee.\n * @param request - The request to use when getting the layer 1 gas fee.\n * @param request.layer1GasFeeFlows - The layer 1 gas fee flows to search.\n * @param request.provider - The provider to use to get the layer 1 gas fee.\n * @param request.transactionMeta - The transaction to get the layer 1 gas fee for.\n */\nexport async function getTransactionLayer1GasFee({\n layer1GasFeeFlows,\n provider,\n transactionMeta,\n}: UpdateLayer1GasFeeRequest): Promise<Hex | undefined> {\n const layer1GasFeeFlow = getLayer1GasFeeFlow(\n transactionMeta,\n layer1GasFeeFlows,\n );\n\n if (!layer1GasFeeFlow) {\n return undefined;\n }\n\n log(\n 'Found layer 1 gas fee flow',\n layer1GasFeeFlow.constructor.name,\n transactionMeta.id,\n );\n\n try {\n const { layer1Fee } = await layer1GasFeeFlow.getLayer1Fee({\n provider,\n transactionMeta,\n });\n return layer1Fee;\n } catch (error) {\n log('Failed to get layer 1 gas fee', transactionMeta.id, error);\n return undefined;\n }\n}\n"]}
@@ -1,6 +1,6 @@
1
- import type { Provider } from '@metamask/network-controller';
2
- import { type Hex } from '@metamask/utils';
3
- import type { Layer1GasFeeFlow, TransactionMeta } from '../types';
1
+ import type { Provider } from "@metamask/network-controller";
2
+ import { type Hex } from "@metamask/utils";
3
+ import type { Layer1GasFeeFlow, TransactionMeta } from "../types.cjs";
4
4
  export type UpdateLayer1GasFeeRequest = {
5
5
  layer1GasFeeFlows: Layer1GasFeeFlow[];
6
6
  provider: Provider;
@@ -22,4 +22,4 @@ export declare function updateTransactionLayer1GasFee(request: UpdateLayer1GasFe
22
22
  * @param request.transactionMeta - The transaction to get the layer 1 gas fee for.
23
23
  */
24
24
  export declare function getTransactionLayer1GasFee({ layer1GasFeeFlows, provider, transactionMeta, }: UpdateLayer1GasFeeRequest): Promise<Hex | undefined>;
25
- //# sourceMappingURL=layer1-gas-fee-flow.d.ts.map
25
+ //# sourceMappingURL=layer1-gas-fee-flow.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layer1-gas-fee-flow.d.cts","sourceRoot":"","sources":["../../src/utils/layer1-gas-fee-flow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,qCAAqC;AAC7D,OAAO,EAAsB,KAAK,GAAG,EAAE,wBAAwB;AAG/D,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,qBAAiB;AAIlE,MAAM,MAAM,yBAAyB,GAAG;IACtC,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;IACtC,QAAQ,EAAE,QAAQ,CAAC;IACnB,eAAe,EAAE,eAAe,CAAC;CAClC,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,6BAA6B,CACjD,OAAO,EAAE,yBAAyB,iBAanC;AAiBD;;;;;;GAMG;AACH,wBAAsB,0BAA0B,CAAC,EAC/C,iBAAiB,EACjB,QAAQ,EACR,eAAe,GAChB,EAAE,yBAAyB,GAAG,OAAO,CAAC,GAAG,GAAG,SAAS,CAAC,CA0BtD"}
@@ -0,0 +1,25 @@
1
+ import type { Provider } from "@metamask/network-controller";
2
+ import { type Hex } from "@metamask/utils";
3
+ import type { Layer1GasFeeFlow, TransactionMeta } from "../types.mjs";
4
+ export type UpdateLayer1GasFeeRequest = {
5
+ layer1GasFeeFlows: Layer1GasFeeFlow[];
6
+ provider: Provider;
7
+ transactionMeta: TransactionMeta;
8
+ };
9
+ /**
10
+ * Updates the given transactionMeta with the layer 1 gas fee.
11
+ * @param request - The request to use when getting the layer 1 gas fee.
12
+ * @param request.provider - Provider used to create a new underlying EthQuery instance
13
+ * @param request.transactionMeta - The transaction to get the layer 1 gas fee for.
14
+ * @param request.layer1GasFeeFlows - The layer 1 gas fee flows to search.
15
+ */
16
+ export declare function updateTransactionLayer1GasFee(request: UpdateLayer1GasFeeRequest): Promise<void>;
17
+ /**
18
+ * Get the layer 1 gas fee for a transaction and return the layer1Fee.
19
+ * @param request - The request to use when getting the layer 1 gas fee.
20
+ * @param request.layer1GasFeeFlows - The layer 1 gas fee flows to search.
21
+ * @param request.provider - The provider to use to get the layer 1 gas fee.
22
+ * @param request.transactionMeta - The transaction to get the layer 1 gas fee for.
23
+ */
24
+ export declare function getTransactionLayer1GasFee({ layer1GasFeeFlows, provider, transactionMeta, }: UpdateLayer1GasFeeRequest): Promise<Hex | undefined>;
25
+ //# sourceMappingURL=layer1-gas-fee-flow.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layer1-gas-fee-flow.d.mts","sourceRoot":"","sources":["../../src/utils/layer1-gas-fee-flow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,qCAAqC;AAC7D,OAAO,EAAsB,KAAK,GAAG,EAAE,wBAAwB;AAG/D,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,qBAAiB;AAIlE,MAAM,MAAM,yBAAyB,GAAG;IACtC,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;IACtC,QAAQ,EAAE,QAAQ,CAAC;IACnB,eAAe,EAAE,eAAe,CAAC;CAClC,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,6BAA6B,CACjD,OAAO,EAAE,yBAAyB,iBAanC;AAiBD;;;;;;GAMG;AACH,wBAAsB,0BAA0B,CAAC,EAC/C,iBAAiB,EACjB,QAAQ,EACR,eAAe,GAChB,EAAE,yBAAyB,GAAG,OAAO,CAAC,GAAG,GAAG,SAAS,CAAC,CA0BtD"}
@@ -1,11 +1,54 @@
1
- import {
2
- getTransactionLayer1GasFee,
3
- updateTransactionLayer1GasFee
4
- } from "../chunk-NOHEXQ7Y.mjs";
5
- import "../chunk-UQQWZT6C.mjs";
6
- import "../chunk-XUI43LEZ.mjs";
7
- export {
8
- getTransactionLayer1GasFee,
9
- updateTransactionLayer1GasFee
10
- };
1
+ import { createModuleLogger } from "@metamask/utils";
2
+ import { projectLogger } from "../logger.mjs";
3
+ const log = createModuleLogger(projectLogger, 'layer-1-gas-fee-flow');
4
+ /**
5
+ * Updates the given transactionMeta with the layer 1 gas fee.
6
+ * @param request - The request to use when getting the layer 1 gas fee.
7
+ * @param request.provider - Provider used to create a new underlying EthQuery instance
8
+ * @param request.transactionMeta - The transaction to get the layer 1 gas fee for.
9
+ * @param request.layer1GasFeeFlows - The layer 1 gas fee flows to search.
10
+ */
11
+ export async function updateTransactionLayer1GasFee(request) {
12
+ const layer1GasFee = await getTransactionLayer1GasFee(request);
13
+ if (!layer1GasFee) {
14
+ return;
15
+ }
16
+ const { transactionMeta } = request;
17
+ transactionMeta.layer1GasFee = layer1GasFee;
18
+ log('Updated layer 1 gas fee', layer1GasFee, transactionMeta.id);
19
+ }
20
+ /**
21
+ * Get the layer 1 gas fee flow for a transaction.
22
+ * @param transactionMeta - The transaction to get the layer 1 gas fee flow for.
23
+ * @param layer1GasFeeFlows - The layer 1 gas fee flows to search.
24
+ * @returns The layer 1 gas fee flow for the transaction, or undefined if none match.
25
+ */
26
+ function getLayer1GasFeeFlow(transactionMeta, layer1GasFeeFlows) {
27
+ return layer1GasFeeFlows.find((layer1GasFeeFlow) => layer1GasFeeFlow.matchesTransaction(transactionMeta));
28
+ }
29
+ /**
30
+ * Get the layer 1 gas fee for a transaction and return the layer1Fee.
31
+ * @param request - The request to use when getting the layer 1 gas fee.
32
+ * @param request.layer1GasFeeFlows - The layer 1 gas fee flows to search.
33
+ * @param request.provider - The provider to use to get the layer 1 gas fee.
34
+ * @param request.transactionMeta - The transaction to get the layer 1 gas fee for.
35
+ */
36
+ export async function getTransactionLayer1GasFee({ layer1GasFeeFlows, provider, transactionMeta, }) {
37
+ const layer1GasFeeFlow = getLayer1GasFeeFlow(transactionMeta, layer1GasFeeFlows);
38
+ if (!layer1GasFeeFlow) {
39
+ return undefined;
40
+ }
41
+ log('Found layer 1 gas fee flow', layer1GasFeeFlow.constructor.name, transactionMeta.id);
42
+ try {
43
+ const { layer1Fee } = await layer1GasFeeFlow.getLayer1Fee({
44
+ provider,
45
+ transactionMeta,
46
+ });
47
+ return layer1Fee;
48
+ }
49
+ catch (error) {
50
+ log('Failed to get layer 1 gas fee', transactionMeta.id, error);
51
+ return undefined;
52
+ }
53
+ }
11
54
  //# sourceMappingURL=layer1-gas-fee-flow.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
1
+ {"version":3,"file":"layer1-gas-fee-flow.mjs","sourceRoot":"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SAAS,CAAC;KAClB;IAAC,OAAO,KAAK,EAAE;QACd,GAAG,CAAC,+BAA+B,EAAE,eAAe,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;QAChE,OAAO,SAAS,CAAC;KAClB;AACH,CAAC","sourcesContent":["import type { Provider } from '@metamask/network-controller';\nimport { createModuleLogger, type Hex } from '@metamask/utils';\n\nimport { projectLogger } from '../logger';\nimport type { Layer1GasFeeFlow, TransactionMeta } from '../types';\n\nconst log = createModuleLogger(projectLogger, 'layer-1-gas-fee-flow');\n\nexport type UpdateLayer1GasFeeRequest = {\n layer1GasFeeFlows: Layer1GasFeeFlow[];\n provider: Provider;\n transactionMeta: TransactionMeta;\n};\n\n/**\n * Updates the given transactionMeta with the layer 1 gas fee.\n * @param request - The request to use when getting the layer 1 gas fee.\n * @param request.provider - Provider used to create a new underlying EthQuery instance\n * @param request.transactionMeta - The transaction to get the layer 1 gas fee for.\n * @param request.layer1GasFeeFlows - The layer 1 gas fee flows to search.\n */\nexport async function updateTransactionLayer1GasFee(\n request: UpdateLayer1GasFeeRequest,\n) {\n const layer1GasFee = await getTransactionLayer1GasFee(request);\n\n if (!layer1GasFee) {\n return;\n }\n\n const { transactionMeta } = request;\n\n transactionMeta.layer1GasFee = layer1GasFee;\n\n log('Updated layer 1 gas fee', layer1GasFee, transactionMeta.id);\n}\n\n/**\n * Get the layer 1 gas fee flow for a transaction.\n * @param transactionMeta - The transaction to get the layer 1 gas fee flow for.\n * @param layer1GasFeeFlows - The layer 1 gas fee flows to search.\n * @returns The layer 1 gas fee flow for the transaction, or undefined if none match.\n */\nfunction getLayer1GasFeeFlow(\n transactionMeta: TransactionMeta,\n layer1GasFeeFlows: Layer1GasFeeFlow[],\n): Layer1GasFeeFlow | undefined {\n return layer1GasFeeFlows.find((layer1GasFeeFlow) =>\n layer1GasFeeFlow.matchesTransaction(transactionMeta),\n );\n}\n\n/**\n * Get the layer 1 gas fee for a transaction and return the layer1Fee.\n * @param request - The request to use when getting the layer 1 gas fee.\n * @param request.layer1GasFeeFlows - The layer 1 gas fee flows to search.\n * @param request.provider - The provider to use to get the layer 1 gas fee.\n * @param request.transactionMeta - The transaction to get the layer 1 gas fee for.\n */\nexport async function getTransactionLayer1GasFee({\n layer1GasFeeFlows,\n provider,\n transactionMeta,\n}: UpdateLayer1GasFeeRequest): Promise<Hex | undefined> {\n const layer1GasFeeFlow = getLayer1GasFeeFlow(\n transactionMeta,\n layer1GasFeeFlows,\n );\n\n if (!layer1GasFeeFlow) {\n return undefined;\n }\n\n log(\n 'Found layer 1 gas fee flow',\n layer1GasFeeFlow.constructor.name,\n transactionMeta.id,\n );\n\n try {\n const { layer1Fee } = await layer1GasFeeFlow.getLayer1Fee({\n provider,\n transactionMeta,\n });\n return layer1Fee;\n } catch (error) {\n log('Failed to get layer 1 gas fee', transactionMeta.id, error);\n return undefined;\n }\n}\n"]}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAndFormatTransactionsForNonceTracker = exports.getNextNonce = void 0;
4
+ const controller_utils_1 = require("@metamask/controller-utils");
5
+ const logger_1 = require("../logger.cjs");
6
+ const log = (0, logger_1.createModuleLogger)(logger_1.projectLogger, 'nonce');
7
+ /**
8
+ * Determine the next nonce to be used for a transaction.
9
+ *
10
+ * @param txMeta - The transaction metadata.
11
+ * @param getNonceLock - An anonymous function that acquires the nonce lock for an address
12
+ * @returns The next hexadecimal nonce to be used for the given transaction, and optionally a function to release the nonce lock.
13
+ */
14
+ async function getNextNonce(txMeta, getNonceLock) {
15
+ const { customNonceValue, txParams: { from, nonce: existingNonce }, } = txMeta;
16
+ const customNonce = customNonceValue ? (0, controller_utils_1.toHex)(customNonceValue) : undefined;
17
+ if (customNonce) {
18
+ log('Using custom nonce', customNonce);
19
+ return [customNonce, undefined];
20
+ }
21
+ if (existingNonce) {
22
+ log('Using existing nonce', existingNonce);
23
+ return [existingNonce, undefined];
24
+ }
25
+ const nonceLock = await getNonceLock(from);
26
+ const nonce = (0, controller_utils_1.toHex)(nonceLock.nextNonce);
27
+ const releaseLock = nonceLock.releaseLock.bind(nonceLock);
28
+ log('Using nonce from nonce tracker', nonce, nonceLock.nonceDetails);
29
+ return [nonce, releaseLock];
30
+ }
31
+ exports.getNextNonce = getNextNonce;
32
+ /**
33
+ * Filter and format transactions for the nonce tracker.
34
+ *
35
+ * @param currentChainId - Chain ID of the current network.
36
+ * @param fromAddress - Address of the account from which the transactions to filter from are sent.
37
+ * @param transactionStatus - Status of the transactions for which to filter.
38
+ * @param transactions - Array of transactionMeta objects that have been prefiltered.
39
+ * @returns Array of transactions formatted for the nonce tracker.
40
+ */
41
+ function getAndFormatTransactionsForNonceTracker(currentChainId, fromAddress, transactionStatus, transactions) {
42
+ return transactions
43
+ .filter(({ chainId, isTransfer, isUserOperation, status, txParams: { from } }) => !isTransfer &&
44
+ !isUserOperation &&
45
+ chainId === currentChainId &&
46
+ status === transactionStatus &&
47
+ from.toLowerCase() === fromAddress.toLowerCase())
48
+ .map(({ status, txParams: { from, gas, value, nonce } }) => {
49
+ // the only value we care about is the nonce
50
+ // but we need to return the other values to satisfy the type
51
+ // TODO: refactor nonceTracker to not require this
52
+ /* istanbul ignore next */
53
+ return {
54
+ status,
55
+ history: [{}],
56
+ txParams: {
57
+ from: from ?? '',
58
+ gas: gas ?? '',
59
+ value: value ?? '',
60
+ nonce: nonce ?? '',
61
+ },
62
+ };
63
+ });
64
+ }
65
+ exports.getAndFormatTransactionsForNonceTracker = getAndFormatTransactionsForNonceTracker;
66
+ //# sourceMappingURL=nonce.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nonce.cjs","sourceRoot":"","sources":["../../src/utils/nonce.ts"],"names":[],"mappings":";;;AAAA,iEAAmD;AAMnD,0CAA8D;AAG9D,MAAM,GAAG,GAAG,IAAA,2BAAkB,EAAC,sBAAa,EAAE,OAAO,CAAC,CAAC;AAEvD;;;;;;GAMG;AACI,KAAK,UAAU,YAAY,CAChC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,WAAW,CAAC,WAAW,EAAE,CACnD;SACA,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE;QACzD,4CAA4C;QAC5C,6DAA6D;QAC7D,kDAAkD;QAClD,0BAA0B;QAC1B,OAAO;YACL,MAAM;YACN,OAAO,EAAE,CAAC,EAAE,CAAC;YACb,QAAQ,EAAE;gBACR,IAAI,EAAE,IAAI,IAAI,EAAE;gBAChB,GAAG,EAAE,GAAG,IAAI,EAAE;gBACd,KAAK,EAAE,KAAK,IAAI,EAAE;gBAClB,KAAK,EAAE,KAAK,IAAI,EAAE;aACnB;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACP,CAAC;AA/BD,0FA+BC","sourcesContent":["import { toHex } from '@metamask/controller-utils';\nimport type {\n NonceLock,\n Transaction as NonceTrackerTransaction,\n} from '@metamask/nonce-tracker';\n\nimport { createModuleLogger, projectLogger } from '../logger';\nimport type { TransactionMeta, TransactionStatus } from '../types';\n\nconst log = createModuleLogger(projectLogger, 'nonce');\n\n/**\n * Determine the next nonce to be used for a transaction.\n *\n * @param txMeta - The transaction metadata.\n * @param getNonceLock - An anonymous function that acquires the nonce lock for an address\n * @returns The next hexadecimal nonce to be used for the given transaction, and optionally a function to release the nonce lock.\n */\nexport async function getNextNonce(\n txMeta: TransactionMeta,\n getNonceLock: (address: string) => Promise<NonceLock>,\n): Promise<[string, (() => void) | undefined]> {\n const {\n customNonceValue,\n txParams: { from, nonce: existingNonce },\n } = txMeta;\n\n const customNonce = customNonceValue ? toHex(customNonceValue) : undefined;\n\n if (customNonce) {\n log('Using custom nonce', customNonce);\n return [customNonce, undefined];\n }\n\n if (existingNonce) {\n log('Using existing nonce', existingNonce);\n return [existingNonce, undefined];\n }\n\n const nonceLock = await getNonceLock(from);\n const nonce = toHex(nonceLock.nextNonce);\n const releaseLock = nonceLock.releaseLock.bind(nonceLock);\n\n log('Using nonce from nonce tracker', nonce, nonceLock.nonceDetails);\n\n return [nonce, releaseLock];\n}\n\n/**\n * Filter and format transactions for the nonce tracker.\n *\n * @param currentChainId - Chain ID of the current network.\n * @param fromAddress - Address of the account from which the transactions to filter from are sent.\n * @param transactionStatus - Status of the transactions for which to filter.\n * @param transactions - Array of transactionMeta objects that have been prefiltered.\n * @returns Array of transactions formatted for the nonce tracker.\n */\nexport function getAndFormatTransactionsForNonceTracker(\n currentChainId: string,\n fromAddress: string,\n transactionStatus: TransactionStatus,\n transactions: TransactionMeta[],\n): NonceTrackerTransaction[] {\n return transactions\n .filter(\n ({ chainId, isTransfer, isUserOperation, status, txParams: { from } }) =>\n !isTransfer &&\n !isUserOperation &&\n chainId === currentChainId &&\n status === transactionStatus &&\n from.toLowerCase() === fromAddress.toLowerCase(),\n )\n .map(({ status, txParams: { from, gas, value, nonce } }) => {\n // the only value we care about is the nonce\n // but we need to return the other values to satisfy the type\n // TODO: refactor nonceTracker to not require this\n /* istanbul ignore next */\n return {\n status,\n history: [{}],\n txParams: {\n from: from ?? '',\n gas: gas ?? '',\n value: value ?? '',\n nonce: nonce ?? '',\n },\n };\n });\n}\n"]}
@@ -1,5 +1,5 @@
1
- import type { NonceLock, Transaction as NonceTrackerTransaction } from '@metamask/nonce-tracker';
2
- import type { TransactionMeta, TransactionStatus } from '../types';
1
+ import type { NonceLock, Transaction as NonceTrackerTransaction } from "@metamask/nonce-tracker";
2
+ import type { TransactionMeta, TransactionStatus } from "../types.cjs";
3
3
  /**
4
4
  * Determine the next nonce to be used for a transaction.
5
5
  *
@@ -18,4 +18,4 @@ export declare function getNextNonce(txMeta: TransactionMeta, getNonceLock: (add
18
18
  * @returns Array of transactions formatted for the nonce tracker.
19
19
  */
20
20
  export declare function getAndFormatTransactionsForNonceTracker(currentChainId: string, fromAddress: string, transactionStatus: TransactionStatus, transactions: TransactionMeta[]): NonceTrackerTransaction[];
21
- //# sourceMappingURL=nonce.d.ts.map
21
+ //# sourceMappingURL=nonce.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nonce.d.cts","sourceRoot":"","sources":["../../src/utils/nonce.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,SAAS,EACT,WAAW,IAAI,uBAAuB,EACvC,gCAAgC;AAGjC,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,qBAAiB;AAInE;;;;;;GAMG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,eAAe,EACvB,YAAY,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,SAAS,CAAC,GACpD,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC,CAyB7C;AAED;;;;;;;;GAQG;AACH,wBAAgB,uCAAuC,CACrD,cAAc,EAAE,MAAM,EACtB,WAAW,EAAE,MAAM,EACnB,iBAAiB,EAAE,iBAAiB,EACpC,YAAY,EAAE,eAAe,EAAE,GAC9B,uBAAuB,EAAE,CA0B3B"}
@@ -0,0 +1,21 @@
1
+ import type { NonceLock, Transaction as NonceTrackerTransaction } from "@metamask/nonce-tracker";
2
+ import type { TransactionMeta, TransactionStatus } from "../types.mjs";
3
+ /**
4
+ * Determine the next nonce to be used for a transaction.
5
+ *
6
+ * @param txMeta - The transaction metadata.
7
+ * @param getNonceLock - An anonymous function that acquires the nonce lock for an address
8
+ * @returns The next hexadecimal nonce to be used for the given transaction, and optionally a function to release the nonce lock.
9
+ */
10
+ export declare function getNextNonce(txMeta: TransactionMeta, getNonceLock: (address: string) => Promise<NonceLock>): Promise<[string, (() => void) | undefined]>;
11
+ /**
12
+ * Filter and format transactions for the nonce tracker.
13
+ *
14
+ * @param currentChainId - Chain ID of the current network.
15
+ * @param fromAddress - Address of the account from which the transactions to filter from are sent.
16
+ * @param transactionStatus - Status of the transactions for which to filter.
17
+ * @param transactions - Array of transactionMeta objects that have been prefiltered.
18
+ * @returns Array of transactions formatted for the nonce tracker.
19
+ */
20
+ export declare function getAndFormatTransactionsForNonceTracker(currentChainId: string, fromAddress: string, transactionStatus: TransactionStatus, transactions: TransactionMeta[]): NonceTrackerTransaction[];
21
+ //# sourceMappingURL=nonce.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nonce.d.mts","sourceRoot":"","sources":["../../src/utils/nonce.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,SAAS,EACT,WAAW,IAAI,uBAAuB,EACvC,gCAAgC;AAGjC,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,qBAAiB;AAInE;;;;;;GAMG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,eAAe,EACvB,YAAY,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,SAAS,CAAC,GACpD,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC,CAyB7C;AAED;;;;;;;;GAQG;AACH,wBAAgB,uCAAuC,CACrD,cAAc,EAAE,MAAM,EACtB,WAAW,EAAE,MAAM,EACnB,iBAAiB,EAAE,iBAAiB,EACpC,YAAY,EAAE,eAAe,EAAE,GAC9B,uBAAuB,EAAE,CA0B3B"}
@@ -1,11 +1,61 @@
1
- import {
2
- getAndFormatTransactionsForNonceTracker,
3
- getNextNonce
4
- } from "../chunk-6DDVVUJC.mjs";
5
- import "../chunk-UQQWZT6C.mjs";
6
- import "../chunk-XUI43LEZ.mjs";
7
- export {
8
- getAndFormatTransactionsForNonceTracker,
9
- getNextNonce
10
- };
1
+ import { toHex } from "@metamask/controller-utils";
2
+ import { createModuleLogger, projectLogger } from "../logger.mjs";
3
+ const log = createModuleLogger(projectLogger, 'nonce');
4
+ /**
5
+ * Determine the next nonce to be used for a transaction.
6
+ *
7
+ * @param txMeta - The transaction metadata.
8
+ * @param getNonceLock - An anonymous function that acquires the nonce lock for an address
9
+ * @returns The next hexadecimal nonce to be used for the given transaction, and optionally a function to release the nonce lock.
10
+ */
11
+ export async function getNextNonce(txMeta, getNonceLock) {
12
+ const { customNonceValue, txParams: { from, nonce: existingNonce }, } = txMeta;
13
+ const customNonce = customNonceValue ? toHex(customNonceValue) : undefined;
14
+ if (customNonce) {
15
+ log('Using custom nonce', customNonce);
16
+ return [customNonce, undefined];
17
+ }
18
+ if (existingNonce) {
19
+ log('Using existing nonce', existingNonce);
20
+ return [existingNonce, undefined];
21
+ }
22
+ const nonceLock = await getNonceLock(from);
23
+ const nonce = toHex(nonceLock.nextNonce);
24
+ const releaseLock = nonceLock.releaseLock.bind(nonceLock);
25
+ log('Using nonce from nonce tracker', nonce, nonceLock.nonceDetails);
26
+ return [nonce, releaseLock];
27
+ }
28
+ /**
29
+ * Filter and format transactions for the nonce tracker.
30
+ *
31
+ * @param currentChainId - Chain ID of the current network.
32
+ * @param fromAddress - Address of the account from which the transactions to filter from are sent.
33
+ * @param transactionStatus - Status of the transactions for which to filter.
34
+ * @param transactions - Array of transactionMeta objects that have been prefiltered.
35
+ * @returns Array of transactions formatted for the nonce tracker.
36
+ */
37
+ export function getAndFormatTransactionsForNonceTracker(currentChainId, fromAddress, transactionStatus, transactions) {
38
+ return transactions
39
+ .filter(({ chainId, isTransfer, isUserOperation, status, txParams: { from } }) => !isTransfer &&
40
+ !isUserOperation &&
41
+ chainId === currentChainId &&
42
+ status === transactionStatus &&
43
+ from.toLowerCase() === fromAddress.toLowerCase())
44
+ .map(({ status, txParams: { from, gas, value, nonce } }) => {
45
+ // the only value we care about is the nonce
46
+ // but we need to return the other values to satisfy the type
47
+ // TODO: refactor nonceTracker to not require this
48
+ /* istanbul ignore next */
49
+ return {
50
+ status,
51
+ history: [{}],
52
+ txParams: {
53
+ from: from ?? '',
54
+ gas: gas ?? '',
55
+ value: value ?? '',
56
+ nonce: nonce ?? '',
57
+ },
58
+ };
59
+ });
60
+ }
11
61
  //# sourceMappingURL=nonce.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"sourcesContent":[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AoC,EACpC,YAA+B;IAE/B,OAAO,YAAY;SAChB,MAAM,CACL,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,CACvE,CAAC,UAAU;QACX,CAAC,eAAe;QAChB,OAAO,KAAK,cAAc;QAC1B,MAAM,KAAK,iBAAiB;QAC5B,IAAI,CAAC,WAAW,EAAE,KAAK,WAAW,CAAC,WAAW,EAAE,CACnD;SACA,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE;QACzD,4CAA4C;QAC5C,6DAA6D;QAC7D,kDAAkD;QAClD,0BAA0B;QAC1B,OAAO;YACL,MAAM;YACN,OAAO,EAAE,CAAC,EAAE,CAAC;YACb,QAAQ,EAAE;gBACR,IAAI,EAAE,IAAI,IAAI,EAAE;gBAChB,GAAG,EAAE,GAAG,IAAI,EAAE;gBACd,KAAK,EAAE,KAAK,IAAI,EAAE;gBAClB,KAAK,EAAE,KAAK,IAAI,EAAE;aACnB;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACP,CAAC","sourcesContent":["import { toHex } from '@metamask/controller-utils';\nimport type {\n NonceLock,\n Transaction as NonceTrackerTransaction,\n} from '@metamask/nonce-tracker';\n\nimport { createModuleLogger, projectLogger } from '../logger';\nimport type { TransactionMeta, TransactionStatus } from '../types';\n\nconst log = createModuleLogger(projectLogger, 'nonce');\n\n/**\n * Determine the next nonce to be used for a transaction.\n *\n * @param txMeta - The transaction metadata.\n * @param getNonceLock - An anonymous function that acquires the nonce lock for an address\n * @returns The next hexadecimal nonce to be used for the given transaction, and optionally a function to release the nonce lock.\n */\nexport async function getNextNonce(\n txMeta: TransactionMeta,\n getNonceLock: (address: string) => Promise<NonceLock>,\n): Promise<[string, (() => void) | undefined]> {\n const {\n customNonceValue,\n txParams: { from, nonce: existingNonce },\n } = txMeta;\n\n const customNonce = customNonceValue ? toHex(customNonceValue) : undefined;\n\n if (customNonce) {\n log('Using custom nonce', customNonce);\n return [customNonce, undefined];\n }\n\n if (existingNonce) {\n log('Using existing nonce', existingNonce);\n return [existingNonce, undefined];\n }\n\n const nonceLock = await getNonceLock(from);\n const nonce = toHex(nonceLock.nextNonce);\n const releaseLock = nonceLock.releaseLock.bind(nonceLock);\n\n log('Using nonce from nonce tracker', nonce, nonceLock.nonceDetails);\n\n return [nonce, releaseLock];\n}\n\n/**\n * Filter and format transactions for the nonce tracker.\n *\n * @param currentChainId - Chain ID of the current network.\n * @param fromAddress - Address of the account from which the transactions to filter from are sent.\n * @param transactionStatus - Status of the transactions for which to filter.\n * @param transactions - Array of transactionMeta objects that have been prefiltered.\n * @returns Array of transactions formatted for the nonce tracker.\n */\nexport function getAndFormatTransactionsForNonceTracker(\n currentChainId: string,\n fromAddress: string,\n transactionStatus: TransactionStatus,\n transactions: TransactionMeta[],\n): NonceTrackerTransaction[] {\n return transactions\n .filter(\n ({ chainId, isTransfer, isUserOperation, status, txParams: { from } }) =>\n !isTransfer &&\n !isUserOperation &&\n chainId === currentChainId &&\n status === transactionStatus &&\n from.toLowerCase() === fromAddress.toLowerCase(),\n )\n .map(({ status, txParams: { from, gas, value, nonce } }) => {\n // the only value we care about is the nonce\n // but we need to return the other values to satisfy the type\n // TODO: refactor nonceTracker to not require this\n /* istanbul ignore next */\n return {\n status,\n history: [{}],\n txParams: {\n from: from ?? '',\n gas: gas ?? '',\n value: value ?? '',\n nonce: nonce ?? '',\n },\n };\n });\n}\n"]}
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getTransactionParamsWithIncreasedGasFee = void 0;
4
+ const controller_utils_1 = require("@metamask/controller-utils");
5
+ const utils_1 = require("@metamask/utils");
6
+ /**
7
+ * Returns new transaction parameters with increased gas fees.
8
+ * @param originalTransactionParams - The original transaction parameters.
9
+ * @param rate - The rate by which to increase the existing gas fee properties.
10
+ * @param newGasValues - Optional new gas values to use instead of increased the existing values.
11
+ * @returns The new transaction parameters with the increased gas fee properties.
12
+ */
13
+ function getTransactionParamsWithIncreasedGasFee(originalTransactionParams, rate, newGasValues) {
14
+ const newGasPrice = getIncreasedGasPrice(originalTransactionParams, rate, newGasValues);
15
+ const new1559Values = getIncreased1559Values(originalTransactionParams, rate, newGasValues);
16
+ if (new1559Values) {
17
+ const newTxParams = {
18
+ ...originalTransactionParams,
19
+ ...new1559Values,
20
+ };
21
+ delete newTxParams.gasPrice;
22
+ return newTxParams;
23
+ }
24
+ if (newGasPrice) {
25
+ const newTxParams = {
26
+ ...originalTransactionParams,
27
+ gasPrice: newGasPrice,
28
+ };
29
+ delete newTxParams.maxFeePerGas;
30
+ delete newTxParams.maxPriorityFeePerGas;
31
+ return newTxParams;
32
+ }
33
+ throw new Error('Cannot increase gas fee as no current values and no new values were provided');
34
+ }
35
+ exports.getTransactionParamsWithIncreasedGasFee = getTransactionParamsWithIncreasedGasFee;
36
+ /**
37
+ * Generate the increased EIP-1559 gas properties.
38
+ * @param originalTransactionParams - The original transaction parameters.
39
+ * @param rate - The rate by which to increase the existing gas fee properties.
40
+ * @param newGasValues - Optional new gas values to use instead of increased the existing values.
41
+ * @returns The new EIP-1559 gas properties.
42
+ */
43
+ function getIncreased1559Values(originalTransactionParams, rate, newGasValues) {
44
+ if (newGasValues &&
45
+ 'maxFeePerGas' in newGasValues &&
46
+ 'maxPriorityFeePerGas' in newGasValues) {
47
+ return newGasValues;
48
+ }
49
+ const currentMaxFeePerGas = originalTransactionParams.maxFeePerGas;
50
+ const currentMaxPriorityFeePerGas = originalTransactionParams.maxPriorityFeePerGas;
51
+ if (!currentMaxFeePerGas ||
52
+ !currentMaxPriorityFeePerGas ||
53
+ currentMaxFeePerGas === '0x0' ||
54
+ currentMaxPriorityFeePerGas === '0x0') {
55
+ return undefined;
56
+ }
57
+ const maxFeePerGas = multiplyHex(currentMaxFeePerGas, rate);
58
+ const maxPriorityFeePerGas = multiplyHex(currentMaxPriorityFeePerGas, rate);
59
+ return { maxFeePerGas, maxPriorityFeePerGas };
60
+ }
61
+ /**
62
+ * Generate the increased gas price.
63
+ * @param originalTransactionParams - The original transaction parameters.
64
+ * @param rate - The rate by which to increase the existing gas fee properties.
65
+ * @param newGasValues - Optional new gas values to use instead of increased the existing values.
66
+ * @returns The new gas price.
67
+ */
68
+ function getIncreasedGasPrice(originalTransactionParams, rate, newGasValues) {
69
+ if (newGasValues && 'gasPrice' in newGasValues) {
70
+ return newGasValues.gasPrice;
71
+ }
72
+ const currentGasPrice = originalTransactionParams.gasPrice;
73
+ if (!currentGasPrice || currentGasPrice === '0x0') {
74
+ return undefined;
75
+ }
76
+ return multiplyHex(currentGasPrice, rate);
77
+ }
78
+ /**
79
+ * Multiply a hex value by a multiplier.
80
+ * @param value - The hex value to multiply.
81
+ * @param multiplier - The multiplier.
82
+ * @returns The multiplied hex value.
83
+ */
84
+ function multiplyHex(value, multiplier) {
85
+ const decimalValue = (0, controller_utils_1.convertHexToDecimal)(value);
86
+ const decimalResult = parseInt(`${decimalValue * multiplier}`, 10);
87
+ return (0, utils_1.add0x)(decimalResult.toString(16));
88
+ }
89
+ //# sourceMappingURL=retry.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retry.cjs","sourceRoot":"","sources":["../../src/utils/retry.ts"],"names":[],"mappings":";;;AAAA,iEAAiE;AAEjE,2CAAwC;AAKxC;;;;;;GAMG;AACH,SAAgB,uCAAuC,CACrD,yBAA4C,EAC5C,IAAY,EACZ,YAAqD;IAErD,MAAM,WAAW,GAAG,oBAAoB,CACtC,yBAAyB,EACzB,IAAI,EACJ,YAAY,CACb,CAAC;IAEF,MAAM,aAAa,GAAG,sBAAsB,CAC1C,yBAAyB,EACzB,IAAI,EACJ,YAAY,CACb,CAAC;IAEF,IAAI,aAAa,EAAE;QACjB,MAAM,WAAW,GAAsB;YACrC,GAAG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AC,QAA2B,CAAC;IAE9E,IAAI,CAAC,eAAe,IAAI,eAAe,KAAK,KAAK,EAAE;QACjD,OAAO,SAAS,CAAC;KAClB;IAED,OAAO,WAAW,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;AAC5C,CAAC;AAED;;;;;GAKG;AACH,SAAS,WAAW,CAAC,KAAsB,EAAE,UAAkB;IAC7D,MAAM,YAAY,GAAG,IAAA,sCAAmB,EAAC,KAAK,CAAC,CAAC;IAChD,MAAM,aAAa,GAAG,QAAQ,CAAC,GAAG,YAAY,GAAG,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC;IAEnE,OAAO,IAAA,aAAK,EAAC,aAAa,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;AAC3C,CAAC","sourcesContent":["import { convertHexToDecimal } from '@metamask/controller-utils';\nimport type { Hex } from '@metamask/utils';\nimport { add0x } from '@metamask/utils';\n\nimport type { FeeMarketEIP1559Values, GasPriceValue } from '../types';\nimport { type TransactionParams } from '../types';\n\n/**\n * Returns new transaction parameters with increased gas fees.\n * @param originalTransactionParams - The original transaction parameters.\n * @param rate - The rate by which to increase the existing gas fee properties.\n * @param newGasValues - Optional new gas values to use instead of increased the existing values.\n * @returns The new transaction parameters with the increased gas fee properties.\n */\nexport function getTransactionParamsWithIncreasedGasFee(\n originalTransactionParams: TransactionParams,\n rate: number,\n newGasValues?: GasPriceValue | FeeMarketEIP1559Values,\n): TransactionParams {\n const newGasPrice = getIncreasedGasPrice(\n originalTransactionParams,\n rate,\n newGasValues,\n );\n\n const new1559Values = getIncreased1559Values(\n originalTransactionParams,\n rate,\n newGasValues,\n );\n\n if (new1559Values) {\n const newTxParams: TransactionParams = {\n ...originalTransactionParams,\n ...new1559Values,\n };\n\n delete newTxParams.gasPrice;\n\n return newTxParams;\n }\n\n if (newGasPrice) {\n const newTxParams: TransactionParams = {\n ...originalTransactionParams,\n gasPrice: newGasPrice,\n };\n\n delete newTxParams.maxFeePerGas;\n delete newTxParams.maxPriorityFeePerGas;\n\n return newTxParams;\n }\n\n throw new Error(\n 'Cannot increase gas fee as no current values and no new values were provided',\n );\n}\n\n/**\n * Generate the increased EIP-1559 gas properties.\n * @param originalTransactionParams - The original transaction parameters.\n * @param rate - The rate by which to increase the existing gas fee properties.\n * @param newGasValues - Optional new gas values to use instead of increased the existing values.\n * @returns The new EIP-1559 gas properties.\n */\nfunction getIncreased1559Values(\n originalTransactionParams: TransactionParams,\n rate: number,\n newGasValues?: GasPriceValue | FeeMarketEIP1559Values,\n): FeeMarketEIP1559Values | undefined {\n if (\n newGasValues &&\n 'maxFeePerGas' in newGasValues &&\n 'maxPriorityFeePerGas' in newGasValues\n ) {\n return newGasValues;\n }\n\n const currentMaxFeePerGas = originalTransactionParams.maxFeePerGas as\n | Hex\n | undefined;\n\n const currentMaxPriorityFeePerGas =\n originalTransactionParams.maxPriorityFeePerGas as Hex | undefined;\n\n if (\n !currentMaxFeePerGas ||\n !currentMaxPriorityFeePerGas ||\n currentMaxFeePerGas === '0x0' ||\n currentMaxPriorityFeePerGas === '0x0'\n ) {\n return undefined;\n }\n\n const maxFeePerGas = multiplyHex(currentMaxFeePerGas, rate);\n const maxPriorityFeePerGas = multiplyHex(currentMaxPriorityFeePerGas, rate);\n\n return { maxFeePerGas, maxPriorityFeePerGas };\n}\n\n/**\n * Generate the increased gas price.\n * @param originalTransactionParams - The original transaction parameters.\n * @param rate - The rate by which to increase the existing gas fee properties.\n * @param newGasValues - Optional new gas values to use instead of increased the existing values.\n * @returns The new gas price.\n */\nfunction getIncreasedGasPrice(\n originalTransactionParams: TransactionParams,\n rate: number,\n newGasValues?: GasPriceValue | FeeMarketEIP1559Values,\n): Hex | undefined {\n if (newGasValues && 'gasPrice' in newGasValues) {\n return newGasValues.gasPrice as Hex;\n }\n\n const currentGasPrice = originalTransactionParams.gasPrice as Hex | undefined;\n\n if (!currentGasPrice || currentGasPrice === '0x0') {\n return undefined;\n }\n\n return multiplyHex(currentGasPrice, rate);\n}\n\n/**\n * Multiply a hex value by a multiplier.\n * @param value - The hex value to multiply.\n * @param multiplier - The multiplier.\n * @returns The multiplied hex value.\n */\nfunction multiplyHex(value: Hex | undefined, multiplier: number): Hex {\n const decimalValue = convertHexToDecimal(value);\n const decimalResult = parseInt(`${decimalValue * multiplier}`, 10);\n\n return add0x(decimalResult.toString(16));\n}\n"]}
@@ -1,5 +1,5 @@
1
- import type { FeeMarketEIP1559Values, GasPriceValue } from '../types';
2
- import { type TransactionParams } from '../types';
1
+ import type { FeeMarketEIP1559Values, GasPriceValue } from "../types.cjs";
2
+ import { type TransactionParams } from "../types.cjs";
3
3
  /**
4
4
  * Returns new transaction parameters with increased gas fees.
5
5
  * @param originalTransactionParams - The original transaction parameters.
@@ -8,4 +8,4 @@ import { type TransactionParams } from '../types';
8
8
  * @returns The new transaction parameters with the increased gas fee properties.
9
9
  */
10
10
  export declare function getTransactionParamsWithIncreasedGasFee(originalTransactionParams: TransactionParams, rate: number, newGasValues?: GasPriceValue | FeeMarketEIP1559Values): TransactionParams;
11
- //# sourceMappingURL=retry.d.ts.map
11
+ //# sourceMappingURL=retry.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retry.d.cts","sourceRoot":"","sources":["../../src/utils/retry.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,sBAAsB,EAAE,aAAa,EAAE,qBAAiB;AACtE,OAAO,EAAE,KAAK,iBAAiB,EAAE,qBAAiB;AAElD;;;;;;GAMG;AACH,wBAAgB,uCAAuC,CACrD,yBAAyB,EAAE,iBAAiB,EAC5C,IAAI,EAAE,MAAM,EACZ,YAAY,CAAC,EAAE,aAAa,GAAG,sBAAsB,GACpD,iBAAiB,CAuCnB"}
@@ -0,0 +1,11 @@
1
+ import type { FeeMarketEIP1559Values, GasPriceValue } from "../types.mjs";
2
+ import { type TransactionParams } from "../types.mjs";
3
+ /**
4
+ * Returns new transaction parameters with increased gas fees.
5
+ * @param originalTransactionParams - The original transaction parameters.
6
+ * @param rate - The rate by which to increase the existing gas fee properties.
7
+ * @param newGasValues - Optional new gas values to use instead of increased the existing values.
8
+ * @returns The new transaction parameters with the increased gas fee properties.
9
+ */
10
+ export declare function getTransactionParamsWithIncreasedGasFee(originalTransactionParams: TransactionParams, rate: number, newGasValues?: GasPriceValue | FeeMarketEIP1559Values): TransactionParams;
11
+ //# sourceMappingURL=retry.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retry.d.mts","sourceRoot":"","sources":["../../src/utils/retry.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,sBAAsB,EAAE,aAAa,EAAE,qBAAiB;AACtE,OAAO,EAAE,KAAK,iBAAiB,EAAE,qBAAiB;AAElD;;;;;;GAMG;AACH,wBAAgB,uCAAuC,CACrD,yBAAyB,EAAE,iBAAiB,EAC5C,IAAI,EAAE,MAAM,EACZ,YAAY,CAAC,EAAE,aAAa,GAAG,sBAAsB,GACpD,iBAAiB,CAuCnB"}