@argent/x-shared 1.79.0 → 1.79.1

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 (501) hide show
  1. package/dist/.ts-temp/tsconfig.tsbuildinfo +1 -1
  2. package/dist/_virtual/_rolldown/runtime.cjs +1 -0
  3. package/dist/_virtual/_rolldown/runtime.js +20 -0
  4. package/dist/index.cjs +1 -1
  5. package/dist/index.js +112 -488
  6. package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/_shortw_utils.cjs +1 -1
  7. package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/_shortw_utils.js +11 -11
  8. package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/curve.cjs +1 -1
  9. package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/curve.js +62 -85
  10. package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/modular.cjs +1 -1
  11. package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/modular.js +153 -190
  12. package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/poseidon.cjs +1 -1
  13. package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/poseidon.js +56 -65
  14. package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/utils.cjs +1 -1
  15. package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/utils.js +125 -151
  16. package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/weierstrass.cjs +1 -1
  17. package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/weierstrass.js +470 -575
  18. package/dist/node_modules/.pnpm/@noble_hashes@1.3.0/node_modules/@noble/hashes/esm/_assert.cjs +1 -1
  19. package/dist/node_modules/.pnpm/@noble_hashes@1.3.0/node_modules/@noble/hashes/esm/_assert.js +26 -40
  20. package/dist/node_modules/.pnpm/@noble_hashes@1.3.0/node_modules/@noble/hashes/esm/crypto.cjs +1 -1
  21. package/dist/node_modules/.pnpm/@noble_hashes@1.3.0/node_modules/@noble/hashes/esm/crypto.js +4 -4
  22. package/dist/node_modules/.pnpm/@noble_hashes@1.3.0/node_modules/@noble/hashes/esm/hmac.cjs +1 -1
  23. package/dist/node_modules/.pnpm/@noble_hashes@1.3.0/node_modules/@noble/hashes/esm/hmac.js +38 -42
  24. package/dist/node_modules/.pnpm/@noble_hashes@1.3.0/node_modules/@noble/hashes/esm/utils.cjs +1 -1
  25. package/dist/node_modules/.pnpm/@noble_hashes@1.3.0/node_modules/@noble/hashes/esm/utils.js +28 -42
  26. package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/_assert.cjs +1 -1
  27. package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/_assert.js +17 -26
  28. package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/_sha2.cjs +1 -1
  29. package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/_sha2.js +52 -59
  30. package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/_u64.cjs +1 -1
  31. package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/_u64.js +20 -19
  32. package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/sha256.cjs +1 -1
  33. package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/sha256.js +118 -113
  34. package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/sha3.cjs +1 -1
  35. package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/sha3.js +95 -105
  36. package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/utils.cjs +1 -1
  37. package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/utils.js +26 -32
  38. package/dist/node_modules/.pnpm/@noble_hashes@2.0.0/node_modules/@noble/hashes/_md.cjs +1 -1
  39. package/dist/node_modules/.pnpm/@noble_hashes@2.0.0/node_modules/@noble/hashes/_md.js +71 -82
  40. package/dist/node_modules/.pnpm/@noble_hashes@2.0.0/node_modules/@noble/hashes/_u64.cjs +1 -1
  41. package/dist/node_modules/.pnpm/@noble_hashes@2.0.0/node_modules/@noble/hashes/_u64.js +20 -20
  42. package/dist/node_modules/.pnpm/@noble_hashes@2.0.0/node_modules/@noble/hashes/sha2.cjs +1 -1
  43. package/dist/node_modules/.pnpm/@noble_hashes@2.0.0/node_modules/@noble/hashes/sha2.js +125 -124
  44. package/dist/node_modules/.pnpm/@noble_hashes@2.0.0/node_modules/@noble/hashes/sha3.cjs +1 -1
  45. package/dist/node_modules/.pnpm/@noble_hashes@2.0.0/node_modules/@noble/hashes/sha3.js +102 -116
  46. package/dist/node_modules/.pnpm/@noble_hashes@2.0.0/node_modules/@noble/hashes/utils.cjs +1 -1
  47. package/dist/node_modules/.pnpm/@noble_hashes@2.0.0/node_modules/@noble/hashes/utils.js +62 -76
  48. package/dist/node_modules/.pnpm/bignumber.js@9.1.2/node_modules/bignumber.js/bignumber.cjs +1 -1
  49. package/dist/node_modules/.pnpm/bignumber.js@9.1.2/node_modules/bignumber.js/bignumber.js +519 -614
  50. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Hash.cjs +1 -1
  51. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Hash.js +15 -19
  52. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_ListCache.cjs +1 -1
  53. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_ListCache.js +15 -19
  54. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Map.cjs +1 -1
  55. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Map.js +6 -6
  56. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_MapCache.cjs +1 -1
  57. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_MapCache.js +15 -19
  58. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Set.cjs +1 -1
  59. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Set.js +5 -5
  60. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_SetCache.cjs +1 -1
  61. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_SetCache.js +10 -12
  62. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Symbol.cjs +1 -1
  63. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Symbol.js +5 -5
  64. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayIncludes.cjs +1 -1
  65. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayIncludes.js +6 -7
  66. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayIncludesWith.cjs +1 -1
  67. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayIncludesWith.js +6 -8
  68. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_assocIndexOf.cjs +1 -1
  69. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_assocIndexOf.js +7 -9
  70. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseFindIndex.cjs +1 -1
  71. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseFindIndex.js +6 -8
  72. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseGetTag.cjs +1 -1
  73. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseGetTag.js +9 -9
  74. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIndexOf.cjs +1 -1
  75. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIndexOf.js +7 -7
  76. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsNaN.cjs +1 -1
  77. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsNaN.js +5 -5
  78. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsNative.cjs +1 -1
  79. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsNative.js +10 -15
  80. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseUniq.cjs +1 -1
  81. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseUniq.js +26 -32
  82. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_cacheHas.cjs +1 -1
  83. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_cacheHas.js +5 -5
  84. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_coreJsData.cjs +1 -1
  85. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_coreJsData.js +5 -5
  86. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_createSet.cjs +1 -1
  87. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_createSet.js +7 -7
  88. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_freeGlobal.cjs +1 -1
  89. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_freeGlobal.js +4 -4
  90. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getMapData.cjs +1 -1
  91. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getMapData.js +6 -6
  92. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getNative.cjs +1 -1
  93. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getNative.js +8 -8
  94. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getRawTag.cjs +1 -1
  95. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getRawTag.js +12 -13
  96. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getValue.cjs +1 -1
  97. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getValue.js +5 -5
  98. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashClear.cjs +1 -1
  99. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashClear.js +6 -6
  100. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashDelete.cjs +1 -1
  101. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashDelete.js +6 -6
  102. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashGet.cjs +1 -1
  103. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashGet.js +11 -11
  104. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashHas.cjs +1 -1
  105. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashHas.js +8 -8
  106. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashSet.cjs +1 -1
  107. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashSet.js +7 -7
  108. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isKeyable.cjs +1 -1
  109. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isKeyable.js +6 -6
  110. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isMasked.cjs +1 -1
  111. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isMasked.js +9 -9
  112. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheClear.cjs +1 -1
  113. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheClear.js +5 -5
  114. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheDelete.cjs +1 -1
  115. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheDelete.js +8 -11
  116. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheGet.cjs +1 -1
  117. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheGet.js +7 -7
  118. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheHas.cjs +1 -1
  119. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheHas.js +6 -6
  120. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheSet.cjs +1 -1
  121. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheSet.js +6 -6
  122. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheClear.cjs +1 -1
  123. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheClear.js +11 -11
  124. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheDelete.cjs +1 -1
  125. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheDelete.js +7 -7
  126. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheGet.cjs +1 -1
  127. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheGet.js +6 -6
  128. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheHas.cjs +1 -1
  129. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheHas.js +6 -6
  130. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheSet.cjs +1 -1
  131. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheSet.js +7 -7
  132. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_nativeCreate.cjs +1 -1
  133. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_nativeCreate.js +4 -4
  134. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_objectToString.cjs +1 -1
  135. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_objectToString.js +6 -6
  136. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_root.cjs +1 -1
  137. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_root.js +4 -4
  138. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_setCacheAdd.cjs +1 -1
  139. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_setCacheAdd.js +6 -6
  140. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_setCacheHas.cjs +1 -1
  141. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_setCacheHas.js +5 -5
  142. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_setToArray.cjs +1 -1
  143. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_setToArray.js +8 -8
  144. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_strictIndexOf.cjs +1 -1
  145. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_strictIndexOf.js +6 -8
  146. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_toSource.cjs +1 -1
  147. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_toSource.js +14 -16
  148. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/eq.cjs +1 -1
  149. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/eq.js +5 -5
  150. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isFunction.cjs +1 -1
  151. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isFunction.js +10 -11
  152. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObject.cjs +1 -1
  153. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObject.js +6 -6
  154. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/noop.cjs +1 -1
  155. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/noop.js +4 -5
  156. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/uniqWith.cjs +1 -1
  157. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/uniqWith.js +6 -6
  158. package/dist/node_modules/.pnpm/micro-starknet@0.2.3/node_modules/micro-starknet/lib/esm/index.cjs +1 -1
  159. package/dist/node_modules/.pnpm/micro-starknet@0.2.3/node_modules/micro-starknet/lib/esm/index.js +121 -118
  160. package/dist/node_modules/.pnpm/numeral@2.0.6/node_modules/numeral/numeral.cjs +1 -1
  161. package/dist/node_modules/.pnpm/numeral@2.0.6/node_modules/numeral/numeral.js +377 -417
  162. package/dist/node_modules/.pnpm/semver@6.3.1/node_modules/semver/semver.cjs +1 -1
  163. package/dist/node_modules/.pnpm/semver@6.3.1/node_modules/semver/semver.js +546 -635
  164. package/dist/paymaster.cjs +1 -1
  165. package/dist/paymaster.js +2 -11
  166. package/dist/simulation.cjs +1 -1
  167. package/dist/simulation.js +22 -90
  168. package/dist/src/account/account.model.cjs +1 -1
  169. package/dist/src/account/account.model.js +58 -52
  170. package/dist/src/account/accountv4.cjs +1 -1
  171. package/dist/src/account/accountv4.js +9 -11
  172. package/dist/src/account/preferences.model.cjs +1 -1
  173. package/dist/src/account/preferences.model.js +12 -10
  174. package/dist/src/accountNameGenerator/colors.cjs +1 -1
  175. package/dist/src/accountNameGenerator/colors.js +24 -24
  176. package/dist/src/accountNameGenerator/index.cjs +1 -1
  177. package/dist/src/accountNameGenerator/index.js +23 -23
  178. package/dist/src/accountNameGenerator/x-names.json.cjs +1 -1
  179. package/dist/src/accountNameGenerator/x-names.json.js +1922 -7
  180. package/dist/src/assets/tokens.json.cjs +1 -1
  181. package/dist/src/assets/tokens.json.js +180 -180
  182. package/dist/src/backend/schema.cjs +1 -1
  183. package/dist/src/backend/schema.js +9 -12
  184. package/dist/src/backend/sessionKeys/schema.cjs +1 -1
  185. package/dist/src/backend/sessionKeys/schema.js +27 -30
  186. package/dist/src/bigdecimal/constants.cjs +1 -1
  187. package/dist/src/bigdecimal/constants.js +6 -3
  188. package/dist/src/bigdecimal/createUnitsSchema.cjs +1 -1
  189. package/dist/src/bigdecimal/createUnitsSchema.js +7 -7
  190. package/dist/src/bigdecimal/formatUnits.cjs +1 -1
  191. package/dist/src/bigdecimal/formatUnits.js +9 -10
  192. package/dist/src/bigdecimal/index.cjs +1 -1
  193. package/dist/src/bigdecimal/index.js +45 -41
  194. package/dist/src/bigdecimal/lib.cjs +1 -1
  195. package/dist/src/bigdecimal/lib.js +105 -117
  196. package/dist/src/bigdecimal/parseUnits.cjs +1 -1
  197. package/dist/src/bigdecimal/parseUnits.js +18 -21
  198. package/dist/src/bigdecimal/utils.cjs +1 -1
  199. package/dist/src/bigdecimal/utils.js +33 -30
  200. package/dist/src/cache/CacheService.cjs +1 -1
  201. package/dist/src/cache/CacheService.js +32 -36
  202. package/dist/src/chains/starknet/address.cjs +1 -1
  203. package/dist/src/chains/starknet/address.js +73 -117
  204. package/dist/src/chains/starknet/addressDomain.cjs +1 -1
  205. package/dist/src/chains/starknet/addressDomain.js +14 -29
  206. package/dist/src/chains/starknet/addressInput.cjs +1 -1
  207. package/dist/src/chains/starknet/addressInput.js +6 -7
  208. package/dist/src/chains/starknet/argentName.cjs +1 -1
  209. package/dist/src/chains/starknet/argentName.js +10 -14
  210. package/dist/src/chains/starknet/cairoVersionSchema.cjs +1 -1
  211. package/dist/src/chains/starknet/cairoVersionSchema.js +5 -5
  212. package/dist/src/chains/starknet/constants.cjs +1 -1
  213. package/dist/src/chains/starknet/constants.js +4 -10
  214. package/dist/src/chains/starknet/getAddressFromArgentName.cjs +1 -1
  215. package/dist/src/chains/starknet/getAddressFromArgentName.js +38 -46
  216. package/dist/src/chains/starknet/getAddressFromStarkName.cjs +1 -1
  217. package/dist/src/chains/starknet/getAddressFromStarkName.js +59 -66
  218. package/dist/src/chains/starknet/network.cjs +1 -1
  219. package/dist/src/chains/starknet/network.js +20 -26
  220. package/dist/src/chains/starknet/services/address/StarknetAddressService.cjs +1 -1
  221. package/dist/src/chains/starknet/services/address/StarknetAddressService.js +31 -36
  222. package/dist/src/chains/starknet/services/deploymentData/constants.cjs +1 -1
  223. package/dist/src/chains/starknet/services/deploymentData/constants.js +14 -21
  224. package/dist/src/chains/starknet/services/deploymentData/deploymentData.schema.cjs +1 -1
  225. package/dist/src/chains/starknet/services/deploymentData/deploymentData.schema.js +15 -17
  226. package/dist/src/chains/starknet/services/deploymentData/findImplementationForAccount.cjs +1 -1
  227. package/dist/src/chains/starknet/services/deploymentData/findImplementationForAccount.js +61 -65
  228. package/dist/src/chains/starknet/services/deploymentData/getAccountClassHash.cjs +1 -1
  229. package/dist/src/chains/starknet/services/deploymentData/getAccountClassHash.js +46 -65
  230. package/dist/src/chains/starknet/starknetId.cjs +1 -1
  231. package/dist/src/chains/starknet/starknetId.js +10 -14
  232. package/dist/src/currencyFetchService/CurrencyFetchService.cjs +1 -1
  233. package/dist/src/currencyFetchService/CurrencyFetchService.js +13 -18
  234. package/dist/src/currencyFetchService/types.ts.cjs +1 -1
  235. package/dist/src/currencyFetchService/types.ts.js +9 -12
  236. package/dist/src/errors/account.cjs +1 -1
  237. package/dist/src/errors/account.js +12 -13
  238. package/dist/src/errors/address.cjs +1 -1
  239. package/dist/src/errors/address.js +11 -12
  240. package/dist/src/errors/baseErrors.cjs +1 -1
  241. package/dist/src/errors/baseErrors.js +14 -14
  242. package/dist/src/errors/call.cjs +1 -1
  243. package/dist/src/errors/call.js +12 -13
  244. package/dist/src/errors/network.cjs +1 -1
  245. package/dist/src/errors/network.js +11 -12
  246. package/dist/src/errors/review.cjs +1 -1
  247. package/dist/src/errors/review.js +11 -12
  248. package/dist/src/errors/swap.cjs +1 -1
  249. package/dist/src/errors/swap.js +12 -13
  250. package/dist/src/features/paymaster/PaymasterService.cjs +1 -1
  251. package/dist/src/features/paymaster/PaymasterService.js +73 -87
  252. package/dist/src/features/paymaster/types.cjs +1 -1
  253. package/dist/src/features/paymaster/types.js +41 -51
  254. package/dist/src/features/simulation/activity/normalize.cjs +1 -1
  255. package/dist/src/features/simulation/activity/normalize.js +36 -38
  256. package/dist/src/features/simulation/activity/schema.cjs +1 -1
  257. package/dist/src/features/simulation/activity/schema.js +224 -250
  258. package/dist/src/features/simulation/activity/utils/createNativeActivity.cjs +1 -1
  259. package/dist/src/features/simulation/activity/utils/createNativeActivity.js +23 -27
  260. package/dist/src/features/simulation/activity/utils/getAnyActivityTitle.cjs +1 -1
  261. package/dist/src/features/simulation/activity/utils/getAnyActivityTitle.js +14 -21
  262. package/dist/src/features/simulation/activity/utils/getOverallLastModified.cjs +1 -1
  263. package/dist/src/features/simulation/activity/utils/getOverallLastModified.js +5 -5
  264. package/dist/src/features/simulation/activity/utils/hasDelegationActivity.cjs +1 -1
  265. package/dist/src/features/simulation/activity/utils/hasDelegationActivity.js +4 -4
  266. package/dist/src/features/simulation/activity/utils/isAddMultisigSignersActivity.cjs +1 -1
  267. package/dist/src/features/simulation/activity/utils/isAddMultisigSignersActivity.js +15 -19
  268. package/dist/src/features/simulation/activity/utils/isChangeMultisigThresholdActivity.cjs +1 -1
  269. package/dist/src/features/simulation/activity/utils/isChangeMultisigThresholdActivity.js +15 -19
  270. package/dist/src/features/simulation/activity/utils/isMulticallWithDeploymentActivity.cjs +1 -1
  271. package/dist/src/features/simulation/activity/utils/isMulticallWithDeploymentActivity.js +5 -5
  272. package/dist/src/features/simulation/activity/utils/isRejectOnChainActivity.cjs +1 -1
  273. package/dist/src/features/simulation/activity/utils/isRejectOnChainActivity.js +19 -21
  274. package/dist/src/features/simulation/activity/utils/isRemoveMultisigSignersActivity.cjs +1 -1
  275. package/dist/src/features/simulation/activity/utils/isRemoveMultisigSignersActivity.js +15 -19
  276. package/dist/src/features/simulation/activity/utils/isSwapActivity.cjs +1 -1
  277. package/dist/src/features/simulation/activity/utils/isSwapActivity.js +17 -18
  278. package/dist/src/features/simulation/activity/utils/isUpgradeActivity.cjs +1 -1
  279. package/dist/src/features/simulation/activity/utils/isUpgradeActivity.js +15 -19
  280. package/dist/src/features/simulation/activity/utils/parseAccountActivities.cjs +1 -1
  281. package/dist/src/features/simulation/activity/utils/parseAccountActivities.js +12 -12
  282. package/dist/src/features/simulation/activity/utils/parseFinanceActivities.cjs +1 -1
  283. package/dist/src/features/simulation/activity/utils/parseFinanceActivities.js +32 -32
  284. package/dist/src/features/simulation/fees/schema.cjs +1 -1
  285. package/dist/src/features/simulation/fees/schema.js +33 -47
  286. package/dist/src/features/simulation/transactionReview/getErrorMessageAndLabelFromSimulation.cjs +1 -1
  287. package/dist/src/features/simulation/transactionReview/getErrorMessageAndLabelFromSimulation.js +15 -17
  288. package/dist/src/features/simulation/transactionReview/getMessageFromSimulationError.cjs +1 -1
  289. package/dist/src/features/simulation/transactionReview/getMessageFromSimulationError.js +5 -5
  290. package/dist/src/features/simulation/transactionReview/schema.cjs +1 -1
  291. package/dist/src/features/simulation/transactionReview/schema.js +221 -242
  292. package/dist/src/features/simulation/warning/helper.cjs +1 -1
  293. package/dist/src/features/simulation/warning/helper.js +12 -11
  294. package/dist/src/features/simulation/warning/schema.cjs +1 -1
  295. package/dist/src/features/simulation/warning/schema.js +10 -11
  296. package/dist/src/features/swap/models/order.model.cjs +1 -1
  297. package/dist/src/features/swap/models/order.model.js +16 -19
  298. package/dist/src/features/swap/models/quote.model.cjs +1 -1
  299. package/dist/src/features/swap/models/quote.model.js +31 -35
  300. package/dist/src/features/swap/models/trade.model.cjs +1 -1
  301. package/dist/src/features/swap/models/trade.model.js +25 -27
  302. package/dist/src/features/swap/services/SwapSharedService.cjs +1 -1
  303. package/dist/src/features/swap/services/SwapSharedService.js +71 -75
  304. package/dist/src/features/swap/services/SwapTransactionService.cjs +1 -1
  305. package/dist/src/features/swap/services/SwapTransactionService.js +57 -63
  306. package/dist/src/features/swap/utils/slippage.cjs +1 -1
  307. package/dist/src/features/swap/utils/slippage.js +18 -25
  308. package/dist/src/features/swap/utils/totalFee.cjs +1 -1
  309. package/dist/src/features/swap/utils/totalFee.js +12 -12
  310. package/dist/src/http/DateService.cjs +1 -1
  311. package/dist/src/http/DateService.js +15 -18
  312. package/dist/src/http/HttpError.cjs +1 -1
  313. package/dist/src/http/HttpError.js +7 -7
  314. package/dist/src/http/HttpService.cjs +1 -1
  315. package/dist/src/http/HttpService.js +117 -134
  316. package/dist/src/http/IHttpService.cjs +1 -1
  317. package/dist/src/http/IHttpService.js +6 -6
  318. package/dist/src/http/SWRService.cjs +1 -1
  319. package/dist/src/http/SWRService.js +50 -57
  320. package/dist/src/http/fetcher.cjs +1 -1
  321. package/dist/src/http/fetcher.js +29 -35
  322. package/dist/src/http/time.cjs +1 -1
  323. package/dist/src/http/time.js +15 -18
  324. package/dist/src/knownDapps/KnownDappsBackendService.cjs +1 -1
  325. package/dist/src/knownDapps/KnownDappsBackendService.js +13 -14
  326. package/dist/src/knownDapps/schema.cjs +1 -1
  327. package/dist/src/knownDapps/schema.js +41 -44
  328. package/dist/src/knownDapps/utils/getDapplandUrl.cjs +1 -1
  329. package/dist/src/knownDapps/utils/getDapplandUrl.js +7 -8
  330. package/dist/src/nameResolution/ResolveNameService.cjs +1 -1
  331. package/dist/src/nameResolution/ResolveNameService.js +34 -41
  332. package/dist/src/nameResolution/schema.cjs +1 -1
  333. package/dist/src/nameResolution/schema.js +20 -25
  334. package/dist/src/nfts/BackendNftService.cjs +1 -1
  335. package/dist/src/nfts/BackendNftService.js +103 -116
  336. package/dist/src/nfts/BackendPaginationError.cjs +1 -1
  337. package/dist/src/nfts/BackendPaginationError.js +11 -12
  338. package/dist/src/nfts/utils.cjs +1 -1
  339. package/dist/src/nfts/utils.js +11 -14
  340. package/dist/src/onchainRecovery/OnchainRecoveryService.cjs +1 -1
  341. package/dist/src/onchainRecovery/OnchainRecoveryService.js +38 -68
  342. package/dist/src/onchainRecovery/schema.cjs +1 -1
  343. package/dist/src/onchainRecovery/schema.js +35 -49
  344. package/dist/src/platform/isBraveBrowser.cjs +1 -1
  345. package/dist/src/platform/isBraveBrowser.js +8 -10
  346. package/dist/src/platform/isBrowser.cjs +1 -1
  347. package/dist/src/platform/isBrowser.js +17 -22
  348. package/dist/src/signer/mergeOwnerGuardianSignatures.cjs +1 -1
  349. package/dist/src/signer/mergeOwnerGuardianSignatures.js +28 -30
  350. package/dist/src/signer/multisigner.cjs +1 -1
  351. package/dist/src/signer/multisigner.js +16 -17
  352. package/dist/src/signer/seedphrase.cjs +1 -1
  353. package/dist/src/signer/seedphrase.js +7 -7
  354. package/dist/src/staking/schema.cjs +1 -1
  355. package/dist/src/staking/schema.js +146 -162
  356. package/dist/src/storage/base.cjs +1 -1
  357. package/dist/src/storage/base.js +33 -34
  358. package/dist/src/storage/utils.cjs +1 -1
  359. package/dist/src/storage/utils.js +19 -28
  360. package/dist/src/tokens/balances.cjs +1 -1
  361. package/dist/src/tokens/balances.js +34 -38
  362. package/dist/src/tokens/constants.cjs +1 -1
  363. package/dist/src/tokens/constants.js +4 -4
  364. package/dist/src/tokens/convertCurrencyValueToTokenAmount.cjs +1 -1
  365. package/dist/src/tokens/convertCurrencyValueToTokenAmount.js +8 -9
  366. package/dist/src/tokens/convertTokenAmountToCurrencyValue.cjs +1 -1
  367. package/dist/src/tokens/convertTokenAmountToCurrencyValue.js +14 -15
  368. package/dist/src/tokens/convertTokenUnitAmountWithDecimals.cjs +1 -1
  369. package/dist/src/tokens/convertTokenUnitAmountWithDecimals.js +8 -9
  370. package/dist/src/tokens/ensureDecimals.cjs +1 -1
  371. package/dist/src/tokens/ensureDecimals.js +4 -4
  372. package/dist/src/tokens/getCurrencySymbol.cjs +1 -1
  373. package/dist/src/tokens/getCurrencySymbol.js +14 -14
  374. package/dist/src/tokens/isUnlimitedAmount.cjs +1 -1
  375. package/dist/src/tokens/isUnlimitedAmount.js +5 -5
  376. package/dist/src/tokens/prettifyCurrencyValue.cjs +1 -1
  377. package/dist/src/tokens/prettifyCurrencyValue.js +13 -14
  378. package/dist/src/tokens/prettifyTokenAmount.cjs +1 -1
  379. package/dist/src/tokens/prettifyTokenAmount.js +22 -22
  380. package/dist/src/tokens/service/implementation.cjs +1 -1
  381. package/dist/src/tokens/service/implementation.js +28 -40
  382. package/dist/src/tokens/service/tokenError.cjs +1 -1
  383. package/dist/src/tokens/service/tokenError.js +11 -12
  384. package/dist/src/tokens/service/types/backend.model.cjs +1 -1
  385. package/dist/src/tokens/service/types/backend.model.js +128 -163
  386. package/dist/src/tokens/service/types/defiPosition.model.cjs +1 -1
  387. package/dist/src/tokens/service/types/defiPosition.model.js +83 -99
  388. package/dist/src/tokens/service/types/defiPositionType.model.cjs +1 -1
  389. package/dist/src/tokens/service/types/defiPositionType.model.js +9 -9
  390. package/dist/src/tokens/service/types/unclaimedRewards.model.cjs +1 -1
  391. package/dist/src/tokens/service/types/unclaimedRewards.model.js +15 -16
  392. package/dist/src/tokens/service/types/webToken.model.cjs +1 -1
  393. package/dist/src/tokens/service/types/webToken.model.js +28 -51
  394. package/dist/src/tokens/utils.cjs +1 -1
  395. package/dist/src/tokens/utils.js +5 -9
  396. package/dist/src/transactions/amount.cjs +1 -1
  397. package/dist/src/transactions/amount.js +17 -24
  398. package/dist/src/transactions/buildTransactions.cjs +1 -1
  399. package/dist/src/transactions/buildTransactions.js +30 -33
  400. package/dist/src/transactions/errors.cjs +1 -1
  401. package/dist/src/transactions/errors.js +11 -18
  402. package/dist/src/transactions/estimate/adjustment.cjs +1 -1
  403. package/dist/src/transactions/estimate/adjustment.js +6 -6
  404. package/dist/src/transactions/estimate/argentMaxFee.cjs +1 -1
  405. package/dist/src/transactions/estimate/argentMaxFee.js +10 -13
  406. package/dist/src/transactions/estimate/error.cjs +1 -1
  407. package/dist/src/transactions/estimate/error.js +12 -13
  408. package/dist/src/transactions/estimate/model.cjs +1 -1
  409. package/dist/src/transactions/estimate/model.js +18 -13
  410. package/dist/src/transactions/estimate/utils.cjs +1 -1
  411. package/dist/src/transactions/estimate/utils.js +139 -172
  412. package/dist/src/transactions/findTransfersAndApprovals.cjs +1 -1
  413. package/dist/src/transactions/findTransfersAndApprovals.js +34 -30
  414. package/dist/src/transactions/getPrettyRcpError.cjs +1 -1
  415. package/dist/src/transactions/getPrettyRcpError.js +8 -10
  416. package/dist/src/transactions/service/implementation.cjs +1 -1
  417. package/dist/src/transactions/service/implementation.js +187 -208
  418. package/dist/src/transactions/service/types.cjs +1 -1
  419. package/dist/src/transactions/service/types.js +9 -9
  420. package/dist/src/transactions/service/utils.cjs +1 -1
  421. package/dist/src/transactions/service/utils.js +24 -25
  422. package/dist/src/transactions/transactionExecuteTypes.cjs +1 -1
  423. package/dist/src/transactions/transactionExecuteTypes.js +8 -9
  424. package/dist/src/transactions/transactionReviewTypes.cjs +1 -1
  425. package/dist/src/transactions/transactionReviewTypes.js +9 -9
  426. package/dist/src/transactions/transactionVersion.cjs +1 -1
  427. package/dist/src/transactions/transactionVersion.js +8 -13
  428. package/dist/src/transactions/txv3.cjs +1 -1
  429. package/dist/src/transactions/txv3.js +10 -11
  430. package/dist/src/utils/address.cjs +1 -1
  431. package/dist/src/utils/address.js +4 -4
  432. package/dist/src/utils/arrays.cjs +1 -1
  433. package/dist/src/utils/arrays.js +4 -4
  434. package/dist/src/utils/avatarImage.cjs +4 -4
  435. package/dist/src/utils/avatarImage.js +35 -40
  436. package/dist/src/utils/base58.cjs +1 -1
  437. package/dist/src/utils/base58.js +12 -15
  438. package/dist/src/utils/bigNumber.cjs +1 -1
  439. package/dist/src/utils/bigNumber.d.ts +1 -1
  440. package/dist/src/utils/bigNumber.js +5 -7
  441. package/dist/src/utils/bips.cjs +1 -1
  442. package/dist/src/utils/bips.js +12 -10
  443. package/dist/src/utils/daysBetween.cjs +1 -1
  444. package/dist/src/utils/daysBetween.js +6 -6
  445. package/dist/src/utils/env.cjs +1 -1
  446. package/dist/src/utils/env.js +4 -4
  447. package/dist/src/utils/hex.cjs +1 -1
  448. package/dist/src/utils/hex.js +7 -8
  449. package/dist/src/utils/id.cjs +1 -1
  450. package/dist/src/utils/id.js +7 -7
  451. package/dist/src/utils/initials.cjs +1 -1
  452. package/dist/src/utils/initials.js +12 -15
  453. package/dist/src/utils/isContractDeployed.cjs +1 -1
  454. package/dist/src/utils/isContractDeployed.js +9 -9
  455. package/dist/src/utils/nonNullable.cjs +1 -1
  456. package/dist/src/utils/nonNullable.js +6 -6
  457. package/dist/src/utils/number/abbreviateNumber.cjs +1 -1
  458. package/dist/src/utils/number/abbreviateNumber.js +13 -14
  459. package/dist/src/utils/number/isAllowedAddressHexInputValue.cjs +1 -1
  460. package/dist/src/utils/number/isAllowedAddressHexInputValue.js +4 -7
  461. package/dist/src/utils/number/isAllowedNumericInputValue.cjs +1 -1
  462. package/dist/src/utils/number/isAllowedNumericInputValue.js +5 -5
  463. package/dist/src/utils/number/isNumeric.cjs +1 -1
  464. package/dist/src/utils/number/isNumeric.js +4 -4
  465. package/dist/src/utils/number/prettifyNumber.cjs +1 -1
  466. package/dist/src/utils/number/prettifyNumber.js +65 -75
  467. package/dist/src/utils/parseAmount.cjs +1 -1
  468. package/dist/src/utils/parseAmount.js +10 -11
  469. package/dist/src/utils/pluralise.cjs +1 -1
  470. package/dist/src/utils/pluralise.js +4 -4
  471. package/dist/src/utils/readFileAsString.cjs +1 -1
  472. package/dist/src/utils/readFileAsString.js +6 -6
  473. package/dist/src/utils/retryUntilInitialised.cjs +1 -1
  474. package/dist/src/utils/retryUntilInitialised.js +21 -20
  475. package/dist/src/utils/schemas.cjs +1 -1
  476. package/dist/src/utils/schemas.js +29 -26
  477. package/dist/src/utils/starknet/starknet.cjs +1 -1
  478. package/dist/src/utils/starknet/starknet.js +64 -77
  479. package/dist/src/utils/starknet/starknetLibTypes.cjs +1 -1
  480. package/dist/src/utils/starknet/starknetLibTypes.js +7 -7
  481. package/dist/src/utils/starknet/starknetSchemas.cjs +1 -1
  482. package/dist/src/utils/starknet/starknetSchemas.js +84 -99
  483. package/dist/src/utils/transactions.cjs +1 -1
  484. package/dist/src/utils/transactions.js +10 -10
  485. package/dist/src/utils/url/urlWithQuery.cjs +1 -1
  486. package/dist/src/utils/url/urlWithQuery.js +8 -8
  487. package/dist/src/utils/voidify.cjs +1 -1
  488. package/dist/src/utils/voidify.js +7 -7
  489. package/dist/swap.cjs +1 -1
  490. package/dist/swap.js +8 -22
  491. package/package.json +15 -15
  492. package/dist/_virtual/_commonjsHelpers.cjs +0 -1
  493. package/dist/_virtual/_commonjsHelpers.js +0 -6
  494. package/dist/_virtual/numeral.cjs +0 -1
  495. package/dist/_virtual/numeral.js +0 -7
  496. package/dist/_virtual/numeral2.cjs +0 -1
  497. package/dist/_virtual/numeral2.js +0 -4
  498. package/dist/_virtual/semver.cjs +0 -1
  499. package/dist/_virtual/semver.js +0 -7
  500. package/dist/_virtual/semver2.cjs +0 -1
  501. package/dist/_virtual/semver2.js +0 -4
@@ -1,173 +1,140 @@
1
- import { isEmpty as y, partition as v } from "lodash-es";
2
- import { stark as P, num as n } from "starknet";
3
- import { calculateCubeRootAdjustment as T } from "./adjustment.js";
4
- import { argentMaxFee as B } from "./argentMaxFee.js";
5
- import { EstimateError as F } from "./error.js";
6
- import { STRK_TOKEN_ADDRESS as E } from "../../chains/starknet/constants.js";
7
- import { isEqualAddress as p } from "../../chains/starknet/address.js";
8
- const j = (e) => {
9
- const { transactions: t } = e;
10
- if (!t)
11
- throw new F({ code: "SIMULATE_AND_REVIEW_FAILED" });
12
- if (!Array.isArray(t))
13
- throw Error(`Unexpected simulation response. Expected array. Got ${typeof t}`);
14
- if (y(t))
15
- return [];
16
- if (t.length > 2)
17
- throw Error(`Unexpected simulation response length. Got ${t.length}`);
18
- const a = t.map((m) => {
19
- if (!m.simulation)
20
- throw new F({ code: "SIMULATE_AND_REVIEW_FAILED" });
21
- return {
22
- ...m.simulation,
23
- ...A(m.simulation.feeEstimations)
24
- };
25
- }), [s, o] = a.length === 1 ? [a[0], void 0] : [a[1], a[0]], r = h(s, o), i = G(s, o);
26
- return [...r, ...i];
27
- }, A = (e) => {
28
- const [t, a] = v(e, (s) => "unit" in s && s.unit === "FRI");
29
- return { nativeFeeEstimations: t, paymasterFeeEstimations: a };
30
- }, G = (e, t) => {
31
- if (!e)
32
- return [];
33
- if (!t)
34
- return e.paymasterFeeEstimations.map((o) => ({
35
- type: "paymaster",
36
- transactions: d(o),
37
- deployment: void 0
38
- }));
39
- const a = t.paymasterFeeEstimations, s = e.paymasterFeeEstimations;
40
- if (a.length !== s.length)
41
- throw Error("Deployment and transaction fee estimations length mismatch");
42
- return s.map((o, r) => ({
43
- type: "paymaster",
44
- transactions: d(o),
45
- deployment: d(a[r])
46
- }));
47
- }, h = (e, t) => {
48
- if (!e)
49
- return [];
50
- if (!t)
51
- return e.nativeFeeEstimations.map((o) => ({
52
- type: "native",
53
- transactions: g(o),
54
- deployment: void 0
55
- }));
56
- const a = t.nativeFeeEstimations, s = e.nativeFeeEstimations;
57
- if (a.length !== s.length)
58
- throw Error("Deployment and transaction fee estimations length mismatch");
59
- return s.map((o, r) => ({
60
- type: "native",
61
- transactions: g(o),
62
- deployment: g(a[r])
63
- }));
64
- }, d = (e) => ({
65
- feeTokenAddress: e.token.address,
66
- maxFee: BigInt(e.maxFee),
67
- overallFee: BigInt(e.overallFee),
68
- tip: e.defaultTip ? n.toBigInt(e.defaultTip) : void 0
69
- }), g = (e) => ({
70
- feeTokenAddress: E,
71
- overallFee: n.toBigInt(e.overallFee),
72
- l1Gas: {
73
- gasConsumed: n.toBigInt(e.resourceBounds.l1Gas.maxAmount),
74
- gasPrice: n.toBigInt(e.resourceBounds.l1Gas.maxPricePerUnit)
75
- },
76
- l1DataGas: {
77
- gasConsumed: n.toBigInt(e.resourceBounds.l1DataGas.maxAmount),
78
- gasPrice: n.toBigInt(e.resourceBounds.l1DataGas.maxPricePerUnit)
79
- },
80
- l2Gas: {
81
- gasConsumed: n.toBigInt(e.resourceBounds.l2Gas.maxAmount),
82
- gasPrice: n.toBigInt(e.resourceBounds.l2Gas.maxPricePerUnit)
83
- },
84
- tip: e.defaultTip ? n.toBigInt(e.defaultTip) : void 0
85
- }), W = (e) => {
86
- const { l1Gas: t, l2Gas: a, l1DataGas: s } = e.resourceBounds, o = t.maxAmount * t.maxPricePerUnit + a.maxAmount * a.maxPricePerUnit + s.maxAmount * s.maxPricePerUnit;
87
- return n.toBigInt(o);
88
- }, $ = (e) => {
89
- const { type: t, deployment: a, transactions: s } = e;
90
- if (t === "paymaster")
91
- return s.maxFee + (a?.maxFee ?? 0n);
92
- if (a && !p(a.feeTokenAddress, s.feeTokenAddress))
93
- throw Error("Cannot calculate estimated fees for different tokens");
94
- const o = !s.overallFee && !a?.overallFee, r = (u) => o ? w(u) : l(u), i = a ? r(a) : 0n, m = r(s);
95
- return i + m;
96
- }, K = (e) => e.transactions.overallFee ? e.transactions.overallFee + (e.deployment?.overallFee ?? 0n) : N(e), _ = (e = []) => e.filter((a) => a.type === "native"), O = (e) => e.filter((t) => t.type === "paymaster"), C = () => E, I = (e = [], t) => {
97
- const a = _(e).find((s) => p(s.transactions.feeTokenAddress, t));
98
- if (!a)
99
- throw Error(`No native estimated fee found for ${t}`);
100
- return a;
101
- }, D = (e = []) => {
102
- const t = C();
103
- return I(e, t);
104
- }, q = (e = []) => D(e), N = (e) => {
105
- if (e.deployment && !p(e.deployment.feeTokenAddress, e.transactions.feeTokenAddress))
106
- throw Error("Cannot calculate estimated fees for different tokens");
107
- const t = l(e.transactions), a = e.deployment ? l(e.deployment) : 0n;
108
- return t + a;
109
- }, l = (e) => {
110
- const { l1Gas: t, l2Gas: a, l1DataGas: s } = e;
111
- return t.gasConsumed * t.gasPrice + a.gasConsumed * a.gasPrice + s.gasConsumed * s.gasPrice;
112
- }, w = (e) => l(x(e)), x = (e, t = T) => {
113
- const a = 10000n, { l1Gas: s, l2Gas: o, l1DataGas: r } = e, i = s.gasConsumed * s.gasPrice + o.gasConsumed * o.gasPrice + r.gasConsumed * r.gasPrice;
114
- if (i < 0)
115
- throw Error("Cannot calculate max fee for negative fee");
116
- const m = n.toBigInt(B({ estimatedFee: i })), u = Number(m) / Number(i), f = t(u), c = BigInt(Math.trunc(f * Number(a)));
117
- return {
118
- ...e,
119
- l1Gas: {
120
- gasConsumed: s.gasConsumed * c / a,
121
- gasPrice: s.gasPrice * c / a
122
- },
123
- l2Gas: {
124
- gasConsumed: o.gasConsumed * c / a,
125
- gasPrice: o.gasPrice * c / a
126
- },
127
- l1DataGas: {
128
- gasConsumed: r.gasConsumed * c / a,
129
- gasPrice: r.gasPrice * c / a
130
- }
131
- };
132
- }, k = (e) => {
133
- const t = e.overallFee ? e : x(e);
134
- return {
135
- ...e,
136
- resourceBounds: {
137
- l1_gas: M(t.l1Gas),
138
- l2_gas: {
139
- max_amount: n.toHex(t.l2Gas.gasConsumed),
140
- max_price_per_unit: n.toHex(t.l2Gas.gasPrice)
141
- },
142
- l1_data_gas: {
143
- max_amount: n.toHex(t.l1DataGas.gasConsumed),
144
- max_price_per_unit: n.toHex(t.l1DataGas.gasPrice)
145
- }
146
- }
147
- };
148
- }, z = (e) => ({
149
- ...e,
150
- resourceBounds: P.resourceBoundsToBigInt(k(e).resourceBounds)
151
- }), M = (e) => ({
152
- max_amount: n.toHex(e.gasConsumed),
153
- max_price_per_unit: n.toHex(e.gasPrice)
1
+ import { isEqualAddress as e } from "../../chains/starknet/address.js";
2
+ import { STRK_TOKEN_ADDRESS as t } from "../../chains/starknet/constants.js";
3
+ import { argentMaxFee as n } from "./argentMaxFee.js";
4
+ import { EstimateError as r } from "./error.js";
5
+ import { calculateCubeRootAdjustment as i } from "./adjustment.js";
6
+ import { isEmpty as a, partition as o } from "lodash-es";
7
+ import { num as s, stark as c } from "starknet";
8
+ //#region src/transactions/estimate/utils.ts
9
+ var l = (e) => {
10
+ let { transactions: t } = e;
11
+ if (!t) throw new r({ code: "SIMULATE_AND_REVIEW_FAILED" });
12
+ if (!Array.isArray(t)) throw Error(`Unexpected simulation response. Expected array. Got ${typeof t}`);
13
+ if (a(t)) return [];
14
+ if (t.length > 2) throw Error(`Unexpected simulation response length. Got ${t.length}`);
15
+ let n = t.map((e) => {
16
+ if (!e.simulation) throw new r({ code: "SIMULATE_AND_REVIEW_FAILED" });
17
+ return {
18
+ ...e.simulation,
19
+ ...u(e.simulation.feeEstimations)
20
+ };
21
+ }), [i, o] = n.length === 1 ? [n[0], void 0] : [n[1], n[0]], s = f(i, o), c = d(i, o);
22
+ return [...s, ...c];
23
+ }, u = (e) => {
24
+ let [t, n] = o(e, (e) => "unit" in e && e.unit === "FRI");
25
+ return {
26
+ nativeFeeEstimations: t,
27
+ paymasterFeeEstimations: n
28
+ };
29
+ }, d = (e, t) => {
30
+ if (!e) return [];
31
+ if (!t) return e.paymasterFeeEstimations.map((e) => ({
32
+ type: "paymaster",
33
+ transactions: p(e),
34
+ deployment: void 0
35
+ }));
36
+ let n = t.paymasterFeeEstimations, r = e.paymasterFeeEstimations;
37
+ if (n.length !== r.length) throw Error("Deployment and transaction fee estimations length mismatch");
38
+ return r.map((e, t) => ({
39
+ type: "paymaster",
40
+ transactions: p(e),
41
+ deployment: p(n[t])
42
+ }));
43
+ }, f = (e, t) => {
44
+ if (!e) return [];
45
+ if (!t) return e.nativeFeeEstimations.map((e) => ({
46
+ type: "native",
47
+ transactions: m(e),
48
+ deployment: void 0
49
+ }));
50
+ let n = t.nativeFeeEstimations, r = e.nativeFeeEstimations;
51
+ if (n.length !== r.length) throw Error("Deployment and transaction fee estimations length mismatch");
52
+ return r.map((e, t) => ({
53
+ type: "native",
54
+ transactions: m(e),
55
+ deployment: m(n[t])
56
+ }));
57
+ }, p = (e) => ({
58
+ feeTokenAddress: e.token.address,
59
+ maxFee: BigInt(e.maxFee),
60
+ overallFee: BigInt(e.overallFee),
61
+ tip: e.defaultTip ? s.toBigInt(e.defaultTip) : void 0
62
+ }), m = (e) => ({
63
+ feeTokenAddress: t,
64
+ overallFee: s.toBigInt(e.overallFee),
65
+ l1Gas: {
66
+ gasConsumed: s.toBigInt(e.resourceBounds.l1Gas.maxAmount),
67
+ gasPrice: s.toBigInt(e.resourceBounds.l1Gas.maxPricePerUnit)
68
+ },
69
+ l1DataGas: {
70
+ gasConsumed: s.toBigInt(e.resourceBounds.l1DataGas.maxAmount),
71
+ gasPrice: s.toBigInt(e.resourceBounds.l1DataGas.maxPricePerUnit)
72
+ },
73
+ l2Gas: {
74
+ gasConsumed: s.toBigInt(e.resourceBounds.l2Gas.maxAmount),
75
+ gasPrice: s.toBigInt(e.resourceBounds.l2Gas.maxPricePerUnit)
76
+ },
77
+ tip: e.defaultTip ? s.toBigInt(e.defaultTip) : void 0
78
+ }), h = (e) => {
79
+ let { l1Gas: t, l2Gas: n, l1DataGas: r } = e.resourceBounds, i = t.maxAmount * t.maxPricePerUnit + n.maxAmount * n.maxPricePerUnit + r.maxAmount * r.maxPricePerUnit;
80
+ return s.toBigInt(i);
81
+ }, g = (t) => {
82
+ let { type: n, deployment: r, transactions: i } = t;
83
+ if (n === "paymaster") return i.maxFee + (r?.maxFee ?? 0n);
84
+ if (r && !e(r.feeTokenAddress, i.feeTokenAddress)) throw Error("Cannot calculate estimated fees for different tokens");
85
+ let a = !i.overallFee && !r?.overallFee, o = (e) => a ? E(e) : T(e);
86
+ return (r ? o(r) : 0n) + o(i);
87
+ }, _ = (e) => e.transactions.overallFee ? e.transactions.overallFee + (e.deployment?.overallFee ?? 0n) : w(e), v = (e = []) => e.filter((e) => e.type === "native"), y = (e) => e.filter((e) => e.type === "paymaster"), b = () => t, x = (t = [], n) => {
88
+ let r = v(t).find((t) => e(t.transactions.feeTokenAddress, n));
89
+ if (!r) throw Error(`No native estimated fee found for ${n}`);
90
+ return r;
91
+ }, S = (e = []) => x(e, b()), C = (e = []) => S(e), w = (t) => {
92
+ if (t.deployment && !e(t.deployment.feeTokenAddress, t.transactions.feeTokenAddress)) throw Error("Cannot calculate estimated fees for different tokens");
93
+ return T(t.transactions) + (t.deployment ? T(t.deployment) : 0n);
94
+ }, T = (e) => {
95
+ let { l1Gas: t, l2Gas: n, l1DataGas: r } = e;
96
+ return t.gasConsumed * t.gasPrice + n.gasConsumed * n.gasPrice + r.gasConsumed * r.gasPrice;
97
+ }, E = (e) => T(D(e)), D = (e, t = i) => {
98
+ let r = 10000n, { l1Gas: a, l2Gas: o, l1DataGas: c } = e, l = a.gasConsumed * a.gasPrice + o.gasConsumed * o.gasPrice + c.gasConsumed * c.gasPrice;
99
+ if (l < 0) throw Error("Cannot calculate max fee for negative fee");
100
+ let u = s.toBigInt(n({ estimatedFee: l })), d = t(Number(u) / Number(l)), f = BigInt(Math.trunc(d * Number(r)));
101
+ return {
102
+ ...e,
103
+ l1Gas: {
104
+ gasConsumed: a.gasConsumed * f / r,
105
+ gasPrice: a.gasPrice * f / r
106
+ },
107
+ l2Gas: {
108
+ gasConsumed: o.gasConsumed * f / r,
109
+ gasPrice: o.gasPrice * f / r
110
+ },
111
+ l1DataGas: {
112
+ gasConsumed: c.gasConsumed * f / r,
113
+ gasPrice: c.gasPrice * f / r
114
+ }
115
+ };
116
+ }, O = (e) => {
117
+ let t = e.overallFee ? e : D(e);
118
+ return {
119
+ ...e,
120
+ resourceBounds: {
121
+ l1_gas: A(t.l1Gas),
122
+ l2_gas: {
123
+ max_amount: s.toHex(t.l2Gas.gasConsumed),
124
+ max_price_per_unit: s.toHex(t.l2Gas.gasPrice)
125
+ },
126
+ l1_data_gas: {
127
+ max_amount: s.toHex(t.l1DataGas.gasConsumed),
128
+ max_price_per_unit: s.toHex(t.l1DataGas.gasPrice)
129
+ }
130
+ }
131
+ };
132
+ }, k = (e) => ({
133
+ ...e,
134
+ resourceBounds: c.resourceBoundsToBigInt(O(e).resourceBounds)
135
+ }), A = (e) => ({
136
+ max_amount: s.toHex(e.gasConsumed),
137
+ max_price_per_unit: s.toHex(e.gasPrice)
154
138
  });
155
- export {
156
- w as estimatedFeeToMaxFeeTotal,
157
- k as estimatedFeeToMaxResourceBounds,
158
- z as estimatedFeeToMaxResourceBoundsBN,
159
- l as estimatedFeeToTotal,
160
- $ as estimatedFeesToMaxFeeTotalV2,
161
- N as estimatedFeesToTotal,
162
- K as estimatedFeesToTotalWithOverallFee,
163
- O as filterPaymasterEstimatedFees,
164
- j as getEstimatedFeeFromSimulationAndRespectWatermarkFeeV2,
165
- I as getNativeEstimatedFeeByFeeToken,
166
- D as getNativeEstimatedFeeByTxVersion,
167
- q as getNativeEstimatedFeeForAccount,
168
- _ as getNativeEstimatedFees,
169
- h as getNativeFeeFromSimulation,
170
- C as getNativeFeeTokenAddress,
171
- G as getPaymasterFeeFromSimulation,
172
- W as toMaxFeeEstimation
173
- };
139
+ //#endregion
140
+ export { E as estimatedFeeToMaxFeeTotal, O as estimatedFeeToMaxResourceBounds, k as estimatedFeeToMaxResourceBoundsBN, T as estimatedFeeToTotal, g as estimatedFeesToMaxFeeTotalV2, w as estimatedFeesToTotal, _ as estimatedFeesToTotalWithOverallFee, y as filterPaymasterEstimatedFees, l as getEstimatedFeeFromSimulationAndRespectWatermarkFeeV2, x as getNativeEstimatedFeeByFeeToken, S as getNativeEstimatedFeeByTxVersion, C as getNativeEstimatedFeeForAccount, v as getNativeEstimatedFees, f as getNativeFeeFromSimulation, b as getNativeFeeTokenAddress, d as getPaymasterFeeFromSimulation, h as toMaxFeeEstimation };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("starknet"),c=require("../chains/starknet/address.cjs"),s={Transfer:t.hash.getSelectorFromName("Transfer"),Approval:t.hash.getSelectorFromName("Approval")},i=(l,r,a)=>{for(const o of l){const{events:f,internal_calls:n}=o;for(const e of f)for(const d of e.keys)d===s.Approval&&r.push({tokenAddress:c.addressSchema.parse(o.contract_address),owner:e.data[0],spender:e.data[1],value:t.uint256.uint256ToBN({low:e.data[2],high:e.data[3]}).toString()}),d===s.Transfer&&a.push({tokenAddress:c.addressSchema.parse(o.contract_address),from:e.data[0],to:e.data[1],value:t.uint256.uint256ToBN({low:e.data[2],high:e.data[3]}).toString()});n&&i(n,r,a)}return{approvals:r,transfers:a}};exports.EventsBySelector=s;exports.findTransfersAndApprovals=i;
1
+ require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../chains/starknet/address.cjs`);let t=require(`starknet`);var n={Transfer:t.hash.getSelectorFromName(`Transfer`),Approval:t.hash.getSelectorFromName(`Approval`)},r=(i,a,o)=>{for(let s of i){let{events:i,internal_calls:c}=s;for(let r of i)for(let i of r.keys)i===n.Approval&&a.push({tokenAddress:e.addressSchema.parse(s.contract_address),owner:r.data[0],spender:r.data[1],value:t.uint256.uint256ToBN({low:r.data[2],high:r.data[3]}).toString()}),i===n.Transfer&&o.push({tokenAddress:e.addressSchema.parse(s.contract_address),from:r.data[0],to:r.data[1],value:t.uint256.uint256ToBN({low:r.data[2],high:r.data[3]}).toString()});c&&r(c,a,o)}return{approvals:a,transfers:o}};exports.EventsBySelector=n,exports.findTransfersAndApprovals=r;
@@ -1,31 +1,35 @@
1
- import { hash as s, uint256 as d } from "starknet";
2
- import { addressSchema as c } from "../chains/starknet/address.js";
3
- const f = {
4
- Transfer: s.getSelectorFromName("Transfer"),
5
- // 0x99cd8bde557814842a3121e8ddfd433a539b8c9f14bf31ebf108d12e6196e9
6
- Approval: s.getSelectorFromName("Approval")
7
- // 0x134692b230b9e1ffa39098904722134159652b09c5bc41d88d6698779d228ff
8
- }, p = (i, e, o) => {
9
- for (const r of i) {
10
- const { events: l, internal_calls: a } = r;
11
- for (const t of l)
12
- for (const n of t.keys)
13
- n === f.Approval && e.push({
14
- tokenAddress: c.parse(r.contract_address),
15
- owner: t.data[0],
16
- spender: t.data[1],
17
- value: d.uint256ToBN({ low: t.data[2], high: t.data[3] }).toString()
18
- }), n === f.Transfer && o.push({
19
- tokenAddress: c.parse(r.contract_address),
20
- from: t.data[0],
21
- to: t.data[1],
22
- value: d.uint256ToBN({ low: t.data[2], high: t.data[3] }).toString()
23
- });
24
- a && p(a, e, o);
25
- }
26
- return { approvals: e, transfers: o };
27
- };
28
- export {
29
- f as EventsBySelector,
30
- p as findTransfersAndApprovals
1
+ import { addressSchema as e } from "../chains/starknet/address.js";
2
+ import { hash as t, uint256 as n } from "starknet";
3
+ //#region src/transactions/findTransfersAndApprovals.ts
4
+ var r = {
5
+ Transfer: t.getSelectorFromName("Transfer"),
6
+ Approval: t.getSelectorFromName("Approval")
7
+ }, i = (t, a, o) => {
8
+ for (let s of t) {
9
+ let { events: t, internal_calls: c } = s;
10
+ for (let i of t) for (let t of i.keys) t === r.Approval && a.push({
11
+ tokenAddress: e.parse(s.contract_address),
12
+ owner: i.data[0],
13
+ spender: i.data[1],
14
+ value: n.uint256ToBN({
15
+ low: i.data[2],
16
+ high: i.data[3]
17
+ }).toString()
18
+ }), t === r.Transfer && o.push({
19
+ tokenAddress: e.parse(s.contract_address),
20
+ from: i.data[0],
21
+ to: i.data[1],
22
+ value: n.uint256ToBN({
23
+ low: i.data[2],
24
+ high: i.data[3]
25
+ }).toString()
26
+ });
27
+ c && i(c, a, o);
28
+ }
29
+ return {
30
+ approvals: a,
31
+ transfers: o
32
+ };
31
33
  };
34
+ //#endregion
35
+ export { r as EventsBySelector, i as findTransfersAndApprovals };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("lodash-es"),c=/(0x[a-fA-F0-9]+)\s*\('(.*?)'\)/,o=r=>{if(!e.isString(r))return;const t=r.match(c);if(t&&!e.isEmpty(t[2]))return t[2]};exports.getPrettyRpcError=o;
1
+ require(`../../_virtual/_rolldown/runtime.cjs`);let e=require(`lodash-es`);var t=/(0x[a-fA-F0-9]+)\s*\('(.*?)'\)/,n=n=>{if(!(0,e.isString)(n))return;let r=n.match(t);if(r&&!(0,e.isEmpty)(r[2]))return r[2]};exports.getPrettyRpcError=n;
@@ -1,11 +1,9 @@
1
- import { isString as c, isEmpty as o } from "lodash-es";
2
- const e = /(0x[a-fA-F0-9]+)\s*\('(.*?)'\)/, i = (r) => {
3
- if (!c(r))
4
- return;
5
- const t = r.match(e);
6
- if (t && !o(t[2]))
7
- return t[2];
8
- };
9
- export {
10
- i as getPrettyRpcError
1
+ import { isEmpty as e, isString as t } from "lodash-es";
2
+ //#region src/transactions/getPrettyRcpError.ts
3
+ var n = /(0x[a-fA-F0-9]+)\s*\('(.*?)'\)/, r = (r) => {
4
+ if (!t(r)) return;
5
+ let i = r.match(n);
6
+ if (i && !e(i[2])) return i[2];
11
7
  };
8
+ //#endregion
9
+ export { r as getPrettyRpcError };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("starknet"),g=require("url-join"),l=require("../../errors/review.cjs"),y=require("./utils.cjs"),C=require("../../utils/url/urlWithQuery.cjs"),h=require("../../features/simulation/transactionReview/schema.cjs"),B=require("../estimate/utils.cjs"),v=require("../../utils/arrays.cjs");class F{constructor(e,a){this.apiBase=e,this.httpService=a}async getLabels(){const e=g(this.apiBase,"reviewer","labels");return await this.httpService.get(e)}async getWarnings(){const e=g(this.apiBase,"reviewer","warnings/reasons");return await this.httpService.get(e)}async simulateAndReview(e,a,c,i,o,t){const s=a.some(r=>r.type==="DEPLOY_ACCOUNT");try{if(!("getChainId"in e))throw new Error("MISSING_METHOD");const r=s?"0x0":await e.getNonce(),n=await e.getChainId(),u={transactions:a.map(d=>({...y.getPayloadFromTransaction({transaction:d,nonce:r,chainId:n,isDeploymentTransaction:s,appDomain:i,cairoVersion:e.cairoVersion,address:e.address}),type:d.type}))},m=g(this.apiBase,"reviewer","transactions","v2","review","starknet"),w=t?C.urlWithQuery(m,{delayedTransactions:"true"}):m,_=await this.httpService.post(w,{headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(u)},h.simulateAndReviewSchema);if(_.transactions?.some(d=>h.isTransactionSimulationError(d)))return _;const E=B.getEstimatedFeeFromSimulationAndRespectWatermarkFeeV2(_);return{..._,enrichedFeeEstimation:E}}catch(r){return console.error(r),this.fallbackToOnchainFeeEstimation({transactions:a,account:e,isDeploymentTransaction:s,feeTokenAddress:c,accountDeployTransaction:o})}}getCallsFromTx(e){let a;return e.calls&&(a=v.ensureArray(e.calls)),a}async fallbackToOnchainFeeEstimation({transactions:e,account:a,isDeploymentTransaction:c,feeTokenAddress:i,accountDeployTransaction:o}){try{const t=c?this.getCallsFromTx(e[1]):this.getCallsFromTx(e[0]);if(!t)throw new l.ReviewError({code:"NO_CALLS_FOUND"});const s=await this.fetchFeesOnchain({starknetAccount:a,calls:t,isDeployed:!c,feeTokenAddress:i,accountDeployTransaction:o});return{transactions:[],enrichedFeeEstimation:s,isBackendDown:!0}}catch(t){throw console.error(t),new l.ReviewError({message:`${t}`,code:"SIMULATE_AND_REVIEW_FAILED"})}}async fetchFeesOnchain({starknetAccount:e,calls:a,isDeployed:c,feeTokenAddress:i,accountDeployTransaction:o}){try{const t={type:"native",transactions:{feeTokenAddress:i,l1Gas:{gasConsumed:0n,gasPrice:0n},l2Gas:{gasConsumed:0n,gasPrice:0n},l1DataGas:{gasConsumed:0n,gasPrice:0n}}};if(!c&&o){if("estimateFeeBulk"in e){const s=[{type:p.TransactionType.DEPLOY_ACCOUNT,payload:{classHash:o.classHash,addressSalt:o.salt,constructorCalldata:o.calldata,contractAddress:e.address}},{type:p.TransactionType.INVOKE,payload:a}],[r,n]=await e.estimateFeeBulk(s).catch(u=>{throw console.error(u),u});if(!r.resourceBounds.l1_data_gas||!r.resourceBounds.l1_gas||!r.resourceBounds.l2_gas||!n.resourceBounds.l1_data_gas||!n.resourceBounds.l1_gas||!n.resourceBounds.l2_gas)throw new l.ReviewError({code:"ONCHAIN_FEE_ESTIMATION_FAILED",message:"Missing gas_consumed or gas_price"});t.deployment={feeTokenAddress:i,l1Gas:{gasConsumed:r.resourceBounds.l1_gas.max_amount,gasPrice:r.resourceBounds.l1_gas.max_price_per_unit},l2Gas:{gasConsumed:r.resourceBounds.l2_gas.max_amount,gasPrice:r.resourceBounds.l2_gas.max_price_per_unit},l1DataGas:{gasConsumed:r.resourceBounds.l1_data_gas.max_amount,gasPrice:r.resourceBounds.l1_data_gas.max_price_per_unit}},t.transactions={feeTokenAddress:i,l1Gas:{gasConsumed:n.resourceBounds.l1_gas.max_amount,gasPrice:n.resourceBounds.l1_gas.max_price_per_unit},l2Gas:{gasConsumed:n.resourceBounds.l2_gas.max_amount,gasPrice:n.resourceBounds.l2_gas.max_price_per_unit},l1DataGas:{gasConsumed:n.resourceBounds.l1_data_gas.max_amount,gasPrice:n.resourceBounds.l1_data_gas.max_price_per_unit}}}}else{const{resourceBounds:s}=await e.estimateInvokeFee(a);if(!s.l1_gas||!s.l2_gas||!s.l1_data_gas)throw new l.ReviewError({code:"ONCHAIN_FEE_ESTIMATION_FAILED",message:"Missing gas_consumed or gas_price"});t.transactions={feeTokenAddress:i,l1Gas:{gasConsumed:s.l1_gas.max_amount,gasPrice:s.l1_gas.max_price_per_unit},l2Gas:{gasConsumed:s.l2_gas.max_amount,gasPrice:s.l2_gas.max_price_per_unit},l1DataGas:{gasConsumed:s.l1_data_gas.max_amount,gasPrice:s.l1_data_gas.max_price_per_unit}}}return[t]}catch(t){throw new l.ReviewError({code:"ONCHAIN_FEE_ESTIMATION_FAILED",message:`${t}`})}}}exports.TransactionReviewServiceWeb=F;
1
+ const e=require(`../../../_virtual/_rolldown/runtime.cjs`),t=require(`../../utils/arrays.cjs`),n=require(`../../utils/url/urlWithQuery.cjs`),r=require(`../estimate/utils.cjs`),i=require(`../../errors/review.cjs`),a=require(`../../features/simulation/transactionReview/schema.cjs`),o=require(`./utils.cjs`);let s=require(`starknet`),c=require(`url-join`);c=e.__toESM(c);var l=class{constructor(e,t){this.apiBase=e,this.httpService=t}async getLabels(){let e=(0,c.default)(this.apiBase,`reviewer`,`labels`);return await this.httpService.get(e)}async getWarnings(){let e=(0,c.default)(this.apiBase,`reviewer`,`warnings/reasons`);return await this.httpService.get(e)}async simulateAndReview(e,t,i,s,l,u){let d=t.some(e=>e.type===`DEPLOY_ACCOUNT`);try{if(!(`getChainId`in e))throw Error(`MISSING_METHOD`);let i=d?`0x0`:await e.getNonce(),l=await e.getChainId(),f={transactions:t.map(t=>({...o.getPayloadFromTransaction({transaction:t,nonce:i,chainId:l,isDeploymentTransaction:d,appDomain:s,cairoVersion:e.cairoVersion,address:e.address}),type:t.type}))},p=(0,c.default)(this.apiBase,`reviewer`,`transactions`,`v2`,`review`,`starknet`),m=u?n.urlWithQuery(p,{delayedTransactions:`true`}):p,h=await this.httpService.post(m,{headers:{Accept:`application/json`,"Content-Type":`application/json`},body:JSON.stringify(f)},a.simulateAndReviewSchema);if(h.transactions?.some(e=>a.isTransactionSimulationError(e)))return h;let g=r.getEstimatedFeeFromSimulationAndRespectWatermarkFeeV2(h);return{...h,enrichedFeeEstimation:g}}catch(n){return console.error(n),this.fallbackToOnchainFeeEstimation({transactions:t,account:e,isDeploymentTransaction:d,feeTokenAddress:i,accountDeployTransaction:l})}}getCallsFromTx(e){let n;return e.calls&&(n=t.ensureArray(e.calls)),n}async fallbackToOnchainFeeEstimation({transactions:e,account:t,isDeploymentTransaction:n,feeTokenAddress:r,accountDeployTransaction:a}){try{let o=n?this.getCallsFromTx(e[1]):this.getCallsFromTx(e[0]);if(!o)throw new i.ReviewError({code:`NO_CALLS_FOUND`});return{transactions:[],enrichedFeeEstimation:await this.fetchFeesOnchain({starknetAccount:t,calls:o,isDeployed:!n,feeTokenAddress:r,accountDeployTransaction:a}),isBackendDown:!0}}catch(e){throw console.error(e),new i.ReviewError({message:`${e}`,code:`SIMULATE_AND_REVIEW_FAILED`})}}async fetchFeesOnchain({starknetAccount:e,calls:t,isDeployed:n,feeTokenAddress:r,accountDeployTransaction:a}){try{let o={type:`native`,transactions:{feeTokenAddress:r,l1Gas:{gasConsumed:0n,gasPrice:0n},l2Gas:{gasConsumed:0n,gasPrice:0n},l1DataGas:{gasConsumed:0n,gasPrice:0n}}};if(!n&&a){if(`estimateFeeBulk`in e){let n=[{type:s.TransactionType.DEPLOY_ACCOUNT,payload:{classHash:a.classHash,addressSalt:a.salt,constructorCalldata:a.calldata,contractAddress:e.address}},{type:s.TransactionType.INVOKE,payload:t}],[c,l]=await e.estimateFeeBulk(n).catch(e=>{throw console.error(e),e});if(!c.resourceBounds.l1_data_gas||!c.resourceBounds.l1_gas||!c.resourceBounds.l2_gas||!l.resourceBounds.l1_data_gas||!l.resourceBounds.l1_gas||!l.resourceBounds.l2_gas)throw new i.ReviewError({code:`ONCHAIN_FEE_ESTIMATION_FAILED`,message:`Missing gas_consumed or gas_price`});o.deployment={feeTokenAddress:r,l1Gas:{gasConsumed:c.resourceBounds.l1_gas.max_amount,gasPrice:c.resourceBounds.l1_gas.max_price_per_unit},l2Gas:{gasConsumed:c.resourceBounds.l2_gas.max_amount,gasPrice:c.resourceBounds.l2_gas.max_price_per_unit},l1DataGas:{gasConsumed:c.resourceBounds.l1_data_gas.max_amount,gasPrice:c.resourceBounds.l1_data_gas.max_price_per_unit}},o.transactions={feeTokenAddress:r,l1Gas:{gasConsumed:l.resourceBounds.l1_gas.max_amount,gasPrice:l.resourceBounds.l1_gas.max_price_per_unit},l2Gas:{gasConsumed:l.resourceBounds.l2_gas.max_amount,gasPrice:l.resourceBounds.l2_gas.max_price_per_unit},l1DataGas:{gasConsumed:l.resourceBounds.l1_data_gas.max_amount,gasPrice:l.resourceBounds.l1_data_gas.max_price_per_unit}}}}else{let{resourceBounds:n}=await e.estimateInvokeFee(t);if(!n.l1_gas||!n.l2_gas||!n.l1_data_gas)throw new i.ReviewError({code:`ONCHAIN_FEE_ESTIMATION_FAILED`,message:`Missing gas_consumed or gas_price`});o.transactions={feeTokenAddress:r,l1Gas:{gasConsumed:n.l1_gas.max_amount,gasPrice:n.l1_gas.max_price_per_unit},l2Gas:{gasConsumed:n.l2_gas.max_amount,gasPrice:n.l2_gas.max_price_per_unit},l1DataGas:{gasConsumed:n.l1_data_gas.max_amount,gasPrice:n.l1_data_gas.max_price_per_unit}}}return[o]}catch(e){throw new i.ReviewError({code:`ONCHAIN_FEE_ESTIMATION_FAILED`,message:`${e}`})}}};exports.TransactionReviewServiceWeb=l;