@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,212 @@
|
|
|
1
|
+
import * as P from '../../../../micro-packed/0.8.0/src/index.js';
|
|
2
|
+
|
|
3
|
+
// prettier-ignore
|
|
4
|
+
type IntIdxType = '' | '8' | '16' | '24' | '32' | '40' | '48' | '56' |
|
|
5
|
+
'64' | '72' | '80' | '88' | '96' | '104' | '112' | '120' | '128' | '136' |
|
|
6
|
+
'144' | '152' | '160' | '168' | '176' | '184' | '192' | '200' | '208' | '216' |
|
|
7
|
+
'224' | '232' | '240' | '248' | '256';
|
|
8
|
+
type UintType = `uint${IntIdxType}`;
|
|
9
|
+
type IntType = `int${IntIdxType}`;
|
|
10
|
+
type NumberType = UintType | IntType;
|
|
11
|
+
// Basic type support
|
|
12
|
+
// int<M>: two’s complement signed integer type of M bits, 0 < M <= 256, M % 8 == 0.
|
|
13
|
+
// prettier-ignore
|
|
14
|
+
// bytes<M>: binary type of M bytes, 0 < M <= 32.
|
|
15
|
+
// prettier-ignore
|
|
16
|
+
type ByteIdxType = '' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' |
|
|
17
|
+
'10' | '11' | '12' | '13' | '14' | '15' | '16' | '17' | '18' | '19' | '20' | '21' |
|
|
18
|
+
'22' | '23' | '24' | '25' | '26' | '27' | '28' | '29' | '30' | '31' | '32';
|
|
19
|
+
type ByteType = `bytes${ByteIdxType}`;
|
|
20
|
+
|
|
21
|
+
export type Writable<T> = T extends {}
|
|
22
|
+
? {
|
|
23
|
+
-readonly [P in keyof T]: Writable<T[P]>;
|
|
24
|
+
}
|
|
25
|
+
: T;
|
|
26
|
+
export type IsEmptyArray<T> =
|
|
27
|
+
T extends ReadonlyArray<any> ? (T['length'] extends 0 ? true : false) : true;
|
|
28
|
+
export type ArrLike<T> = Array<T> | ReadonlyArray<T>;
|
|
29
|
+
|
|
30
|
+
export type Component<T extends string> = {
|
|
31
|
+
readonly name?: string;
|
|
32
|
+
readonly type: T;
|
|
33
|
+
};
|
|
34
|
+
export type NamedComponent<T extends string> = Component<T> & { readonly name: string };
|
|
35
|
+
export type BaseComponent = Component<string>;
|
|
36
|
+
export type Tuple<TC extends ArrLike<Component<string>>> = {
|
|
37
|
+
readonly name?: string;
|
|
38
|
+
readonly type: 'tuple';
|
|
39
|
+
readonly components: TC;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// [{name: 'a', type: 'string'}, {name: 'b', type: 'uint'}] -> {a: string, b: bigint};
|
|
43
|
+
export type MapTuple<T> =
|
|
44
|
+
T extends ArrLike<Component<string> & { name: string }>
|
|
45
|
+
? {
|
|
46
|
+
[K in T[number] as K['name']]: MapType<K>;
|
|
47
|
+
}
|
|
48
|
+
: T extends ArrLike<Component<string>>
|
|
49
|
+
? // [{name: 'a', type: 'string'}, {type: 'uint'}] -> [string, bigint];
|
|
50
|
+
{
|
|
51
|
+
[K in keyof T]: T[K] extends BaseComponent ? MapType<T[K]> : unknown;
|
|
52
|
+
}
|
|
53
|
+
: unknown;
|
|
54
|
+
// prettier-ignore
|
|
55
|
+
export type MapType<T extends BaseComponent> =
|
|
56
|
+
T extends Tuple<Array<Component<string>>> ? MapTuple<T['components']> :
|
|
57
|
+
T extends { readonly type: 'tuple[]'; readonly components: infer C extends Array<Component<string>> } ? MapTuple<C>[] :
|
|
58
|
+
T extends Component<infer Type> ? GetType<Type> :
|
|
59
|
+
unknown; // default
|
|
60
|
+
export type UnmapType<T> = T extends MapType<infer U> ? U : never;
|
|
61
|
+
// If only one arg -- use as is, otherwise construct tuple by tuple rules
|
|
62
|
+
export type ArgsType<T extends ReadonlyArray<any> | undefined> =
|
|
63
|
+
IsEmptyArray<T> extends true
|
|
64
|
+
? undefined // empty arr
|
|
65
|
+
: T extends ReadonlyArray<any>
|
|
66
|
+
? T['length'] extends 1 // single elm
|
|
67
|
+
? MapType<T[0]>
|
|
68
|
+
: MapTuple<T>
|
|
69
|
+
: MapTuple<T>;
|
|
70
|
+
|
|
71
|
+
// prettier-ignore
|
|
72
|
+
export type GetType<T extends string> =
|
|
73
|
+
T extends `${infer Base}[]${infer Rest}` ? GetType<`${Base}${Rest}`>[] : // 'string[]' -> 'string'[]
|
|
74
|
+
T extends `${infer Base}[${number}]${infer Rest}` ? GetType<`${Base}${Rest}`>[] : // 'string[3]' -> 'string'[]
|
|
75
|
+
T extends 'address' ? string :
|
|
76
|
+
T extends 'string' ? string :
|
|
77
|
+
T extends 'bool' ? boolean :
|
|
78
|
+
T extends NumberType ? bigint :
|
|
79
|
+
T extends ByteType ? Uint8Array :
|
|
80
|
+
unknown; // default
|
|
81
|
+
|
|
82
|
+
export const ARRAY_RE = /(.+)(\[(\d+)?\])$/; // TODO: is this correct?
|
|
83
|
+
|
|
84
|
+
function EPad<T>(p: P.CoderType<T>) {
|
|
85
|
+
return P.padLeft(32, p, P.ZeroPad);
|
|
86
|
+
}
|
|
87
|
+
const PTR = EPad(P.U32BE);
|
|
88
|
+
const U256BE_LEN = PTR;
|
|
89
|
+
|
|
90
|
+
// Main difference between regular array: length stored outside and offsets calculated without length
|
|
91
|
+
function ethArray<T>(inner: P.CoderType<T>): P.CoderType<T[]> {
|
|
92
|
+
return P.wrap({
|
|
93
|
+
size: undefined,
|
|
94
|
+
encodeStream: (w: P.Writer, value: T[]) => {
|
|
95
|
+
U256BE_LEN.encodeStream(w, value.length);
|
|
96
|
+
w.bytes(P.array(value.length, inner).encode(value));
|
|
97
|
+
},
|
|
98
|
+
decodeStream: (r: P.Reader): T[] =>
|
|
99
|
+
P.array(U256BE_LEN.decodeStream(r), inner).decodeStream(r.offsetReader(r.pos)),
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// Because u32 in eth is not real u32, just U256BE with limits...
|
|
104
|
+
const ethInt = (bits: number, signed = false) => {
|
|
105
|
+
if (!Number.isSafeInteger(bits) || bits <= 0 || bits % 8 !== 0 || bits > 256)
|
|
106
|
+
throw new Error('ethInt: invalid numeric type');
|
|
107
|
+
const _bits = BigInt(bits);
|
|
108
|
+
const inner = P.bigint(32, false, signed);
|
|
109
|
+
return P.validate(
|
|
110
|
+
P.wrap({
|
|
111
|
+
size: inner.size,
|
|
112
|
+
encodeStream: (w: P.Writer, value: bigint) => inner.encodeStream(w, value),
|
|
113
|
+
decodeStream: (r: P.Reader): bigint => inner.decodeStream(r),
|
|
114
|
+
}),
|
|
115
|
+
(value) => {
|
|
116
|
+
// TODO: validate useful for narrowing types, need to add support in types?
|
|
117
|
+
if (typeof value === 'number') value = BigInt(value);
|
|
118
|
+
P.utils.checkBounds(value, _bits, !!signed);
|
|
119
|
+
return value;
|
|
120
|
+
}
|
|
121
|
+
);
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
// Ugly hack, because tuple of pointers considered "dynamic" without any reason.
|
|
125
|
+
function isDyn<T>(args: P.CoderType<T>[] | Record<string, P.CoderType<T>>) {
|
|
126
|
+
let res = false;
|
|
127
|
+
if (Array.isArray(args)) {
|
|
128
|
+
for (let arg of args) if (arg.size === undefined) res = true;
|
|
129
|
+
} else {
|
|
130
|
+
for (let arg in args) if (args[arg].size === undefined) res = true;
|
|
131
|
+
}
|
|
132
|
+
return res;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// NOTE: we need as const if we want to access string as values inside types :(
|
|
136
|
+
export function mapComponent<T extends BaseComponent>(c: T): P.CoderType<MapType<Writable<T>>> {
|
|
137
|
+
// Arrays (should be first one, since recursive)
|
|
138
|
+
let m;
|
|
139
|
+
if ((m = ARRAY_RE.exec(c.type))) {
|
|
140
|
+
const inner = mapComponent({ ...c, type: m[1] });
|
|
141
|
+
if (inner.size === 0)
|
|
142
|
+
throw new Error('mapComponent: arrays of zero-size elements disabled (possible DoS attack)');
|
|
143
|
+
// Static array
|
|
144
|
+
if (m[3] !== undefined) {
|
|
145
|
+
const m3 = Number.parseInt(m[3]);
|
|
146
|
+
if (!Number.isSafeInteger(m3)) throw new Error(`mapComponent: wrong array size=${m[3]}`);
|
|
147
|
+
let out = P.array(m3, inner);
|
|
148
|
+
// Static array of dynamic values should be behind pointer too, again without reason.
|
|
149
|
+
if (inner.size === undefined) out = P.pointer(PTR, out);
|
|
150
|
+
return out as any;
|
|
151
|
+
} else {
|
|
152
|
+
// Dynamic array
|
|
153
|
+
return P.pointer(PTR, ethArray(inner)) as any;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
if (c.type === 'tuple') {
|
|
157
|
+
const components: (Component<string> & { name?: string })[] = (c as any).components;
|
|
158
|
+
let hasNames = true;
|
|
159
|
+
const args: P.CoderType<any>[] = [];
|
|
160
|
+
for (let comp of components) {
|
|
161
|
+
if (!comp.name) hasNames = false;
|
|
162
|
+
args.push(mapComponent(comp));
|
|
163
|
+
}
|
|
164
|
+
let out: any;
|
|
165
|
+
// If there is names for all fields -- return struct, otherwise tuple
|
|
166
|
+
if (hasNames) {
|
|
167
|
+
const struct: Record<string, P.CoderType<unknown>> = {};
|
|
168
|
+
for (const arg of components) {
|
|
169
|
+
if (struct[arg.name!]) throw new Error(`mapType: same field name=${arg.name}`);
|
|
170
|
+
struct[arg.name!] = mapComponent(arg);
|
|
171
|
+
}
|
|
172
|
+
out = P.struct(struct);
|
|
173
|
+
} else out = P.tuple(args);
|
|
174
|
+
// If tuple has dynamic elements it becomes dynamic too, without reason.
|
|
175
|
+
if (isDyn(args)) out = P.pointer(PTR, out);
|
|
176
|
+
return out;
|
|
177
|
+
}
|
|
178
|
+
if (c.type === 'string')
|
|
179
|
+
return P.pointer(PTR, P.padRight(32, P.string(U256BE_LEN), P.ZeroPad)) as any;
|
|
180
|
+
if (c.type === 'bytes')
|
|
181
|
+
return P.pointer(PTR, P.padRight(32, P.bytes(U256BE_LEN), P.ZeroPad)) as any;
|
|
182
|
+
if (c.type === 'address') return EPad(P.hex(20, { isLE: false, with0x: true })) as any;
|
|
183
|
+
if (c.type === 'bool') return EPad(P.bool) as any;
|
|
184
|
+
if ((m = /^(u?)int([0-9]+)?$/.exec(c.type)))
|
|
185
|
+
return ethInt(m[2] ? +m[2] : 256, m[1] !== 'u') as any;
|
|
186
|
+
if ((m = /^bytes([0-9]{1,2})$/.exec(c.type))) {
|
|
187
|
+
const parsed = +m[1];
|
|
188
|
+
if (!parsed || parsed > 32) throw new Error('wrong bytes<N> type');
|
|
189
|
+
return P.padRight(32, P.bytes(parsed), P.ZeroPad) as any;
|
|
190
|
+
}
|
|
191
|
+
throw new Error(`mapComponent: unknown component=${c}`);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// Because args and output are not tuple
|
|
195
|
+
// TODO: try merge with mapComponent
|
|
196
|
+
export function mapArgs<T extends ArrLike<Component<string>>>(
|
|
197
|
+
args: T
|
|
198
|
+
): P.CoderType<ArgsType<Writable<T>>> {
|
|
199
|
+
// More ergonomic input/output
|
|
200
|
+
if (args.length === 1) return mapComponent(args[0] as any) as any;
|
|
201
|
+
let hasNames = true;
|
|
202
|
+
for (const arg of args) if (!arg.name) hasNames = false;
|
|
203
|
+
if (hasNames) {
|
|
204
|
+
const out: Record<string, P.CoderType<unknown>> = {};
|
|
205
|
+
for (const arg of args) {
|
|
206
|
+
const name = (arg as any).name;
|
|
207
|
+
if (out[name]) throw new Error(`mapArgs: same field name=${name}`);
|
|
208
|
+
out[name] = mapComponent(arg as any) as any;
|
|
209
|
+
}
|
|
210
|
+
return P.struct(out) as any;
|
|
211
|
+
} else return P.tuple(args.map(mapComponent)) as any;
|
|
212
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/*! micro-eth-signer - MIT License (c) 2021 Paul Miller (paulmillr.com) */
|
|
2
|
+
import { secp256k1 } from '../../../../../@noble/curves/2.0.1/src/secp256k1.js';
|
|
3
|
+
import { keccak_256 } from '../../../../../@noble/hashes/2.0.1/src/sha3.js';
|
|
4
|
+
import { bytesToHex, hexToBytes, utf8ToBytes } from '../../../../../@noble/hashes/2.0.1/src/utils.js';
|
|
5
|
+
import { add0x, astr, ethHex, strip0x } from '../utils.js';
|
|
6
|
+
|
|
7
|
+
export const addr = {
|
|
8
|
+
RE: /^(0[xX])?([0-9a-fA-F]{40})?$/ satisfies RegExp as RegExp,
|
|
9
|
+
parse: (
|
|
10
|
+
address: string,
|
|
11
|
+
allowEmpty = false
|
|
12
|
+
): {
|
|
13
|
+
hasPrefix: boolean;
|
|
14
|
+
data: string;
|
|
15
|
+
} => {
|
|
16
|
+
astr(address);
|
|
17
|
+
// NOTE: empty address allowed for 'to', but would be mistake for other address fields.
|
|
18
|
+
// '0x' instead of null/undefined because we don't want to send contract creation tx if user
|
|
19
|
+
// accidentally missed 'to' field.
|
|
20
|
+
if (allowEmpty && address === '0x') return { hasPrefix: true, data: '' };
|
|
21
|
+
const res = address.match(addr.RE) || [];
|
|
22
|
+
const hasPrefix = res[1] != null;
|
|
23
|
+
const data = res[2];
|
|
24
|
+
if (!data) {
|
|
25
|
+
const len = hasPrefix ? 42 : 40;
|
|
26
|
+
throw new Error(`address must be ${len}-char hex, got ${address.length}-char ${address}`);
|
|
27
|
+
}
|
|
28
|
+
return { hasPrefix, data };
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Address checksum is calculated by hashing with keccak_256.
|
|
33
|
+
* It hashes *string*, not a bytearray: keccak('beef') not keccak([0xbe, 0xef])
|
|
34
|
+
* @param nonChecksummedAddress
|
|
35
|
+
* @param allowEmpty - allows '0x'
|
|
36
|
+
* @returns checksummed address
|
|
37
|
+
*/
|
|
38
|
+
addChecksum: (nonChecksummedAddress: string, allowEmpty = false): string => {
|
|
39
|
+
const low = addr.parse(nonChecksummedAddress, allowEmpty).data.toLowerCase();
|
|
40
|
+
const hash = bytesToHex(keccak_256(utf8ToBytes(low)));
|
|
41
|
+
let checksummed = '';
|
|
42
|
+
for (let i = 0; i < low.length; i++) {
|
|
43
|
+
const hi = Number.parseInt(hash[i], 16);
|
|
44
|
+
const li = low[i];
|
|
45
|
+
checksummed += hi <= 7 ? li : li.toUpperCase(); // if char is 9-f, upcase it
|
|
46
|
+
}
|
|
47
|
+
return add0x(checksummed);
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Creates address from secp256k1 public key.
|
|
52
|
+
*/
|
|
53
|
+
fromPublicKey: (key: string | Uint8Array): string => {
|
|
54
|
+
if (!key) throw new Error('invalid public key: ' + key);
|
|
55
|
+
if (typeof key === 'string') key = hexToBytes(strip0x(key));
|
|
56
|
+
const pub65b = secp256k1.Point.fromBytes(key).toBytes(false);
|
|
57
|
+
const hashed = keccak_256(pub65b.subarray(1, 65));
|
|
58
|
+
const address = bytesToHex(hashed).slice(24); // slice 24..64
|
|
59
|
+
return addr.addChecksum(address);
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Creates address from ETH private key in hex or ui8a format.
|
|
64
|
+
*/
|
|
65
|
+
fromSecretKey: (key: string | Uint8Array): string => {
|
|
66
|
+
if (typeof key === 'string') key = hexToBytes(strip0x(key));
|
|
67
|
+
return addr.fromPublicKey(secp256k1.getPublicKey(key, false));
|
|
68
|
+
},
|
|
69
|
+
fromPrivateKey: (key: string | Uint8Array): string => {
|
|
70
|
+
return addr.fromSecretKey(key);
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Generates hex string with new random private key and address. Uses CSPRNG internally.
|
|
75
|
+
*/
|
|
76
|
+
random(): { privateKey: string; address: string } {
|
|
77
|
+
const privateKey = ethHex.encode(secp256k1.utils.randomSecretKey());
|
|
78
|
+
return { privateKey: privateKey, address: addr.fromSecretKey(privateKey) };
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Verifies checksum if the address is checksummed.
|
|
83
|
+
* Always returns true when the address is not checksummed.
|
|
84
|
+
* @param allowEmpty - allows '0x'
|
|
85
|
+
*/
|
|
86
|
+
isValid: (checksummedAddress: string, allowEmpty = false): boolean => {
|
|
87
|
+
let parsed: { hasPrefix: boolean; data: string };
|
|
88
|
+
try {
|
|
89
|
+
parsed = addr.parse(checksummedAddress, allowEmpty);
|
|
90
|
+
} catch (error) {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
const { data: address, hasPrefix } = parsed;
|
|
94
|
+
if (!hasPrefix) return false;
|
|
95
|
+
const low = address.toLowerCase();
|
|
96
|
+
const upp = address.toUpperCase();
|
|
97
|
+
if (address === low || address === upp) return true;
|
|
98
|
+
return addr.addChecksum(low, allowEmpty) === checksummedAddress;
|
|
99
|
+
},
|
|
100
|
+
};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { numberToVarBytesBE } from '../../../../../@noble/curves/2.0.1/src/utils.js';
|
|
2
|
+
import * as P from '../../../../micro-packed/0.8.0/src/index.js';
|
|
3
|
+
import { isBytes, type Bytes } from '../utils.js';
|
|
4
|
+
|
|
5
|
+
// Spec-compliant RLP in 100 lines of code.
|
|
6
|
+
export type RLPInput = string | number | Bytes | bigint | RLPInput[] | null;
|
|
7
|
+
// length: first 3 bit !== 111 ? 6 bit length : 3bit lenlen
|
|
8
|
+
const RLPLength = P.wrap({
|
|
9
|
+
encodeStream(w: P.Writer, value: number) {
|
|
10
|
+
if (value < 56) return w.bits(value, 6);
|
|
11
|
+
w.bits(0b111, 3);
|
|
12
|
+
const length = P.U32BE.encode(value);
|
|
13
|
+
let pos = 0;
|
|
14
|
+
for (; pos < length.length; pos++) if (length[pos] !== 0) break;
|
|
15
|
+
w.bits(4 - pos - 1, 3);
|
|
16
|
+
w.bytes(length.slice(pos));
|
|
17
|
+
},
|
|
18
|
+
decodeStream(r: P.Reader): number {
|
|
19
|
+
const start = r.bits(3);
|
|
20
|
+
if (start !== 0b111) return (start << 3) | r.bits(3);
|
|
21
|
+
const len = r.bytes(r.bits(3) + 1);
|
|
22
|
+
for (let i = 0; i < len.length; i++) {
|
|
23
|
+
if (len[i]) break;
|
|
24
|
+
throw new Error('Wrong length encoding with leading zeros');
|
|
25
|
+
}
|
|
26
|
+
const res = P.int(len.length).decode(len);
|
|
27
|
+
if (res <= 55) throw new Error('RLPLength: less than 55, but used multi-byte flag');
|
|
28
|
+
return res;
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// Recursive struct definition
|
|
33
|
+
export type InternalRLP =
|
|
34
|
+
| { TAG: 'byte'; data: number }
|
|
35
|
+
| {
|
|
36
|
+
TAG: 'complex';
|
|
37
|
+
data: { TAG: 'string'; data: Uint8Array } | { TAG: 'list'; data: InternalRLP[] };
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const rlpInner = P.tag(P.map(P.bits(1), { byte: 0, complex: 1 }), {
|
|
41
|
+
byte: P.bits(7),
|
|
42
|
+
complex: P.tag(P.map(P.bits(1), { string: 0, list: 1 }), {
|
|
43
|
+
string: P.bytes(RLPLength),
|
|
44
|
+
list: P.prefix(
|
|
45
|
+
RLPLength,
|
|
46
|
+
P.array(
|
|
47
|
+
null,
|
|
48
|
+
P.lazy((): P.CoderType<InternalRLP> => rlpInner)
|
|
49
|
+
)
|
|
50
|
+
),
|
|
51
|
+
}),
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const phex = P.hex(null);
|
|
55
|
+
const pstr = P.string(null);
|
|
56
|
+
const empty = Uint8Array.of();
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* RLP parser.
|
|
60
|
+
* Real type of rlp is `Item = Uint8Array | Item[]`.
|
|
61
|
+
* Strings/number encoded to Uint8Array, but not decoded back: type information is lost.
|
|
62
|
+
*/
|
|
63
|
+
export const RLP: P.CoderType<RLPInput> = P.apply(rlpInner, {
|
|
64
|
+
encode(from: InternalRLP): RLPInput {
|
|
65
|
+
if (from.TAG === 'byte') return new Uint8Array([from.data]);
|
|
66
|
+
if (from.TAG !== 'complex') throw new Error('RLP.encode: unexpected type');
|
|
67
|
+
const complex = from.data;
|
|
68
|
+
if (complex.TAG === 'string') {
|
|
69
|
+
if (complex.data.length === 1 && complex.data[0] < 128)
|
|
70
|
+
throw new Error('RLP.encode: wrong string length encoding, should use single byte mode');
|
|
71
|
+
return complex.data;
|
|
72
|
+
}
|
|
73
|
+
if (complex.TAG === 'list') return complex.data.map((i) => this.encode(i));
|
|
74
|
+
throw new Error('RLP.encode: unknown TAG');
|
|
75
|
+
},
|
|
76
|
+
decode(data: RLPInput): InternalRLP {
|
|
77
|
+
if (data == null) return this.decode(empty);
|
|
78
|
+
switch (typeof data) {
|
|
79
|
+
case 'object':
|
|
80
|
+
if (isBytes(data)) {
|
|
81
|
+
if (data.length === 1) {
|
|
82
|
+
const head = data[0];
|
|
83
|
+
if (head < 128) return { TAG: 'byte', data: head };
|
|
84
|
+
}
|
|
85
|
+
return { TAG: 'complex', data: { TAG: 'string', data: data } };
|
|
86
|
+
}
|
|
87
|
+
if (Array.isArray(data))
|
|
88
|
+
return { TAG: 'complex', data: { TAG: 'list', data: data.map((i) => this.decode(i)) } };
|
|
89
|
+
throw new Error('RLP.encode: unknown type');
|
|
90
|
+
case 'number':
|
|
91
|
+
if (data < 0) throw new Error('RLP.encode: invalid integer as argument, must be unsigned');
|
|
92
|
+
if (data === 0) return this.decode(empty);
|
|
93
|
+
return this.decode(numberToVarBytesBE(data));
|
|
94
|
+
case 'bigint':
|
|
95
|
+
if (data < BigInt(0))
|
|
96
|
+
throw new Error('RLP.encode: invalid integer as argument, must be unsigned');
|
|
97
|
+
return this.decode(numberToVarBytesBE(data));
|
|
98
|
+
case 'string':
|
|
99
|
+
return this.decode(data.startsWith('0x') ? phex.encode(data) : pstr.encode(data));
|
|
100
|
+
default:
|
|
101
|
+
throw new Error('RLP.encode: unknown type');
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
});
|