diff --git a/CHANGELOG.md b/CHANGELOG.md index c367c2a..b0b8030 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## [0.2.0] - 2025-12-XX + +### Added +- WebSocket streaming support for real-time market data +- Subscription APIs for orderbook, trades, candles, and user events +- CLI binary for terminal-based queries (`--features=cli`) +- CLI commands for market data and account management +- Network selection via `--network` flag (mainnet/testnet) +- Environment-based authentication for CLI via `HL_PRIVATE_KEY` + +### Changed +- Project status: WebSocket and CLI marked as complete + ## [0.1.0] - 2025-12-10 ### Added diff --git a/Cargo.lock b/Cargo.lock index 7450042..bd5179d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -21,9 +21,9 @@ checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "alloy" -version = "1.1.3" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f07655fedc35188f3c50ff8fc6ee45703ae14ef1bc7ae7d80e23a747012184e3" +checksum = "f609fb6392508278b276906d6247ea44f5777e448db95444fa39e89b7aee896a" dependencies = [ "alloy-consensus", "alloy-contract", @@ -51,19 +51,19 @@ version = "0.2.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35d744058a9daa51a8cf22a3009607498fcf82d3cf4c5444dd8056cdf651f471" dependencies = [ - "alloy-primitives 1.4.1", + "alloy-primitives 1.5.2", "num_enum", "strum", ] [[package]] name = "alloy-consensus" -version = "1.1.3" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e318e25fb719e747a7e8db1654170fc185024f3ed5b10f86c08d448a912f6e2" +checksum = "f3dcd2b4e208ce5477de90ccdcbd4bde2c8fb06af49a443974e92bb8f2c5e93f" dependencies = [ "alloy-eips", - "alloy-primitives 1.4.1", + "alloy-primitives 1.5.2", "alloy-rlp", "alloy-serde", "alloy-trie", @@ -85,13 +85,13 @@ dependencies = [ [[package]] name = "alloy-consensus-any" -version = "1.1.3" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "364380a845193a317bcb7a5398fc86cdb66c47ebe010771dde05f6869bf9e64a" +checksum = "ee5655f234985f5ab1e31bef7e02ed11f0a899468cf3300e061e1b96e9e11de0" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives 1.4.1", + "alloy-primitives 1.5.2", "alloy-rlp", "alloy-serde", "serde", @@ -99,16 +99,16 @@ dependencies = [ [[package]] name = "alloy-contract" -version = "1.1.3" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d39c80ffc806f27a76ed42f3351a455f3dc4f81d6ff92c8aad2cf36b7d3a34" +checksum = "7f01b6d8e5b4f3222aaf7f18613a7292e2fbc9163fe120649cd1b078ca534349" dependencies = [ "alloy-consensus", "alloy-dyn-abi", "alloy-json-abi", "alloy-network", "alloy-network-primitives", - "alloy-primitives 1.4.1", + "alloy-primitives 1.5.2", "alloy-provider", "alloy-pubsub", "alloy-rpc-types-eth", @@ -122,25 +122,25 @@ dependencies = [ [[package]] name = "alloy-core" -version = "1.4.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca96214615ec8cf3fa2a54b32f486eb49100ca7fe7eb0b8c1137cd316e7250a" +checksum = "9d4087016b0896051dd3d03e0bedda2f4d4d1689af8addc8450288c63a9e5f68" dependencies = [ "alloy-dyn-abi", "alloy-json-abi", - "alloy-primitives 1.4.1", + "alloy-primitives 1.5.2", "alloy-rlp", "alloy-sol-types", ] [[package]] name = "alloy-dyn-abi" -version = "1.4.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdff496dd4e98a81f4861e66f7eaf5f2488971848bb42d9c892f871730245c8" +checksum = "369f5707b958927176265e8a58627fc6195e5dfa5c55689396e68b241b3a72e6" dependencies = [ "alloy-json-abi", - "alloy-primitives 1.4.1", + "alloy-primitives 1.5.2", "alloy-sol-type-parser", "alloy-sol-types", "itoa", @@ -155,7 +155,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "741bdd7499908b3aa0b159bba11e71c8cddd009a2c2eb7a06e825f1ec87900a5" dependencies = [ - "alloy-primitives 1.4.1", + "alloy-primitives 1.5.2", "alloy-rlp", "crc", "serde", @@ -168,7 +168,7 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9441120fa82df73e8959ae0e4ab8ade03de2aaae61be313fbf5746277847ce25" dependencies = [ - "alloy-primitives 1.4.1", + "alloy-primitives 1.5.2", "alloy-rlp", "borsh", "serde", @@ -180,7 +180,7 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2919c5a56a1007492da313e7a3b6d45ef5edc5d33416fdec63c0d7a2702a0d20" dependencies = [ - "alloy-primitives 1.4.1", + "alloy-primitives 1.5.2", "alloy-rlp", "borsh", "k256", @@ -190,14 +190,14 @@ dependencies = [ [[package]] name = "alloy-eips" -version = "1.1.3" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c4d7c5839d9f3a467900c625416b24328450c65702eb3d8caff8813e4d1d33" +checksum = "6847d641141b92a1557094aa6c236cbe49c06fb24144d4a21fe6acb970c15888" dependencies = [ "alloy-eip2124", "alloy-eip2930", "alloy-eip7702", - "alloy-primitives 1.4.1", + "alloy-primitives 1.5.2", "alloy-rlp", "alloy-serde", "auto_impl", @@ -213,12 +213,12 @@ dependencies = [ [[package]] name = "alloy-genesis" -version = "1.1.3" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ba4b1be0988c11f0095a2380aa596e35533276b8fa6c9e06961bbfe0aebcac5" +checksum = "fe3192fca2eb0b0c4b122b3c2d8254496b88a4e810558dddd3ea2f30ad9469df" dependencies = [ "alloy-eips", - "alloy-primitives 1.4.1", + "alloy-primitives 1.5.2", "alloy-serde", "alloy-trie", "borsh", @@ -228,11 +228,11 @@ dependencies = [ [[package]] name = "alloy-json-abi" -version = "1.4.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5513d5e6bd1cba6bdcf5373470f559f320c05c8c59493b6e98912fbe6733943f" +checksum = "84e3cf01219c966f95a460c95f1d4c30e12f6c18150c21a30b768af2a2a29142" dependencies = [ - "alloy-primitives 1.4.1", + "alloy-primitives 1.5.2", "alloy-sol-type-parser", "serde", "serde_json", @@ -240,11 +240,11 @@ dependencies = [ [[package]] name = "alloy-json-rpc" -version = "1.1.3" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f72cf87cda808e593381fb9f005ffa4d2475552b7a6c5ac33d087bf77d82abd0" +checksum = "d4ab3330e491053e9608b2a315f147357bb8acb9377a988c1203f2e8e2b296c9" dependencies = [ - "alloy-primitives 1.4.1", + "alloy-primitives 1.5.2", "alloy-sol-types", "http", "serde", @@ -255,16 +255,16 @@ dependencies = [ [[package]] name = "alloy-network" -version = "1.1.3" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12aeb37b6f2e61b93b1c3d34d01ee720207c76fe447e2a2c217e433ac75b17f5" +checksum = "c1e22ff194b1e34b4defd1e257e3fe4dce0eee37451c7757a1510d6b23e7379a" dependencies = [ "alloy-consensus", "alloy-consensus-any", "alloy-eips", "alloy-json-rpc", "alloy-network-primitives", - "alloy-primitives 1.4.1", + "alloy-primitives 1.5.2", "alloy-rpc-types-any", "alloy-rpc-types-eth", "alloy-serde", @@ -281,13 +281,13 @@ dependencies = [ [[package]] name = "alloy-network-primitives" -version = "1.1.3" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abd29ace62872083e30929cd9b282d82723196d196db589f3ceda67edcc05552" +checksum = "b8a6cbb9f431bdad294eebb5af9b293d6979e633bfe5468d1e87c1421a858265" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives 1.4.1", + "alloy-primitives 1.5.2", "alloy-serde", "serde", ] @@ -321,9 +321,9 @@ dependencies = [ [[package]] name = "alloy-primitives" -version = "1.4.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "355bf68a433e0fd7f7d33d5a9fc2583fde70bf5c530f63b80845f8da5505cf28" +checksum = "f6a0fb18dd5fb43ec5f0f6a20be1ce0287c79825827de5744afaa6c957737c33" dependencies = [ "alloy-rlp", "bytes", @@ -339,6 +339,7 @@ dependencies = [ "paste", "proptest", "rand 0.9.2", + "rapidhash", "ruint", "rustc-hash", "serde", @@ -348,9 +349,9 @@ dependencies = [ [[package]] name = "alloy-provider" -version = "1.1.3" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b710636d7126e08003b8217e24c09f0cca0b46d62f650a841736891b1ed1fc1" +checksum = "3f5dde1abc3d582e53d139904fcdd8b2103f0bd03e8f2acb4292edbbaeaa7e6e" dependencies = [ "alloy-chains", "alloy-consensus", @@ -358,7 +359,7 @@ dependencies = [ "alloy-json-rpc", "alloy-network", "alloy-network-primitives", - "alloy-primitives 1.4.1", + "alloy-primitives 1.5.2", "alloy-pubsub", "alloy-rpc-client", "alloy-rpc-types-anvil", @@ -394,12 +395,12 @@ dependencies = [ [[package]] name = "alloy-pubsub" -version = "1.1.3" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdd4c64eb250a18101d22ae622357c6b505e158e9165d4c7974d59082a600c5e" +checksum = "acbfe0a3c553a027f722185fb574124d205147fffb309cae52d0a2094f076887" dependencies = [ "alloy-json-rpc", - "alloy-primitives 1.4.1", + "alloy-primitives 1.5.2", "alloy-transport", "auto_impl", "bimap", @@ -438,12 +439,12 @@ dependencies = [ [[package]] name = "alloy-rpc-client" -version = "1.1.3" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0882e72d2c1c0c79dcf4ab60a67472d3f009a949f774d4c17d0bdb669cfde05" +checksum = "5a94bdef2710322c6770be08689fee0878c2ad75615b8fc40e05d7f3c9618c0b" dependencies = [ "alloy-json-rpc", - "alloy-primitives 1.4.1", + "alloy-primitives 1.5.2", "alloy-pubsub", "alloy-transport", "alloy-transport-http", @@ -464,11 +465,11 @@ dependencies = [ [[package]] name = "alloy-rpc-types" -version = "1.1.3" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39cf1398cb33aacb139a960fa3d8cf8b1202079f320e77e952a0b95967bf7a9f" +checksum = "811a573c8080e1b492d488e6a240ec5dd7677d7167e91ce9cb4d0ec1fcac8027" dependencies = [ - "alloy-primitives 1.4.1", + "alloy-primitives 1.5.2", "alloy-rpc-types-anvil", "alloy-rpc-types-debug", "alloy-rpc-types-engine", @@ -481,11 +482,11 @@ dependencies = [ [[package]] name = "alloy-rpc-types-anvil" -version = "1.1.3" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3ce4c24e416bd0f17fceeb2f26cd8668df08fe19e1dc02f9d41c3b8ed1e93e0" +checksum = "838ca94be532a929f27961851000ec8bbbaeb06e2a2bcca44fac7855a2fe0f6f" dependencies = [ - "alloy-primitives 1.4.1", + "alloy-primitives 1.5.2", "alloy-rpc-types-eth", "alloy-serde", "serde", @@ -493,9 +494,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-any" -version = "1.1.3" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a63fb40ed24e4c92505f488f9dd256e2afaed17faa1b7a221086ebba74f4122" +checksum = "12df0b34551ca2eab8ec83b56cb709ee5da991737282180d354a659b907f00dc" dependencies = [ "alloy-consensus-any", "alloy-rpc-types-eth", @@ -504,11 +505,11 @@ dependencies = [ [[package]] name = "alloy-rpc-types-debug" -version = "1.1.3" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4936f579d9d10eae01772b2ab3497f9d568684f05f26f8175e12f9a1a2babc33" +checksum = "6c49a3a168a5bf18f1cf7ed5723a650aebe714edf7665b53dacf5707716733d0" dependencies = [ - "alloy-primitives 1.4.1", + "alloy-primitives 1.5.2", "derive_more", "serde", "serde_with", @@ -516,13 +517,13 @@ dependencies = [ [[package]] name = "alloy-rpc-types-engine" -version = "1.1.3" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c60bdce3be295924122732b7ecd0b2495ce4790bedc5370ca7019c08ad3f26e" +checksum = "ffe16cd1dea6089902ec609e04261a9ae6d11ec66005ba24c1f97f0eefbc0fa9" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives 1.4.1", + "alloy-primitives 1.5.2", "alloy-rlp", "alloy-serde", "derive_more", @@ -533,15 +534,15 @@ dependencies = [ [[package]] name = "alloy-rpc-types-eth" -version = "1.1.3" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9eae0c7c40da20684548cbc8577b6b7447f7bf4ddbac363df95e3da220e41e72" +checksum = "b7f9f130511b8632686dfe6f9909b38d7ae4c68de3ce17d28991400646a39b25" dependencies = [ "alloy-consensus", "alloy-consensus-any", "alloy-eips", "alloy-network-primitives", - "alloy-primitives 1.4.1", + "alloy-primitives 1.5.2", "alloy-rlp", "alloy-serde", "alloy-sol-types", @@ -554,11 +555,11 @@ dependencies = [ [[package]] name = "alloy-rpc-types-trace" -version = "1.1.3" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef206a4b8d436fbb7cf2e6a61c692d11df78f9382becc3c9a283bd58e64f0583" +checksum = "cafe859944638c5d57d1a3a0034cdb5d07c98c37de8adce5508f28834acf958f" dependencies = [ - "alloy-primitives 1.4.1", + "alloy-primitives 1.5.2", "alloy-rpc-types-eth", "alloy-serde", "serde", @@ -568,11 +569,11 @@ dependencies = [ [[package]] name = "alloy-rpc-types-txpool" -version = "1.1.3" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecb5a795264a02222f9534435b8f40dcbd88de8e9d586647884aae24f389ebf2" +checksum = "afaa06544e36f223b99b1415a12911230fd527994f020736c3c7950d5080208e" dependencies = [ - "alloy-primitives 1.4.1", + "alloy-primitives 1.5.2", "alloy-rpc-types-eth", "alloy-serde", "serde", @@ -580,22 +581,22 @@ dependencies = [ [[package]] name = "alloy-serde" -version = "1.1.3" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0df1987ed0ff2d0159d76b52e7ddfc4e4fbddacc54d2fbee765e0d14d7c01b5" +checksum = "067b718d2e6ac1bb889341fcc7a250cfa49bcd3ba4f23923f1c1eb1f2b10cb7c" dependencies = [ - "alloy-primitives 1.4.1", + "alloy-primitives 1.5.2", "serde", "serde_json", ] [[package]] name = "alloy-signer" -version = "1.1.3" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ff69deedee7232d7ce5330259025b868c5e6a52fa8dffda2c861fb3a5889b24" +checksum = "acff6b251740ef473932386d3b71657d3825daebf2217fb41a7ef676229225d4" dependencies = [ - "alloy-primitives 1.4.1", + "alloy-primitives 1.5.2", "async-trait", "auto_impl", "either", @@ -606,13 +607,13 @@ dependencies = [ [[package]] name = "alloy-signer-local" -version = "1.1.3" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72cfe0be3ec5a8c1a46b2e5a7047ed41121d360d97f4405bb7c1c784880c86cb" +checksum = "c9129ef31975d987114c27c9930ee817cf3952355834d47f2fdf4596404507e8" dependencies = [ "alloy-consensus", "alloy-network", - "alloy-primitives 1.4.1", + "alloy-primitives 1.5.2", "alloy-signer", "async-trait", "k256", @@ -622,9 +623,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro" -version = "1.4.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3ce480400051b5217f19d6e9a82d9010cdde20f1ae9c00d53591e4a1afbb312" +checksum = "09eb18ce0df92b4277291bbaa0ed70545d78b02948df756bbd3d6214bf39a218" dependencies = [ "alloy-sol-macro-expander", "alloy-sol-macro-input", @@ -636,9 +637,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro-expander" -version = "1.4.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d792e205ed3b72f795a8044c52877d2e6b6e9b1d13f431478121d8d4eaa9028" +checksum = "95d9fa2daf21f59aa546d549943f10b5cce1ae59986774019fbedae834ffe01b" dependencies = [ "alloy-json-abi", "alloy-sol-macro-input", @@ -655,9 +656,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro-input" -version = "1.4.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bd1247a8f90b465ef3f1207627547ec16940c35597875cdc09c49d58b19693c" +checksum = "9396007fe69c26ee118a19f4dee1f5d1d6be186ea75b3881adf16d87f8444686" dependencies = [ "alloy-json-abi", "const-hex", @@ -673,9 +674,9 @@ dependencies = [ [[package]] name = "alloy-sol-type-parser" -version = "1.4.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "954d1b2533b9b2c7959652df3076954ecb1122a28cc740aa84e7b0a49f6ac0a9" +checksum = "af67a0b0dcebe14244fc92002cd8d96ecbf65db4639d479f5fcd5805755a4c27" dependencies = [ "serde", "winnow", @@ -683,21 +684,21 @@ dependencies = [ [[package]] name = "alloy-sol-types" -version = "1.4.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70319350969a3af119da6fb3e9bddb1bce66c9ea933600cb297c8b1850ad2a3c" +checksum = "09aeea64f09a7483bdcd4193634c7e5cf9fd7775ee767585270cd8ce2d69dc95" dependencies = [ "alloy-json-abi", - "alloy-primitives 1.4.1", + "alloy-primitives 1.5.2", "alloy-sol-macro", "serde", ] [[package]] name = "alloy-transport" -version = "1.1.3" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be98b07210d24acf5b793c99b759e9a696e4a2e67593aec0487ae3b3e1a2478c" +checksum = "bec1fb08ee484e615f24867c0b154fff5722bb00176102a16868c6532b7c3623" dependencies = [ "alloy-json-rpc", "auto_impl", @@ -718,9 +719,9 @@ dependencies = [ [[package]] name = "alloy-transport-http" -version = "1.1.3" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4198a1ee82e562cab85e7f3d5921aab725d9bd154b6ad5017f82df1695877c97" +checksum = "64b722073c76f2de7e118d546ee1921c50710f97feb32aed50db94cfa5b663e1" dependencies = [ "alloy-json-rpc", "alloy-transport", @@ -733,9 +734,9 @@ dependencies = [ [[package]] name = "alloy-transport-ipc" -version = "1.1.3" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8db249779ebc20dc265920c7e706ed0d31dbde8627818d1cbde60919b875bb0" +checksum = "bdedcf401aab4b96d8b5e6638b79d04a6afb96c0bfcb50a2324fbadfe65c47b3" dependencies = [ "alloy-json-rpc", "alloy-pubsub", @@ -753,15 +754,14 @@ dependencies = [ [[package]] name = "alloy-transport-ws" -version = "1.1.3" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ad2344a12398d7105e3722c9b7a7044ea837128e11d453604dec6e3731a86e2" +checksum = "942210908f0c56941097f5653a5f334546940e6fd9073495b257e52216469feb" dependencies = [ "alloy-pubsub", "alloy-transport", "futures", "http", - "rustls", "serde_json", "tokio", "tokio-tungstenite 0.26.2", @@ -771,11 +771,11 @@ dependencies = [ [[package]] name = "alloy-trie" -version = "0.9.1" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3412d52bb97c6c6cc27ccc28d4e6e8cf605469101193b50b0bd5813b1f990b5" +checksum = "2b77b56af09ead281337d06b1d036c88e2dc8a2e45da512a532476dbee94912b" dependencies = [ - "alloy-primitives 1.4.1", + "alloy-primitives 1.5.2", "alloy-rlp", "arrayvec", "derive_more", @@ -787,9 +787,9 @@ dependencies = [ [[package]] name = "alloy-tx-macros" -version = "1.1.3" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "333544408503f42d7d3792bfc0f7218b643d968a03d2c0ed383ae558fb4a76d0" +checksum = "04950a13cc4209d8e9b78f306e87782466bad8538c94324702d061ff03e211c9" dependencies = [ "darling", "proc-macro2", @@ -806,6 +806,56 @@ dependencies = [ "libc", ] +[[package]] +name = "anstream" +version = "0.6.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" + +[[package]] +name = "anstyle-parse" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.61.2", +] + [[package]] name = "anyhow" version = "1.0.100" @@ -1196,9 +1246,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.19.0" +version = "3.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" +checksum = "5dd9dc738b7a8311c7ade152424974d8115f2cdad61e8dab8dac9f2362298510" [[package]] name = "byte-slice-cast" @@ -1260,9 +1310,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.49" +version = "1.2.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90583009037521a116abf44494efecd645ba48b6622457080f080b85544e2215" +checksum = "9f50d563227a1c37cc0a263f64eca3334388c01c5e4c4861a9def205c614383c" dependencies = [ "find-msvc-tools", "shlex", @@ -1292,6 +1342,52 @@ dependencies = [ "windows-link", ] +[[package]] +name = "clap" +version = "4.5.53" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9e340e012a1bf4935f5282ed1436d1489548e8f72308207ea5df0e23d2d03f8" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.53" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d76b5d13eaa18c901fd2f7fca939fefe3a0727a953561fefdf3b2922b8569d00" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.5.49" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a0b5487afeab2deb2ff4e03a807ad1a03ac532ff5a2cee5d86884440c7f7671" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.111", +] + +[[package]] +name = "clap_lex" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d" + +[[package]] +name = "colorchoice" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" + [[package]] name = "const-hex" version = "1.17.0" @@ -1502,18 +1598,18 @@ dependencies = [ [[package]] name = "derive_more" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10b768e943bed7bf2cab53df09f4bc34bfd217cdb57d971e769874c9a6710618" +checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" dependencies = [ "derive_more-impl", ] [[package]] name = "derive_more-impl" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d286bfdaf75e988b4a78e013ecd79c581e06399ab53fbacd2d916c2f904f30b" +checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" dependencies = [ "convert_case", "proc-macro2", @@ -2347,6 +2443,12 @@ dependencies = [ "serde", ] +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + [[package]] name = "itertools" version = "0.10.5" @@ -2376,9 +2478,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.15" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +checksum = "7ee5b5339afb4c41626dde77b7a611bd4f2c202b897852b4bcf5d03eddc61010" [[package]] name = "js-sys" @@ -2629,6 +2731,12 @@ version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + [[package]] name = "openssl" version = "0.10.75" @@ -3071,6 +3179,15 @@ dependencies = [ "rand_core 0.9.3", ] +[[package]] +name = "rapidhash" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2988730ee014541157f48ce4dcc603940e00915edc3c7f9a8d78092256bb2493" +dependencies = [ + "rustversion", +] + [[package]] name = "recvmsg" version = "1.0.0" @@ -3177,12 +3294,13 @@ dependencies = [ [[package]] name = "rhyperliquid" -version = "0.1.0" +version = "0.2.0" dependencies = [ "alloy", "alloy-primitives 0.8.26", "anyhow", "async-trait", + "clap", "futures", "futures-util", "once_cell", @@ -3357,9 +3475,9 @@ dependencies = [ [[package]] name = "rustix" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e" +checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34" dependencies = [ "bitflags", "errno", @@ -3384,9 +3502,9 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.13.1" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "708c0f9d5f54ba0272468c1d306a52c495b31fa155e91bc25371e6df7996908c" +checksum = "21e6f2ab2928ca4291b86736a8bd920a277a399bba1589409d72154ff87c1282" dependencies = [ "web-time", "zeroize", @@ -3423,9 +3541,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.20" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" +checksum = "62049b2877bf12821e8f9ad256ee38fdc31db7387ec2d3b3f403024de2034aea" [[package]] name = "schannel" @@ -3593,9 +3711,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.145" +version = "1.0.146" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c" +checksum = "217ca874ae0207aac254aa02c957ded05585a90892cc8d87f9e5fa49669dadd8" dependencies = [ "indexmap 2.12.1", "itoa", @@ -3844,9 +3962,9 @@ dependencies = [ [[package]] name = "syn-solidity" -version = "1.4.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff790eb176cc81bb8936aed0f7b9f14fc4670069a2d371b3e3b0ecce908b2cb3" +checksum = "5f92d01b5de07eaf324f7fca61cc6bd3d82bbc1de5b6c963e6fe79e86f36580d" dependencies = [ "paste", "proc-macro2", @@ -4155,18 +4273,18 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.7.3" +version = "0.7.5+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2cdb639ebbc97961c51720f858597f7f24c4fc295327923af55b74c3c724533" +checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347" dependencies = [ "serde_core", ] [[package]] name = "toml_edit" -version = "0.23.9" +version = "0.23.10+spec-1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d7cbc3b4b49633d57a0509303158ca50de80ae32c265093b24c414705807832" +checksum = "84c8b9f757e028cee9fa244aea147aab2a9ec09d5325a9b01e0a49730c2b5269" dependencies = [ "indexmap 2.12.1", "toml_datetime", @@ -4176,9 +4294,9 @@ dependencies = [ [[package]] name = "toml_parser" -version = "1.0.4" +version = "1.0.6+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0cbe268d35bdb4bb5a56a2de88d0ad0eb70af5384a99d648cd4b3d04039800e" +checksum = "a3198b4b0a8e11f09dd03e133c0280504d0801269e9afa46362ffde1cbeebf44" dependencies = [ "winnow", ] @@ -4230,9 +4348,9 @@ checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" -version = "0.1.43" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d15d90a0b5c19378952d479dc858407149d7bb45a14de0142f6c534b16fc647" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" dependencies = [ "pin-project-lite", "tracing-attributes", @@ -4252,9 +4370,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.35" +version = "0.1.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a04e24fab5c89c6a36eb8558c9656f30d81de51dfa4d3b45f26b21d61fa0a6c" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" dependencies = [ "once_cell", "valuable", @@ -4406,6 +4524,12 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + [[package]] name = "uuid" version = "1.19.0" diff --git a/Cargo.toml b/Cargo.toml index 5a23f37..e0ce08e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rhyperliquid" -version = "0.1.0" +version = "0.2.0" edition = "2021" authors = ["Elijah Hampton "] description = "Rust SDK and client for the Hyperliquid exchange API" @@ -12,6 +12,10 @@ categories = ["cryptography", "api-bindings"] license = "MIT" rust-version = "1.75" +[features] +default = [] +cli = [] + [badges] maintenance = { status = "actively-developed" } @@ -24,6 +28,7 @@ alloy = { version = "1", features = ["full"] } alloy-primitives = { version = "0.8.0", features = ["serde"] } anyhow = "1.0" async-trait = "0.1" +clap = { version = "4.5.53", features = ["derive"] } futures = "0.3.31" futures-util = { version = "0.3.31", features = ["sink"] } once_cell = "1.19" diff --git a/README.md b/README.md index 7a957cc..8d7f95d 100644 --- a/README.md +++ b/README.md @@ -14,17 +14,19 @@ A Rust SDK for [Hyperliquid](https://hyperliquid.xyz), the high-performance perp - Order placement and cancellation - Position management - Vault operations +- Command-line interface for quick queries ## Project Status - [x] Complete REST Info API (market data) - [x] EIP-712 authentication & message signing - [x] Exchange API (order placement, cancellation) -- [X] WebSocket streaming (real-time data feeds) -- [ ] CLI +- [x] WebSocket streaming (real-time data feeds) +- [x] CLI for market data and account queries ## Quick Start +### Library Usage ```rust use rhyperliquid::HyperliquidClient; @@ -46,6 +48,69 @@ async fn main() -> Result<(), Box> { } ``` +### CLI Usage + +The CLI provides quick access to market data and account information from your terminal. +```bash +# Run CLI commands +cargo run --bin cli --features=cli -- [OPTIONS] + +# Examples: + +# Get all mid prices +cargo run --bin cli --features=cli -- all-mids + +# Get all mid prices on testnet +cargo run --bin cli --features=cli -- --network testnet all-mids + +# Get L2 orderbook for BTC +cargo run --bin cli --features=cli -- l2-book --coin BTC + +# Get user's open orders (requires HL_PRIVATE_KEY env var) +export HL_PRIVATE_KEY=your_private_key_here +cargo run --bin cli --features=cli -- --allow-signer-key-env open-orders --user 0x... + +# Get candle data +cargo run --bin cli --features=cli -- candle-snapshot \ + --coin ETH \ + --interval 1h \ + --start-time 1640000000000 \ + --end-time 1640100000000 + +# Get vault details +cargo run --bin cli --features=cli -- vault-details --vault-address 0x... +``` + +#### CLI Options + +**Global Flags:** +- `--network ` - Network to connect to (default: mainnet) +- `--allow-signer-key-env` - Allow reading private key from `HL_PRIVATE_KEY` environment variable + +**Available Commands:** +- `all-mids` - Get mid prices for all assets +- `open-orders` - Get user's open orders +- `frontend-open-orders` - Get frontend-formatted open orders +- `user-fills` - Get user's fill history +- `user-fills-by-time` - Get fills within time range +- `user-rate-limit` - Check user's rate limit status +- `order-status` - Get status of specific order +- `l2-book` - Get L2 orderbook snapshot +- `candle-snapshot` - Get historical candle data +- `historical-orders` - Get user's historical orders +- `sub-accounts` - Get user's sub-accounts +- `vault-details` - Get vault information +- `user-vault-equities` - Get user's vault equity +- `user-role` - Get user's role information +- `portfolio` - Get user's portfolio +- `referral` - Get user's referral information +- `user-fees` - Get user's fee information + +Use `--help` on any command for detailed parameter information: +```bash +cargo run --bin cli --features=cli -- l2-book --help +``` + ## Trading For order placement and cancellation examples, see [`examples/basic_order.rs`](examples/basic_order.rs). @@ -72,17 +137,28 @@ This crate is under active development. ### As a Library Dependency Add to your `Cargo.toml`: - ```toml [dependencies] rhyperliquid = "0.1" tokio = { version = "1.41", features = ["full"] } ``` +### CLI Installation +```bash +# Install from source with CLI support +cargo install --path . --features=cli --bin cli + +# Or clone and build +git clone https://github.com/elijahhampton/rhyperliquid.git +cd rhyperliquid +cargo build --release --features=cli --bin cli + +# Binary will be at target/release/cli +``` + ### From Source Clone and build the repository: - ```bash # Clone the repository git clone https://github.com/elijahhampton/rhyperliquid.git @@ -91,12 +167,14 @@ cd rhyperliquid # Build the library cargo build --release +# Build with CLI +cargo build --release --features=cli + # Run tests cargo test --all-features # Build documentation cargo doc --open - ``` ## Getting Help @@ -104,17 +182,16 @@ If you have any questions, first see if the answer to your question can be found If the answer is not there: -Open a discussion with your question, or -Open an issue with the bug - +- Open a discussion with your question, or +- Open an issue with the bug ### Minimum Supported Rust Version (MSRV) Rust **1.75.0** or higher is required. - ```bash # Verify your Rust version rustc --version +# Update if needed rustup update stable ``` diff --git a/src/api/info.rs b/src/api/info.rs index 8a5cf38..2620276 100644 --- a/src/api/info.rs +++ b/src/api/info.rs @@ -264,8 +264,8 @@ impl<'client> InfoApi<'client> { pub async fn l2_book_snapshot( &self, coin: &str, - n_sig_figs: Option, - mantissa: Option, + n_sig_figs: Option, + mantissa: Option, ) -> Result { let mut payload = json!({ "type": "l2Book", diff --git a/src/bin/cli.rs b/src/bin/cli.rs new file mode 100644 index 0000000..e4571d3 --- /dev/null +++ b/src/bin/cli.rs @@ -0,0 +1,171 @@ +#![allow(unused_imports, clippy::too_many_lines)] +use alloy::signers::local::LocalSigner; +use clap::{Parser, Subcommand}; +use rhyperliquid::{ + cli::{Cli, Commands}, + init_tracing::init_tracing, + types::info::user::CandleSnapshotRequest, + HyperliquidClientBuilder, +}; +use std::env; + +#[tokio::main] +async fn main() -> Result<(), Box> { + #[cfg(feature = "cli")] + init_tracing(); + + #[cfg(feature = "cli")] + let cli = Cli::parse(); + + #[allow(clippy::expect_used)] + #[cfg(feature = "cli")] + let signer = env::var("HL_PRIVATE_KEY").expect("HL_PRIVATE_KEY env var is missing"); + + #[cfg(feature = "cli")] + let mut hyperliquid = &mut HyperliquidClientBuilder::new(); + + // Check if the user provided a network, default to testnet + #[cfg(feature = "cli")] + if let Some(network) = cli.network { + match network.to_lowercase().as_str() { + "testnet" => { + hyperliquid = hyperliquid.testnet(); + } + "mainnet" => { + hyperliquid = hyperliquid.mainnet(); + } + _ => hyperliquid = hyperliquid.testnet(), + } + } else { + hyperliquid = hyperliquid.testnet(); + } + + // Check if user provides permission to check env var for signer key + #[cfg(feature = "cli")] + if let Some(signer_permission) = cli.allow_signer_key_env { + if signer_permission { + hyperliquid = hyperliquid.with_wallet(LocalSigner::from_slice(signer.as_bytes())?); + } + } + + #[cfg(feature = "cli")] + let client = hyperliquid.build()?; + #[cfg(feature = "cli")] + let info_api = &client.info(); + + #[cfg(feature = "cli")] + match cli.command { + Commands::AllMids { dex } => { + let all_mids = info_api.all_mids(dex).await?; + tracing::info!("{:?}", all_mids); + } + Commands::OpenOrders { user, dex } => { + let open_orders = info_api.open_orders(&user, dex.as_deref()).await?; + tracing::info!("{:?}", open_orders); + } + Commands::FrontendOpenOrders { user, dex } => { + let frontend_open_orders = info_api + .open_orders_with_additional_info(&user, dex.as_deref()) + .await?; + tracing::info!("{:?}", frontend_open_orders); + } + Commands::UserFills { + user, + aggregate_by_time, + } => { + let user_fills = info_api.fills(&user, aggregate_by_time).await?; + tracing::info!({"{:?}", user_fills}); + } + Commands::UserFillsByTime { + user, + start_time, + end_time, + aggregate_by_time, + } => { + let fills_by_time = info_api + .fills_by_time(&user, start_time, end_time, aggregate_by_time) + .await?; + tracing::info!("{:?}", fills_by_time); + } + Commands::UserRateLimit { user } => { + let user_rate_limit = info_api.rate_limits(&user).await?; + tracing::info!("{:?}", user_rate_limit); + } + Commands::OrderStatus { user, oid } => { + let order_status = info_api + .order_status(&user, rhyperliquid::types::info::OrderId::Numeric(oid)) + .await?; + tracing::info!("{:?}", order_status); + } + Commands::L2Book { + coin, + n_sig_figs, + mantissa, + } => { + let l2_book = info_api + .l2_book_snapshot(&coin, n_sig_figs, mantissa) + .await?; + tracing::info!("{:?}", l2_book); + } + Commands::CandleSnapshot { + coin, + interval, + start_time, + end_time, + } => { + let snapshot = info_api + .candle_snapshot(CandleSnapshotRequest { + coin, + interval, + start_time, + end_time, + }) + .await?; + + tracing::info!("{:?}", snapshot); + } + Commands::HistoricalOrders { user } => { + let historical_orders = info_api.historical_orders(&user).await?; + tracing::info!("{:?}", historical_orders); + } + Commands::SubAccounts { user } => { + let sub_accounts = info_api.subaccounts(&user).await?; + if let Some(accounts) = sub_accounts { + tracing::info!("{:?}", accounts); + } else { + tracing::info!("User {:?} does not have subaccounts.", user); + } + } + Commands::VaultDetails { + vault_address, + user, + } => { + let vault_details = info_api + .vault_details(&vault_address, user.as_deref()) + .await?; + tracing::info!("{:?}", vault_details); + } + Commands::UserVaultEquities { user } => { + let equities = info_api.vault_deposits(&user).await?; + tracing::info!("{:?}", equities); + } + Commands::UserRole { user } => { + let role = info_api.role(&user).await?; + tracing::info!("{:?}", role); + } + Commands::Portfolio { user } => { + let portfolio = info_api.portfolio(&user).await?; + tracing::info!("{:?}", portfolio); + } + Commands::Referral { user } => { + let referral = info_api.portfolio(&user).await?; + tracing::info!("{:?}", referral); + } + Commands::UserFees { user } => { + let user_fees = info_api.fees(&user).await?; + tracing::info!("{:?}", user_fees); + } + } + + Ok(()) +} diff --git a/src/cli/mod.rs b/src/cli/mod.rs new file mode 100644 index 0000000..d461700 --- /dev/null +++ b/src/cli/mod.rs @@ -0,0 +1,111 @@ +use clap::{Parser, Subcommand}; + +#[derive(Subcommand)] +pub enum Commands { + AllMids { + #[arg(short, long)] + dex: Option, + }, + OpenOrders { + #[arg(short, long)] + user: String, + #[arg(short, long)] + dex: Option, + }, + FrontendOpenOrders { + #[arg(short, long)] + user: String, + #[arg(short, long)] + dex: Option, + }, + UserFills { + #[arg(short, long)] + user: String, + #[arg(short, long)] + aggregate_by_time: Option, + }, + UserFillsByTime { + #[arg(short, long)] + user: String, + #[arg(short, long)] + start_time: u64, + #[arg(short, long)] + end_time: Option, + #[arg(short, long)] + aggregate_by_time: Option, + }, + UserRateLimit { + #[arg(short, long)] + user: String, + }, + OrderStatus { + #[arg(short, long)] + user: String, + #[arg(short, long)] + oid: u64, // Can be u64 or hex string + }, + L2Book { + #[arg(short, long)] + coin: String, + #[arg(short, long)] + n_sig_figs: Option, + #[arg(short, long)] + mantissa: Option, + }, + CandleSnapshot { + #[arg(short, long)] + coin: String, + #[arg(short, long)] + interval: String, + #[arg(short, long)] + start_time: u64, + #[arg(short, long)] + end_time: u64, + }, + HistoricalOrders { + #[arg(short, long)] + user: String, + }, + SubAccounts { + #[arg(short, long)] + user: String, + }, + VaultDetails { + #[arg(short, long)] + vault_address: String, + #[arg(short, long)] + user: Option, + }, + UserVaultEquities { + #[arg(short, long)] + user: String, + }, + UserRole { + #[arg(short, long)] + user: String, + }, + Portfolio { + #[arg(short, long)] + user: String, + }, + Referral { + #[arg(short, long)] + user: String, + }, + UserFees { + #[arg(short, long)] + user: String, + }, +} + +#[derive(Parser)] +pub struct Cli { + #[arg(short, long)] + pub network: Option, + + #[arg(short, long)] + pub allow_signer_key_env: Option, + + #[command(subcommand)] + pub command: Commands, +} diff --git a/src/lib.rs b/src/lib.rs index c1d0d3f..dedb25a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -7,13 +7,18 @@ mod signature; pub use crate::api::{response, SubscriptionClient, SubscriptionConfig}; pub use crate::client::{HyperliquidClient, HyperliquidClientBuilder}; pub use crate::error::{HyperliquidError, Result}; + /// Utilities for examples and testing. /// /// Note: This module is primarily intended for examples and /// may change between versions. #[allow(dead_code)] pub mod example_helpers; + /// Tracing initialization utilities. pub mod init_tracing; pub mod types; pub mod utils; + +#[cfg(feature = "cli")] +pub mod cli;