@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 @@
1
+ {"version":3,"file":"tx.d.ts","sourceRoot":"","sources":["../../../../../../../../src/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/tx.ts"],"names":[],"mappings":"AAKA,OAAO,EAOL,KAAK,OAAO,EACZ,KAAK,MAAM,EACZ,MAAM,kBAAkB,CAAC;AAoB1B,QAAA,MAAM,WAAW;;;sBAGwB,MAAM;;uBAED,MAAM;mCACmB,MAAM;;CAEnE,CAAC;AACX,KAAK,YAAY,GAAG,MAAM,OAAO,WAAW,CAAC;AAC7C,KAAK,WAAW,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAChD,KAAK,gBAAgB,CAAC,CAAC,IAAI;KACxB,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,YAAY,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;CAC5D,GAAG;KACD,CAAC,IAAI,MAAM,CAAC,IAAI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AYxD"}
@@ -0,0 +1,207 @@
1
+ /*! micro-eth-signer - MIT License (c) 2021 Paul Miller (paulmillr.com) */
2
+ import { keccak_256 } from '../../../../../@noble/hashes/2.0.1/src/sha3.js';
3
+ import { bytesToHex, hexToBytes } from '../../../../../@noble/hashes/2.0.1/src/utils.js';
4
+ import { addr } from './address.js';
5
+ import { RawTx, TxVersions, decodeLegacyV, removeSig, sortRawData, validateFields, } from './tx-internal.js';
6
+ // prettier-ignore
7
+ import { secp256k1 } from '../../../../../@noble/curves/2.0.1/src/secp256k1.js';
8
+ import { amounts, cloneDeep, ethHex, ethHexNoLeadingZero, initSig, isBytes, sign, strip0x, verify, } from '../utils.js';
9
+ // The file exports Transaction, but actual (RLP) parsing logic is done in `./tx`
10
+ // Transaction-related utils.
11
+ // 4 fields are required. Others are pre-filled with default values.
12
+ const TX_DEFAULTS = {
13
+ accessList: [], // needs to be .slice()-d to create new reference
14
+ authorizationList: [],
15
+ chainId: BigInt(1), // mainnet
16
+ data: '',
17
+ gasLimit: BigInt(21000), // TODO: investigate if limit is smaller in eip4844 txs
18
+ maxPriorityFeePerGas: (BigInt(1) * amounts.GWEI), // Reduce fingerprinting by using standard, popular value
19
+ type: 'eip1559',
20
+ };
21
+ // Changes:
22
+ // - legacy: instead of hardfork now accepts additional param chainId
23
+ // if chainId is present, we enable relay protection
24
+ // This removes hardfork param and simplifies replay protection logic
25
+ // - tx parametrized over type: you cannot access fields from different tx version
26
+ // - legacy: 'v' param is hidden in coders. Transaction operates in terms chainId and yParity.
27
+ // TODO: tx is kinda immutable, but user can change .raw values before signing
28
+ // need to think about re-validation?
29
+ export class Transaction {
30
+ type;
31
+ raw;
32
+ isSigned;
33
+ // Doesn't force any defaults, catches if fields incompatible with type
34
+ constructor(type, raw, strict = true, allowSignatureFields = true) {
35
+ this.type = type;
36
+ this.raw = raw;
37
+ validateFields(type, raw, strict, allowSignatureFields);
38
+ this.isSigned = typeof raw.r === 'bigint' && typeof raw.s === 'bigint';
39
+ }
40
+ static prepare(data, strict = true) {
41
+ const type = (data.type !== undefined ? data.type : TX_DEFAULTS.type);
42
+ if (!TxVersions.hasOwnProperty(type))
43
+ throw new Error(`wrong transaction type=${type}`);
44
+ const coder = TxVersions[type];
45
+ const fields = new Set(coder.fields);
46
+ // Copy default fields, but only if the field is present on the tx type.
47
+ const raw = { type };
48
+ for (const f in TX_DEFAULTS) {
49
+ if (f !== 'type' && fields.has(f)) {
50
+ raw[f] = TX_DEFAULTS[f];
51
+ if (['accessList', 'authorizationList'].includes(f))
52
+ raw[f] = cloneDeep(raw[f]);
53
+ }
54
+ }
55
+ // Copy all fields, so we can validate unexpected ones.
56
+ return new Transaction(type, sortRawData(Object.assign(raw, data)), strict, false);
57
+ }
58
+ /**
59
+ * Creates transaction which sends whole account balance. Does two things:
60
+ * 1. `amount = accountBalance - maxFeePerGas * gasLimit`
61
+ * 2. `maxPriorityFeePerGas = maxFeePerGas`
62
+ *
63
+ * Every eth block sets a fee for all its transactions, called base fee.
64
+ * maxFeePerGas indicates how much gas user is able to spend in the worst case.
65
+ * If the block's base fee is 5 gwei, while user is able to spend 10 gwei in maxFeePerGas,
66
+ * the transaction would only consume 5 gwei. That means, base fee is unknown
67
+ * before the transaction is included in a block.
68
+ *
69
+ * By setting priorityFee to maxFee, we make the process deterministic:
70
+ * `maxFee = 10, maxPriority = 10, baseFee = 5` would always spend 10 gwei.
71
+ * In the end, the balance would become 0.
72
+ *
73
+ * WARNING: using the method would decrease privacy of a transfer, because
74
+ * payments for services have specific amounts, and not *the whole amount*.
75
+ * @param accountBalance - account balance in wei
76
+ * @param burnRemaining - send unspent fee to miners. When false, some "small amount" would remain
77
+ * @returns new transaction with adjusted amounts
78
+ */
79
+ setWholeAmount(accountBalance, burnRemaining = true) {
80
+ const _0n = BigInt(0);
81
+ if (typeof accountBalance !== 'bigint' || accountBalance <= _0n)
82
+ throw new Error('account balance must be bigger than 0');
83
+ const fee = this.fee;
84
+ const amountToSend = accountBalance - fee;
85
+ if (amountToSend <= _0n)
86
+ throw new Error('account balance must be bigger than fee of ' + fee);
87
+ const raw = { ...this.raw, value: amountToSend };
88
+ if (!['legacy', 'eip2930'].includes(this.type) && burnRemaining) {
89
+ const r = raw;
90
+ r.maxPriorityFeePerGas = r.maxFeePerGas;
91
+ }
92
+ return new Transaction(this.type, raw);
93
+ }
94
+ static fromRawBytes(bytes, strict = false) {
95
+ const raw = RawTx.decode(bytes);
96
+ return new Transaction(raw.type, raw.data, strict);
97
+ }
98
+ static fromHex(hex, strict = false) {
99
+ return Transaction.fromRawBytes(ethHexNoLeadingZero.decode(hex), strict);
100
+ }
101
+ assertIsSigned() {
102
+ if (!this.isSigned)
103
+ throw new Error('expected signed transaction');
104
+ }
105
+ /**
106
+ * Converts transaction to RLP.
107
+ * @param includeSignature whether to include signature
108
+ */
109
+ toBytes(includeSignature = this.isSigned) {
110
+ // cloneDeep is not necessary here
111
+ let data = Object.assign({}, this.raw);
112
+ if (includeSignature) {
113
+ this.assertIsSigned();
114
+ }
115
+ else {
116
+ removeSig(data);
117
+ }
118
+ return RawTx.encode({ type: this.type, data }); // TODO: remove any
119
+ }
120
+ /**
121
+ * Converts transaction to hex.
122
+ * @param includeSignature whether to include signature
123
+ */
124
+ toHex(includeSignature = this.isSigned) {
125
+ return ethHex.encode(this.toBytes(includeSignature));
126
+ }
127
+ /** Calculates keccak-256 hash of signed transaction. Used in block explorers. */
128
+ get hash() {
129
+ this.assertIsSigned();
130
+ return bytesToHex(this.calcHash(true));
131
+ }
132
+ /** Returns sender's address. */
133
+ get sender() {
134
+ return this.recoverSender().address;
135
+ }
136
+ /**
137
+ * For legacy transactions, but can be used with libraries when yParity presented as v.
138
+ */
139
+ get v() {
140
+ return decodeLegacyV(this.raw);
141
+ }
142
+ calcHash(includeSignature) {
143
+ return keccak_256(this.toBytes(includeSignature));
144
+ }
145
+ /** Calculates MAXIMUM fee in wei that could be spent. */
146
+ get fee() {
147
+ const { type, raw } = this;
148
+ // Fee calculation is not exact, real fee can be smaller
149
+ let gasFee;
150
+ if (type === 'legacy' || type === 'eip2930') {
151
+ // Because TypeScript is not smart enough to narrow down types here :(
152
+ const r = raw;
153
+ gasFee = r.gasPrice;
154
+ }
155
+ else {
156
+ const r = raw;
157
+ // maxFeePerGas is absolute limit, you never pay more than that
158
+ // maxFeePerGas = baseFeePerGas[*2] + maxPriorityFeePerGas
159
+ gasFee = r.maxFeePerGas;
160
+ }
161
+ // TODO: how to calculate 4844 fee?
162
+ return raw.gasLimit * gasFee;
163
+ }
164
+ clone() {
165
+ return new Transaction(this.type, cloneDeep(this.raw));
166
+ }
167
+ verifySignature() {
168
+ this.assertIsSigned();
169
+ const { r, s } = this.raw;
170
+ return verify(new secp256k1.Signature(r, s).toBytes(), this.calcHash(false), hexToBytes(this.recoverSender().publicKey));
171
+ }
172
+ removeSignature() {
173
+ return new Transaction(this.type, removeSig(cloneDeep(this.raw)));
174
+ }
175
+ /**
176
+ * Signs transaction with a private key.
177
+ * @param privateKey key in hex or Uint8Array format
178
+ * @param opts extraEntropy will increase security of sig by mixing rfc6979 randomness
179
+ * @returns new "same" transaction, but signed
180
+ */
181
+ signBy(privateKey, extraEntropy = true) {
182
+ if (this.isSigned)
183
+ throw new Error('expected unsigned transaction');
184
+ const priv = isBytes(privateKey) ? privateKey : hexToBytes(strip0x(privateKey));
185
+ const hash = this.calcHash(false);
186
+ const sig = sign(hash, priv, extraEntropy);
187
+ const { r, s, recovery } = sig;
188
+ const sraw = Object.assign(cloneDeep(this.raw), { r, s, yParity: recovery });
189
+ // The copied result is validated in non-strict way, strict is only for user input.
190
+ return new Transaction(this.type, sraw, false);
191
+ }
192
+ /** Calculates public key and address from signed transaction's signature. */
193
+ recoverSender() {
194
+ this.assertIsSigned();
195
+ const { r, s, yParity } = this.raw;
196
+ const sig = initSig({ r: r, s: s }, yParity);
197
+ // Will crash on 'chainstart' hardfork
198
+ if (sig.hasHighS())
199
+ throw new Error('invalid s');
200
+ const publicKey = secp256k1.recoverPublicKey(sig.toBytes('recovered'), this.calcHash(false), {
201
+ prehash: false,
202
+ });
203
+ // const point = sig.recoverPublicKey(this.calcHash(false));
204
+ return { publicKey: bytesToHex(publicKey), address: addr.fromPublicKey(publicKey) };
205
+ }
206
+ }
207
+ //# sourceMappingURL=tx.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tx.js","sourceRoot":"","sources":["../../../../../../../../src/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/tx.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,gDAAgD,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,iDAAiD,CAAC;AAEzF,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EACL,KAAK,EACL,UAAU,EACV,aAAa,EACb,SAAS,EACT,WAAW,EACX,cAAc,GAGf,MAAM,kBAAkB,CAAC;AAC1B,kBAAkB;AAClB,OAAO,EAAE,SAAS,EAAE,MAAM,qDAAqD,CAAC;AAChF,OAAO,EACL,OAAO,EACP,SAAS,EACT,MAAM,EACN,mBAAmB,EACnB,OAAO,EACP,OAAO,EACP,IAAI,EACJ,OAAO,EACP,MAAM,GACP,MAAM,aAAa,CAAC;AAErB,iFAAiF;AAEjF,6BAA6B;AAE7B,oEAAoE;AACpE,MAAM,WAAW,GAAG;IAClB,UAAU,EAAE,EAAE,EAAE,iDAAiD;IACjE,iBAAiB,EAAE,EAAE;IACrB,OAAO,EAAE,MAAM,CAAC,CAAC,CAA4B,EAAE,UAAU;IACzD,IAAI,EAAE,EAAE;IACR,QAAQ,EAAE,MAAM,CAAC,KAAK,CAA4B,EAAE,uDAAuD;IAC3G,oBAAoB,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAA4B,EAAE,yDAAyD;IACtI,IAAI,EAAE,SAAS;CACP,CAAC;AA+BX,WAAW;AACX,qEAAqE;AACrE,8DA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AAQ,CAAC,CAAC;QAChD,sCAAsC;QACtC,IAAI,GAAG,CAAC,QAAQ,EAAE;YAAE,MAAM,IAAI,KAAK,CAAC,WAAW,CAAC,CAAC;QACjD,MAAM,SAAS,GAAG,SAAS,CAAC,gBAAgB,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;YAC3F,OAAO,EAAE,KAAK;SACf,CAAC,CAAC;QACH,4DAA4D;QAC5D,OAAO,EAAE,SAAS,EAAE,UAAU,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,EAAE,CAAC;IACtF,CAAC;CACF"}
@@ -0,0 +1,78 @@
1
+ import { type GetType as AbiGetType } from '../advanced/abi-mapper.js';
2
+ export type Hex = string | Uint8Array;
3
+ export interface TypedSigner<T> {
4
+ _getHash: (message: T) => string;
5
+ sign(message: T, privateKey: Hex, extraEntropy?: boolean | Uint8Array): string;
6
+ recoverPublicKey(signature: string, message: T): string;
7
+ verify(signature: string, message: T, address: string): boolean;
8
+ }
9
+ export declare const eip191Signer: TypedSigner<string | Uint8Array>;
10
+ export type EIP712Component = {
11
+ name: string;
12
+ type: string;
13
+ };
14
+ export type EIP712Types = Record<string, readonly EIP712Component[]>;
15
+ type ProcessType<T extends string, Types extends EIP712Types> = T extends `${infer Base}[]${infer Rest}` ? ProcessType<`${Base}${Rest}`, Types>[] : T extends `${infer Base}[${number}]${infer Rest}` ? ProcessType<`${Base}${Rest}`, Types>[] : T extends keyof Types ? GetType<Types, T> | undefined : AbiGetType<T>;
16
+ export type GetType<Types extends EIP712Types, K extends keyof Types & string> = {
17
+ [C in Types[K][number] as C['name']]: ProcessType<C['type'], Types>;
18
+ };
19
+ type Key<T extends EIP712Types> = keyof T & string;
20
+ export declare function encoder<T extends EIP712Types>(types: T, domain: GetType<T, 'EIP712Domain'>): {
21
+ encodeData: <K extends Key<T>>(type: K, message: GetType<T, K>) => string;
22
+ structHash: <K extends Key<T>>(type: K, message: GetType<T, K>) => string;
23
+ _getHash: <K extends Key<T>>(primaryType: K, message: GetType<T, K>) => string;
24
+ sign: <K extends Key<T>>(primaryType: K, message: GetType<T, K>, privateKey: Hex, extraEntropy?: boolean | Uint8Array) => string;
25
+ verify: <K extends Key<T>>(primaryType: K, signature: string, message: GetType<T, K>, address: string) => boolean;
26
+ recoverPublicKey: <K extends Key<T>>(primaryType: K, signature: string, message: GetType<T, K>) => string;
27
+ };
28
+ export declare const EIP712Domain: readonly [{
29
+ readonly name: "name";
30
+ readonly type: "string";
31
+ }, {
32
+ readonly name: "version";
33
+ readonly type: "string";
34
+ }, {
35
+ readonly name: "chainId";
36
+ readonly type: "uint256";
37
+ }, {
38
+ readonly name: "verifyingContract";
39
+ readonly type: "address";
40
+ }, {
41
+ readonly name: "salt";
42
+ readonly type: "bytes32";
43
+ }];
44
+ export type DomainParams = typeof EIP712Domain;
45
+ declare const domainTypes: {
46
+ EIP712Domain: DomainParams;
47
+ };
48
+ export type EIP712Domain = GetType<typeof domainTypes, 'EIP712Domain'>;
49
+ export declare function getDomainType(domain: EIP712Domain): ({
50
+ readonly name: "name";
51
+ readonly type: "string";
52
+ } | {
53
+ readonly name: "version";
54
+ readonly type: "string";
55
+ } | {
56
+ readonly name: "chainId";
57
+ readonly type: "uint256";
58
+ } | {
59
+ readonly name: "verifyingContract";
60
+ readonly type: "address";
61
+ } | {
62
+ readonly name: "salt";
63
+ readonly type: "bytes32";
64
+ })[];
65
+ export type TypedData<T extends EIP712Types, K extends Key<T>> = {
66
+ types: T;
67
+ primaryType: K;
68
+ domain: GetType<T, 'EIP712Domain'>;
69
+ message: GetType<T, K>;
70
+ };
71
+ export declare function encodeData<T extends EIP712Types, K extends Key<T>>(typed: TypedData<T, K>): string;
72
+ export declare function sigHash<T extends EIP712Types, K extends Key<T>>(typed: TypedData<T, K>): string;
73
+ export declare function signTyped<T extends EIP712Types, K extends Key<T>>(typed: TypedData<T, K>, privateKey: Hex, extraEntropy?: boolean | Uint8Array): string;
74
+ export declare function verifyTyped<T extends EIP712Types, K extends Key<T>>(signature: string, typed: TypedData<T, K>, address: string): boolean;
75
+ export declare function recoverPublicKeyTyped<T extends EIP712Types, K extends Key<T>>(signature: string, typed: TypedData<T, K>): string;
76
+ export declare const _TEST: any;
77
+ export {};
78
+ //# sourceMappingURL=typed-data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typed-data.d.ts","sourceRoot":"","sources":["../../../../../../../../src/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/typed-data.ts"],"names":[],"mappings":"AAGA,OAAO,EAAgB,KAAK,OAAO,IAAI,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAKrF,MAAM,MAAM,GAAG,GAAG,MAAM,GAAG,UAAU,CAAC;AACtC,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,QAAQ,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,MAAM,CAAC;IACjC,IAAI,CAAC,OAAO,EAAE,CAAC,EAAE,UAAU,EAAE,GAAG,EAAE,YAAY,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,MAAM,CAAC;IAC/E,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,MAAM,CAAC;IACxD,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;CACjE;AA0DD,eAAO,MAAM,YAAY,EAAE,WAAW,CAAC,MAAM,GAAG,UAAU,CAMzD,CAAC;AAcF,MAAM,MAAM,eAAe,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAC7D,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,eAAe,EAAE,CAAC,CAAC;AAMrE,KAAK,WAAW,CAAC,CAAC,SAAS,M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SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,CAM/F;AAED,wBAAgB,SAAS,CAAC,CAAC,SAAS,WAAW,EAAE,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,EAC/D,KAAK,EAAE,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EACtB,UAAU,EAAE,GAAG,EACf,YAAY,CAAC,EAAE,OAAO,GAAG,UAAU,GAClC,MAAM,CAQR;AAED,wBAAgB,WAAW,CAAC,CAAC,SAAS,WAAW,EAAE,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,EACjE,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EACtB,OAAO,EAAE,MAAM,GACd,OAAO,CAQT;AAED,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,WAAW,EAAE,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,EAC3E,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,GACrB,MAAM,CAMR;AAGD,eAAO,MAAM,KAAK,EAAE,GAAuE,CAAC"}
@@ -0,0 +1,298 @@
1
+ import { secp256k1 } from '../../../../../@noble/curves/2.0.1/src/secp256k1.js';
2
+ import { keccak_256 } from '../../../../../@noble/hashes/2.0.1/src/sha3.js';
3
+ import { concatBytes, hexToBytes, utf8ToBytes } from '../../../../../@noble/hashes/2.0.1/src/utils.js';
4
+ import { mapComponent } from '../advanced/abi-mapper.js';
5
+ import { add0x, astr, ethHex, initSig, isObject, sign, strip0x, verify } from '../utils.js';
6
+ import { addr } from './address.js';
7
+ // 0x19 <1 byte version> <version specific data> <data to sign>.
8
+ // VERSIONS:
9
+ // - 0x19 <0x00> <intended validator address> <data to sign>
10
+ // - 0x19 <0x01> domainSeparator hashStruct(message)
11
+ // - 0x19 <0x45 (E)> <thereum Signed Message:\n" + len(message)> <data to sign>
12
+ function getSigner(version, msgFn) {
13
+ if (version < 0 || version >= 256 || !Number.isSafeInteger(version))
14
+ throw new Error('Wrong version byte');
15
+ // bytes32 hash = keccak256(abi.encodePacked(byte(0x19), byte(0), address(this), msg.value, nonce, payload));
16
+ const getHash = (message) => keccak_256(concatBytes(new Uint8Array([0x19, version]), msgFn(message)));
17
+ // TODO: 'v' can contain non-undefined chainId, but not sure if it is used. If used, we need to check it with EIP-712 domain
18
+ return {
19
+ _getHash: (message) => ethHex.encode(getHash(message)),
20
+ sign(message, privateKey, extraEntropy = true) {
21
+ const hash = getHash(message);
22
+ if (typeof privateKey === 'string')
23
+ privateKey = ethHex.decode(privateKey);
24
+ const sig = sign(hash, privateKey, extraEntropy);
25
+ const end = sig.recovery === 0 ? '1b' : '1c';
26
+ return add0x(sig.toHex('compact') + end);
27
+ },
28
+ recoverPublicKey(signature, message) {
29
+ astr(signature);
30
+ const hash = getHash(message);
31
+ signature = strip0x(signature);
32
+ if (signature.length !== 65 * 2)
33
+ throw new Error('invalid signature length');
34
+ const sigh = signature.slice(0, -2);
35
+ const end = signature.slice(-2);
36
+ if (!['1b', '1c'].includes(end))
37
+ throw new Error('invalid recovery bit');
38
+ const sig = initSig(hexToBytes(sigh), end === '1b' ? 0 : 1);
39
+ const publicKey = secp256k1.recoverPublicKey(sig.toBytes('recovered'), hash, {
40
+ prehash: false,
41
+ });
42
+ // const pub = sig.recoverPublicKey(hash).toBytes(false);
43
+ if (!verify(sig.toBytes('compact'), hash, publicKey))
44
+ throw new Error('invalid signature');
45
+ return addr.fromPublicKey(publicKey);
46
+ },
47
+ verify(signature, message, address) {
48
+ const recAddr = this.recoverPublicKey(signature, message);
49
+ const low = recAddr.toLowerCase();
50
+ const upp = recAddr.toUpperCase();
51
+ if (address === low || address === upp)
52
+ return true; // non-checksummed
53
+ return recAddr === address; // checksummed
54
+ },
55
+ };
56
+ }
57
+ // EIP-191/EIP-7749: 0x19 <0x00> <intended validator address> <data to sign>
58
+ // export const intendedValidator = getSigner(
59
+ // 0x00,
60
+ // ({ message, validator }: { message: Uint8Array; validator: string }) => {
61
+ // const { data } = addr.parse(validator);
62
+ // return concatBytes(hexToBytes(data), message);
63
+ // }
64
+ // );
65
+ // EIP-191: 0x19 <0x45 (E)> <thereum Signed Message:\n" + len(message)> <data to sign>
66
+ export const eip191Signer = getSigner(0x45, (msg) => {
67
+ if (typeof msg === 'string')
68
+ msg = utf8ToBytes(msg);
69
+ return concatBytes(utf8ToBytes(`thereum Signed Message:\n${msg.length}`), msg);
70
+ });
71
+ // TODO: merge with abi somehow?
72
+ function parseType(s) {
73
+ let m = s.match(/^([^\[]+)(?:.*\[(.*?)\])?$/);
74
+ if (!m)
75
+ throw new Error(`parseType: wrong type: ${s}`);
76
+ const base = m[1];
77
+ const isArray = m[2] !== undefined;
78
+ // TODO: check for safe integer
79
+ const arrayLen = m[2] !== undefined && m[2] !== '' ? Number(m[2]) : undefined;
80
+ if (arrayLen !== undefined && (!Number.isSafeInteger(arrayLen) || arrayLen.toString() !== m[2]))
81
+ throw new Error(`parseType: wrong array length: ${s}`);
82
+ let type = 'struct';
83
+ if (['string', 'bytes'].includes(base))
84
+ type = 'dynamic';
85
+ else if (['bool', 'address'].includes(base))
86
+ type = 'atomic';
87
+ else if ((m = /^(u?)int([0-9]+)?$/.exec(base))) {
88
+ const bits = m[2] ? +m[2] : 256;
89
+ if (!Number.isSafeInteger(bits) || bits <= 0 || bits % 8 !== 0 || bits > 256)
90
+ throw new Error('parseType: invalid numeric type');
91
+ type = 'atomic';
92
+ }
93
+ else if ((m = /^bytes([0-9]{1,2})$/.exec(base))) {
94
+ const bytes = +m[1];
95
+ if (!bytes || bytes > 32)
96
+ throw new Error(`parseType: wrong bytes<N=${bytes}> type`);
97
+ type = 'atomic';
98
+ }
99
+ const item = s.replace(/\[[^\]]*\]$/, '');
100
+ return { base, item, type, arrayLen, isArray };
101
+ }
102
+ // traverse dependency graph, find all transitive dependencies. Also, basic sanity check
103
+ function getDependencies(types) {
104
+ if (typeof types !== 'object' || types === null)
105
+ throw new Error('wrong types object');
106
+ // Collect non-basic dependencies & sanity
107
+ const res = {};
108
+ for (const [name, fields] of Object.entries(types)) {
109
+ const cur = new Set(); // type may appear multiple times in struct
110
+ for (const { type } of fields) {
111
+ const p = parseType(type);
112
+ if (p.type !== 'struct')
113
+ continue; // skip basic fields
114
+ if (p.base === name)
115
+ continue; // self reference
116
+ if (!types[p.base])
117
+ throw new Error(`getDependencies: wrong struct type name=${type}`);
118
+ cur.add(p.base);
119
+ }
120
+ res[name] = cur;
121
+ }
122
+ // This should be more efficient with toposort + cycle detection, but I've already spent too much time here
123
+ // and for most cases there won't be a lot of types here anyway.
124
+ for (let changed = true; changed;) {
125
+ changed = false;
126
+ for (const [name, curDeps] of Object.entries(res)) {
127
+ // Map here, because curDeps will change
128
+ const trDeps = Array.from(curDeps).map((i) => res[i]);
129
+ for (const d of trDeps) {
130
+ for (const td of d) {
131
+ if (td === name || curDeps.has(td))
132
+ continue;
133
+ curDeps.add(td);
134
+ changed = true;
135
+ }
136
+ }
137
+ }
138
+ }
139
+ return res;
140
+ }
141
+ function getTypes(types) {
142
+ const deps = getDependencies(types);
143
+ const names = {};
144
+ // Build names
145
+ for (const type in types)
146
+ names[type] = `${type}(${types[type].map(({ name, type }) => `${type} ${name}`).join(',')})`;
147
+ const fullNames = {};
148
+ for (const [name, curDeps] of Object.entries(deps)) {
149
+ const n = [name].concat(Array.from(curDeps).sort());
150
+ fullNames[name] = n.map((i) => names[i]).join('');
151
+ }
152
+ const hashes = Object.fromEntries(Object.entries(fullNames).map(([k, v]) => [k, keccak_256(utf8ToBytes(v))]));
153
+ // fields
154
+ const fields = {};
155
+ for (const type in types) {
156
+ const res = new Set();
157
+ for (const { name } of types[type]) {
158
+ if (res.has(name))
159
+ throw new Error(`field ${name} included multiple times in type ${type}`);
160
+ res.add(name);
161
+ }
162
+ fields[type] = res;
163
+ }
164
+ return { names, fullNames, hashes, fields };
165
+ }
166
+ // This re-uses domain per multiple requests, which is based on assumption that domain is static for different requests with
167
+ // different types. Please raise issue if you have different use case.
168
+ export function encoder(types, domain) {
169
+ if (!isObject(domain))
170
+ throw Error(`wrong domain=${domain}`);
171
+ if (!isObject(types))
172
+ throw Error(`wrong types=${types}`);
173
+ const info = getTypes(types);
174
+ const encodeField = (type, data, withHash = true) => {
175
+ const p = parseType(type);
176
+ if (p.isArray) {
177
+ if (!Array.isArray(data))
178
+ throw new Error(`expected array, got: ${data}`);
179
+ if (p.arrayLen !== undefined && data.length !== p.arrayLen)
180
+ throw new Error(`wrong array length: expected ${p.arrayLen}, got ${data}`);
181
+ return keccak_256(concatBytes(...data.map((i) => encodeField(p.item, i))));
182
+ }
183
+ if (p.type === 'struct') {
184
+ const def = types[type];
185
+ if (!def)
186
+ throw new Error(`wrong type: ${type}`);
187
+ const fieldNames = info.fields[type];
188
+ if (!isObject(data))
189
+ throw new Error(`encoding non-object as custom type ${type}`);
190
+ for (const k in data)
191
+ if (!fieldNames.has(k))
192
+ throw new Error(`unexpected field ${k} in ${type}`);
193
+ // TODO: use correct concatBytes (need to export from P?). This will easily crash with stackoverflow if too much fields.
194
+ const fields = [];
195
+ for (const { name, type } of def) {
196
+ // This is not mentioned in spec, but used in eth-sig-util
197
+ // Since there is no 'optional' fields inside eip712, it makes impossible to encode circular structure without arrays,
198
+ // but seems like other project use this.
199
+ // NOTE: this is V4 only stuff. If you need V3 behavior, please open issue.
200
+ if (types[type] && data[name] === undefined) {
201
+ fields.push(new Uint8Array(32));
202
+ continue;
203
+ }
204
+ fields.push(encodeField(type, data[name]));
205
+ }
206
+ const res = concatBytes(info.hashes[p.base], ...fields);
207
+ return withHash ? keccak_256(res) : res;
208
+ }
209
+ if (type === 'string' || type === 'bytes') {
210
+ if (type === 'bytes' && typeof data === 'string')
211
+ data = ethHex.decode(data);
212
+ return keccak_256(typeof data === 'string' ? utf8ToBytes(data) : data); // hashed as is!
213
+ }
214
+ // Type conversion is neccessary here, because we can get data from JSON (no Uint8Arrays/bigints).
215
+ if (type.startsWith('bytes') && typeof data === 'string')
216
+ data = ethHex.decode(data);
217
+ if ((type.startsWith('int') || type.startsWith('uint')) && typeof data === 'string')
218
+ data = BigInt(data);
219
+ return mapComponent({ type }).encode(data);
220
+ };
221
+ const encodeData = (type, data) => {
222
+ astr(type);
223
+ if (!types[type])
224
+ throw new Error(`Unknown type: ${type}`);
225
+ if (!isObject(data))
226
+ throw new Error('wrong data object');
227
+ return encodeField(type, data, false);
228
+ };
229
+ const structHash = (type, data) => keccak_256(encodeData(type, data));
230
+ const domainHash = structHash('EIP712Domain', domain);
231
+ // NOTE: we cannot use Msg here, since its already parametrized and everything will break.
232
+ const signer = getSigner(0x01, (msg) => {
233
+ if (typeof msg.primaryType !== 'string')
234
+ throw Error(`wrong primaryType=${msg.primaryType}`);
235
+ if (!isObject(msg.message))
236
+ throw Error(`wrong message=${msg.message}`);
237
+ if (msg.primaryType === 'EIP712Domain')
238
+ return domainHash;
239
+ return concatBytes(domainHash, structHash(msg.primaryType, msg.message));
240
+ });
241
+ return {
242
+ encodeData: (type, message) => ethHex.encode(encodeData(type, message)),
243
+ structHash: (type, message) => ethHex.encode(structHash(type, message)),
244
+ // Signer
245
+ _getHash: (primaryType, message) => signer._getHash({ primaryType, message }),
246
+ sign: (primaryType, message, privateKey, extraEntropy) => signer.sign({ primaryType, message }, privateKey, extraEntropy),
247
+ verify: (primaryType, signature, message, address) => signer.verify(signature, { primaryType, message }, address),
248
+ recoverPublicKey: (primaryType, signature, message) => signer.recoverPublicKey(signature, { primaryType, message }),
249
+ };
250
+ }
251
+ export const EIP712Domain = [
252
+ { name: 'name', type: 'string' }, // the user readable name of signing domain, i.e. the name of the DApp or the protocol.
253
+ { name: 'version', type: 'string' }, // the current major version of the signing domain. Signatures from different versions are not compatible.
254
+ { name: 'chainId', type: 'uint256' }, // the EIP-155 chain id. The user-agent should refuse signing if it does not match the currently active chain.
255
+ { name: 'verifyingContract', type: 'address' }, // the address of the contract that will verify the signature. The user-agent may do contract specific phishing prevention.
256
+ { name: 'salt', type: 'bytes32' }, // an disambiguating salt for the protocol. This can be used as a domain separator of last resort.
257
+ ];
258
+ const domainTypes = { EIP712Domain: EIP712Domain };
259
+ // Filter unused domain fields from type
260
+ export function getDomainType(domain) {
261
+ return EIP712Domain.filter(({ name }) => domain[name] !== undefined);
262
+ }
263
+ const getTypedTypes = (typed) => ({
264
+ EIP712Domain: getDomainType(typed.domain),
265
+ ...typed.types,
266
+ });
267
+ function validateTyped(t) {
268
+ if (!isObject(t.message))
269
+ throw new Error('wrong message');
270
+ if (!isObject(t.domain))
271
+ throw new Error('wrong domain');
272
+ if (!isObject(t.types))
273
+ throw new Error('wrong types');
274
+ if (typeof t.primaryType !== 'string' || !t.types[t.primaryType])
275
+ throw new Error('wrong primaryType');
276
+ }
277
+ export function encodeData(typed) {
278
+ validateTyped(typed);
279
+ return encoder(getTypedTypes(typed), typed.domain).encodeData(typed.primaryType, typed.message);
280
+ }
281
+ export function sigHash(typed) {
282
+ validateTyped(typed);
283
+ return encoder(getTypedTypes(typed), typed.domain)._getHash(typed.primaryType, typed.message);
284
+ }
285
+ export function signTyped(typed, privateKey, extraEntropy) {
286
+ validateTyped(typed);
287
+ return encoder(getTypedTypes(typed), typed.domain).sign(typed.primaryType, typed.message, privateKey, extraEntropy);
288
+ }
289
+ export function verifyTyped(signature, typed, address) {
290
+ validateTyped(typed);
291
+ return encoder(getTypedTypes(typed), typed.domain).verify(typed.primaryType, signature, typed.message, address);
292
+ }
293
+ export function recoverPublicKeyTyped(signature, typed) {
294
+ return encoder(getTypedTypes(typed), typed.domain).recoverPublicKey(typed.primaryType, signature, typed.message);
295
+ }
296
+ // Internal methods for test purposes only
297
+ export const _TEST = /* @__PURE__ */ { parseType, getDependencies, getTypes, encoder };
298
+ //# sourceMappingURL=typed-data.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typed-data.js","sourceRoot":"","sources":["../../../../../../../../src/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/typed-data.ts"],"names":[],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K,CAAC,OAAO,EACb,OAAO,CACR,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,qBAAqB,CACnC,SAAiB,EACjB,KAAsB;IAEtB,OAAO,OAAO,CAAC,aAAa,CAAC,KAAK,CAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,gBAAgB,CACtE,KAAK,CAAC,WAAW,EACjB,SAAS,EACT,KAAK,CAAC,OAAO,CACd,CAAC;AACJ,CAAC;AAED,0CAA0C;AAC1C,MAAM,CAAC,MAAM,KAAK,GAAQ,eAAe,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC"}
@@ -0,0 +1,6 @@
1
+ export { addr } from './core/address.js';
2
+ export { authorization } from './core/tx-internal.js';
3
+ export { Transaction } from './core/tx.js';
4
+ export { eip191Signer, recoverPublicKeyTyped, signTyped, verifyTyped, type EIP712Domain, type TypedData, } from './core/typed-data.js';
5
+ export { amounts, ethHex, ethHexNoLeadingZero, weieth, weigwei } from './utils.js';
6
+ //# sourceMappingURL=index.d.ts.map