@hfunlabs/hyperliquid 0.30.0-hfunlabs.1 → 0.30.2-hfunlabs.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 (397) hide show
  1. package/esm/_dnt.shims.d.ts +2 -0
  2. package/esm/_dnt.shims.d.ts.map +1 -0
  3. package/esm/_dnt.shims.js +58 -0
  4. package/esm/_dnt.shims.js.map +1 -0
  5. package/esm/deps/jsr.io/@noble/curves/2.0.1/src/abstract/curve.d.ts +195 -0
  6. package/esm/deps/jsr.io/@noble/curves/2.0.1/src/abstract/curve.d.ts.map +1 -0
  7. package/esm/deps/jsr.io/@noble/curves/2.0.1/src/abstract/curve.js +457 -0
  8. package/esm/deps/jsr.io/@noble/curves/2.0.1/src/abstract/curve.js.map +1 -0
  9. package/esm/deps/jsr.io/@noble/curves/2.0.1/src/abstract/hash-to-curve.d.ts +90 -0
  10. package/esm/deps/jsr.io/@noble/curves/2.0.1/src/abstract/hash-to-curve.d.ts.map +1 -0
  11. package/esm/deps/jsr.io/@noble/curves/2.0.1/src/abstract/hash-to-curve.js +207 -0
  12. package/esm/deps/jsr.io/@noble/curves/2.0.1/src/abstract/hash-to-curve.js.map +1 -0
  13. package/esm/deps/jsr.io/@noble/curves/2.0.1/src/abstract/modular.d.ts +159 -0
  14. package/esm/deps/jsr.io/@noble/curves/2.0.1/src/abstract/modular.d.ts.map +1 -0
  15. package/esm/deps/jsr.io/@noble/curves/2.0.1/src/abstract/modular.js +555 -0
  16. package/esm/deps/jsr.io/@noble/curves/2.0.1/src/abstract/modular.js.map +1 -0
  17. package/esm/deps/jsr.io/@noble/curves/2.0.1/src/abstract/weierstrass.d.ts +325 -0
  18. package/esm/deps/jsr.io/@noble/curves/2.0.1/src/abstract/weierstrass.d.ts.map +1 -0
  19. package/esm/deps/jsr.io/@noble/curves/2.0.1/src/abstract/weierstrass.js +1222 -0
  20. package/esm/deps/jsr.io/@noble/curves/2.0.1/src/abstract/weierstrass.js.map +1 -0
  21. package/esm/deps/jsr.io/@noble/curves/2.0.1/src/secp256k1.d.ts +76 -0
  22. package/esm/deps/jsr.io/@noble/curves/2.0.1/src/secp256k1.d.ts.map +1 -0
  23. package/esm/deps/jsr.io/@noble/curves/2.0.1/src/secp256k1.js +283 -0
  24. package/esm/deps/jsr.io/@noble/curves/2.0.1/src/secp256k1.js.map +1 -0
  25. package/esm/deps/jsr.io/@noble/curves/2.0.1/src/utils.d.ts +103 -0
  26. package/esm/deps/jsr.io/@noble/curves/2.0.1/src/utils.d.ts.map +1 -0
  27. package/esm/deps/jsr.io/@noble/curves/2.0.1/src/utils.js +241 -0
  28. package/esm/deps/jsr.io/@noble/curves/2.0.1/src/utils.js.map +1 -0
  29. package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/_md.d.ts +49 -0
  30. package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/_md.d.ts.map +1 -0
  31. package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/_md.js +147 -0
  32. package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/_md.js.map +1 -0
  33. package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/_u64.d.ts +55 -0
  34. package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/_u64.d.ts.map +1 -0
  35. package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/_u64.js +67 -0
  36. package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/_u64.js.map +1 -0
  37. package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/hmac.d.ts +36 -0
  38. package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/hmac.d.ts.map +1 -0
  39. package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/hmac.js +90 -0
  40. package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/hmac.js.map +1 -0
  41. package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/sha2.d.ts +199 -0
  42. package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/sha2.d.ts.map +1 -0
  43. package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/sha2.js +397 -0
  44. package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/sha2.js.map +1 -0
  45. package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/sha3.d.ts +58 -0
  46. package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/sha3.d.ts.map +1 -0
  47. package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/sha3.js +254 -0
  48. package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/sha3.js.map +1 -0
  49. package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/utils.d.ts +124 -0
  50. package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/utils.d.ts.map +1 -0
  51. package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/utils.js +243 -0
  52. package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/utils.js.map +1 -0
  53. package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/advanced/abi-mapper.d.ts +44 -0
  54. package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/advanced/abi-mapper.d.ts.map +1 -0
  55. package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/advanced/abi-mapper.js +144 -0
  56. package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/advanced/abi-mapper.js.map +1 -0
  57. package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/address.d.ts +38 -0
  58. package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/address.d.ts.map +1 -0
  59. package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/address.js +96 -0
  60. package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/address.js.map +1 -0
  61. package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/rlp.d.ts +23 -0
  62. package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/rlp.d.ts.map +1 -0
  63. package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/rlp.js +98 -0
  64. package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/rlp.js.map +1 -0
  65. package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/tx-internal.d.ts +300 -0
  66. package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/tx-internal.d.ts.map +1 -0
  67. package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/tx-internal.js +535 -0
  68. package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/tx-internal.js.map +1 -0
  69. package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/tx.d.ts +98 -0
  70. package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/tx.d.ts.map +1 -0
  71. package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/tx.js +207 -0
  72. package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/tx.js.map +1 -0
  73. package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/typed-data.d.ts +78 -0
  74. package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/typed-data.d.ts.map +1 -0
  75. package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/typed-data.js +298 -0
  76. package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/typed-data.js.map +1 -0
  77. package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/index.d.ts +6 -0
  78. package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/index.d.ts.map +1 -0
  79. package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/index.js +6 -0
  80. package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/index.js.map +1 -0
  81. package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/utils.d.ts +66 -0
  82. package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/utils.d.ts.map +1 -0
  83. package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/utils.js +180 -0
  84. package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/utils.js.map +1 -0
  85. package/esm/deps/jsr.io/@paulmillr/micro-packed/0.8.0/src/index.d.ts +877 -0
  86. package/esm/deps/jsr.io/@paulmillr/micro-packed/0.8.0/src/index.d.ts.map +1 -0
  87. package/esm/deps/jsr.io/@paulmillr/micro-packed/0.8.0/src/index.js +2001 -0
  88. package/esm/deps/jsr.io/@paulmillr/micro-packed/0.8.0/src/index.js.map +1 -0
  89. package/esm/deps/jsr.io/@scure/base/2.0.0/index.d.ts +294 -0
  90. package/esm/deps/jsr.io/@scure/base/2.0.0/index.d.ts.map +1 -0
  91. package/esm/deps/jsr.io/@scure/base/2.0.0/index.js +704 -0
  92. package/esm/deps/jsr.io/@scure/base/2.0.0/index.js.map +1 -0
  93. package/esm/deps/jsr.io/@std/async/1.0.16/unstable_semaphore.d.ts +93 -0
  94. package/esm/deps/jsr.io/@std/async/1.0.16/unstable_semaphore.d.ts.map +1 -0
  95. package/esm/deps/jsr.io/@std/async/1.0.16/unstable_semaphore.js +137 -0
  96. package/esm/deps/jsr.io/@std/async/1.0.16/unstable_semaphore.js.map +1 -0
  97. package/esm/src/api/exchange/_methods/_base/_nonce.d.ts +3 -2
  98. package/esm/src/api/exchange/_methods/_base/_nonce.d.ts.map +1 -1
  99. package/esm/src/api/exchange/_methods/_base/_nonce.js +3 -2
  100. package/esm/src/api/exchange/_methods/_base/_nonce.js.map +1 -1
  101. package/esm/src/api/exchange/_methods/_base/_semaphore.d.ts +7 -6
  102. package/esm/src/api/exchange/_methods/_base/_semaphore.d.ts.map +1 -1
  103. package/esm/src/api/exchange/_methods/_base/_semaphore.js +34 -47
  104. package/esm/src/api/exchange/_methods/_base/_semaphore.js.map +1 -1
  105. package/esm/src/api/exchange/_methods/_base/execute.d.ts +14 -3
  106. package/esm/src/api/exchange/_methods/_base/execute.d.ts.map +1 -1
  107. package/esm/src/api/exchange/_methods/_base/execute.js +44 -10
  108. package/esm/src/api/exchange/_methods/_base/execute.js.map +1 -1
  109. package/esm/src/api/exchange/_methods/batchModify.d.ts +6 -6
  110. package/esm/src/api/exchange/_methods/createVault.d.ts +5 -5
  111. package/esm/src/api/exchange/_methods/modify.d.ts +5 -5
  112. package/esm/src/api/exchange/_methods/order.d.ts +13 -13
  113. package/esm/src/api/exchange/_methods/order.d.ts.map +1 -1
  114. package/esm/src/api/exchange/_methods/order.js +4 -2
  115. package/esm/src/api/exchange/_methods/order.js.map +1 -1
  116. package/esm/src/api/exchange/client.d.ts +1 -1
  117. package/esm/src/api/exchange/client.d.ts.map +1 -1
  118. package/esm/src/api/exchange/client.js.map +1 -1
  119. package/esm/src/api/exchange/mod.d.ts +1 -1
  120. package/esm/src/api/exchange/mod.d.ts.map +1 -1
  121. package/esm/src/api/exchange/mod.js.map +1 -1
  122. package/esm/src/api/info/_methods/_base/commonSchemas.d.ts +8 -8
  123. package/esm/src/api/info/_methods/frontendOpenOrders.d.ts +3 -3
  124. package/esm/src/api/info/_methods/historicalOrders.d.ts +4 -4
  125. package/esm/src/api/info/_methods/l3Orders.d.ts +11 -11
  126. package/esm/src/api/info/_methods/l4Orders.d.ts +6 -6
  127. package/esm/src/api/info/_methods/openOrders.d.ts +3 -3
  128. package/esm/src/api/info/_methods/orderStatus.d.ts +5 -5
  129. package/esm/src/api/info/_methods/recentTrades.d.ts +2 -2
  130. package/esm/src/api/info/_methods/twapHistory.d.ts +4 -4
  131. package/esm/src/api/info/_methods/userFills.d.ts +3 -3
  132. package/esm/src/api/info/_methods/userFillsByTime.d.ts +4 -4
  133. package/esm/src/api/info/_methods/userFunding.d.ts +3 -3
  134. package/esm/src/api/info/_methods/userFunding.js +2 -2
  135. package/esm/src/api/info/_methods/userFunding.js.map +1 -1
  136. package/esm/src/api/info/_methods/userTwapSliceFills.d.ts +4 -4
  137. package/esm/src/api/info/_methods/userTwapSliceFillsByTime.d.ts +5 -5
  138. package/esm/src/api/info/_methods/webData2.d.ts +9 -9
  139. package/esm/src/api/subscription/_methods/assetCtxs.d.ts +2 -0
  140. package/esm/src/api/subscription/_methods/assetCtxs.d.ts.map +1 -1
  141. package/esm/src/api/subscription/_methods/assetCtxs.js.map +1 -1
  142. package/esm/src/api/subscription/_methods/clearinghouseState.d.ts +2 -0
  143. package/esm/src/api/subscription/_methods/clearinghouseState.d.ts.map +1 -1
  144. package/esm/src/api/subscription/_methods/clearinghouseState.js +2 -0
  145. package/esm/src/api/subscription/_methods/clearinghouseState.js.map +1 -1
  146. package/esm/src/api/subscription/_methods/explorerBlock.d.ts +2 -0
  147. package/esm/src/api/subscription/_methods/explorerBlock.d.ts.map +1 -1
  148. package/esm/src/api/subscription/_methods/explorerBlock.js +2 -0
  149. package/esm/src/api/subscription/_methods/explorerBlock.js.map +1 -1
  150. package/esm/src/api/subscription/_methods/explorerTxs.d.ts +2 -0
  151. package/esm/src/api/subscription/_methods/explorerTxs.d.ts.map +1 -1
  152. package/esm/src/api/subscription/_methods/explorerTxs.js +2 -0
  153. package/esm/src/api/subscription/_methods/explorerTxs.js.map +1 -1
  154. package/esm/src/api/subscription/_methods/openOrders.d.ts +5 -5
  155. package/esm/src/api/subscription/_methods/orderUpdates.d.ts +4 -4
  156. package/esm/src/api/subscription/_methods/trades.d.ts +3 -3
  157. package/esm/src/api/subscription/_methods/twapStates.d.ts +9 -4
  158. package/esm/src/api/subscription/_methods/twapStates.d.ts.map +1 -1
  159. package/esm/src/api/subscription/_methods/twapStates.js +6 -1
  160. package/esm/src/api/subscription/_methods/twapStates.js.map +1 -1
  161. package/esm/src/api/subscription/_methods/userEvents.d.ts +17 -17
  162. package/esm/src/api/subscription/_methods/userFills.d.ts +5 -5
  163. package/esm/src/api/subscription/_methods/userHistoricalOrders.d.ts +6 -6
  164. package/esm/src/api/subscription/_methods/userTwapHistory.d.ts +6 -6
  165. package/esm/src/api/subscription/_methods/userTwapSliceFills.d.ts +6 -6
  166. package/esm/src/api/subscription/_methods/webData2.d.ts +11 -11
  167. package/esm/src/signing/_privateKeySigner.js +1 -1
  168. package/esm/src/signing/_privateKeySigner.js.map +1 -1
  169. package/esm/src/signing/mod.js +1 -1
  170. package/esm/src/signing/mod.js.map +1 -1
  171. package/package.json +2 -3
  172. package/script/_dnt.shims.d.ts +2 -0
  173. package/script/_dnt.shims.d.ts.map +1 -0
  174. package/script/_dnt.shims.js +61 -0
  175. package/script/_dnt.shims.js.map +1 -0
  176. package/script/deps/jsr.io/@noble/curves/2.0.1/src/abstract/curve.d.ts +195 -0
  177. package/script/deps/jsr.io/@noble/curves/2.0.1/src/abstract/curve.d.ts.map +1 -0
  178. package/script/deps/jsr.io/@noble/curves/2.0.1/src/abstract/curve.js +468 -0
  179. package/script/deps/jsr.io/@noble/curves/2.0.1/src/abstract/curve.js.map +1 -0
  180. package/script/deps/jsr.io/@noble/curves/2.0.1/src/abstract/hash-to-curve.d.ts +90 -0
  181. package/script/deps/jsr.io/@noble/curves/2.0.1/src/abstract/hash-to-curve.d.ts.map +1 -0
  182. package/script/deps/jsr.io/@noble/curves/2.0.1/src/abstract/hash-to-curve.js +215 -0
  183. package/script/deps/jsr.io/@noble/curves/2.0.1/src/abstract/hash-to-curve.js.map +1 -0
  184. package/script/deps/jsr.io/@noble/curves/2.0.1/src/abstract/modular.d.ts +159 -0
  185. package/script/deps/jsr.io/@noble/curves/2.0.1/src/abstract/modular.d.ts.map +1 -0
  186. package/script/deps/jsr.io/@noble/curves/2.0.1/src/abstract/modular.js +578 -0
  187. package/script/deps/jsr.io/@noble/curves/2.0.1/src/abstract/modular.js.map +1 -0
  188. package/script/deps/jsr.io/@noble/curves/2.0.1/src/abstract/weierstrass.d.ts +325 -0
  189. package/script/deps/jsr.io/@noble/curves/2.0.1/src/abstract/weierstrass.d.ts.map +1 -0
  190. package/script/deps/jsr.io/@noble/curves/2.0.1/src/abstract/weierstrass.js +1232 -0
  191. package/script/deps/jsr.io/@noble/curves/2.0.1/src/abstract/weierstrass.js.map +1 -0
  192. package/script/deps/jsr.io/@noble/curves/2.0.1/src/secp256k1.d.ts +76 -0
  193. package/script/deps/jsr.io/@noble/curves/2.0.1/src/secp256k1.d.ts.map +1 -0
  194. package/script/deps/jsr.io/@noble/curves/2.0.1/src/secp256k1.js +286 -0
  195. package/script/deps/jsr.io/@noble/curves/2.0.1/src/secp256k1.js.map +1 -0
  196. package/script/deps/jsr.io/@noble/curves/2.0.1/src/utils.d.ts +103 -0
  197. package/script/deps/jsr.io/@noble/curves/2.0.1/src/utils.d.ts.map +1 -0
  198. package/script/deps/jsr.io/@noble/curves/2.0.1/src/utils.js +273 -0
  199. package/script/deps/jsr.io/@noble/curves/2.0.1/src/utils.js.map +1 -0
  200. package/script/deps/jsr.io/@noble/hashes/2.0.1/src/_md.d.ts +49 -0
  201. package/script/deps/jsr.io/@noble/hashes/2.0.1/src/_md.d.ts.map +1 -0
  202. package/script/deps/jsr.io/@noble/hashes/2.0.1/src/_md.js +153 -0
  203. package/script/deps/jsr.io/@noble/hashes/2.0.1/src/_md.js.map +1 -0
  204. package/script/deps/jsr.io/@noble/hashes/2.0.1/src/_u64.d.ts +55 -0
  205. package/script/deps/jsr.io/@noble/hashes/2.0.1/src/_u64.d.ts.map +1 -0
  206. package/script/deps/jsr.io/@noble/hashes/2.0.1/src/_u64.js +90 -0
  207. package/script/deps/jsr.io/@noble/hashes/2.0.1/src/_u64.js.map +1 -0
  208. package/script/deps/jsr.io/@noble/hashes/2.0.1/src/hmac.d.ts +36 -0
  209. package/script/deps/jsr.io/@noble/hashes/2.0.1/src/hmac.d.ts.map +1 -0
  210. package/script/deps/jsr.io/@noble/hashes/2.0.1/src/hmac.js +95 -0
  211. package/script/deps/jsr.io/@noble/hashes/2.0.1/src/hmac.js.map +1 -0
  212. package/script/deps/jsr.io/@noble/hashes/2.0.1/src/sha2.d.ts +199 -0
  213. package/script/deps/jsr.io/@noble/hashes/2.0.1/src/sha2.d.ts.map +1 -0
  214. package/script/deps/jsr.io/@noble/hashes/2.0.1/src/sha2.js +439 -0
  215. package/script/deps/jsr.io/@noble/hashes/2.0.1/src/sha2.js.map +1 -0
  216. package/script/deps/jsr.io/@noble/hashes/2.0.1/src/sha3.d.ts +58 -0
  217. package/script/deps/jsr.io/@noble/hashes/2.0.1/src/sha3.d.ts.map +1 -0
  218. package/script/deps/jsr.io/@noble/hashes/2.0.1/src/sha3.js +259 -0
  219. package/script/deps/jsr.io/@noble/hashes/2.0.1/src/sha3.js.map +1 -0
  220. package/script/deps/jsr.io/@noble/hashes/2.0.1/src/utils.d.ts +124 -0
  221. package/script/deps/jsr.io/@noble/hashes/2.0.1/src/utils.d.ts.map +1 -0
  222. package/script/deps/jsr.io/@noble/hashes/2.0.1/src/utils.js +304 -0
  223. package/script/deps/jsr.io/@noble/hashes/2.0.1/src/utils.js.map +1 -0
  224. package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/advanced/abi-mapper.d.ts +44 -0
  225. package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/advanced/abi-mapper.d.ts.map +1 -0
  226. package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/advanced/abi-mapper.js +182 -0
  227. package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/advanced/abi-mapper.js.map +1 -0
  228. package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/address.d.ts +38 -0
  229. package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/address.d.ts.map +1 -0
  230. package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/address.js +99 -0
  231. package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/address.js.map +1 -0
  232. package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/rlp.d.ts +23 -0
  233. package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/rlp.d.ts.map +1 -0
  234. package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/rlp.js +134 -0
  235. package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/rlp.js.map +1 -0
  236. package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/tx-internal.d.ts +300 -0
  237. package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/tx-internal.d.ts.map +1 -0
  238. package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/tx-internal.js +576 -0
  239. package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/tx-internal.js.map +1 -0
  240. package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/tx.d.ts +98 -0
  241. package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/tx.d.ts.map +1 -0
  242. package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/tx.js +211 -0
  243. package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/tx.js.map +1 -0
  244. package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/typed-data.d.ts +78 -0
  245. package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/typed-data.d.ts.map +1 -0
  246. package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/typed-data.js +308 -0
  247. package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/typed-data.js.map +1 -0
  248. package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/index.d.ts +6 -0
  249. package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/index.d.ts.map +1 -0
  250. package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/index.js +21 -0
  251. package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/index.js.map +1 -0
  252. package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/utils.d.ts +66 -0
  253. package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/utils.d.ts.map +1 -0
  254. package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/utils.js +195 -0
  255. package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/utils.js.map +1 -0
  256. package/script/deps/jsr.io/@paulmillr/micro-packed/0.8.0/src/index.d.ts +877 -0
  257. package/script/deps/jsr.io/@paulmillr/micro-packed/0.8.0/src/index.d.ts.map +1 -0
  258. package/script/deps/jsr.io/@paulmillr/micro-packed/0.8.0/src/index.js +2032 -0
  259. package/script/deps/jsr.io/@paulmillr/micro-packed/0.8.0/src/index.js.map +1 -0
  260. package/script/deps/jsr.io/@scure/base/2.0.0/index.d.ts +294 -0
  261. package/script/deps/jsr.io/@scure/base/2.0.0/index.d.ts.map +1 -0
  262. package/script/deps/jsr.io/@scure/base/2.0.0/index.js +710 -0
  263. package/script/deps/jsr.io/@scure/base/2.0.0/index.js.map +1 -0
  264. package/script/deps/jsr.io/@std/async/1.0.16/unstable_semaphore.d.ts +93 -0
  265. package/script/deps/jsr.io/@std/async/1.0.16/unstable_semaphore.d.ts.map +1 -0
  266. package/script/deps/jsr.io/@std/async/1.0.16/unstable_semaphore.js +141 -0
  267. package/script/deps/jsr.io/@std/async/1.0.16/unstable_semaphore.js.map +1 -0
  268. package/script/src/api/exchange/_methods/_base/_nonce.d.ts +3 -2
  269. package/script/src/api/exchange/_methods/_base/_nonce.d.ts.map +1 -1
  270. package/script/src/api/exchange/_methods/_base/_nonce.js +4 -3
  271. package/script/src/api/exchange/_methods/_base/_nonce.js.map +1 -1
  272. package/script/src/api/exchange/_methods/_base/_semaphore.d.ts +7 -6
  273. package/script/src/api/exchange/_methods/_base/_semaphore.d.ts.map +1 -1
  274. package/script/src/api/exchange/_methods/_base/_semaphore.js +35 -50
  275. package/script/src/api/exchange/_methods/_base/_semaphore.js.map +1 -1
  276. package/script/src/api/exchange/_methods/_base/execute.d.ts +14 -3
  277. package/script/src/api/exchange/_methods/_base/execute.d.ts.map +1 -1
  278. package/script/src/api/exchange/_methods/_base/execute.js +43 -9
  279. package/script/src/api/exchange/_methods/_base/execute.js.map +1 -1
  280. package/script/src/api/exchange/_methods/batchModify.d.ts +6 -6
  281. package/script/src/api/exchange/_methods/createVault.d.ts +5 -5
  282. package/script/src/api/exchange/_methods/modify.d.ts +5 -5
  283. package/script/src/api/exchange/_methods/order.d.ts +13 -13
  284. package/script/src/api/exchange/_methods/order.d.ts.map +1 -1
  285. package/script/src/api/exchange/_methods/order.js +4 -2
  286. package/script/src/api/exchange/_methods/order.js.map +1 -1
  287. package/script/src/api/exchange/client.d.ts +1 -1
  288. package/script/src/api/exchange/client.d.ts.map +1 -1
  289. package/script/src/api/exchange/client.js.map +1 -1
  290. package/script/src/api/exchange/mod.d.ts +1 -1
  291. package/script/src/api/exchange/mod.d.ts.map +1 -1
  292. package/script/src/api/exchange/mod.js.map +1 -1
  293. package/script/src/api/info/_methods/_base/commonSchemas.d.ts +8 -8
  294. package/script/src/api/info/_methods/frontendOpenOrders.d.ts +3 -3
  295. package/script/src/api/info/_methods/historicalOrders.d.ts +4 -4
  296. package/script/src/api/info/_methods/l3Orders.d.ts +11 -11
  297. package/script/src/api/info/_methods/l4Orders.d.ts +6 -6
  298. package/script/src/api/info/_methods/openOrders.d.ts +3 -3
  299. package/script/src/api/info/_methods/orderStatus.d.ts +5 -5
  300. package/script/src/api/info/_methods/recentTrades.d.ts +2 -2
  301. package/script/src/api/info/_methods/twapHistory.d.ts +4 -4
  302. package/script/src/api/info/_methods/userFills.d.ts +3 -3
  303. package/script/src/api/info/_methods/userFillsByTime.d.ts +4 -4
  304. package/script/src/api/info/_methods/userFunding.d.ts +3 -3
  305. package/script/src/api/info/_methods/userFunding.js +2 -2
  306. package/script/src/api/info/_methods/userFunding.js.map +1 -1
  307. package/script/src/api/info/_methods/userTwapSliceFills.d.ts +4 -4
  308. package/script/src/api/info/_methods/userTwapSliceFillsByTime.d.ts +5 -5
  309. package/script/src/api/info/_methods/webData2.d.ts +9 -9
  310. package/script/src/api/subscription/_methods/assetCtxs.d.ts +2 -0
  311. package/script/src/api/subscription/_methods/assetCtxs.d.ts.map +1 -1
  312. package/script/src/api/subscription/_methods/assetCtxs.js.map +1 -1
  313. package/script/src/api/subscription/_methods/clearinghouseState.d.ts +2 -0
  314. package/script/src/api/subscription/_methods/clearinghouseState.d.ts.map +1 -1
  315. package/script/src/api/subscription/_methods/clearinghouseState.js +2 -0
  316. package/script/src/api/subscription/_methods/clearinghouseState.js.map +1 -1
  317. package/script/src/api/subscription/_methods/explorerBlock.d.ts +2 -0
  318. package/script/src/api/subscription/_methods/explorerBlock.d.ts.map +1 -1
  319. package/script/src/api/subscription/_methods/explorerBlock.js +2 -0
  320. package/script/src/api/subscription/_methods/explorerBlock.js.map +1 -1
  321. package/script/src/api/subscription/_methods/explorerTxs.d.ts +2 -0
  322. package/script/src/api/subscription/_methods/explorerTxs.d.ts.map +1 -1
  323. package/script/src/api/subscription/_methods/explorerTxs.js +2 -0
  324. package/script/src/api/subscription/_methods/explorerTxs.js.map +1 -1
  325. package/script/src/api/subscription/_methods/openOrders.d.ts +5 -5
  326. package/script/src/api/subscription/_methods/orderUpdates.d.ts +4 -4
  327. package/script/src/api/subscription/_methods/trades.d.ts +3 -3
  328. package/script/src/api/subscription/_methods/twapStates.d.ts +9 -4
  329. package/script/src/api/subscription/_methods/twapStates.d.ts.map +1 -1
  330. package/script/src/api/subscription/_methods/twapStates.js +6 -1
  331. package/script/src/api/subscription/_methods/twapStates.js.map +1 -1
  332. package/script/src/api/subscription/_methods/userEvents.d.ts +17 -17
  333. package/script/src/api/subscription/_methods/userFills.d.ts +5 -5
  334. package/script/src/api/subscription/_methods/userHistoricalOrders.d.ts +6 -6
  335. package/script/src/api/subscription/_methods/userTwapHistory.d.ts +6 -6
  336. package/script/src/api/subscription/_methods/userTwapSliceFills.d.ts +6 -6
  337. package/script/src/api/subscription/_methods/webData2.d.ts +11 -11
  338. package/script/src/signing/_privateKeySigner.js +3 -3
  339. package/script/src/signing/_privateKeySigner.js.map +1 -1
  340. package/script/src/signing/mod.js +2 -2
  341. package/script/src/signing/mod.js.map +1 -1
  342. package/src/_dnt.shims.ts +60 -0
  343. package/src/deps/jsr.io/@noble/curves/2.0.1/src/abstract/curve.ts +633 -0
  344. package/src/deps/jsr.io/@noble/curves/2.0.1/src/abstract/hash-to-curve.ts +292 -0
  345. package/src/deps/jsr.io/@noble/curves/2.0.1/src/abstract/modular.ts +621 -0
  346. package/src/deps/jsr.io/@noble/curves/2.0.1/src/abstract/weierstrass.ts +1562 -0
  347. package/src/deps/jsr.io/@noble/curves/2.0.1/src/secp256k1.ts +327 -0
  348. package/src/deps/jsr.io/@noble/curves/2.0.1/src/utils.ts +306 -0
  349. package/src/deps/jsr.io/@noble/hashes/2.0.1/src/_md.ts +156 -0
  350. package/src/deps/jsr.io/@noble/hashes/2.0.1/src/_u64.ts +91 -0
  351. package/src/deps/jsr.io/@noble/hashes/2.0.1/src/hmac.ts +94 -0
  352. package/src/deps/jsr.io/@noble/hashes/2.0.1/src/sha2.ts +469 -0
  353. package/src/deps/jsr.io/@noble/hashes/2.0.1/src/sha3.ts +295 -0
  354. package/src/deps/jsr.io/@noble/hashes/2.0.1/src/utils.ts +340 -0
  355. package/src/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/advanced/abi-mapper.ts +212 -0
  356. package/src/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/address.ts +100 -0
  357. package/src/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/rlp.ts +104 -0
  358. package/src/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/tx-internal.ts +626 -0
  359. package/src/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/tx.ts +274 -0
  360. package/src/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/typed-data.ts +391 -0
  361. package/src/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/index.ts +12 -0
  362. package/src/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/utils.ts +233 -0
  363. package/src/deps/jsr.io/@paulmillr/micro-packed/0.8.0/src/index.ts +2196 -0
  364. package/src/deps/jsr.io/@scure/base/2.0.0/index.ts +857 -0
  365. package/src/deps/jsr.io/@std/async/1.0.16/unstable_semaphore.ts +146 -0
  366. package/src/src/api/exchange/_methods/_base/_nonce.ts +3 -2
  367. package/src/src/api/exchange/_methods/_base/_semaphore.ts +34 -59
  368. package/src/src/api/exchange/_methods/_base/execute.ts +60 -12
  369. package/src/src/api/exchange/_methods/order.ts +5 -3
  370. package/src/src/api/exchange/client.ts +5 -1
  371. package/src/src/api/exchange/mod.ts +5 -1
  372. package/src/src/api/info/_methods/userFunding.ts +2 -2
  373. package/src/src/api/subscription/_methods/assetCtxs.ts +2 -0
  374. package/src/src/api/subscription/_methods/clearinghouseState.ts +2 -0
  375. package/src/src/api/subscription/_methods/explorerBlock.ts +2 -0
  376. package/src/src/api/subscription/_methods/explorerTxs.ts +2 -0
  377. package/src/src/api/subscription/_methods/twapStates.ts +9 -1
  378. package/src/src/signing/_privateKeySigner.ts +1 -1
  379. package/src/src/signing/mod.ts +1 -1
  380. package/esm/deps/jsr.io/@std/msgpack/1.0.3/decode.d.ts +0 -21
  381. package/esm/deps/jsr.io/@std/msgpack/1.0.3/decode.d.ts.map +0 -1
  382. package/esm/deps/jsr.io/@std/msgpack/1.0.3/decode.js +0 -292
  383. package/esm/deps/jsr.io/@std/msgpack/1.0.3/decode.js.map +0 -1
  384. package/esm/deps/jsr.io/@std/msgpack/1.0.3/mod.d.ts +0 -44
  385. package/esm/deps/jsr.io/@std/msgpack/1.0.3/mod.d.ts.map +0 -1
  386. package/esm/deps/jsr.io/@std/msgpack/1.0.3/mod.js +0 -46
  387. package/esm/deps/jsr.io/@std/msgpack/1.0.3/mod.js.map +0 -1
  388. package/script/deps/jsr.io/@std/msgpack/1.0.3/decode.d.ts +0 -21
  389. package/script/deps/jsr.io/@std/msgpack/1.0.3/decode.d.ts.map +0 -1
  390. package/script/deps/jsr.io/@std/msgpack/1.0.3/decode.js +0 -295
  391. package/script/deps/jsr.io/@std/msgpack/1.0.3/decode.js.map +0 -1
  392. package/script/deps/jsr.io/@std/msgpack/1.0.3/mod.d.ts +0 -44
  393. package/script/deps/jsr.io/@std/msgpack/1.0.3/mod.d.ts.map +0 -1
  394. package/script/deps/jsr.io/@std/msgpack/1.0.3/mod.js +0 -62
  395. package/script/deps/jsr.io/@std/msgpack/1.0.3/mod.js.map +0 -1
  396. package/src/deps/jsr.io/@std/msgpack/1.0.3/decode.ts +0 -391
  397. package/src/deps/jsr.io/@std/msgpack/1.0.3/mod.ts +0 -47
@@ -0,0 +1,295 @@
1
+ /**
2
+ * SHA3 (keccak) hash function, based on a new "Sponge function" design.
3
+ * Different from older hashes, the internal state is bigger than output size.
4
+ *
5
+ * Check out [FIPS-202](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf),
6
+ * [Website](https://keccak.team/keccak.html),
7
+ * [the differences between SHA-3 and Keccak](https://crypto.stackexchange.com/questions/15727/what-are-the-key-differences-between-the-draft-sha-3-standard-and-the-keccak-sub).
8
+ *
9
+ * Check out `sha3-addons` module for cSHAKE, k12, and others.
10
+ * @module
11
+ */
12
+ import { rotlBH, rotlBL, rotlSH, rotlSL, split } from './_u64.js';
13
+ // prettier-ignore
14
+ import {
15
+ abytes, aexists, anumber, aoutput,
16
+ clean, createHasher,
17
+ oidNist,
18
+ swap32IfBE,
19
+ u32,
20
+ type CHash, type CHashXOF,
21
+ type Hash,
22
+ type HashInfo,
23
+ type HashXOF
24
+ } from './utils.js';
25
+
26
+ // No __PURE__ annotations in sha3 header:
27
+ // EVERYTHING is in fact used on every export.
28
+ // Various per round constants calculations
29
+ const _0n = BigInt(0);
30
+ const _1n = BigInt(1);
31
+ const _2n = BigInt(2);
32
+ const _7n = BigInt(7);
33
+ const _256n = BigInt(256);
34
+ const _0x71n = BigInt(0x71);
35
+ const SHA3_PI: number[] = [];
36
+ const SHA3_ROTL: number[] = [];
37
+ const _SHA3_IOTA: bigint[] = []; // no pure annotation: var is always used
38
+ for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {
39
+ // Pi
40
+ [x, y] = [y, (2 * x + 3 * y) % 5];
41
+ SHA3_PI.push(2 * (5 * y + x));
42
+ // Rotational
43
+ SHA3_ROTL.push((((round + 1) * (round + 2)) / 2) % 64);
44
+ // Iota
45
+ let t = _0n;
46
+ for (let j = 0; j < 7; j++) {
47
+ R = ((R << _1n) ^ ((R >> _7n) * _0x71n)) % _256n;
48
+ if (R & _2n) t ^= _1n << ((_1n << BigInt(j)) - _1n);
49
+ }
50
+ _SHA3_IOTA.push(t);
51
+ }
52
+ const IOTAS = split(_SHA3_IOTA, true);
53
+ const SHA3_IOTA_H = IOTAS[0];
54
+ const SHA3_IOTA_L = IOTAS[1];
55
+
56
+ // Left rotation (without 0, 32, 64)
57
+ const rotlH = (h: number, l: number, s: number) => (s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s));
58
+ const rotlL = (h: number, l: number, s: number) => (s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s));
59
+
60
+ /** `keccakf1600` internal function, additionally allows to adjust round count. */
61
+ export function keccakP(s: Uint32Array, rounds: number = 24): void {
62
+ const B = new Uint32Array(5 * 2);
63
+ // NOTE: all indices are x2 since we store state as u32 instead of u64 (bigints to slow in js)
64
+ for (let round = 24 - rounds; round < 24; round++) {
65
+ // Theta θ
66
+ for (let x = 0; x < 10; x++) B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];
67
+ for (let x = 0; x < 10; x += 2) {
68
+ const idx1 = (x + 8) % 10;
69
+ const idx0 = (x + 2) % 10;
70
+ const B0 = B[idx0];
71
+ const B1 = B[idx0 + 1];
72
+ const Th = rotlH(B0, B1, 1) ^ B[idx1];
73
+ const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];
74
+ for (let y = 0; y < 50; y += 10) {
75
+ s[x + y] ^= Th;
76
+ s[x + y + 1] ^= Tl;
77
+ }
78
+ }
79
+ // Rho (ρ) and Pi (π)
80
+ let curH = s[2];
81
+ let curL = s[3];
82
+ for (let t = 0; t < 24; t++) {
83
+ const shift = SHA3_ROTL[t];
84
+ const Th = rotlH(curH, curL, shift);
85
+ const Tl = rotlL(curH, curL, shift);
86
+ const PI = SHA3_PI[t];
87
+ curH = s[PI];
88
+ curL = s[PI + 1];
89
+ s[PI] = Th;
90
+ s[PI + 1] = Tl;
91
+ }
92
+ // Chi (χ)
93
+ for (let y = 0; y < 50; y += 10) {
94
+ for (let x = 0; x < 10; x++) B[x] = s[y + x];
95
+ for (let x = 0; x < 10; x++) s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];
96
+ }
97
+ // Iota (ι)
98
+ s[0] ^= SHA3_IOTA_H[round];
99
+ s[1] ^= SHA3_IOTA_L[round];
100
+ }
101
+ clean(B);
102
+ }
103
+
104
+ /** Keccak sponge function. */
105
+ export class Keccak implements Hash<Keccak>, HashXOF<Keccak> {
106
+ protected state: Uint8Array;
107
+ protected pos = 0;
108
+ protected posOut = 0;
109
+ protected finished = false;
110
+ protected state32: Uint32Array;
111
+ protected destroyed = false;
112
+
113
+ public blockLen: number;
114
+ public suffix: number;
115
+ public outputLen: number;
116
+ protected enableXOF = false;
117
+ protected rounds: number;
118
+
119
+ // NOTE: we accept arguments in bytes instead of bits here.
120
+ constructor(
121
+ blockLen: number,
122
+ suffix: number,
123
+ outputLen: number,
124
+ enableXOF = false,
125
+ rounds: number = 24
126
+ ) {
127
+ this.blockLen = blockLen;
128
+ this.suffix = suffix;
129
+ this.outputLen = outputLen;
130
+ this.enableXOF = enableXOF;
131
+ this.rounds = rounds;
132
+ // Can be passed from user as dkLen
133
+ anumber(outputLen, 'outputLen');
134
+ // 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes
135
+ // 0 < blockLen < 200
136
+ if (!(0 < blockLen && blockLen < 200))
137
+ throw new Error('only keccak-f1600 function is supported');
138
+ this.state = new Uint8Array(200);
139
+ this.state32 = u32(this.state);
140
+ }
141
+ clone(): Keccak {
142
+ return this._cloneInto();
143
+ }
144
+ protected keccak(): void {
145
+ swap32IfBE(this.state32);
146
+ keccakP(this.state32, this.rounds);
147
+ swap32IfBE(this.state32);
148
+ this.posOut = 0;
149
+ this.pos = 0;
150
+ }
151
+ update(data: Uint8Array): this {
152
+ aexists(this);
153
+ abytes(data);
154
+ const { blockLen, state } = this;
155
+ const len = data.length;
156
+ for (let pos = 0; pos < len; ) {
157
+ const take = Math.min(blockLen - this.pos, len - pos);
158
+ for (let i = 0; i < take; i++) state[this.pos++] ^= data[pos++];
159
+ if (this.pos === blockLen) this.keccak();
160
+ }
161
+ return this;
162
+ }
163
+ protected finish(): void {
164
+ if (this.finished) return;
165
+ this.finished = true;
166
+ const { state, suffix, pos, blockLen } = this;
167
+ // Do the padding
168
+ state[pos] ^= suffix;
169
+ if ((suffix & 0x80) !== 0 && pos === blockLen - 1) this.keccak();
170
+ state[blockLen - 1] ^= 0x80;
171
+ this.keccak();
172
+ }
173
+ protected writeInto(out: Uint8Array): Uint8Array {
174
+ aexists(this, false);
175
+ abytes(out);
176
+ this.finish();
177
+ const bufferOut = this.state;
178
+ const { blockLen } = this;
179
+ for (let pos = 0, len = out.length; pos < len; ) {
180
+ if (this.posOut >= blockLen) this.keccak();
181
+ const take = Math.min(blockLen - this.posOut, len - pos);
182
+ out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);
183
+ this.posOut += take;
184
+ pos += take;
185
+ }
186
+ return out;
187
+ }
188
+ xofInto(out: Uint8Array): Uint8Array {
189
+ // Sha3/Keccak usage with XOF is probably mistake, only SHAKE instances can do XOF
190
+ if (!this.enableXOF) throw new Error('XOF is not possible for this instance');
191
+ return this.writeInto(out);
192
+ }
193
+ xof(bytes: number): Uint8Array {
194
+ anumber(bytes);
195
+ return this.xofInto(new Uint8Array(bytes));
196
+ }
197
+ digestInto(out: Uint8Array): Uint8Array {
198
+ aoutput(out, this);
199
+ if (this.finished) throw new Error('digest() was already called');
200
+ this.writeInto(out);
201
+ this.destroy();
202
+ return out;
203
+ }
204
+ digest(): Uint8Array {
205
+ return this.digestInto(new Uint8Array(this.outputLen));
206
+ }
207
+ destroy(): void {
208
+ this.destroyed = true;
209
+ clean(this.state);
210
+ }
211
+ _cloneInto(to?: Keccak): Keccak {
212
+ const { blockLen, suffix, outputLen, rounds, enableXOF } = this;
213
+ to ||= new Keccak(blockLen, suffix, outputLen, enableXOF, rounds);
214
+ to.state32.set(this.state32);
215
+ to.pos = this.pos;
216
+ to.posOut = this.posOut;
217
+ to.finished = this.finished;
218
+ to.rounds = rounds;
219
+ // Suffix can change in cSHAKE
220
+ to.suffix = suffix;
221
+ to.outputLen = outputLen;
222
+ to.enableXOF = enableXOF;
223
+ to.destroyed = this.destroyed;
224
+ return to;
225
+ }
226
+ }
227
+
228
+ const genKeccak = (suffix: number, blockLen: number, outputLen: number, info: HashInfo = {}) =>
229
+ createHasher(() => new Keccak(blockLen, suffix, outputLen), info);
230
+
231
+ /** SHA3-224 hash function. */
232
+ export const sha3_224: CHash = /* @__PURE__ */ genKeccak(
233
+ 0x06,
234
+ 144,
235
+ 28,
236
+ /* @__PURE__ */ oidNist(0x07)
237
+ );
238
+ /** SHA3-256 hash function. Different from keccak-256. */
239
+ export const sha3_256: CHash = /* @__PURE__ */ genKeccak(
240
+ 0x06,
241
+ 136,
242
+ 32,
243
+ /* @__PURE__ */ oidNist(0x08)
244
+ );
245
+ /** SHA3-384 hash function. */
246
+ export const sha3_384: CHash = /* @__PURE__ */ genKeccak(
247
+ 0x06,
248
+ 104,
249
+ 48,
250
+ /* @__PURE__ */ oidNist(0x09)
251
+ );
252
+ /** SHA3-512 hash function. */
253
+ export const sha3_512: CHash = /* @__PURE__ */ genKeccak(
254
+ 0x06,
255
+ 72,
256
+ 64,
257
+ /* @__PURE__ */ oidNist(0x0a)
258
+ );
259
+
260
+ /** keccak-224 hash function. */
261
+ export const keccak_224: CHash = /* @__PURE__ */ genKeccak(0x01, 144, 28);
262
+ /** keccak-256 hash function. Different from SHA3-256. */
263
+ export const keccak_256: CHash = /* @__PURE__ */ genKeccak(0x01, 136, 32);
264
+ /** keccak-384 hash function. */
265
+ export const keccak_384: CHash = /* @__PURE__ */ genKeccak(0x01, 104, 48);
266
+ /** keccak-512 hash function. */
267
+ export const keccak_512: CHash = /* @__PURE__ */ genKeccak(0x01, 72, 64);
268
+
269
+ /** Options for SHAKE XOF. */
270
+ export type ShakeOpts = { dkLen?: number };
271
+
272
+ const genShake = (suffix: number, blockLen: number, outputLen: number, info: HashInfo = {}) =>
273
+ createHasher<Keccak, ShakeOpts>(
274
+ (opts: ShakeOpts = {}) =>
275
+ new Keccak(blockLen, suffix, opts.dkLen === undefined ? outputLen : opts.dkLen, true),
276
+ info
277
+ );
278
+
279
+ /** SHAKE128 XOF with 128-bit security. */
280
+ export const shake128: CHashXOF<Keccak, ShakeOpts> =
281
+ /* @__PURE__ */
282
+ genShake(0x1f, 168, 16, /* @__PURE__ */ oidNist(0x0b));
283
+ /** SHAKE256 XOF with 256-bit security. */
284
+ export const shake256: CHashXOF<Keccak, ShakeOpts> =
285
+ /* @__PURE__ */
286
+ genShake(0x1f, 136, 32, /* @__PURE__ */ oidNist(0x0c));
287
+
288
+ /** SHAKE128 XOF with 256-bit output (NIST version). */
289
+ export const shake128_32: CHashXOF<Keccak, ShakeOpts> =
290
+ /* @__PURE__ */
291
+ genShake(0x1f, 168, 32, /* @__PURE__ */ oidNist(0x0b));
292
+ /** SHAKE256 XOF with 512-bit output (NIST version). */
293
+ export const shake256_64: CHashXOF<Keccak, ShakeOpts> =
294
+ /* @__PURE__ */
295
+ genShake(0x1f, 136, 64, /* @__PURE__ */ oidNist(0x0c));
@@ -0,0 +1,340 @@
1
+ /**
2
+ * Utilities for hex, bytes, CSPRNG.
3
+ * @module
4
+ */
5
+ /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
6
+ /** Checks if something is Uint8Array. Be careful: nodejs Buffer will return true. */
7
+ import * as dntShim from "../../../../../../_dnt.shims.js";
8
+
9
+ export function isBytes(a: unknown): a is Uint8Array {
10
+ return a instanceof Uint8Array || (ArrayBuffer.isView(a) && a.constructor.name === 'Uint8Array');
11
+ }
12
+
13
+ /** Asserts something is positive integer. */
14
+ export function anumber(n: number, title: string = ''): void {
15
+ if (!Number.isSafeInteger(n) || n < 0) {
16
+ const prefix = title && `"${title}" `;
17
+ throw new Error(`${prefix}expected integer >= 0, got ${n}`);
18
+ }
19
+ }
20
+
21
+ /** Asserts something is Uint8Array. */
22
+ export function abytes(value: Uint8Array, length?: number, title: string = ''): Uint8Array {
23
+ const bytes = isBytes(value);
24
+ const len = value?.length;
25
+ const needsLen = length !== undefined;
26
+ if (!bytes || (needsLen && len !== length)) {
27
+ const prefix = title && `"${title}" `;
28
+ const ofLen = needsLen ? ` of length ${length}` : '';
29
+ const got = bytes ? `length=${len}` : `type=${typeof value}`;
30
+ throw new Error(prefix + 'expected Uint8Array' + ofLen + ', got ' + got);
31
+ }
32
+ return value;
33
+ }
34
+
35
+ /** Asserts something is hash */
36
+ export function ahash(h: CHash): void {
37
+ if (typeof h !== 'function' || typeof h.create !== 'function')
38
+ throw new Error('Hash must wrapped by utils.createHasher');
39
+ anumber(h.outputLen);
40
+ anumber(h.blockLen);
41
+ }
42
+
43
+ /** Asserts a hash instance has not been destroyed / finished */
44
+ export function aexists(instance: any, checkFinished = true): void {
45
+ if (instance.destroyed) throw new Error('Hash instance has been destroyed');
46
+ if (checkFinished && instance.finished) throw new Error('Hash#digest() has already been called');
47
+ }
48
+
49
+ /** Asserts output is properly-sized byte array */
50
+ export function aoutput(out: any, instance: any): void {
51
+ abytes(out, undefined, 'digestInto() output');
52
+ const min = instance.outputLen;
53
+ if (out.length < min) {
54
+ throw new Error('"digestInto() output" expected to be of length >=' + min);
55
+ }
56
+ }
57
+
58
+ /** Generic type encompassing 8/16/32-byte arrays - but not 64-byte. */
59
+ // prettier-ignore
60
+ export type TypedArray = Int8Array | Uint8ClampedArray | Uint8Array |
61
+ Uint16Array | Int16Array | Uint32Array | Int32Array;
62
+
63
+ /** Cast u8 / u16 / u32 to u8. */
64
+ export function u8(arr: TypedArray): Uint8Array {
65
+ return new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);
66
+ }
67
+
68
+ /** Cast u8 / u16 / u32 to u32. */
69
+ export function u32(arr: TypedArray): Uint32Array {
70
+ return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
71
+ }
72
+
73
+ /** Zeroize a byte array. Warning: JS provides no guarantees. */
74
+ export function clean(...arrays: TypedArray[]): void {
75
+ for (let i = 0; i < arrays.length; i++) {
76
+ arrays[i].fill(0);
77
+ }
78
+ }
79
+
80
+ /** Create DataView of an array for easy byte-level manipulation. */
81
+ export function createView(arr: TypedArray): DataView {
82
+ return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
83
+ }
84
+
85
+ /** The rotate right (circular right shift) operation for uint32 */
86
+ export function rotr(word: number, shift: number): number {
87
+ return (word << (32 - shift)) | (word >>> shift);
88
+ }
89
+
90
+ /** The rotate left (circular left shift) operation for uint32 */
91
+ export function rotl(word: number, shift: number): number {
92
+ return (word << shift) | ((word >>> (32 - shift)) >>> 0);
93
+ }
94
+
95
+ /** Is current platform little-endian? Most are. Big-Endian platform: IBM */
96
+ export const isLE: boolean = /* @__PURE__ */ (() =>
97
+ new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44)();
98
+
99
+ /** The byte swap operation for uint32 */
100
+ export function byteSwap(word: number): number {
101
+ return (
102
+ ((word << 24) & 0xff000000) |
103
+ ((word << 8) & 0xff0000) |
104
+ ((word >>> 8) & 0xff00) |
105
+ ((word >>> 24) & 0xff)
106
+ );
107
+ }
108
+ /** Conditionally byte swap if on a big-endian platform */
109
+ export const swap8IfBE: (n: number) => number = isLE
110
+ ? (n: number) => n
111
+ : (n: number) => byteSwap(n);
112
+
113
+ /** In place byte swap for Uint32Array */
114
+ export function byteSwap32(arr: Uint32Array): Uint32Array {
115
+ for (let i = 0; i < arr.length; i++) {
116
+ arr[i] = byteSwap(arr[i]);
117
+ }
118
+ return arr;
119
+ }
120
+
121
+ export const swap32IfBE: (u: Uint32Array) => Uint32Array = isLE
122
+ ? (u: Uint32Array) => u
123
+ : byteSwap32;
124
+
125
+ // Built-in hex conversion https://caniuse.com/mdn-javascript_builtins_uint8array_fromhex
126
+ const hasHexBuiltin: boolean = /* @__PURE__ */ (() =>
127
+ // @ts-ignore
128
+ typeof Uint8Array.from([]).toHex === 'function' && typeof Uint8Array.fromHex === 'function')();
129
+
130
+ // Array where index 0xf0 (240) is mapped to string 'f0'
131
+ const hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) =>
132
+ i.toString(16).padStart(2, '0')
133
+ );
134
+
135
+ /**
136
+ * Convert byte array to hex string. Uses built-in function, when available.
137
+ * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'
138
+ */
139
+ export function bytesToHex(bytes: Uint8Array): string {
140
+ abytes(bytes);
141
+ // @ts-ignore
142
+ if (hasHexBuiltin) return bytes.toHex();
143
+ // pre-caching improves the speed 6x
144
+ let hex = '';
145
+ for (let i = 0; i < bytes.length; i++) {
146
+ hex += hexes[bytes[i]];
147
+ }
148
+ return hex;
149
+ }
150
+
151
+ // We use optimized technique to convert hex string to byte array
152
+ const asciis = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 } as const;
153
+ function asciiToBase16(ch: number): number | undefined {
154
+ if (ch >= asciis._0 && ch <= asciis._9) return ch - asciis._0; // '2' => 50-48
155
+ if (ch >= asciis.A && ch <= asciis.F) return ch - (asciis.A - 10); // 'B' => 66-(65-10)
156
+ if (ch >= asciis.a && ch <= asciis.f) return ch - (asciis.a - 10); // 'b' => 98-(97-10)
157
+ return;
158
+ }
159
+
160
+ /**
161
+ * Convert hex string to byte array. Uses built-in function, when available.
162
+ * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])
163
+ */
164
+ export function hexToBytes(hex: string): Uint8Array {
165
+ if (typeof hex !== 'string') throw new Error('hex string expected, got ' + typeof hex);
166
+ // @ts-ignore
167
+ if (hasHexBuiltin) return Uint8Array.fromHex(hex);
168
+ const hl = hex.length;
169
+ const al = hl / 2;
170
+ if (hl % 2) throw new Error('hex string expected, got unpadded hex of length ' + hl);
171
+ const array = new Uint8Array(al);
172
+ for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {
173
+ const n1 = asciiToBase16(hex.charCodeAt(hi));
174
+ const n2 = asciiToBase16(hex.charCodeAt(hi + 1));
175
+ if (n1 === undefined || n2 === undefined) {
176
+ const char = hex[hi] + hex[hi + 1];
177
+ throw new Error('hex string expected, got non-hex character "' + char + '" at index ' + hi);
178
+ }
179
+ array[ai] = n1 * 16 + n2; // multiply first octet, e.g. 'a3' => 10*16+3 => 160 + 3 => 163
180
+ }
181
+ return array;
182
+ }
183
+
184
+ /**
185
+ * There is no setImmediate in browser and setTimeout is slow.
186
+ * Call of async fn will return Promise, which will be fullfiled only on
187
+ * next scheduler queue processing step and this is exactly what we need.
188
+ */
189
+ export const nextTick = async (): Promise<void> => {};
190
+
191
+ /** Returns control to thread each 'tick' ms to avoid blocking. */
192
+ export async function asyncLoop(
193
+ iters: number,
194
+ tick: number,
195
+ cb: (i: number) => void
196
+ ): Promise<void> {
197
+ let ts = Date.now();
198
+ for (let i = 0; i < iters; i++) {
199
+ cb(i);
200
+ // Date.now() is not monotonic, so in case if clock goes backwards we return return control too
201
+ const diff = Date.now() - ts;
202
+ if (diff >= 0 && diff < tick) continue;
203
+ await nextTick();
204
+ ts += diff;
205
+ }
206
+ }
207
+
208
+ // Global symbols, but ts doesn't see them: https://github.com/microsoft/TypeScript/issues/31535
209
+ declare const TextEncoder: any;
210
+
211
+ /**
212
+ * Converts string to bytes using UTF8 encoding.
213
+ * Built-in doesn't validate input to be string: we do the check.
214
+ * @example utf8ToBytes('abc') // Uint8Array.from([97, 98, 99])
215
+ */
216
+ export function utf8ToBytes(str: string): Uint8Array {
217
+ if (typeof str !== 'string') throw new Error('string expected');
218
+ return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809
219
+ }
220
+
221
+ /** KDFs can accept string or Uint8Array for user convenience. */
222
+ export type KDFInput = string | Uint8Array;
223
+
224
+ /**
225
+ * Helper for KDFs: consumes uint8array or string.
226
+ * When string is passed, does utf8 decoding, using TextDecoder.
227
+ */
228
+ export function kdfInputToBytes(data: KDFInput, errorTitle = ''): Uint8Array {
229
+ if (typeof data === 'string') return utf8ToBytes(data);
230
+ return abytes(data, undefined, errorTitle);
231
+ }
232
+
233
+ /** Copies several Uint8Arrays into one. */
234
+ export function concatBytes(...arrays: Uint8Array[]): Uint8Array {
235
+ let sum = 0;
236
+ for (let i = 0; i < arrays.length; i++) {
237
+ const a = arrays[i];
238
+ abytes(a);
239
+ sum += a.length;
240
+ }
241
+ const res = new Uint8Array(sum);
242
+ for (let i = 0, pad = 0; i < arrays.length; i++) {
243
+ const a = arrays[i];
244
+ res.set(a, pad);
245
+ pad += a.length;
246
+ }
247
+ return res;
248
+ }
249
+
250
+ type EmptyObj = {};
251
+ /** Merges default options and passed options. */
252
+ export function checkOpts<T1 extends EmptyObj, T2 extends EmptyObj>(
253
+ defaults: T1,
254
+ opts?: T2
255
+ ): T1 & T2 {
256
+ if (opts !== undefined && {}.toString.call(opts) !== '[object Object]')
257
+ throw new Error('options must be object or undefined');
258
+ const merged = Object.assign(defaults, opts);
259
+ return merged as T1 & T2;
260
+ }
261
+
262
+ /** Common interface for all hashes. */
263
+ export interface Hash<T> {
264
+ blockLen: number; // Bytes per block
265
+ outputLen: number; // Bytes in output
266
+ update(buf: Uint8Array): this;
267
+ digestInto(buf: Uint8Array): void;
268
+ digest(): Uint8Array;
269
+ destroy(): void;
270
+ _cloneInto(to?: T): T;
271
+ clone(): T;
272
+ }
273
+
274
+ /** PseudoRandom (number) Generator */
275
+ export interface PRG {
276
+ addEntropy(seed: Uint8Array): void;
277
+ randomBytes(length: number): Uint8Array;
278
+ clean(): void;
279
+ }
280
+
281
+ /**
282
+ * XOF: streaming API to read digest in chunks.
283
+ * Same as 'squeeze' in keccak/k12 and 'seek' in blake3, but more generic name.
284
+ * When hash used in XOF mode it is up to user to call '.destroy' afterwards, since we cannot
285
+ * destroy state, next call can require more bytes.
286
+ */
287
+ export type HashXOF<T extends Hash<T>> = Hash<T> & {
288
+ xof(bytes: number): Uint8Array; // Read 'bytes' bytes from digest stream
289
+ xofInto(buf: Uint8Array): Uint8Array; // read buf.length bytes from digest stream into buf
290
+ };
291
+
292
+ /** Hash constructor */
293
+ export type HasherCons<T, Opts = undefined> = Opts extends undefined ? () => T : (opts?: Opts) => T;
294
+ /** Optional hash params. */
295
+ export type HashInfo = {
296
+ oid?: Uint8Array; // DER encoded OID in bytes
297
+ };
298
+ /** Hash function */
299
+ export type CHash<T extends Hash<T> = Hash<any>, Opts = undefined> = {
300
+ outputLen: number;
301
+ blockLen: number;
302
+ } & HashInfo &
303
+ (Opts extends undefined
304
+ ? {
305
+ (msg: Uint8Array): Uint8Array;
306
+ create(): T;
307
+ }
308
+ : {
309
+ (msg: Uint8Array, opts?: Opts): Uint8Array;
310
+ create(opts?: Opts): T;
311
+ });
312
+ /** XOF with output */
313
+ export type CHashXOF<T extends HashXOF<T> = HashXOF<any>, Opts = undefined> = CHash<T, Opts>;
314
+
315
+ /** Creates function with outputLen, blockLen, create properties from a class constructor. */
316
+ export function createHasher<T extends Hash<T>, Opts = undefined>(
317
+ hashCons: HasherCons<T, Opts>,
318
+ info: HashInfo = {}
319
+ ): CHash<T, Opts> {
320
+ const hashC: any = (msg: Uint8Array, opts?: Opts) => hashCons(opts).update(msg).digest();
321
+ const tmp = hashCons(undefined);
322
+ hashC.outputLen = tmp.outputLen;
323
+ hashC.blockLen = tmp.blockLen;
324
+ hashC.create = (opts?: Opts) => hashCons(opts);
325
+ Object.assign(hashC, info);
326
+ return Object.freeze(hashC);
327
+ }
328
+
329
+ /** Cryptographically secure PRNG. Uses internal OS-level `crypto.getRandomValues`. */
330
+ export function randomBytes(bytesLength = 32): Uint8Array {
331
+ const cr = typeof dntShim.dntGlobalThis === 'object' ? (dntShim.dntGlobalThis as any).crypto : null;
332
+ if (typeof cr?.getRandomValues !== 'function')
333
+ throw new Error('crypto.getRandomValues must be defined');
334
+ return cr.getRandomValues(new Uint8Array(bytesLength));
335
+ }
336
+
337
+ /** Creates OID opts for NIST hashes, with prefix 06 09 60 86 48 01 65 03 04 02. */
338
+ export const oidNist = (suffix: number): Required<HashInfo> => ({
339
+ oid: Uint8Array.from([0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, suffix]),
340
+ });