@argent/x-shared 1.79.0 → 1.79.2

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 (502) 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 +20 -19
  492. package/dist/.eslintrc.d.cts +0 -39
  493. package/dist/_virtual/_commonjsHelpers.cjs +0 -1
  494. package/dist/_virtual/_commonjsHelpers.js +0 -6
  495. package/dist/_virtual/numeral.cjs +0 -1
  496. package/dist/_virtual/numeral.js +0 -7
  497. package/dist/_virtual/numeral2.cjs +0 -1
  498. package/dist/_virtual/numeral2.js +0 -4
  499. package/dist/_virtual/semver.cjs +0 -1
  500. package/dist/_virtual/semver.js +0 -7
  501. package/dist/_virtual/semver2.cjs +0 -1
  502. package/dist/_virtual/semver2.js +0 -4
@@ -1,579 +1,474 @@
1
- import { mod as ut, hashToPrivateScalar as dt, invert as ht } from "./modular.js";
2
- import * as mt from "./utils.js";
3
- import { bytesToNumberBE as _, bitMask as yt, validateObject as lt, concatBytes as et, numberToBytesBE as rt, ensureBytes as Y, bytesToHex as nt, hexToBytes as at, createHmacDrbg as pt } from "./utils.js";
4
- import { validateBasic as ft, wNAF as wt } from "./curve.js";
5
- function Et(B) {
6
- const n = ft(B);
7
- lt(n, {
8
- a: "field",
9
- b: "field"
10
- }, {
11
- allowedPrivateKeyLengths: "array",
12
- wrapPrivateKey: "boolean",
13
- isTorsionFree: "function",
14
- clearCofactor: "function",
15
- allowInfinityPoint: "boolean",
16
- fromBytes: "function",
17
- toBytes: "function"
18
- });
19
- const { endo: t, Fp: v, a: A } = n;
20
- if (t) {
21
- if (!v.eql(A, v.ZERO))
22
- throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");
23
- if (typeof t != "object" || typeof t.beta != "bigint" || typeof t.splitScalar != "function")
24
- throw new Error("Expected endomorphism with beta: bigint and splitScalar: function");
25
- }
26
- return Object.freeze({ ...n });
1
+ import { bitMask as e, bytesToHex as t, bytesToNumberBE as n, concatBytes as r, createHmacDrbg as i, ensureBytes as a, hexToBytes as o, numberToBytesBE as s, utils_exports as c, validateObject as l } from "./utils.js";
2
+ import { hashToPrivateScalar as u, invert as d, mod as f } from "./modular.js";
3
+ import { validateBasic as p, wNAF as m } from "./curve.js";
4
+ //#region node_modules/.pnpm/@noble+curves@1.0.0/node_modules/@noble/curves/esm/abstract/weierstrass.js
5
+ function h(e) {
6
+ let t = p(e);
7
+ l(t, {
8
+ a: "field",
9
+ b: "field"
10
+ }, {
11
+ allowedPrivateKeyLengths: "array",
12
+ wrapPrivateKey: "boolean",
13
+ isTorsionFree: "function",
14
+ clearCofactor: "function",
15
+ allowInfinityPoint: "boolean",
16
+ fromBytes: "function",
17
+ toBytes: "function"
18
+ });
19
+ let { endo: n, Fp: r, a: i } = t;
20
+ if (n) {
21
+ if (!r.eql(i, r.ZERO)) throw Error("Endomorphism can only be defined for Koblitz curves that have a=0");
22
+ if (typeof n != "object" || typeof n.beta != "bigint" || typeof n.splitScalar != "function") throw Error("Expected endomorphism with beta: bigint and splitScalar: function");
23
+ }
24
+ return Object.freeze({ ...t });
27
25
  }
28
- const { bytesToNumberBE: gt, hexToBytes: bt } = mt, k = {
29
- // asn.1 DER encoding utils
30
- Err: class extends Error {
31
- constructor(n = "") {
32
- super(n);
33
- }
34
- },
35
- _parseInt(B) {
36
- const { Err: n } = k;
37
- if (B.length < 2 || B[0] !== 2)
38
- throw new n("Invalid signature integer tag");
39
- const t = B[1], v = B.subarray(2, t + 2);
40
- if (!t || v.length !== t)
41
- throw new n("Invalid signature integer: wrong length");
42
- if (v[0] & 128)
43
- throw new n("Invalid signature integer: negative");
44
- if (v[0] === 0 && !(v[1] & 128))
45
- throw new n("Invalid signature integer: unnecessary leading zero");
46
- return { d: gt(v), l: B.subarray(t + 2) };
47
- },
48
- toSig(B) {
49
- const { Err: n } = k, t = typeof B == "string" ? bt(B) : B;
50
- if (!(t instanceof Uint8Array))
51
- throw new Error("ui8a expected");
52
- let v = t.length;
53
- if (v < 2 || t[0] != 48)
54
- throw new n("Invalid signature tag");
55
- if (t[1] !== v - 2)
56
- throw new n("Invalid signature: incorrect length");
57
- const { d: A, l: O } = k._parseInt(t.subarray(2)), { d: F, l: S } = k._parseInt(O);
58
- if (S.length)
59
- throw new n("Invalid signature: left bytes after parsing");
60
- return { r: A, s: F };
61
- },
62
- hexFromSig(B) {
63
- const n = (x) => Number.parseInt(x[0], 16) & 8 ? "00" + x : x, t = (x) => {
64
- const U = x.toString(16);
65
- return U.length & 1 ? `0${U}` : U;
66
- }, v = n(t(B.s)), A = n(t(B.r)), O = v.length / 2, F = A.length / 2, S = t(O), P = t(F);
67
- return `30${t(F + O + 4)}02${P}${A}02${S}${v}`;
68
- }
69
- }, L = BigInt(0), z = BigInt(1);
70
- BigInt(2);
71
- const ct = BigInt(3);
72
- BigInt(4);
73
- function Bt(B) {
74
- const n = Et(B), { Fp: t } = n, v = n.toBytes || ((m, e, i) => {
75
- const s = e.toAffine();
76
- return et(Uint8Array.from([4]), t.toBytes(s.x), t.toBytes(s.y));
77
- }), A = n.fromBytes || ((m) => {
78
- const e = m.subarray(1), i = t.fromBytes(e.subarray(0, t.BYTES)), s = t.fromBytes(e.subarray(t.BYTES, 2 * t.BYTES));
79
- return { x: i, y: s };
80
- });
81
- function O(m) {
82
- const { a: e, b: i } = n, s = t.sqr(m), u = t.mul(s, m);
83
- return t.add(t.add(u, t.mul(m, e)), i);
84
- }
85
- if (!t.eql(t.sqr(n.Gy), O(n.Gx)))
86
- throw new Error("bad generator point: equation left != right");
87
- function F(m) {
88
- return typeof m == "bigint" && L < m && m < n.n;
89
- }
90
- function S(m) {
91
- if (!F(m))
92
- throw new Error("Expected valid bigint: 0 < bigint < curve.n");
93
- }
94
- function P(m) {
95
- const { allowedPrivateKeyLengths: e, nByteLength: i, wrapPrivateKey: s, n: u } = n;
96
- if (e && typeof m != "bigint") {
97
- if (m instanceof Uint8Array && (m = nt(m)), typeof m != "string" || !e.includes(m.length))
98
- throw new Error("Invalid key");
99
- m = m.padStart(i * 2, "0");
100
- }
101
- let f;
102
- try {
103
- f = typeof m == "bigint" ? m : _(Y("private key", m, i));
104
- } catch {
105
- throw new Error(`private key must be ${i} bytes, hex or bigint, not ${typeof m}`);
106
- }
107
- return s && (f = ut(f, u)), S(f), f;
108
- }
109
- const x = /* @__PURE__ */ new Map();
110
- function U(m) {
111
- if (!(m instanceof y))
112
- throw new Error("ProjectivePoint expected");
113
- }
114
- class y {
115
- constructor(e, i, s) {
116
- if (this.px = e, this.py = i, this.pz = s, e == null || !t.isValid(e))
117
- throw new Error("x required");
118
- if (i == null || !t.isValid(i))
119
- throw new Error("y required");
120
- if (s == null || !t.isValid(s))
121
- throw new Error("z required");
122
- }
123
- // Does not validate if the point is on-curve.
124
- // Use fromHex instead, or call assertValidity() later.
125
- static fromAffine(e) {
126
- const { x: i, y: s } = e || {};
127
- if (!e || !t.isValid(i) || !t.isValid(s))
128
- throw new Error("invalid affine point");
129
- if (e instanceof y)
130
- throw new Error("projective point not allowed");
131
- const u = (f) => t.eql(f, t.ZERO);
132
- return u(i) && u(s) ? y.ZERO : new y(i, s, t.ONE);
133
- }
134
- get x() {
135
- return this.toAffine().x;
136
- }
137
- get y() {
138
- return this.toAffine().y;
139
- }
140
- /**
141
- * Takes a bunch of Projective Points but executes only one
142
- * inversion on all of them. Inversion is very slow operation,
143
- * so this improves performance massively.
144
- * Optimization: converts a list of projective points to a list of identical points with Z=1.
145
- */
146
- static normalizeZ(e) {
147
- const i = t.invertBatch(e.map((s) => s.pz));
148
- return e.map((s, u) => s.toAffine(i[u])).map(y.fromAffine);
149
- }
150
- /**
151
- * Converts hash string or Uint8Array to Point.
152
- * @param hex short/long ECDSA hex
153
- */
154
- static fromHex(e) {
155
- const i = y.fromAffine(A(Y("pointHex", e)));
156
- return i.assertValidity(), i;
157
- }
158
- // Multiplies generator point by privateKey.
159
- static fromPrivateKey(e) {
160
- return y.BASE.multiply(P(e));
161
- }
162
- // "Private method", don't use it directly
163
- _setWindowSize(e) {
164
- this._WINDOW_SIZE = e, x.delete(this);
165
- }
166
- // A point on curve is valid if it conforms to equation.
167
- assertValidity() {
168
- if (this.is0()) {
169
- if (n.allowInfinityPoint)
170
- return;
171
- throw new Error("bad point: ZERO");
172
- }
173
- const { x: e, y: i } = this.toAffine();
174
- if (!t.isValid(e) || !t.isValid(i))
175
- throw new Error("bad point: x or y not FE");
176
- const s = t.sqr(i), u = O(e);
177
- if (!t.eql(s, u))
178
- throw new Error("bad point: equation left != right");
179
- if (!this.isTorsionFree())
180
- throw new Error("bad point: not in prime-order subgroup");
181
- }
182
- hasEvenY() {
183
- const { y: e } = this.toAffine();
184
- if (t.isOdd)
185
- return !t.isOdd(e);
186
- throw new Error("Field doesn't support isOdd");
187
- }
188
- /**
189
- * Compare one point to another.
190
- */
191
- equals(e) {
192
- U(e);
193
- const { px: i, py: s, pz: u } = this, { px: f, py: E, pz: h } = e, a = t.eql(t.mul(i, h), t.mul(f, u)), c = t.eql(t.mul(s, h), t.mul(E, u));
194
- return a && c;
195
- }
196
- /**
197
- * Flips point to one corresponding to (x, -y) in Affine coordinates.
198
- */
199
- negate() {
200
- return new y(this.px, t.neg(this.py), this.pz);
201
- }
202
- // Renes-Costello-Batina exception-free doubling formula.
203
- // There is 30% faster Jacobian formula, but it is not complete.
204
- // https://eprint.iacr.org/2015/1060, algorithm 3
205
- // Cost: 8M + 3S + 3*a + 2*b3 + 15add.
206
- double() {
207
- const { a: e, b: i } = n, s = t.mul(i, ct), { px: u, py: f, pz: E } = this;
208
- let h = t.ZERO, a = t.ZERO, c = t.ZERO, d = t.mul(u, u), N = t.mul(f, f), b = t.mul(E, E), p = t.mul(u, f);
209
- return p = t.add(p, p), c = t.mul(u, E), c = t.add(c, c), h = t.mul(e, c), a = t.mul(s, b), a = t.add(h, a), h = t.sub(N, a), a = t.add(N, a), a = t.mul(h, a), h = t.mul(p, h), c = t.mul(s, c), b = t.mul(e, b), p = t.sub(d, b), p = t.mul(e, p), p = t.add(p, c), c = t.add(d, d), d = t.add(c, d), d = t.add(d, b), d = t.mul(d, p), a = t.add(a, d), b = t.mul(f, E), b = t.add(b, b), d = t.mul(b, p), h = t.sub(h, d), c = t.mul(b, N), c = t.add(c, c), c = t.add(c, c), new y(h, a, c);
210
- }
211
- // Renes-Costello-Batina exception-free addition formula.
212
- // There is 30% faster Jacobian formula, but it is not complete.
213
- // https://eprint.iacr.org/2015/1060, algorithm 1
214
- // Cost: 12M + 0S + 3*a + 3*b3 + 23add.
215
- add(e) {
216
- U(e);
217
- const { px: i, py: s, pz: u } = this, { px: f, py: E, pz: h } = e;
218
- let a = t.ZERO, c = t.ZERO, d = t.ZERO;
219
- const N = n.a, b = t.mul(n.b, ct);
220
- let p = t.mul(i, f), T = t.mul(s, E), Z = t.mul(u, h), H = t.add(i, s), r = t.add(f, E);
221
- H = t.mul(H, r), r = t.add(p, T), H = t.sub(H, r), r = t.add(i, u);
222
- let o = t.add(f, h);
223
- return r = t.mul(r, o), o = t.add(p, Z), r = t.sub(r, o), o = t.add(s, u), a = t.add(E, h), o = t.mul(o, a), a = t.add(T, Z), o = t.sub(o, a), d = t.mul(N, r), a = t.mul(b, Z), d = t.add(a, d), a = t.sub(T, d), d = t.add(T, d), c = t.mul(a, d), T = t.add(p, p), T = t.add(T, p), Z = t.mul(N, Z), r = t.mul(b, r), T = t.add(T, Z), Z = t.sub(p, Z), Z = t.mul(N, Z), r = t.add(r, Z), p = t.mul(T, r), c = t.add(c, p), p = t.mul(o, r), a = t.mul(H, a), a = t.sub(a, p), p = t.mul(H, T), d = t.mul(o, d), d = t.add(d, p), new y(a, c, d);
224
- }
225
- subtract(e) {
226
- return this.add(e.negate());
227
- }
228
- is0() {
229
- return this.equals(y.ZERO);
230
- }
231
- wNAF(e) {
232
- return C.wNAFCached(this, x, e, (i) => {
233
- const s = t.invertBatch(i.map((u) => u.pz));
234
- return i.map((u, f) => u.toAffine(s[f])).map(y.fromAffine);
235
- });
236
- }
237
- /**
238
- * Non-constant-time multiplication. Uses double-and-add algorithm.
239
- * It's faster, but should only be used when you don't care about
240
- * an exposed private key e.g. sig verification, which works over *public* keys.
241
- */
242
- multiplyUnsafe(e) {
243
- const i = y.ZERO;
244
- if (e === L)
245
- return i;
246
- if (S(e), e === z)
247
- return this;
248
- const { endo: s } = n;
249
- if (!s)
250
- return C.unsafeLadder(this, e);
251
- let { k1neg: u, k1: f, k2neg: E, k2: h } = s.splitScalar(e), a = i, c = i, d = this;
252
- for (; f > L || h > L; )
253
- f & z && (a = a.add(d)), h & z && (c = c.add(d)), d = d.double(), f >>= z, h >>= z;
254
- return u && (a = a.negate()), E && (c = c.negate()), c = new y(t.mul(c.px, s.beta), c.py, c.pz), a.add(c);
255
- }
256
- /**
257
- * Constant time multiplication.
258
- * Uses wNAF method. Windowed method may be 10% faster,
259
- * but takes 2x longer to generate and consumes 2x memory.
260
- * Uses precomputes when available.
261
- * Uses endomorphism for Koblitz curves.
262
- * @param scalar by which the point would be multiplied
263
- * @returns New point
264
- */
265
- multiply(e) {
266
- S(e);
267
- let i = e, s, u;
268
- const { endo: f } = n;
269
- if (f) {
270
- const { k1neg: E, k1: h, k2neg: a, k2: c } = f.splitScalar(i);
271
- let { p: d, f: N } = this.wNAF(h), { p: b, f: p } = this.wNAF(c);
272
- d = C.constTimeNegate(E, d), b = C.constTimeNegate(a, b), b = new y(t.mul(b.px, f.beta), b.py, b.pz), s = d.add(b), u = N.add(p);
273
- } else {
274
- const { p: E, f: h } = this.wNAF(i);
275
- s = E, u = h;
276
- }
277
- return y.normalizeZ([s, u])[0];
278
- }
279
- /**
280
- * Efficiently calculate `aP + bQ`. Unsafe, can expose private key, if used incorrectly.
281
- * Not using Strauss-Shamir trick: precomputation tables are faster.
282
- * The trick could be useful if both P and Q are not G (not in our case).
283
- * @returns non-zero affine point
284
- */
285
- multiplyAndAddUnsafe(e, i, s) {
286
- const u = y.BASE, f = (h, a) => a === L || a === z || !h.equals(u) ? h.multiplyUnsafe(a) : h.multiply(a), E = f(this, i).add(f(e, s));
287
- return E.is0() ? void 0 : E;
288
- }
289
- // Converts Projective point to affine (x, y) coordinates.
290
- // Can accept precomputed Z^-1 - for example, from invertBatch.
291
- // (x, y, z) ∋ (x=x/z, y=y/z)
292
- toAffine(e) {
293
- const { px: i, py: s, pz: u } = this, f = this.is0();
294
- e == null && (e = f ? t.ONE : t.inv(u));
295
- const E = t.mul(i, e), h = t.mul(s, e), a = t.mul(u, e);
296
- if (f)
297
- return { x: t.ZERO, y: t.ZERO };
298
- if (!t.eql(a, t.ONE))
299
- throw new Error("invZ was invalid");
300
- return { x: E, y: h };
301
- }
302
- isTorsionFree() {
303
- const { h: e, isTorsionFree: i } = n;
304
- if (e === z)
305
- return !0;
306
- if (i)
307
- return i(y, this);
308
- throw new Error("isTorsionFree() has not been declared for the elliptic curve");
309
- }
310
- clearCofactor() {
311
- const { h: e, clearCofactor: i } = n;
312
- return e === z ? this : i ? i(y, this) : this.multiplyUnsafe(n.h);
313
- }
314
- toRawBytes(e = !0) {
315
- return this.assertValidity(), v(y, this, e);
316
- }
317
- toHex(e = !0) {
318
- return nt(this.toRawBytes(e));
319
- }
320
- }
321
- y.BASE = new y(n.Gx, n.Gy, t.ONE), y.ZERO = new y(t.ZERO, t.ONE, t.ZERO);
322
- const W = n.nBitLength, C = wt(y, n.endo ? Math.ceil(W / 2) : W);
323
- return {
324
- CURVE: n,
325
- ProjectivePoint: y,
326
- normPrivateKeyToScalar: P,
327
- weierstrassEquation: O,
328
- isWithinCurveOrder: F
329
- };
26
+ var { bytesToNumberBE: g, hexToBytes: _ } = c, v = {
27
+ Err: class extends Error {
28
+ constructor(e = "") {
29
+ super(e);
30
+ }
31
+ },
32
+ _parseInt(e) {
33
+ let { Err: t } = v;
34
+ if (e.length < 2 || e[0] !== 2) throw new t("Invalid signature integer tag");
35
+ let n = e[1], r = e.subarray(2, n + 2);
36
+ if (!n || r.length !== n) throw new t("Invalid signature integer: wrong length");
37
+ if (r[0] & 128) throw new t("Invalid signature integer: negative");
38
+ if (r[0] === 0 && !(r[1] & 128)) throw new t("Invalid signature integer: unnecessary leading zero");
39
+ return {
40
+ d: g(r),
41
+ l: e.subarray(n + 2)
42
+ };
43
+ },
44
+ toSig(e) {
45
+ let { Err: t } = v, n = typeof e == "string" ? _(e) : e;
46
+ if (!(n instanceof Uint8Array)) throw Error("ui8a expected");
47
+ let r = n.length;
48
+ if (r < 2 || n[0] != 48) throw new t("Invalid signature tag");
49
+ if (n[1] !== r - 2) throw new t("Invalid signature: incorrect length");
50
+ let { d: i, l: a } = v._parseInt(n.subarray(2)), { d: o, l: s } = v._parseInt(a);
51
+ if (s.length) throw new t("Invalid signature: left bytes after parsing");
52
+ return {
53
+ r: i,
54
+ s: o
55
+ };
56
+ },
57
+ hexFromSig(e) {
58
+ let t = (e) => Number.parseInt(e[0], 16) & 8 ? "00" + e : e, n = (e) => {
59
+ let t = e.toString(16);
60
+ return t.length & 1 ? `0${t}` : t;
61
+ }, r = t(n(e.s)), i = t(n(e.r)), a = r.length / 2, o = i.length / 2, s = n(a), c = n(o);
62
+ return `30${n(o + a + 4)}02${c}${i}02${s}${r}`;
63
+ }
64
+ }, y = BigInt(0), b = BigInt(1), x = BigInt(3);
65
+ function S(e) {
66
+ let i = h(e), { Fp: o } = i, s = i.toBytes || ((e, t, n) => {
67
+ let i = t.toAffine();
68
+ return r(Uint8Array.from([4]), o.toBytes(i.x), o.toBytes(i.y));
69
+ }), c = i.fromBytes || ((e) => {
70
+ let t = e.subarray(1);
71
+ return {
72
+ x: o.fromBytes(t.subarray(0, o.BYTES)),
73
+ y: o.fromBytes(t.subarray(o.BYTES, 2 * o.BYTES))
74
+ };
75
+ });
76
+ function l(e) {
77
+ let { a: t, b: n } = i, r = o.sqr(e), a = o.mul(r, e);
78
+ return o.add(o.add(a, o.mul(e, t)), n);
79
+ }
80
+ if (!o.eql(o.sqr(i.Gy), l(i.Gx))) throw Error("bad generator point: equation left != right");
81
+ function u(e) {
82
+ return typeof e == "bigint" && y < e && e < i.n;
83
+ }
84
+ function d(e) {
85
+ if (!u(e)) throw Error("Expected valid bigint: 0 < bigint < curve.n");
86
+ }
87
+ function p(e) {
88
+ let { allowedPrivateKeyLengths: r, nByteLength: o, wrapPrivateKey: s, n: c } = i;
89
+ if (r && typeof e != "bigint") {
90
+ if (e instanceof Uint8Array && (e = t(e)), typeof e != "string" || !r.includes(e.length)) throw Error("Invalid key");
91
+ e = e.padStart(o * 2, "0");
92
+ }
93
+ let l;
94
+ try {
95
+ l = typeof e == "bigint" ? e : n(a("private key", e, o));
96
+ } catch {
97
+ throw Error(`private key must be ${o} bytes, hex or bigint, not ${typeof e}`);
98
+ }
99
+ return s && (l = f(l, c)), d(l), l;
100
+ }
101
+ let g = /* @__PURE__ */ new Map();
102
+ function _(e) {
103
+ if (!(e instanceof v)) throw Error("ProjectivePoint expected");
104
+ }
105
+ class v {
106
+ constructor(e, t, n) {
107
+ if (this.px = e, this.py = t, this.pz = n, e == null || !o.isValid(e)) throw Error("x required");
108
+ if (t == null || !o.isValid(t)) throw Error("y required");
109
+ if (n == null || !o.isValid(n)) throw Error("z required");
110
+ }
111
+ static fromAffine(e) {
112
+ let { x: t, y: n } = e || {};
113
+ if (!e || !o.isValid(t) || !o.isValid(n)) throw Error("invalid affine point");
114
+ if (e instanceof v) throw Error("projective point not allowed");
115
+ let r = (e) => o.eql(e, o.ZERO);
116
+ return r(t) && r(n) ? v.ZERO : new v(t, n, o.ONE);
117
+ }
118
+ get x() {
119
+ return this.toAffine().x;
120
+ }
121
+ get y() {
122
+ return this.toAffine().y;
123
+ }
124
+ static normalizeZ(e) {
125
+ let t = o.invertBatch(e.map((e) => e.pz));
126
+ return e.map((e, n) => e.toAffine(t[n])).map(v.fromAffine);
127
+ }
128
+ static fromHex(e) {
129
+ let t = v.fromAffine(c(a("pointHex", e)));
130
+ return t.assertValidity(), t;
131
+ }
132
+ static fromPrivateKey(e) {
133
+ return v.BASE.multiply(p(e));
134
+ }
135
+ _setWindowSize(e) {
136
+ this._WINDOW_SIZE = e, g.delete(this);
137
+ }
138
+ assertValidity() {
139
+ if (this.is0()) {
140
+ if (i.allowInfinityPoint) return;
141
+ throw Error("bad point: ZERO");
142
+ }
143
+ let { x: e, y: t } = this.toAffine();
144
+ if (!o.isValid(e) || !o.isValid(t)) throw Error("bad point: x or y not FE");
145
+ let n = o.sqr(t), r = l(e);
146
+ if (!o.eql(n, r)) throw Error("bad point: equation left != right");
147
+ if (!this.isTorsionFree()) throw Error("bad point: not in prime-order subgroup");
148
+ }
149
+ hasEvenY() {
150
+ let { y: e } = this.toAffine();
151
+ if (o.isOdd) return !o.isOdd(e);
152
+ throw Error("Field doesn't support isOdd");
153
+ }
154
+ equals(e) {
155
+ _(e);
156
+ let { px: t, py: n, pz: r } = this, { px: i, py: a, pz: s } = e, c = o.eql(o.mul(t, s), o.mul(i, r)), l = o.eql(o.mul(n, s), o.mul(a, r));
157
+ return c && l;
158
+ }
159
+ negate() {
160
+ return new v(this.px, o.neg(this.py), this.pz);
161
+ }
162
+ double() {
163
+ let { a: e, b: t } = i, n = o.mul(t, x), { px: r, py: a, pz: s } = this, c = o.ZERO, l = o.ZERO, u = o.ZERO, d = o.mul(r, r), f = o.mul(a, a), p = o.mul(s, s), m = o.mul(r, a);
164
+ return m = o.add(m, m), u = o.mul(r, s), u = o.add(u, u), c = o.mul(e, u), l = o.mul(n, p), l = o.add(c, l), c = o.sub(f, l), l = o.add(f, l), l = o.mul(c, l), c = o.mul(m, c), u = o.mul(n, u), p = o.mul(e, p), m = o.sub(d, p), m = o.mul(e, m), m = o.add(m, u), u = o.add(d, d), d = o.add(u, d), d = o.add(d, p), d = o.mul(d, m), l = o.add(l, d), p = o.mul(a, s), p = o.add(p, p), d = o.mul(p, m), c = o.sub(c, d), u = o.mul(p, f), u = o.add(u, u), u = o.add(u, u), new v(c, l, u);
165
+ }
166
+ add(e) {
167
+ _(e);
168
+ let { px: t, py: n, pz: r } = this, { px: a, py: s, pz: c } = e, l = o.ZERO, u = o.ZERO, d = o.ZERO, f = i.a, p = o.mul(i.b, x), m = o.mul(t, a), h = o.mul(n, s), g = o.mul(r, c), y = o.add(t, n), b = o.add(a, s);
169
+ y = o.mul(y, b), b = o.add(m, h), y = o.sub(y, b), b = o.add(t, r);
170
+ let S = o.add(a, c);
171
+ return b = o.mul(b, S), S = o.add(m, g), b = o.sub(b, S), S = o.add(n, r), l = o.add(s, c), S = o.mul(S, l), l = o.add(h, g), S = o.sub(S, l), d = o.mul(f, b), l = o.mul(p, g), d = o.add(l, d), l = o.sub(h, d), d = o.add(h, d), u = o.mul(l, d), h = o.add(m, m), h = o.add(h, m), g = o.mul(f, g), b = o.mul(p, b), h = o.add(h, g), g = o.sub(m, g), g = o.mul(f, g), b = o.add(b, g), m = o.mul(h, b), u = o.add(u, m), m = o.mul(S, b), l = o.mul(y, l), l = o.sub(l, m), m = o.mul(y, h), d = o.mul(S, d), d = o.add(d, m), new v(l, u, d);
172
+ }
173
+ subtract(e) {
174
+ return this.add(e.negate());
175
+ }
176
+ is0() {
177
+ return this.equals(v.ZERO);
178
+ }
179
+ wNAF(e) {
180
+ return C.wNAFCached(this, g, e, (e) => {
181
+ let t = o.invertBatch(e.map((e) => e.pz));
182
+ return e.map((e, n) => e.toAffine(t[n])).map(v.fromAffine);
183
+ });
184
+ }
185
+ multiplyUnsafe(e) {
186
+ let t = v.ZERO;
187
+ if (e === y) return t;
188
+ if (d(e), e === b) return this;
189
+ let { endo: n } = i;
190
+ if (!n) return C.unsafeLadder(this, e);
191
+ let { k1neg: r, k1: a, k2neg: s, k2: c } = n.splitScalar(e), l = t, u = t, f = this;
192
+ for (; a > y || c > y;) a & b && (l = l.add(f)), c & b && (u = u.add(f)), f = f.double(), a >>= b, c >>= b;
193
+ return r && (l = l.negate()), s && (u = u.negate()), u = new v(o.mul(u.px, n.beta), u.py, u.pz), l.add(u);
194
+ }
195
+ multiply(e) {
196
+ d(e);
197
+ let t = e, n, r, { endo: a } = i;
198
+ if (a) {
199
+ let { k1neg: e, k1: i, k2neg: s, k2: c } = a.splitScalar(t), { p: l, f: u } = this.wNAF(i), { p: d, f } = this.wNAF(c);
200
+ l = C.constTimeNegate(e, l), d = C.constTimeNegate(s, d), d = new v(o.mul(d.px, a.beta), d.py, d.pz), n = l.add(d), r = u.add(f);
201
+ } else {
202
+ let { p: e, f: i } = this.wNAF(t);
203
+ n = e, r = i;
204
+ }
205
+ return v.normalizeZ([n, r])[0];
206
+ }
207
+ multiplyAndAddUnsafe(e, t, n) {
208
+ let r = v.BASE, i = (e, t) => t === y || t === b || !e.equals(r) ? e.multiplyUnsafe(t) : e.multiply(t), a = i(this, t).add(i(e, n));
209
+ return a.is0() ? void 0 : a;
210
+ }
211
+ toAffine(e) {
212
+ let { px: t, py: n, pz: r } = this, i = this.is0();
213
+ e ??= i ? o.ONE : o.inv(r);
214
+ let a = o.mul(t, e), s = o.mul(n, e), c = o.mul(r, e);
215
+ if (i) return {
216
+ x: o.ZERO,
217
+ y: o.ZERO
218
+ };
219
+ if (!o.eql(c, o.ONE)) throw Error("invZ was invalid");
220
+ return {
221
+ x: a,
222
+ y: s
223
+ };
224
+ }
225
+ isTorsionFree() {
226
+ let { h: e, isTorsionFree: t } = i;
227
+ if (e === b) return !0;
228
+ if (t) return t(v, this);
229
+ throw Error("isTorsionFree() has not been declared for the elliptic curve");
230
+ }
231
+ clearCofactor() {
232
+ let { h: e, clearCofactor: t } = i;
233
+ return e === b ? this : t ? t(v, this) : this.multiplyUnsafe(i.h);
234
+ }
235
+ toRawBytes(e = !0) {
236
+ return this.assertValidity(), s(v, this, e);
237
+ }
238
+ toHex(e = !0) {
239
+ return t(this.toRawBytes(e));
240
+ }
241
+ }
242
+ v.BASE = new v(i.Gx, i.Gy, o.ONE), v.ZERO = new v(o.ZERO, o.ONE, o.ZERO);
243
+ let S = i.nBitLength, C = m(v, i.endo ? Math.ceil(S / 2) : S);
244
+ return {
245
+ CURVE: i,
246
+ ProjectivePoint: v,
247
+ normPrivateKeyToScalar: p,
248
+ weierstrassEquation: l,
249
+ isWithinCurveOrder: u
250
+ };
330
251
  }
331
- function vt(B) {
332
- const n = ft(B);
333
- return lt(n, {
334
- hash: "hash",
335
- hmac: "function",
336
- randomBytes: "function"
337
- }, {
338
- bits2int: "function",
339
- bits2int_modN: "function",
340
- lowS: "boolean"
341
- }), Object.freeze({ lowS: !0, ...n });
252
+ function C(e) {
253
+ let t = p(e);
254
+ return l(t, {
255
+ hash: "hash",
256
+ hmac: "function",
257
+ randomBytes: "function"
258
+ }, {
259
+ bits2int: "function",
260
+ bits2int_modN: "function",
261
+ lowS: "boolean"
262
+ }), Object.freeze({
263
+ lowS: !0,
264
+ ...t
265
+ });
342
266
  }
343
- function Ot(B) {
344
- const n = vt(B), { Fp: t, n: v } = n, A = t.BYTES + 1, O = 2 * t.BYTES + 1;
345
- function F(r) {
346
- return L < r && r < t.ORDER;
347
- }
348
- function S(r) {
349
- return ut(r, v);
350
- }
351
- function P(r) {
352
- return ht(r, v);
353
- }
354
- const { ProjectivePoint: x, normPrivateKeyToScalar: U, weierstrassEquation: y, isWithinCurveOrder: W } = Bt({
355
- ...n,
356
- toBytes(r, o, l) {
357
- const g = o.toAffine(), w = t.toBytes(g.x), R = et;
358
- return l ? R(Uint8Array.from([o.hasEvenY() ? 2 : 3]), w) : R(Uint8Array.from([4]), w, t.toBytes(g.y));
359
- },
360
- fromBytes(r) {
361
- const o = r.length, l = r[0], g = r.subarray(1);
362
- if (o === A && (l === 2 || l === 3)) {
363
- const w = _(g);
364
- if (!F(w))
365
- throw new Error("Point is not on curve");
366
- const R = y(w);
367
- let q = t.sqrt(R);
368
- const I = (q & z) === z;
369
- return (l & 1) === 1 !== I && (q = t.neg(q)), { x: w, y: q };
370
- } else if (o === O && l === 4) {
371
- const w = t.fromBytes(g.subarray(0, t.BYTES)), R = t.fromBytes(g.subarray(t.BYTES, 2 * t.BYTES));
372
- return { x: w, y: R };
373
- } else
374
- throw new Error(`Point of length ${o} was invalid. Expected ${A} compressed bytes or ${O} uncompressed bytes`);
375
- }
376
- }), C = (r) => nt(rt(r, n.nByteLength));
377
- function m(r) {
378
- const o = v >> z;
379
- return r > o;
380
- }
381
- function e(r) {
382
- return m(r) ? S(-r) : r;
383
- }
384
- const i = (r, o, l) => _(r.slice(o, l));
385
- class s {
386
- constructor(o, l, g) {
387
- this.r = o, this.s = l, this.recovery = g, this.assertValidity();
388
- }
389
- // pair (bytes of r, bytes of s)
390
- static fromCompact(o) {
391
- const l = n.nByteLength;
392
- return o = Y("compactSignature", o, l * 2), new s(i(o, 0, l), i(o, l, 2 * l));
393
- }
394
- // DER encoded ECDSA signature
395
- // https://bitcoin.stackexchange.com/questions/57644/what-are-the-parts-of-a-bitcoin-transaction-input-script
396
- static fromDER(o) {
397
- const { r: l, s: g } = k.toSig(Y("DER", o));
398
- return new s(l, g);
399
- }
400
- assertValidity() {
401
- if (!W(this.r))
402
- throw new Error("r must be 0 < r < CURVE.n");
403
- if (!W(this.s))
404
- throw new Error("s must be 0 < s < CURVE.n");
405
- }
406
- addRecoveryBit(o) {
407
- return new s(this.r, this.s, o);
408
- }
409
- recoverPublicKey(o) {
410
- const { r: l, s: g, recovery: w } = this, R = c(Y("msgHash", o));
411
- if (w == null || ![0, 1, 2, 3].includes(w))
412
- throw new Error("recovery id invalid");
413
- const q = w === 2 || w === 3 ? l + n.n : l;
414
- if (q >= t.ORDER)
415
- throw new Error("recovery id 2 or 3 invalid");
416
- const I = (w & 1) === 0 ? "02" : "03", D = x.fromHex(I + C(q)), K = P(q), X = S(-R * K), Q = S(g * K), $ = x.BASE.multiplyAndAddUnsafe(D, X, Q);
417
- if (!$)
418
- throw new Error("point at infinify");
419
- return $.assertValidity(), $;
420
- }
421
- // Signatures should be low-s, to prevent malleability.
422
- hasHighS() {
423
- return m(this.s);
424
- }
425
- normalizeS() {
426
- return this.hasHighS() ? new s(this.r, S(-this.s), this.recovery) : this;
427
- }
428
- // DER-encoded
429
- toDERRawBytes() {
430
- return at(this.toDERHex());
431
- }
432
- toDERHex() {
433
- return k.hexFromSig({ r: this.r, s: this.s });
434
- }
435
- // padded bytes of r, then padded bytes of s
436
- toCompactRawBytes() {
437
- return at(this.toCompactHex());
438
- }
439
- toCompactHex() {
440
- return C(this.r) + C(this.s);
441
- }
442
- }
443
- const u = {
444
- isValidPrivateKey(r) {
445
- try {
446
- return U(r), !0;
447
- } catch {
448
- return !1;
449
- }
450
- },
451
- normPrivateKeyToScalar: U,
452
- /**
453
- * Produces cryptographically secure private key from random of size (nBitLength+64)
454
- * as per FIPS 186 B.4.1 with modulo bias being neglible.
455
- */
456
- randomPrivateKey: () => {
457
- const r = n.randomBytes(t.BYTES + 8), o = dt(r, v);
458
- return rt(o, n.nByteLength);
459
- },
460
- /**
461
- * Creates precompute table for an arbitrary EC point. Makes point "cached".
462
- * Allows to massively speed-up `point.multiply(scalar)`.
463
- * @returns cached point
464
- * @example
465
- * const fast = utils.precompute(8, ProjectivePoint.fromHex(someonesPubKey));
466
- * fast.multiply(privKey); // much faster ECDH now
467
- */
468
- precompute(r = 8, o = x.BASE) {
469
- return o._setWindowSize(r), o.multiply(BigInt(3)), o;
470
- }
471
- };
472
- function f(r, o = !0) {
473
- return x.fromPrivateKey(r).toRawBytes(o);
474
- }
475
- function E(r) {
476
- const o = r instanceof Uint8Array, l = typeof r == "string", g = (o || l) && r.length;
477
- return o ? g === A || g === O : l ? g === 2 * A || g === 2 * O : r instanceof x;
478
- }
479
- function h(r, o, l = !0) {
480
- if (E(r))
481
- throw new Error("first arg must be private key");
482
- if (!E(o))
483
- throw new Error("second arg must be public key");
484
- return x.fromHex(o).multiply(U(r)).toRawBytes(l);
485
- }
486
- const a = n.bits2int || function(r) {
487
- const o = _(r), l = r.length * 8 - n.nBitLength;
488
- return l > 0 ? o >> BigInt(l) : o;
489
- }, c = n.bits2int_modN || function(r) {
490
- return S(a(r));
491
- }, d = yt(n.nBitLength);
492
- function N(r) {
493
- if (typeof r != "bigint")
494
- throw new Error("bigint expected");
495
- if (!(L <= r && r < d))
496
- throw new Error(`bigint expected < 2^${n.nBitLength}`);
497
- return rt(r, n.nByteLength);
498
- }
499
- function b(r, o, l = p) {
500
- if (["recovered", "canonical"].some((j) => j in l))
501
- throw new Error("sign() legacy options not supported");
502
- const { hash: g, randomBytes: w } = n;
503
- let { lowS: R, prehash: q, extraEntropy: I } = l;
504
- R == null && (R = !0), r = Y("msgHash", r), q && (r = Y("prehashed msgHash", g(r)));
505
- const D = c(r), K = U(o), X = [N(K), N(D)];
506
- if (I != null) {
507
- const j = I === !0 ? w(t.BYTES) : I;
508
- X.push(Y("extraEntropy", j, t.BYTES));
509
- }
510
- const Q = et(...X), $ = D;
511
- function tt(j) {
512
- const G = a(j);
513
- if (!W(G))
514
- return;
515
- const ot = P(G), V = x.BASE.multiply(G).toAffine(), M = S(V.x);
516
- if (M === L)
517
- return;
518
- const J = S(ot * S($ + M * K));
519
- if (J === L)
520
- return;
521
- let st = (V.x === M ? 0 : 2) | Number(V.y & z), it = J;
522
- return R && m(J) && (it = e(J), st ^= 1), new s(M, it, st);
523
- }
524
- return { seed: Q, k2sig: tt };
525
- }
526
- const p = { lowS: n.lowS, prehash: !1 }, T = { lowS: n.lowS, prehash: !1 };
527
- function Z(r, o, l = p) {
528
- const { seed: g, k2sig: w } = b(r, o, l);
529
- return pt(n.hash.outputLen, n.nByteLength, n.hmac)(g, w);
530
- }
531
- x.BASE._setWindowSize(8);
532
- function H(r, o, l, g = T) {
533
- const w = r;
534
- if (o = Y("msgHash", o), l = Y("publicKey", l), "strict" in g)
535
- throw new Error("options.strict was renamed to lowS");
536
- const { lowS: R, prehash: q } = g;
537
- let I, D;
538
- try {
539
- if (typeof w == "string" || w instanceof Uint8Array)
540
- try {
541
- I = s.fromDER(w);
542
- } catch (V) {
543
- if (!(V instanceof k.Err))
544
- throw V;
545
- I = s.fromCompact(w);
546
- }
547
- else if (typeof w == "object" && typeof w.r == "bigint" && typeof w.s == "bigint") {
548
- const { r: V, s: M } = w;
549
- I = new s(V, M);
550
- } else
551
- throw new Error("PARSE");
552
- D = x.fromHex(l);
553
- } catch (V) {
554
- if (V.message === "PARSE")
555
- throw new Error("signature must be Signature instance, Uint8Array or hex string");
556
- return !1;
557
- }
558
- if (R && I.hasHighS())
559
- return !1;
560
- q && (o = n.hash(o));
561
- const { r: K, s: X } = I, Q = c(o), $ = P(X), tt = S(Q * $), j = S(K * $), G = x.BASE.multiplyAndAddUnsafe(D, tt, j)?.toAffine();
562
- return G ? S(G.x) === K : !1;
563
- }
564
- return {
565
- CURVE: n,
566
- getPublicKey: f,
567
- getSharedSecret: h,
568
- sign: Z,
569
- verify: H,
570
- ProjectivePoint: x,
571
- Signature: s,
572
- utils: u
573
- };
267
+ function w(c) {
268
+ let l = C(c), { Fp: p, n: m } = l, h = p.BYTES + 1, g = 2 * p.BYTES + 1;
269
+ function _(e) {
270
+ return y < e && e < p.ORDER;
271
+ }
272
+ function x(e) {
273
+ return f(e, m);
274
+ }
275
+ function w(e) {
276
+ return d(e, m);
277
+ }
278
+ let { ProjectivePoint: T, normPrivateKeyToScalar: E, weierstrassEquation: D, isWithinCurveOrder: O } = S({
279
+ ...l,
280
+ toBytes(e, t, n) {
281
+ let i = t.toAffine(), a = p.toBytes(i.x), o = r;
282
+ return n ? o(Uint8Array.from([t.hasEvenY() ? 2 : 3]), a) : o(Uint8Array.from([4]), a, p.toBytes(i.y));
283
+ },
284
+ fromBytes(e) {
285
+ let t = e.length, r = e[0], i = e.subarray(1);
286
+ if (t === h && (r === 2 || r === 3)) {
287
+ let e = n(i);
288
+ if (!_(e)) throw Error("Point is not on curve");
289
+ let t = D(e), a = p.sqrt(t), o = (a & b) === b;
290
+ return (r & 1) == 1 !== o && (a = p.neg(a)), {
291
+ x: e,
292
+ y: a
293
+ };
294
+ } else if (t === g && r === 4) return {
295
+ x: p.fromBytes(i.subarray(0, p.BYTES)),
296
+ y: p.fromBytes(i.subarray(p.BYTES, 2 * p.BYTES))
297
+ };
298
+ else throw Error(`Point of length ${t} was invalid. Expected ${h} compressed bytes or ${g} uncompressed bytes`);
299
+ }
300
+ }), k = (e) => t(s(e, l.nByteLength));
301
+ function A(e) {
302
+ return e > m >> b;
303
+ }
304
+ function j(e) {
305
+ return A(e) ? x(-e) : e;
306
+ }
307
+ let M = (e, t, r) => n(e.slice(t, r));
308
+ class N {
309
+ constructor(e, t, n) {
310
+ this.r = e, this.s = t, this.recovery = n, this.assertValidity();
311
+ }
312
+ static fromCompact(e) {
313
+ let t = l.nByteLength;
314
+ return e = a("compactSignature", e, t * 2), new N(M(e, 0, t), M(e, t, 2 * t));
315
+ }
316
+ static fromDER(e) {
317
+ let { r: t, s: n } = v.toSig(a("DER", e));
318
+ return new N(t, n);
319
+ }
320
+ assertValidity() {
321
+ if (!O(this.r)) throw Error("r must be 0 < r < CURVE.n");
322
+ if (!O(this.s)) throw Error("s must be 0 < s < CURVE.n");
323
+ }
324
+ addRecoveryBit(e) {
325
+ return new N(this.r, this.s, e);
326
+ }
327
+ recoverPublicKey(e) {
328
+ let { r: t, s: n, recovery: r } = this, i = z(a("msgHash", e));
329
+ if (r == null || ![
330
+ 0,
331
+ 1,
332
+ 2,
333
+ 3
334
+ ].includes(r)) throw Error("recovery id invalid");
335
+ let o = r === 2 || r === 3 ? t + l.n : t;
336
+ if (o >= p.ORDER) throw Error("recovery id 2 or 3 invalid");
337
+ let s = r & 1 ? "03" : "02", c = T.fromHex(s + k(o)), u = w(o), d = x(-i * u), f = x(n * u), m = T.BASE.multiplyAndAddUnsafe(c, d, f);
338
+ if (!m) throw Error("point at infinify");
339
+ return m.assertValidity(), m;
340
+ }
341
+ hasHighS() {
342
+ return A(this.s);
343
+ }
344
+ normalizeS() {
345
+ return this.hasHighS() ? new N(this.r, x(-this.s), this.recovery) : this;
346
+ }
347
+ toDERRawBytes() {
348
+ return o(this.toDERHex());
349
+ }
350
+ toDERHex() {
351
+ return v.hexFromSig({
352
+ r: this.r,
353
+ s: this.s
354
+ });
355
+ }
356
+ toCompactRawBytes() {
357
+ return o(this.toCompactHex());
358
+ }
359
+ toCompactHex() {
360
+ return k(this.r) + k(this.s);
361
+ }
362
+ }
363
+ let P = {
364
+ isValidPrivateKey(e) {
365
+ try {
366
+ return E(e), !0;
367
+ } catch {
368
+ return !1;
369
+ }
370
+ },
371
+ normPrivateKeyToScalar: E,
372
+ randomPrivateKey: () => s(u(l.randomBytes(p.BYTES + 8), m), l.nByteLength),
373
+ precompute(e = 8, t = T.BASE) {
374
+ return t._setWindowSize(e), t.multiply(BigInt(3)), t;
375
+ }
376
+ };
377
+ function F(e, t = !0) {
378
+ return T.fromPrivateKey(e).toRawBytes(t);
379
+ }
380
+ function I(e) {
381
+ let t = e instanceof Uint8Array, n = typeof e == "string", r = (t || n) && e.length;
382
+ return t ? r === h || r === g : n ? r === 2 * h || r === 2 * g : e instanceof T;
383
+ }
384
+ function L(e, t, n = !0) {
385
+ if (I(e)) throw Error("first arg must be private key");
386
+ if (!I(t)) throw Error("second arg must be public key");
387
+ return T.fromHex(t).multiply(E(e)).toRawBytes(n);
388
+ }
389
+ let R = l.bits2int || function(e) {
390
+ let t = n(e), r = e.length * 8 - l.nBitLength;
391
+ return r > 0 ? t >> BigInt(r) : t;
392
+ }, z = l.bits2int_modN || function(e) {
393
+ return x(R(e));
394
+ }, B = e(l.nBitLength);
395
+ function V(e) {
396
+ if (typeof e != "bigint") throw Error("bigint expected");
397
+ if (!(y <= e && e < B)) throw Error(`bigint expected < 2^${l.nBitLength}`);
398
+ return s(e, l.nByteLength);
399
+ }
400
+ function H(e, t, n = U) {
401
+ if (["recovered", "canonical"].some((e) => e in n)) throw Error("sign() legacy options not supported");
402
+ let { hash: i, randomBytes: o } = l, { lowS: s, prehash: c, extraEntropy: u } = n;
403
+ s ??= !0, e = a("msgHash", e), c && (e = a("prehashed msgHash", i(e)));
404
+ let d = z(e), f = E(t), m = [V(f), V(d)];
405
+ if (u != null) {
406
+ let e = u === !0 ? o(p.BYTES) : u;
407
+ m.push(a("extraEntropy", e, p.BYTES));
408
+ }
409
+ let h = r(...m), g = d;
410
+ function _(e) {
411
+ let t = R(e);
412
+ if (!O(t)) return;
413
+ let n = w(t), r = T.BASE.multiply(t).toAffine(), i = x(r.x);
414
+ if (i === y) return;
415
+ let a = x(n * x(g + i * f));
416
+ if (a === y) return;
417
+ let o = (r.x === i ? 0 : 2) | Number(r.y & b), c = a;
418
+ return s && A(a) && (c = j(a), o ^= 1), new N(i, c, o);
419
+ }
420
+ return {
421
+ seed: h,
422
+ k2sig: _
423
+ };
424
+ }
425
+ let U = {
426
+ lowS: l.lowS,
427
+ prehash: !1
428
+ }, W = {
429
+ lowS: l.lowS,
430
+ prehash: !1
431
+ };
432
+ function G(e, t, n = U) {
433
+ let { seed: r, k2sig: a } = H(e, t, n);
434
+ return i(l.hash.outputLen, l.nByteLength, l.hmac)(r, a);
435
+ }
436
+ T.BASE._setWindowSize(8);
437
+ function K(e, t, n, r = W) {
438
+ let i = e;
439
+ if (t = a("msgHash", t), n = a("publicKey", n), "strict" in r) throw Error("options.strict was renamed to lowS");
440
+ let { lowS: o, prehash: s } = r, c, u;
441
+ try {
442
+ if (typeof i == "string" || i instanceof Uint8Array) try {
443
+ c = N.fromDER(i);
444
+ } catch (e) {
445
+ if (!(e instanceof v.Err)) throw e;
446
+ c = N.fromCompact(i);
447
+ }
448
+ else if (typeof i == "object" && typeof i.r == "bigint" && typeof i.s == "bigint") {
449
+ let { r: e, s: t } = i;
450
+ c = new N(e, t);
451
+ } else throw Error("PARSE");
452
+ u = T.fromHex(n);
453
+ } catch (e) {
454
+ if (e.message === "PARSE") throw Error("signature must be Signature instance, Uint8Array or hex string");
455
+ return !1;
456
+ }
457
+ if (o && c.hasHighS()) return !1;
458
+ s && (t = l.hash(t));
459
+ let { r: d, s: f } = c, p = z(t), m = w(f), h = x(p * m), g = x(d * m), _ = T.BASE.multiplyAndAddUnsafe(u, h, g)?.toAffine();
460
+ return _ ? x(_.x) === d : !1;
461
+ }
462
+ return {
463
+ CURVE: l,
464
+ getPublicKey: F,
465
+ getSharedSecret: L,
466
+ sign: G,
467
+ verify: K,
468
+ ProjectivePoint: T,
469
+ Signature: N,
470
+ utils: P
471
+ };
574
472
  }
575
- export {
576
- k as DER,
577
- Ot as weierstrass,
578
- Bt as weierstrassPoints
579
- };
473
+ //#endregion
474
+ export { w as weierstrass };