@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.
- package/esm/_dnt.shims.d.ts +2 -0
- package/esm/_dnt.shims.d.ts.map +1 -0
- package/esm/_dnt.shims.js +58 -0
- package/esm/_dnt.shims.js.map +1 -0
- package/esm/deps/jsr.io/@noble/curves/2.0.1/src/abstract/curve.d.ts +195 -0
- package/esm/deps/jsr.io/@noble/curves/2.0.1/src/abstract/curve.d.ts.map +1 -0
- package/esm/deps/jsr.io/@noble/curves/2.0.1/src/abstract/curve.js +457 -0
- package/esm/deps/jsr.io/@noble/curves/2.0.1/src/abstract/curve.js.map +1 -0
- package/esm/deps/jsr.io/@noble/curves/2.0.1/src/abstract/hash-to-curve.d.ts +90 -0
- package/esm/deps/jsr.io/@noble/curves/2.0.1/src/abstract/hash-to-curve.d.ts.map +1 -0
- package/esm/deps/jsr.io/@noble/curves/2.0.1/src/abstract/hash-to-curve.js +207 -0
- package/esm/deps/jsr.io/@noble/curves/2.0.1/src/abstract/hash-to-curve.js.map +1 -0
- package/esm/deps/jsr.io/@noble/curves/2.0.1/src/abstract/modular.d.ts +159 -0
- package/esm/deps/jsr.io/@noble/curves/2.0.1/src/abstract/modular.d.ts.map +1 -0
- package/esm/deps/jsr.io/@noble/curves/2.0.1/src/abstract/modular.js +555 -0
- package/esm/deps/jsr.io/@noble/curves/2.0.1/src/abstract/modular.js.map +1 -0
- package/esm/deps/jsr.io/@noble/curves/2.0.1/src/abstract/weierstrass.d.ts +325 -0
- package/esm/deps/jsr.io/@noble/curves/2.0.1/src/abstract/weierstrass.d.ts.map +1 -0
- package/esm/deps/jsr.io/@noble/curves/2.0.1/src/abstract/weierstrass.js +1222 -0
- package/esm/deps/jsr.io/@noble/curves/2.0.1/src/abstract/weierstrass.js.map +1 -0
- package/esm/deps/jsr.io/@noble/curves/2.0.1/src/secp256k1.d.ts +76 -0
- package/esm/deps/jsr.io/@noble/curves/2.0.1/src/secp256k1.d.ts.map +1 -0
- package/esm/deps/jsr.io/@noble/curves/2.0.1/src/secp256k1.js +283 -0
- package/esm/deps/jsr.io/@noble/curves/2.0.1/src/secp256k1.js.map +1 -0
- package/esm/deps/jsr.io/@noble/curves/2.0.1/src/utils.d.ts +103 -0
- package/esm/deps/jsr.io/@noble/curves/2.0.1/src/utils.d.ts.map +1 -0
- package/esm/deps/jsr.io/@noble/curves/2.0.1/src/utils.js +241 -0
- package/esm/deps/jsr.io/@noble/curves/2.0.1/src/utils.js.map +1 -0
- package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/_md.d.ts +49 -0
- package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/_md.d.ts.map +1 -0
- package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/_md.js +147 -0
- package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/_md.js.map +1 -0
- package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/_u64.d.ts +55 -0
- package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/_u64.d.ts.map +1 -0
- package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/_u64.js +67 -0
- package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/_u64.js.map +1 -0
- package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/hmac.d.ts +36 -0
- package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/hmac.d.ts.map +1 -0
- package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/hmac.js +90 -0
- package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/hmac.js.map +1 -0
- package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/sha2.d.ts +199 -0
- package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/sha2.d.ts.map +1 -0
- package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/sha2.js +397 -0
- package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/sha2.js.map +1 -0
- package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/sha3.d.ts +58 -0
- package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/sha3.d.ts.map +1 -0
- package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/sha3.js +254 -0
- package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/sha3.js.map +1 -0
- package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/utils.d.ts +124 -0
- package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/utils.d.ts.map +1 -0
- package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/utils.js +243 -0
- package/esm/deps/jsr.io/@noble/hashes/2.0.1/src/utils.js.map +1 -0
- package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/advanced/abi-mapper.d.ts +44 -0
- package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/advanced/abi-mapper.d.ts.map +1 -0
- package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/advanced/abi-mapper.js +144 -0
- package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/advanced/abi-mapper.js.map +1 -0
- package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/address.d.ts +38 -0
- package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/address.d.ts.map +1 -0
- package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/address.js +96 -0
- package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/address.js.map +1 -0
- package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/rlp.d.ts +23 -0
- package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/rlp.d.ts.map +1 -0
- package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/rlp.js +98 -0
- package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/rlp.js.map +1 -0
- package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/tx-internal.d.ts +300 -0
- package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/tx-internal.d.ts.map +1 -0
- package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/tx-internal.js +535 -0
- package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/tx-internal.js.map +1 -0
- package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/tx.d.ts +98 -0
- package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/tx.d.ts.map +1 -0
- package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/tx.js +207 -0
- package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/tx.js.map +1 -0
- package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/typed-data.d.ts +78 -0
- package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/typed-data.d.ts.map +1 -0
- package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/typed-data.js +298 -0
- package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/typed-data.js.map +1 -0
- package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/index.d.ts +6 -0
- package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/index.d.ts.map +1 -0
- package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/index.js +6 -0
- package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/index.js.map +1 -0
- package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/utils.d.ts +66 -0
- package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/utils.d.ts.map +1 -0
- package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/utils.js +180 -0
- package/esm/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/utils.js.map +1 -0
- package/esm/deps/jsr.io/@paulmillr/micro-packed/0.8.0/src/index.d.ts +877 -0
- package/esm/deps/jsr.io/@paulmillr/micro-packed/0.8.0/src/index.d.ts.map +1 -0
- package/esm/deps/jsr.io/@paulmillr/micro-packed/0.8.0/src/index.js +2001 -0
- package/esm/deps/jsr.io/@paulmillr/micro-packed/0.8.0/src/index.js.map +1 -0
- package/esm/deps/jsr.io/@scure/base/2.0.0/index.d.ts +294 -0
- package/esm/deps/jsr.io/@scure/base/2.0.0/index.d.ts.map +1 -0
- package/esm/deps/jsr.io/@scure/base/2.0.0/index.js +704 -0
- package/esm/deps/jsr.io/@scure/base/2.0.0/index.js.map +1 -0
- package/esm/deps/jsr.io/@std/async/1.0.16/unstable_semaphore.d.ts +93 -0
- package/esm/deps/jsr.io/@std/async/1.0.16/unstable_semaphore.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/async/1.0.16/unstable_semaphore.js +137 -0
- package/esm/deps/jsr.io/@std/async/1.0.16/unstable_semaphore.js.map +1 -0
- package/esm/src/api/exchange/_methods/_base/_nonce.d.ts +3 -2
- package/esm/src/api/exchange/_methods/_base/_nonce.d.ts.map +1 -1
- package/esm/src/api/exchange/_methods/_base/_nonce.js +3 -2
- package/esm/src/api/exchange/_methods/_base/_nonce.js.map +1 -1
- package/esm/src/api/exchange/_methods/_base/_semaphore.d.ts +7 -6
- package/esm/src/api/exchange/_methods/_base/_semaphore.d.ts.map +1 -1
- package/esm/src/api/exchange/_methods/_base/_semaphore.js +34 -47
- package/esm/src/api/exchange/_methods/_base/_semaphore.js.map +1 -1
- package/esm/src/api/exchange/_methods/_base/execute.d.ts +14 -3
- package/esm/src/api/exchange/_methods/_base/execute.d.ts.map +1 -1
- package/esm/src/api/exchange/_methods/_base/execute.js +44 -10
- package/esm/src/api/exchange/_methods/_base/execute.js.map +1 -1
- package/esm/src/api/exchange/_methods/batchModify.d.ts +6 -6
- package/esm/src/api/exchange/_methods/createVault.d.ts +5 -5
- package/esm/src/api/exchange/_methods/modify.d.ts +5 -5
- package/esm/src/api/exchange/_methods/order.d.ts +13 -13
- package/esm/src/api/exchange/_methods/order.d.ts.map +1 -1
- package/esm/src/api/exchange/_methods/order.js +4 -2
- package/esm/src/api/exchange/_methods/order.js.map +1 -1
- package/esm/src/api/exchange/client.d.ts +1 -1
- package/esm/src/api/exchange/client.d.ts.map +1 -1
- package/esm/src/api/exchange/client.js.map +1 -1
- package/esm/src/api/exchange/mod.d.ts +1 -1
- package/esm/src/api/exchange/mod.d.ts.map +1 -1
- package/esm/src/api/exchange/mod.js.map +1 -1
- package/esm/src/api/info/_methods/_base/commonSchemas.d.ts +8 -8
- package/esm/src/api/info/_methods/frontendOpenOrders.d.ts +3 -3
- package/esm/src/api/info/_methods/historicalOrders.d.ts +4 -4
- package/esm/src/api/info/_methods/l3Orders.d.ts +11 -11
- package/esm/src/api/info/_methods/l4Orders.d.ts +6 -6
- package/esm/src/api/info/_methods/openOrders.d.ts +3 -3
- package/esm/src/api/info/_methods/orderStatus.d.ts +5 -5
- package/esm/src/api/info/_methods/recentTrades.d.ts +2 -2
- package/esm/src/api/info/_methods/twapHistory.d.ts +4 -4
- package/esm/src/api/info/_methods/userFills.d.ts +3 -3
- package/esm/src/api/info/_methods/userFillsByTime.d.ts +4 -4
- package/esm/src/api/info/_methods/userFunding.d.ts +3 -3
- package/esm/src/api/info/_methods/userFunding.js +2 -2
- package/esm/src/api/info/_methods/userFunding.js.map +1 -1
- package/esm/src/api/info/_methods/userTwapSliceFills.d.ts +4 -4
- package/esm/src/api/info/_methods/userTwapSliceFillsByTime.d.ts +5 -5
- package/esm/src/api/info/_methods/webData2.d.ts +9 -9
- package/esm/src/api/subscription/_methods/assetCtxs.d.ts +2 -0
- package/esm/src/api/subscription/_methods/assetCtxs.d.ts.map +1 -1
- package/esm/src/api/subscription/_methods/assetCtxs.js.map +1 -1
- package/esm/src/api/subscription/_methods/clearinghouseState.d.ts +2 -0
- package/esm/src/api/subscription/_methods/clearinghouseState.d.ts.map +1 -1
- package/esm/src/api/subscription/_methods/clearinghouseState.js +2 -0
- package/esm/src/api/subscription/_methods/clearinghouseState.js.map +1 -1
- package/esm/src/api/subscription/_methods/explorerBlock.d.ts +2 -0
- package/esm/src/api/subscription/_methods/explorerBlock.d.ts.map +1 -1
- package/esm/src/api/subscription/_methods/explorerBlock.js +2 -0
- package/esm/src/api/subscription/_methods/explorerBlock.js.map +1 -1
- package/esm/src/api/subscription/_methods/explorerTxs.d.ts +2 -0
- package/esm/src/api/subscription/_methods/explorerTxs.d.ts.map +1 -1
- package/esm/src/api/subscription/_methods/explorerTxs.js +2 -0
- package/esm/src/api/subscription/_methods/explorerTxs.js.map +1 -1
- package/esm/src/api/subscription/_methods/openOrders.d.ts +5 -5
- package/esm/src/api/subscription/_methods/orderUpdates.d.ts +4 -4
- package/esm/src/api/subscription/_methods/trades.d.ts +3 -3
- package/esm/src/api/subscription/_methods/twapStates.d.ts +9 -4
- package/esm/src/api/subscription/_methods/twapStates.d.ts.map +1 -1
- package/esm/src/api/subscription/_methods/twapStates.js +6 -1
- package/esm/src/api/subscription/_methods/twapStates.js.map +1 -1
- package/esm/src/api/subscription/_methods/userEvents.d.ts +17 -17
- package/esm/src/api/subscription/_methods/userFills.d.ts +5 -5
- package/esm/src/api/subscription/_methods/userHistoricalOrders.d.ts +6 -6
- package/esm/src/api/subscription/_methods/userTwapHistory.d.ts +6 -6
- package/esm/src/api/subscription/_methods/userTwapSliceFills.d.ts +6 -6
- package/esm/src/api/subscription/_methods/webData2.d.ts +11 -11
- package/esm/src/signing/_privateKeySigner.js +1 -1
- package/esm/src/signing/_privateKeySigner.js.map +1 -1
- package/esm/src/signing/mod.js +1 -1
- package/esm/src/signing/mod.js.map +1 -1
- package/package.json +2 -3
- package/script/_dnt.shims.d.ts +2 -0
- package/script/_dnt.shims.d.ts.map +1 -0
- package/script/_dnt.shims.js +61 -0
- package/script/_dnt.shims.js.map +1 -0
- package/script/deps/jsr.io/@noble/curves/2.0.1/src/abstract/curve.d.ts +195 -0
- package/script/deps/jsr.io/@noble/curves/2.0.1/src/abstract/curve.d.ts.map +1 -0
- package/script/deps/jsr.io/@noble/curves/2.0.1/src/abstract/curve.js +468 -0
- package/script/deps/jsr.io/@noble/curves/2.0.1/src/abstract/curve.js.map +1 -0
- package/script/deps/jsr.io/@noble/curves/2.0.1/src/abstract/hash-to-curve.d.ts +90 -0
- package/script/deps/jsr.io/@noble/curves/2.0.1/src/abstract/hash-to-curve.d.ts.map +1 -0
- package/script/deps/jsr.io/@noble/curves/2.0.1/src/abstract/hash-to-curve.js +215 -0
- package/script/deps/jsr.io/@noble/curves/2.0.1/src/abstract/hash-to-curve.js.map +1 -0
- package/script/deps/jsr.io/@noble/curves/2.0.1/src/abstract/modular.d.ts +159 -0
- package/script/deps/jsr.io/@noble/curves/2.0.1/src/abstract/modular.d.ts.map +1 -0
- package/script/deps/jsr.io/@noble/curves/2.0.1/src/abstract/modular.js +578 -0
- package/script/deps/jsr.io/@noble/curves/2.0.1/src/abstract/modular.js.map +1 -0
- package/script/deps/jsr.io/@noble/curves/2.0.1/src/abstract/weierstrass.d.ts +325 -0
- package/script/deps/jsr.io/@noble/curves/2.0.1/src/abstract/weierstrass.d.ts.map +1 -0
- package/script/deps/jsr.io/@noble/curves/2.0.1/src/abstract/weierstrass.js +1232 -0
- package/script/deps/jsr.io/@noble/curves/2.0.1/src/abstract/weierstrass.js.map +1 -0
- package/script/deps/jsr.io/@noble/curves/2.0.1/src/secp256k1.d.ts +76 -0
- package/script/deps/jsr.io/@noble/curves/2.0.1/src/secp256k1.d.ts.map +1 -0
- package/script/deps/jsr.io/@noble/curves/2.0.1/src/secp256k1.js +286 -0
- package/script/deps/jsr.io/@noble/curves/2.0.1/src/secp256k1.js.map +1 -0
- package/script/deps/jsr.io/@noble/curves/2.0.1/src/utils.d.ts +103 -0
- package/script/deps/jsr.io/@noble/curves/2.0.1/src/utils.d.ts.map +1 -0
- package/script/deps/jsr.io/@noble/curves/2.0.1/src/utils.js +273 -0
- package/script/deps/jsr.io/@noble/curves/2.0.1/src/utils.js.map +1 -0
- package/script/deps/jsr.io/@noble/hashes/2.0.1/src/_md.d.ts +49 -0
- package/script/deps/jsr.io/@noble/hashes/2.0.1/src/_md.d.ts.map +1 -0
- package/script/deps/jsr.io/@noble/hashes/2.0.1/src/_md.js +153 -0
- package/script/deps/jsr.io/@noble/hashes/2.0.1/src/_md.js.map +1 -0
- package/script/deps/jsr.io/@noble/hashes/2.0.1/src/_u64.d.ts +55 -0
- package/script/deps/jsr.io/@noble/hashes/2.0.1/src/_u64.d.ts.map +1 -0
- package/script/deps/jsr.io/@noble/hashes/2.0.1/src/_u64.js +90 -0
- package/script/deps/jsr.io/@noble/hashes/2.0.1/src/_u64.js.map +1 -0
- package/script/deps/jsr.io/@noble/hashes/2.0.1/src/hmac.d.ts +36 -0
- package/script/deps/jsr.io/@noble/hashes/2.0.1/src/hmac.d.ts.map +1 -0
- package/script/deps/jsr.io/@noble/hashes/2.0.1/src/hmac.js +95 -0
- package/script/deps/jsr.io/@noble/hashes/2.0.1/src/hmac.js.map +1 -0
- package/script/deps/jsr.io/@noble/hashes/2.0.1/src/sha2.d.ts +199 -0
- package/script/deps/jsr.io/@noble/hashes/2.0.1/src/sha2.d.ts.map +1 -0
- package/script/deps/jsr.io/@noble/hashes/2.0.1/src/sha2.js +439 -0
- package/script/deps/jsr.io/@noble/hashes/2.0.1/src/sha2.js.map +1 -0
- package/script/deps/jsr.io/@noble/hashes/2.0.1/src/sha3.d.ts +58 -0
- package/script/deps/jsr.io/@noble/hashes/2.0.1/src/sha3.d.ts.map +1 -0
- package/script/deps/jsr.io/@noble/hashes/2.0.1/src/sha3.js +259 -0
- package/script/deps/jsr.io/@noble/hashes/2.0.1/src/sha3.js.map +1 -0
- package/script/deps/jsr.io/@noble/hashes/2.0.1/src/utils.d.ts +124 -0
- package/script/deps/jsr.io/@noble/hashes/2.0.1/src/utils.d.ts.map +1 -0
- package/script/deps/jsr.io/@noble/hashes/2.0.1/src/utils.js +304 -0
- package/script/deps/jsr.io/@noble/hashes/2.0.1/src/utils.js.map +1 -0
- package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/advanced/abi-mapper.d.ts +44 -0
- package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/advanced/abi-mapper.d.ts.map +1 -0
- package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/advanced/abi-mapper.js +182 -0
- package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/advanced/abi-mapper.js.map +1 -0
- package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/address.d.ts +38 -0
- package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/address.d.ts.map +1 -0
- package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/address.js +99 -0
- package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/address.js.map +1 -0
- package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/rlp.d.ts +23 -0
- package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/rlp.d.ts.map +1 -0
- package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/rlp.js +134 -0
- package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/rlp.js.map +1 -0
- package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/tx-internal.d.ts +300 -0
- package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/tx-internal.d.ts.map +1 -0
- package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/tx-internal.js +576 -0
- package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/tx-internal.js.map +1 -0
- package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/tx.d.ts +98 -0
- package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/tx.d.ts.map +1 -0
- package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/tx.js +211 -0
- package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/tx.js.map +1 -0
- package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/typed-data.d.ts +78 -0
- package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/typed-data.d.ts.map +1 -0
- package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/typed-data.js +308 -0
- package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/typed-data.js.map +1 -0
- package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/index.d.ts +6 -0
- package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/index.d.ts.map +1 -0
- package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/index.js +21 -0
- package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/index.js.map +1 -0
- package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/utils.d.ts +66 -0
- package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/utils.d.ts.map +1 -0
- package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/utils.js +195 -0
- package/script/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/utils.js.map +1 -0
- package/script/deps/jsr.io/@paulmillr/micro-packed/0.8.0/src/index.d.ts +877 -0
- package/script/deps/jsr.io/@paulmillr/micro-packed/0.8.0/src/index.d.ts.map +1 -0
- package/script/deps/jsr.io/@paulmillr/micro-packed/0.8.0/src/index.js +2032 -0
- package/script/deps/jsr.io/@paulmillr/micro-packed/0.8.0/src/index.js.map +1 -0
- package/script/deps/jsr.io/@scure/base/2.0.0/index.d.ts +294 -0
- package/script/deps/jsr.io/@scure/base/2.0.0/index.d.ts.map +1 -0
- package/script/deps/jsr.io/@scure/base/2.0.0/index.js +710 -0
- package/script/deps/jsr.io/@scure/base/2.0.0/index.js.map +1 -0
- package/script/deps/jsr.io/@std/async/1.0.16/unstable_semaphore.d.ts +93 -0
- package/script/deps/jsr.io/@std/async/1.0.16/unstable_semaphore.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/async/1.0.16/unstable_semaphore.js +141 -0
- package/script/deps/jsr.io/@std/async/1.0.16/unstable_semaphore.js.map +1 -0
- package/script/src/api/exchange/_methods/_base/_nonce.d.ts +3 -2
- package/script/src/api/exchange/_methods/_base/_nonce.d.ts.map +1 -1
- package/script/src/api/exchange/_methods/_base/_nonce.js +4 -3
- package/script/src/api/exchange/_methods/_base/_nonce.js.map +1 -1
- package/script/src/api/exchange/_methods/_base/_semaphore.d.ts +7 -6
- package/script/src/api/exchange/_methods/_base/_semaphore.d.ts.map +1 -1
- package/script/src/api/exchange/_methods/_base/_semaphore.js +35 -50
- package/script/src/api/exchange/_methods/_base/_semaphore.js.map +1 -1
- package/script/src/api/exchange/_methods/_base/execute.d.ts +14 -3
- package/script/src/api/exchange/_methods/_base/execute.d.ts.map +1 -1
- package/script/src/api/exchange/_methods/_base/execute.js +43 -9
- package/script/src/api/exchange/_methods/_base/execute.js.map +1 -1
- package/script/src/api/exchange/_methods/batchModify.d.ts +6 -6
- package/script/src/api/exchange/_methods/createVault.d.ts +5 -5
- package/script/src/api/exchange/_methods/modify.d.ts +5 -5
- package/script/src/api/exchange/_methods/order.d.ts +13 -13
- package/script/src/api/exchange/_methods/order.d.ts.map +1 -1
- package/script/src/api/exchange/_methods/order.js +4 -2
- package/script/src/api/exchange/_methods/order.js.map +1 -1
- package/script/src/api/exchange/client.d.ts +1 -1
- package/script/src/api/exchange/client.d.ts.map +1 -1
- package/script/src/api/exchange/client.js.map +1 -1
- package/script/src/api/exchange/mod.d.ts +1 -1
- package/script/src/api/exchange/mod.d.ts.map +1 -1
- package/script/src/api/exchange/mod.js.map +1 -1
- package/script/src/api/info/_methods/_base/commonSchemas.d.ts +8 -8
- package/script/src/api/info/_methods/frontendOpenOrders.d.ts +3 -3
- package/script/src/api/info/_methods/historicalOrders.d.ts +4 -4
- package/script/src/api/info/_methods/l3Orders.d.ts +11 -11
- package/script/src/api/info/_methods/l4Orders.d.ts +6 -6
- package/script/src/api/info/_methods/openOrders.d.ts +3 -3
- package/script/src/api/info/_methods/orderStatus.d.ts +5 -5
- package/script/src/api/info/_methods/recentTrades.d.ts +2 -2
- package/script/src/api/info/_methods/twapHistory.d.ts +4 -4
- package/script/src/api/info/_methods/userFills.d.ts +3 -3
- package/script/src/api/info/_methods/userFillsByTime.d.ts +4 -4
- package/script/src/api/info/_methods/userFunding.d.ts +3 -3
- package/script/src/api/info/_methods/userFunding.js +2 -2
- package/script/src/api/info/_methods/userFunding.js.map +1 -1
- package/script/src/api/info/_methods/userTwapSliceFills.d.ts +4 -4
- package/script/src/api/info/_methods/userTwapSliceFillsByTime.d.ts +5 -5
- package/script/src/api/info/_methods/webData2.d.ts +9 -9
- package/script/src/api/subscription/_methods/assetCtxs.d.ts +2 -0
- package/script/src/api/subscription/_methods/assetCtxs.d.ts.map +1 -1
- package/script/src/api/subscription/_methods/assetCtxs.js.map +1 -1
- package/script/src/api/subscription/_methods/clearinghouseState.d.ts +2 -0
- package/script/src/api/subscription/_methods/clearinghouseState.d.ts.map +1 -1
- package/script/src/api/subscription/_methods/clearinghouseState.js +2 -0
- package/script/src/api/subscription/_methods/clearinghouseState.js.map +1 -1
- package/script/src/api/subscription/_methods/explorerBlock.d.ts +2 -0
- package/script/src/api/subscription/_methods/explorerBlock.d.ts.map +1 -1
- package/script/src/api/subscription/_methods/explorerBlock.js +2 -0
- package/script/src/api/subscription/_methods/explorerBlock.js.map +1 -1
- package/script/src/api/subscription/_methods/explorerTxs.d.ts +2 -0
- package/script/src/api/subscription/_methods/explorerTxs.d.ts.map +1 -1
- package/script/src/api/subscription/_methods/explorerTxs.js +2 -0
- package/script/src/api/subscription/_methods/explorerTxs.js.map +1 -1
- package/script/src/api/subscription/_methods/openOrders.d.ts +5 -5
- package/script/src/api/subscription/_methods/orderUpdates.d.ts +4 -4
- package/script/src/api/subscription/_methods/trades.d.ts +3 -3
- package/script/src/api/subscription/_methods/twapStates.d.ts +9 -4
- package/script/src/api/subscription/_methods/twapStates.d.ts.map +1 -1
- package/script/src/api/subscription/_methods/twapStates.js +6 -1
- package/script/src/api/subscription/_methods/twapStates.js.map +1 -1
- package/script/src/api/subscription/_methods/userEvents.d.ts +17 -17
- package/script/src/api/subscription/_methods/userFills.d.ts +5 -5
- package/script/src/api/subscription/_methods/userHistoricalOrders.d.ts +6 -6
- package/script/src/api/subscription/_methods/userTwapHistory.d.ts +6 -6
- package/script/src/api/subscription/_methods/userTwapSliceFills.d.ts +6 -6
- package/script/src/api/subscription/_methods/webData2.d.ts +11 -11
- package/script/src/signing/_privateKeySigner.js +3 -3
- package/script/src/signing/_privateKeySigner.js.map +1 -1
- package/script/src/signing/mod.js +2 -2
- package/script/src/signing/mod.js.map +1 -1
- package/src/_dnt.shims.ts +60 -0
- package/src/deps/jsr.io/@noble/curves/2.0.1/src/abstract/curve.ts +633 -0
- package/src/deps/jsr.io/@noble/curves/2.0.1/src/abstract/hash-to-curve.ts +292 -0
- package/src/deps/jsr.io/@noble/curves/2.0.1/src/abstract/modular.ts +621 -0
- package/src/deps/jsr.io/@noble/curves/2.0.1/src/abstract/weierstrass.ts +1562 -0
- package/src/deps/jsr.io/@noble/curves/2.0.1/src/secp256k1.ts +327 -0
- package/src/deps/jsr.io/@noble/curves/2.0.1/src/utils.ts +306 -0
- package/src/deps/jsr.io/@noble/hashes/2.0.1/src/_md.ts +156 -0
- package/src/deps/jsr.io/@noble/hashes/2.0.1/src/_u64.ts +91 -0
- package/src/deps/jsr.io/@noble/hashes/2.0.1/src/hmac.ts +94 -0
- package/src/deps/jsr.io/@noble/hashes/2.0.1/src/sha2.ts +469 -0
- package/src/deps/jsr.io/@noble/hashes/2.0.1/src/sha3.ts +295 -0
- package/src/deps/jsr.io/@noble/hashes/2.0.1/src/utils.ts +340 -0
- package/src/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/advanced/abi-mapper.ts +212 -0
- package/src/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/address.ts +100 -0
- package/src/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/rlp.ts +104 -0
- package/src/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/tx-internal.ts +626 -0
- package/src/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/tx.ts +274 -0
- package/src/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/core/typed-data.ts +391 -0
- package/src/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/index.ts +12 -0
- package/src/deps/jsr.io/@paulmillr/micro-eth-signer/0.18.1/src/utils.ts +233 -0
- package/src/deps/jsr.io/@paulmillr/micro-packed/0.8.0/src/index.ts +2196 -0
- package/src/deps/jsr.io/@scure/base/2.0.0/index.ts +857 -0
- package/src/deps/jsr.io/@std/async/1.0.16/unstable_semaphore.ts +146 -0
- package/src/src/api/exchange/_methods/_base/_nonce.ts +3 -2
- package/src/src/api/exchange/_methods/_base/_semaphore.ts +34 -59
- package/src/src/api/exchange/_methods/_base/execute.ts +60 -12
- package/src/src/api/exchange/_methods/order.ts +5 -3
- package/src/src/api/exchange/client.ts +5 -1
- package/src/src/api/exchange/mod.ts +5 -1
- package/src/src/api/info/_methods/userFunding.ts +2 -2
- package/src/src/api/subscription/_methods/assetCtxs.ts +2 -0
- package/src/src/api/subscription/_methods/clearinghouseState.ts +2 -0
- package/src/src/api/subscription/_methods/explorerBlock.ts +2 -0
- package/src/src/api/subscription/_methods/explorerTxs.ts +2 -0
- package/src/src/api/subscription/_methods/twapStates.ts +9 -1
- package/src/src/signing/_privateKeySigner.ts +1 -1
- package/src/src/signing/mod.ts +1 -1
- package/esm/deps/jsr.io/@std/msgpack/1.0.3/decode.d.ts +0 -21
- package/esm/deps/jsr.io/@std/msgpack/1.0.3/decode.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/msgpack/1.0.3/decode.js +0 -292
- package/esm/deps/jsr.io/@std/msgpack/1.0.3/decode.js.map +0 -1
- package/esm/deps/jsr.io/@std/msgpack/1.0.3/mod.d.ts +0 -44
- package/esm/deps/jsr.io/@std/msgpack/1.0.3/mod.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/msgpack/1.0.3/mod.js +0 -46
- package/esm/deps/jsr.io/@std/msgpack/1.0.3/mod.js.map +0 -1
- package/script/deps/jsr.io/@std/msgpack/1.0.3/decode.d.ts +0 -21
- package/script/deps/jsr.io/@std/msgpack/1.0.3/decode.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/msgpack/1.0.3/decode.js +0 -295
- package/script/deps/jsr.io/@std/msgpack/1.0.3/decode.js.map +0 -1
- package/script/deps/jsr.io/@std/msgpack/1.0.3/mod.d.ts +0 -44
- package/script/deps/jsr.io/@std/msgpack/1.0.3/mod.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/msgpack/1.0.3/mod.js +0 -62
- package/script/deps/jsr.io/@std/msgpack/1.0.3/mod.js.map +0 -1
- package/src/deps/jsr.io/@std/msgpack/1.0.3/decode.ts +0 -391
- package/src/deps/jsr.io/@std/msgpack/1.0.3/mod.ts +0 -47
|
@@ -0,0 +1,457 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Methods for elliptic curve multiplication by scalars.
|
|
3
|
+
* Contains wNAF, pippenger.
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
7
|
+
import { bitLen, bitMask } from '../utils.js';
|
|
8
|
+
import { Field, FpInvertBatch, validateField } from './modular.js';
|
|
9
|
+
const _0n = /* @__PURE__ */ BigInt(0);
|
|
10
|
+
const _1n = /* @__PURE__ */ BigInt(1);
|
|
11
|
+
export function negateCt(condition, item) {
|
|
12
|
+
const neg = item.negate();
|
|
13
|
+
return condition ? neg : item;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Takes a bunch of Projective Points but executes only one
|
|
17
|
+
* inversion on all of them. Inversion is very slow operation,
|
|
18
|
+
* so this improves performance massively.
|
|
19
|
+
* Optimization: converts a list of projective points to a list of identical points with Z=1.
|
|
20
|
+
*/
|
|
21
|
+
export function normalizeZ(c, points) {
|
|
22
|
+
const invertedZs = FpInvertBatch(c.Fp, points.map((p) => p.Z));
|
|
23
|
+
return points.map((p, i) => c.fromAffine(p.toAffine(invertedZs[i])));
|
|
24
|
+
}
|
|
25
|
+
function validateW(W, bits) {
|
|
26
|
+
if (!Number.isSafeInteger(W) || W <= 0 || W > bits)
|
|
27
|
+
throw new Error('invalid window size, expected [1..' + bits + '], got W=' + W);
|
|
28
|
+
}
|
|
29
|
+
function calcWOpts(W, scalarBits) {
|
|
30
|
+
validateW(W, scalarBits);
|
|
31
|
+
const windows = Math.ceil(scalarBits / W) + 1; // W=8 33. Not 32, because we skip zero
|
|
32
|
+
const windowSize = 2 ** (W - 1); // W=8 128. Not 256, because we skip zero
|
|
33
|
+
const maxNumber = 2 ** W; // W=8 256
|
|
34
|
+
const mask = bitMask(W); // W=8 255 == mask 0b11111111
|
|
35
|
+
const shiftBy = BigInt(W); // W=8 8
|
|
36
|
+
return { windows, windowSize, mask, maxNumber, shiftBy };
|
|
37
|
+
}
|
|
38
|
+
function calcOffsets(n, window, wOpts) {
|
|
39
|
+
const { windowSize, mask, maxNumber, shiftBy } = wOpts;
|
|
40
|
+
let wbits = Number(n & mask); // extract W bits.
|
|
41
|
+
let nextN = n >> shiftBy; // shift number by W bits.
|
|
42
|
+
// What actually happens here:
|
|
43
|
+
// const highestBit = Number(mask ^ (mask >> 1n));
|
|
44
|
+
// let wbits2 = wbits - 1; // skip zero
|
|
45
|
+
// if (wbits2 & highestBit) { wbits2 ^= Number(mask); // (~);
|
|
46
|
+
// split if bits > max: +224 => 256-32
|
|
47
|
+
if (wbits > windowSize) {
|
|
48
|
+
// we skip zero, which means instead of `>= size-1`, we do `> size`
|
|
49
|
+
wbits -= maxNumber; // -32, can be maxNumber - wbits, but then we need to set isNeg here.
|
|
50
|
+
nextN += _1n; // +256 (carry)
|
|
51
|
+
}
|
|
52
|
+
const offsetStart = window * windowSize;
|
|
53
|
+
const offset = offsetStart + Math.abs(wbits) - 1; // -1 because we skip zero
|
|
54
|
+
const isZero = wbits === 0; // is current window slice a 0?
|
|
55
|
+
const isNeg = wbits < 0; // is current window slice negative?
|
|
56
|
+
const isNegF = window % 2 !== 0; // fake random statement for noise
|
|
57
|
+
const offsetF = offsetStart; // fake offset for noise
|
|
58
|
+
return { nextN, offset, isZero, isNeg, isNegF, offsetF };
|
|
59
|
+
}
|
|
60
|
+
function validateMSMPoints(points, c) {
|
|
61
|
+
if (!Array.isArray(points))
|
|
62
|
+
throw new Error('array expected');
|
|
63
|
+
points.forEach((p, i) => {
|
|
64
|
+
if (!(p instanceof c))
|
|
65
|
+
throw new Error('invalid point at index ' + i);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
function validateMSMScalars(scalars, field) {
|
|
69
|
+
if (!Array.isArray(scalars))
|
|
70
|
+
throw new Error('array of scalars expected');
|
|
71
|
+
scalars.forEach((s, i) => {
|
|
72
|
+
if (!field.isValid(s))
|
|
73
|
+
throw new Error('invalid scalar at index ' + i);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
// Since points in different groups cannot be equal (different object constructor),
|
|
77
|
+
// we can have single place to store precomputes.
|
|
78
|
+
// Allows to make points frozen / immutable.
|
|
79
|
+
const pointPrecomputes = new WeakMap();
|
|
80
|
+
const pointWindowSizes = new WeakMap();
|
|
81
|
+
function getW(P) {
|
|
82
|
+
// To disable precomputes:
|
|
83
|
+
// return 1;
|
|
84
|
+
return pointWindowSizes.get(P) || 1;
|
|
85
|
+
}
|
|
86
|
+
function assert0(n) {
|
|
87
|
+
if (n !== _0n)
|
|
88
|
+
throw new Error('invalid wNAF');
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Elliptic curve multiplication of Point by scalar. Fragile.
|
|
92
|
+
* Table generation takes **30MB of ram and 10ms on high-end CPU**,
|
|
93
|
+
* but may take much longer on slow devices. Actual generation will happen on
|
|
94
|
+
* first call of `multiply()`. By default, `BASE` point is precomputed.
|
|
95
|
+
*
|
|
96
|
+
* Scalars should always be less than curve order: this should be checked inside of a curve itself.
|
|
97
|
+
* Creates precomputation tables for fast multiplication:
|
|
98
|
+
* - private scalar is split by fixed size windows of W bits
|
|
99
|
+
* - every window point is collected from window's table & added to accumulator
|
|
100
|
+
* - since windows are different, same point inside tables won't be accessed more than once per calc
|
|
101
|
+
* - each multiplication is 'Math.ceil(CURVE_ORDER / 𝑊) + 1' point additions (fixed for any scalar)
|
|
102
|
+
* - +1 window is neccessary for wNAF
|
|
103
|
+
* - wNAF reduces table size: 2x less memory + 2x faster generation, but 10% slower multiplication
|
|
104
|
+
*
|
|
105
|
+
* @todo Research returning 2d JS array of windows, instead of a single window.
|
|
106
|
+
* This would allow windows to be in different memory locations
|
|
107
|
+
*/
|
|
108
|
+
export class wNAF {
|
|
109
|
+
BASE;
|
|
110
|
+
ZERO;
|
|
111
|
+
Fn;
|
|
112
|
+
bits;
|
|
113
|
+
// Parametrized with a given Point class (not individual point)
|
|
114
|
+
constructor(Point, bits) {
|
|
115
|
+
this.BASE = Point.BASE;
|
|
116
|
+
this.ZERO = Point.ZERO;
|
|
117
|
+
this.Fn = Point.Fn;
|
|
118
|
+
this.bits = bits;
|
|
119
|
+
}
|
|
120
|
+
// non-const time multiplication ladder
|
|
121
|
+
_unsafeLadder(elm, n, p = this.ZERO) {
|
|
122
|
+
let d = elm;
|
|
123
|
+
while (n > _0n) {
|
|
124
|
+
if (n & _1n)
|
|
125
|
+
p = p.add(d);
|
|
126
|
+
d = d.double();
|
|
127
|
+
n >>= _1n;
|
|
128
|
+
}
|
|
129
|
+
return p;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Creates a wNAF precomputation window. Used for caching.
|
|
133
|
+
* Default window size is set by `utils.precompute()` and is equal to 8.
|
|
134
|
+
* Number of precomputed points depends on the curve size:
|
|
135
|
+
* 2^(𝑊−1) * (Math.ceil(𝑛 / 𝑊) + 1), where:
|
|
136
|
+
* - 𝑊 is the window size
|
|
137
|
+
* - 𝑛 is the bitlength of the curve order.
|
|
138
|
+
* For a 256-bit curve and window size 8, the number of precomputed points is 128 * 33 = 4224.
|
|
139
|
+
* @param point Point instance
|
|
140
|
+
* @param W window size
|
|
141
|
+
* @returns precomputed point tables flattened to a single array
|
|
142
|
+
*/
|
|
143
|
+
precomputeWindow(point, W) {
|
|
144
|
+
const { windows, windowSize } = calcWOpts(W, this.bits);
|
|
145
|
+
const points = [];
|
|
146
|
+
let p = point;
|
|
147
|
+
let base = p;
|
|
148
|
+
for (let window = 0; window < windows; window++) {
|
|
149
|
+
base = p;
|
|
150
|
+
points.push(base);
|
|
151
|
+
// i=1, bc we skip 0
|
|
152
|
+
for (let i = 1; i < windowSize; i++) {
|
|
153
|
+
base = base.add(p);
|
|
154
|
+
points.push(base);
|
|
155
|
+
}
|
|
156
|
+
p = base.double();
|
|
157
|
+
}
|
|
158
|
+
return points;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Implements ec multiplication using precomputed tables and w-ary non-adjacent form.
|
|
162
|
+
* More compact implementation:
|
|
163
|
+
* https://github.com/paulmillr/noble-secp256k1/blob/47cb1669b6e506ad66b35fe7d76132ae97465da2/index.ts#L502-L541
|
|
164
|
+
* @returns real and fake (for const-time) points
|
|
165
|
+
*/
|
|
166
|
+
wNAF(W, precomputes, n) {
|
|
167
|
+
// Scalar should be smaller than field order
|
|
168
|
+
if (!this.Fn.isValid(n))
|
|
169
|
+
throw new Error('invalid scalar');
|
|
170
|
+
// Accumulators
|
|
171
|
+
let p = this.ZERO;
|
|
172
|
+
let f = this.BASE;
|
|
173
|
+
// This code was first written with assumption that 'f' and 'p' will never be infinity point:
|
|
174
|
+
// since each addition is multiplied by 2 ** W, it cannot cancel each other. However,
|
|
175
|
+
// there is negate now: it is possible that negated element from low value
|
|
176
|
+
// would be the same as high element, which will create carry into next window.
|
|
177
|
+
// It's not obvious how this can fail, but still worth investigating later.
|
|
178
|
+
const wo = calcWOpts(W, this.bits);
|
|
179
|
+
for (let window = 0; window < wo.windows; window++) {
|
|
180
|
+
// (n === _0n) is handled and not early-exited. isEven and offsetF are used for noise
|
|
181
|
+
const { nextN, offset, isZero, isNeg, isNegF, offsetF } = calcOffsets(n, window, wo);
|
|
182
|
+
n = nextN;
|
|
183
|
+
if (isZero) {
|
|
184
|
+
// bits are 0: add garbage to fake point
|
|
185
|
+
// Important part for const-time getPublicKey: add random "noise" point to f.
|
|
186
|
+
f = f.add(negateCt(isNegF, precomputes[offsetF]));
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
// bits are 1: add to result point
|
|
190
|
+
p = p.add(negateCt(isNeg, precomputes[offset]));
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
assert0(n);
|
|
194
|
+
// Return both real and fake points: JIT won't eliminate f.
|
|
195
|
+
// At this point there is a way to F be infinity-point even if p is not,
|
|
196
|
+
// which makes it less const-time: around 1 bigint multiply.
|
|
197
|
+
return { p, f };
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Implements ec unsafe (non const-time) multiplication using precomputed tables and w-ary non-adjacent form.
|
|
201
|
+
* @param acc accumulator point to add result of multiplication
|
|
202
|
+
* @returns point
|
|
203
|
+
*/
|
|
204
|
+
wNAFUnsafe(W, precomputes, n, acc = this.ZERO) {
|
|
205
|
+
const wo = calcWOpts(W, this.bits);
|
|
206
|
+
for (let window = 0; window < wo.windows; window++) {
|
|
207
|
+
if (n === _0n)
|
|
208
|
+
break; // Early-exit, skip 0 value
|
|
209
|
+
const { nextN, offset, isZero, isNeg } = calcOffsets(n, window, wo);
|
|
210
|
+
n = nextN;
|
|
211
|
+
if (isZero) {
|
|
212
|
+
// Window bits are 0: skip processing.
|
|
213
|
+
// Move to next window.
|
|
214
|
+
continue;
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
const item = precomputes[offset];
|
|
218
|
+
acc = acc.add(isNeg ? item.negate() : item); // Re-using acc allows to save adds in MSM
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
assert0(n);
|
|
222
|
+
return acc;
|
|
223
|
+
}
|
|
224
|
+
getPrecomputes(W, point, transform) {
|
|
225
|
+
// Calculate precomputes on a first run, reuse them after
|
|
226
|
+
let comp = pointPrecomputes.get(point);
|
|
227
|
+
if (!comp) {
|
|
228
|
+
comp = this.precomputeWindow(point, W);
|
|
229
|
+
if (W !== 1) {
|
|
230
|
+
// Doing transform outside of if brings 15% perf hit
|
|
231
|
+
if (typeof transform === 'function')
|
|
232
|
+
comp = transform(comp);
|
|
233
|
+
pointPrecomputes.set(point, comp);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
return comp;
|
|
237
|
+
}
|
|
238
|
+
cached(point, scalar, transform) {
|
|
239
|
+
const W = getW(point);
|
|
240
|
+
return this.wNAF(W, this.getPrecomputes(W, point, transform), scalar);
|
|
241
|
+
}
|
|
242
|
+
unsafe(point, scalar, transform, prev) {
|
|
243
|
+
const W = getW(point);
|
|
244
|
+
if (W === 1)
|
|
245
|
+
return this._unsafeLadder(point, scalar, prev); // For W=1 ladder is ~x2 faster
|
|
246
|
+
return this.wNAFUnsafe(W, this.getPrecomputes(W, point, transform), scalar, prev);
|
|
247
|
+
}
|
|
248
|
+
// We calculate precomputes for elliptic curve point multiplication
|
|
249
|
+
// using windowed method. This specifies window size and
|
|
250
|
+
// stores precomputed values. Usually only base point would be precomputed.
|
|
251
|
+
createCache(P, W) {
|
|
252
|
+
validateW(W, this.bits);
|
|
253
|
+
pointWindowSizes.set(P, W);
|
|
254
|
+
pointPrecomputes.delete(P);
|
|
255
|
+
}
|
|
256
|
+
hasCache(elm) {
|
|
257
|
+
return getW(elm) !== 1;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Endomorphism-specific multiplication for Koblitz curves.
|
|
262
|
+
* Cost: 128 dbl, 0-256 adds.
|
|
263
|
+
*/
|
|
264
|
+
export function mulEndoUnsafe(Point, point, k1, k2) {
|
|
265
|
+
let acc = point;
|
|
266
|
+
let p1 = Point.ZERO;
|
|
267
|
+
let p2 = Point.ZERO;
|
|
268
|
+
while (k1 > _0n || k2 > _0n) {
|
|
269
|
+
if (k1 & _1n)
|
|
270
|
+
p1 = p1.add(acc);
|
|
271
|
+
if (k2 & _1n)
|
|
272
|
+
p2 = p2.add(acc);
|
|
273
|
+
acc = acc.double();
|
|
274
|
+
k1 >>= _1n;
|
|
275
|
+
k2 >>= _1n;
|
|
276
|
+
}
|
|
277
|
+
return { p1, p2 };
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Pippenger algorithm for multi-scalar multiplication (MSM, Pa + Qb + Rc + ...).
|
|
281
|
+
* 30x faster vs naive addition on L=4096, 10x faster than precomputes.
|
|
282
|
+
* For N=254bit, L=1, it does: 1024 ADD + 254 DBL. For L=5: 1536 ADD + 254 DBL.
|
|
283
|
+
* Algorithmically constant-time (for same L), even when 1 point + scalar, or when scalar = 0.
|
|
284
|
+
* @param c Curve Point constructor
|
|
285
|
+
* @param fieldN field over CURVE.N - important that it's not over CURVE.P
|
|
286
|
+
* @param points array of L curve points
|
|
287
|
+
* @param scalars array of L scalars (aka secret keys / bigints)
|
|
288
|
+
*/
|
|
289
|
+
export function pippenger(c, points, scalars) {
|
|
290
|
+
// If we split scalars by some window (let's say 8 bits), every chunk will only
|
|
291
|
+
// take 256 buckets even if there are 4096 scalars, also re-uses double.
|
|
292
|
+
// TODO:
|
|
293
|
+
// - https://eprint.iacr.org/2024/750.pdf
|
|
294
|
+
// - https://tches.iacr.org/index.php/TCHES/article/view/10287
|
|
295
|
+
// 0 is accepted in scalars
|
|
296
|
+
const fieldN = c.Fn;
|
|
297
|
+
validateMSMPoints(points, c);
|
|
298
|
+
validateMSMScalars(scalars, fieldN);
|
|
299
|
+
const plength = points.length;
|
|
300
|
+
const slength = scalars.length;
|
|
301
|
+
if (plength !== slength)
|
|
302
|
+
throw new Error('arrays of points and scalars must have equal length');
|
|
303
|
+
// if (plength === 0) throw new Error('array must be of length >= 2');
|
|
304
|
+
const zero = c.ZERO;
|
|
305
|
+
const wbits = bitLen(BigInt(plength));
|
|
306
|
+
let windowSize = 1; // bits
|
|
307
|
+
if (wbits > 12)
|
|
308
|
+
windowSize = wbits - 3;
|
|
309
|
+
else if (wbits > 4)
|
|
310
|
+
windowSize = wbits - 2;
|
|
311
|
+
else if (wbits > 0)
|
|
312
|
+
windowSize = 2;
|
|
313
|
+
const MASK = bitMask(windowSize);
|
|
314
|
+
const buckets = new Array(Number(MASK) + 1).fill(zero); // +1 for zero array
|
|
315
|
+
const lastBits = Math.floor((fieldN.BITS - 1) / windowSize) * windowSize;
|
|
316
|
+
let sum = zero;
|
|
317
|
+
for (let i = lastBits; i >= 0; i -= windowSize) {
|
|
318
|
+
buckets.fill(zero);
|
|
319
|
+
for (let j = 0; j < slength; j++) {
|
|
320
|
+
const scalar = scalars[j];
|
|
321
|
+
const wbits = Number((scalar >> BigInt(i)) & MASK);
|
|
322
|
+
buckets[wbits] = buckets[wbits].add(points[j]);
|
|
323
|
+
}
|
|
324
|
+
let resI = zero; // not using this will do small speed-up, but will lose ct
|
|
325
|
+
// Skip first bucket, because it is zero
|
|
326
|
+
for (let j = buckets.length - 1, sumI = zero; j > 0; j--) {
|
|
327
|
+
sumI = sumI.add(buckets[j]);
|
|
328
|
+
resI = resI.add(sumI);
|
|
329
|
+
}
|
|
330
|
+
sum = sum.add(resI);
|
|
331
|
+
if (i !== 0)
|
|
332
|
+
for (let j = 0; j < windowSize; j++)
|
|
333
|
+
sum = sum.double();
|
|
334
|
+
}
|
|
335
|
+
return sum;
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Precomputed multi-scalar multiplication (MSM, Pa + Qb + Rc + ...).
|
|
339
|
+
* @param c Curve Point constructor
|
|
340
|
+
* @param fieldN field over CURVE.N - important that it's not over CURVE.P
|
|
341
|
+
* @param points array of L curve points
|
|
342
|
+
* @returns function which multiplies points with scaars
|
|
343
|
+
*/
|
|
344
|
+
export function precomputeMSMUnsafe(c, points, windowSize) {
|
|
345
|
+
/**
|
|
346
|
+
* Performance Analysis of Window-based Precomputation
|
|
347
|
+
*
|
|
348
|
+
* Base Case (256-bit scalar, 8-bit window):
|
|
349
|
+
* - Standard precomputation requires:
|
|
350
|
+
* - 31 additions per scalar × 256 scalars = 7,936 ops
|
|
351
|
+
* - Plus 255 summary additions = 8,191 total ops
|
|
352
|
+
* Note: Summary additions can be optimized via accumulator
|
|
353
|
+
*
|
|
354
|
+
* Chunked Precomputation Analysis:
|
|
355
|
+
* - Using 32 chunks requires:
|
|
356
|
+
* - 255 additions per chunk
|
|
357
|
+
* - 256 doublings
|
|
358
|
+
* - Total: (255 × 32) + 256 = 8,416 ops
|
|
359
|
+
*
|
|
360
|
+
* Memory Usage Comparison:
|
|
361
|
+
* Window Size | Standard Points | Chunked Points
|
|
362
|
+
* ------------|-----------------|---------------
|
|
363
|
+
* 4-bit | 520 | 15
|
|
364
|
+
* 8-bit | 4,224 | 255
|
|
365
|
+
* 10-bit | 13,824 | 1,023
|
|
366
|
+
* 16-bit | 557,056 | 65,535
|
|
367
|
+
*
|
|
368
|
+
* Key Advantages:
|
|
369
|
+
* 1. Enables larger window sizes due to reduced memory overhead
|
|
370
|
+
* 2. More efficient for smaller scalar counts:
|
|
371
|
+
* - 16 chunks: (16 × 255) + 256 = 4,336 ops
|
|
372
|
+
* - ~2x faster than standard 8,191 ops
|
|
373
|
+
*
|
|
374
|
+
* Limitations:
|
|
375
|
+
* - Not suitable for plain precomputes (requires 256 constant doublings)
|
|
376
|
+
* - Performance degrades with larger scalar counts:
|
|
377
|
+
* - Optimal for ~256 scalars
|
|
378
|
+
* - Less efficient for 4096+ scalars (Pippenger preferred)
|
|
379
|
+
*/
|
|
380
|
+
const fieldN = c.Fn;
|
|
381
|
+
validateW(windowSize, fieldN.BITS);
|
|
382
|
+
validateMSMPoints(points, c);
|
|
383
|
+
const zero = c.ZERO;
|
|
384
|
+
const tableSize = 2 ** windowSize - 1; // table size (without zero)
|
|
385
|
+
const chunks = Math.ceil(fieldN.BITS / windowSize); // chunks of item
|
|
386
|
+
const MASK = bitMask(windowSize);
|
|
387
|
+
const tables = points.map((p) => {
|
|
388
|
+
const res = [];
|
|
389
|
+
for (let i = 0, acc = p; i < tableSize; i++) {
|
|
390
|
+
res.push(acc);
|
|
391
|
+
acc = acc.add(p);
|
|
392
|
+
}
|
|
393
|
+
return res;
|
|
394
|
+
});
|
|
395
|
+
return (scalars) => {
|
|
396
|
+
validateMSMScalars(scalars, fieldN);
|
|
397
|
+
if (scalars.length > points.length)
|
|
398
|
+
throw new Error('array of scalars must be smaller than array of points');
|
|
399
|
+
let res = zero;
|
|
400
|
+
for (let i = 0; i < chunks; i++) {
|
|
401
|
+
// No need to double if accumulator is still zero.
|
|
402
|
+
if (res !== zero)
|
|
403
|
+
for (let j = 0; j < windowSize; j++)
|
|
404
|
+
res = res.double();
|
|
405
|
+
const shiftBy = BigInt(chunks * windowSize - (i + 1) * windowSize);
|
|
406
|
+
for (let j = 0; j < scalars.length; j++) {
|
|
407
|
+
const n = scalars[j];
|
|
408
|
+
const curr = Number((n >> shiftBy) & MASK);
|
|
409
|
+
if (!curr)
|
|
410
|
+
continue; // skip zero scalars chunks
|
|
411
|
+
res = res.add(tables[j][curr - 1]);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
return res;
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
function createField(order, field, isLE) {
|
|
418
|
+
if (field) {
|
|
419
|
+
if (field.ORDER !== order)
|
|
420
|
+
throw new Error('Field.ORDER must match order: Fp == p, Fn == n');
|
|
421
|
+
validateField(field);
|
|
422
|
+
return field;
|
|
423
|
+
}
|
|
424
|
+
else {
|
|
425
|
+
return Field(order, { isLE });
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
/** Validates CURVE opts and creates fields */
|
|
429
|
+
export function createCurveFields(type, CURVE, curveOpts = {}, FpFnLE) {
|
|
430
|
+
if (FpFnLE === undefined)
|
|
431
|
+
FpFnLE = type === 'edwards';
|
|
432
|
+
if (!CURVE || typeof CURVE !== 'object')
|
|
433
|
+
throw new Error(`expected valid ${type} CURVE object`);
|
|
434
|
+
for (const p of ['p', 'n', 'h']) {
|
|
435
|
+
const val = CURVE[p];
|
|
436
|
+
if (!(typeof val === 'bigint' && val > _0n))
|
|
437
|
+
throw new Error(`CURVE.${p} must be positive bigint`);
|
|
438
|
+
}
|
|
439
|
+
const Fp = createField(CURVE.p, curveOpts.Fp, FpFnLE);
|
|
440
|
+
const Fn = createField(CURVE.n, curveOpts.Fn, FpFnLE);
|
|
441
|
+
const _b = type === 'weierstrass' ? 'b' : 'd';
|
|
442
|
+
const params = ['Gx', 'Gy', 'a', _b];
|
|
443
|
+
for (const p of params) {
|
|
444
|
+
// @ts-ignore
|
|
445
|
+
if (!Fp.isValid(CURVE[p]))
|
|
446
|
+
throw new Error(`CURVE.${p} must be valid field element of CURVE.Fp`);
|
|
447
|
+
}
|
|
448
|
+
CURVE = Object.freeze(Object.assign({}, CURVE));
|
|
449
|
+
return { CURVE, Fp, Fn };
|
|
450
|
+
}
|
|
451
|
+
export function createKeygen(randomSecretKey, getPublicKey) {
|
|
452
|
+
return function keygen(seed) {
|
|
453
|
+
const secretKey = randomSecretKey(seed);
|
|
454
|
+
return { secretKey, publicKey: getPublicKey(secretKey) };
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
//# sourceMappingURL=curve.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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,CAAC,CAAC;QACxC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,CAAC,SAAS,CAAC,EAAE,CAAC;IAC3D,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* hash-to-curve from RFC 9380.
|
|
3
|
+
* Hashes arbitrary-length byte strings to a list of one or more elements of a finite field F.
|
|
4
|
+
* https://www.rfc-editor.org/rfc/rfc9380
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
8
|
+
import type { CHash } from '../utils.js';
|
|
9
|
+
import type { AffinePoint, PC_ANY, PC_F, PC_P } from './curve.js';
|
|
10
|
+
import { type IField } from './modular.js';
|
|
11
|
+
export type AsciiOrBytes = string | Uint8Array;
|
|
12
|
+
/**
|
|
13
|
+
* * `DST` is a domain separation tag, defined in section 2.2.5
|
|
14
|
+
* * `p` characteristic of F, where F is a finite field of characteristic p and order q = p^m
|
|
15
|
+
* * `m` is extension degree (1 for prime fields)
|
|
16
|
+
* * `k` is the target security target in bits (e.g. 128), from section 5.1
|
|
17
|
+
* * `expand` is `xmd` (SHA2, SHA3, BLAKE) or `xof` (SHAKE, BLAKE-XOF)
|
|
18
|
+
* * `hash` conforming to `utils.CHash` interface, with `outputLen` / `blockLen` props
|
|
19
|
+
*/
|
|
20
|
+
export type H2COpts = {
|
|
21
|
+
DST: AsciiOrBytes;
|
|
22
|
+
expand: 'xmd' | 'xof';
|
|
23
|
+
hash: CHash;
|
|
24
|
+
p: bigint;
|
|
25
|
+
m: number;
|
|
26
|
+
k: number;
|
|
27
|
+
};
|
|
28
|
+
export type H2CHashOpts = {
|
|
29
|
+
expand: 'xmd' | 'xof';
|
|
30
|
+
hash: CHash;
|
|
31
|
+
};
|
|
32
|
+
export type MapToCurve<T> = (scalar: bigint[]) => AffinePoint<T>;
|
|
33
|
+
export type H2CDSTOpts = {
|
|
34
|
+
DST: AsciiOrBytes;
|
|
35
|
+
};
|
|
36
|
+
export type H2CHasherBase<PC extends PC_ANY> = {
|
|
37
|
+
hashToCurve(msg: Uint8Array, options?: H2CDSTOpts): PC_P<PC>;
|
|
38
|
+
hashToScalar(msg: Uint8Array, options?: H2CDSTOpts): bigint;
|
|
39
|
+
deriveToCurve?(msg: Uint8Array, options?: H2CDSTOpts): PC_P<PC>;
|
|
40
|
+
Point: PC;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* RFC 9380 methods, with cofactor clearing. See https://www.rfc-editor.org/rfc/rfc9380#section-3.
|
|
44
|
+
*
|
|
45
|
+
* * hashToCurve: `map(hash(input))`, encodes RANDOM bytes to curve (WITH hashing)
|
|
46
|
+
* * encodeToCurve: `map(hash(input))`, encodes NON-UNIFORM bytes to curve (WITH hashing)
|
|
47
|
+
* * mapToCurve: `map(scalars)`, encodes NON-UNIFORM scalars to curve (NO hashing)
|
|
48
|
+
*/
|
|
49
|
+
export type H2CHasher<PC extends PC_ANY> = H2CHasherBase<PC> & {
|
|
50
|
+
encodeToCurve(msg: Uint8Array, options?: H2CDSTOpts): PC_P<PC>;
|
|
51
|
+
mapToCurve: MapToCurve<PC_F<PC>>;
|
|
52
|
+
defaults: H2COpts & {
|
|
53
|
+
encodeDST?: AsciiOrBytes;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Produces a uniformly random byte string using a cryptographic hash function H that outputs b bits.
|
|
58
|
+
* [RFC 9380 5.3.1](https://www.rfc-editor.org/rfc/rfc9380#section-5.3.1).
|
|
59
|
+
*/
|
|
60
|
+
export declare function expand_message_xmd(msg: Uint8Array, DST: AsciiOrBytes, lenInBytes: number, H: CHash): Uint8Array;
|
|
61
|
+
/**
|
|
62
|
+
* Produces a uniformly random byte string using an extendable-output function (XOF) H.
|
|
63
|
+
* 1. The collision resistance of H MUST be at least k bits.
|
|
64
|
+
* 2. H MUST be an XOF that has been proved indifferentiable from
|
|
65
|
+
* a random oracle under a reasonable cryptographic assumption.
|
|
66
|
+
* [RFC 9380 5.3.2](https://www.rfc-editor.org/rfc/rfc9380#section-5.3.2).
|
|
67
|
+
*/
|
|
68
|
+
export declare function expand_message_xof(msg: Uint8Array, DST: AsciiOrBytes, lenInBytes: number, k: number, H: CHash): Uint8Array;
|
|
69
|
+
/**
|
|
70
|
+
* Hashes arbitrary-length byte strings to a list of one or more elements of a finite field F.
|
|
71
|
+
* [RFC 9380 5.2](https://www.rfc-editor.org/rfc/rfc9380#section-5.2).
|
|
72
|
+
* @param msg a byte string containing the message to hash
|
|
73
|
+
* @param count the number of elements of F to output
|
|
74
|
+
* @param options `{DST: string, p: bigint, m: number, k: number, expand: 'xmd' | 'xof', hash: H}`, see above
|
|
75
|
+
* @returns [u_0, ..., u_(count - 1)], a list of field elements.
|
|
76
|
+
*/
|
|
77
|
+
export declare function hash_to_field(msg: Uint8Array, count: number, options: H2COpts): bigint[][];
|
|
78
|
+
type XY<T> = (x: T, y: T) => {
|
|
79
|
+
x: T;
|
|
80
|
+
y: T;
|
|
81
|
+
};
|
|
82
|
+
type XYRatio<T> = [T[], T[], T[], T[]];
|
|
83
|
+
export declare function isogenyMap<T, F extends IField<T>>(field: F, map: XYRatio<T>): XY<T>;
|
|
84
|
+
export declare const _DST_scalar: Uint8Array;
|
|
85
|
+
/** Creates hash-to-curve methods from EC Point and mapToCurve function. See {@link H2CHasher}. */
|
|
86
|
+
export declare function createHasher<PC extends PC_ANY>(Point: PC, mapToCurve: MapToCurve<PC_F<PC>>, defaults: H2COpts & {
|
|
87
|
+
encodeDST?: AsciiOrBytes;
|
|
88
|
+
}): H2CHasher<PC>;
|
|
89
|
+
export {};
|
|
90
|
+
//# sourceMappingURL=hash-to-curve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hash-to-curve.d.ts","sourceRoot":"","sources":["../../../../../../../../src/deps/jsr.io/@noble/curves/2.0.1/src/abstract/hash-to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