Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
cmake_minimum_required(VERSION 3.16)

# Must come before project() so it can select vcpkg's "tests" feature (pulls in gtest).
option(HYPERLIQUID_BUILD_TESTS "Build tests" OFF)
if(HYPERLIQUID_BUILD_TESTS)
list(APPEND VCPKG_MANIFEST_FEATURES "tests")
endif()

project(hyperliquid-sdk-cpp VERSION 0.1.0 LANGUAGES C CXX)

set(CMAKE_CXX_STANDARD 23)
Expand Down Expand Up @@ -148,7 +155,6 @@ install(FILES
)

option(HYPERLIQUID_BUILD_EXAMPLES "Build example programs" OFF)
option(HYPERLIQUID_BUILD_TESTS "Build tests" OFF)

if(HYPERLIQUID_BUILD_TESTS)
enable_testing()
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ int main() {

See the [Quickstart guide](https://TuxedoFish.github.io/hyperliquid-sdk-cpp/quickstart/) for the WebSocket equivalent and the async/typed-listener paths, and the [Examples index](https://TuxedoFish.github.io/hyperliquid-sdk-cpp/examples/) for every runnable example in `examples/` (order placement/modification, transfers, staking, vaults, and every websocket channel, over both REST and WebSocket).

Most examples read credentials from `examples/test.json`, a local, gitignored file you create yourself - it's never committed and the repo doesn't ship one. Create it with:
Most examples read credentials from `examples/test.json`, a local, gitignored file you create yourself - it's never committed and the repo doesn't ship one. Copy the template at [`examples/example.json`](examples/example.json) to `examples/test.json` and fill it in, or create it directly:

```json
{
Expand Down
2 changes: 1 addition & 1 deletion docs/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Examples are paired: most `/exchange` or `/info` call in `rest_*.cpp` has a `ws_

## Credentials

Most examples read credentials from `examples/test.json`, a local file you create yourself — it's gitignored and never committed, and the repo doesn't ship one.
Most examples read credentials from `examples/test.json`, a local file you create yourself — it's gitignored and never committed, and the repo doesn't ship one. Copy the template at [`examples/example.json`](https://github.com/TuxedoFish/hyperliquid-sdk-cpp/blob/main/examples/example.json) to `examples/test.json` and fill it in, or create it directly:

```json
{
Expand Down
7 changes: 6 additions & 1 deletion examples/test_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ inline TestConfig loadTestConfig(const std::string& path = EXAMPLES_DIR "test.js
{
std::ifstream file(path);
if (!file.is_open())
throw std::runtime_error("Could not open config file: " + path);
throw std::runtime_error(
"Could not open config file: " + path +
"\nThis file is gitignored and not shipped with the repo - copy examples/example.json "
"to examples/test.json and fill in a testnet wallet's address/private key (and "
"optionally a subaccount address) before running examples. See the README's "
"\"Quickstart\" section, or https://TuxedoFish.github.io/hyperliquid-sdk-cpp/examples/#credentials.");

auto json = nlohmann::json::parse(file);

Expand Down
13 changes: 10 additions & 3 deletions vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@
"nlohmann-json",
"spdlog",
"zlib",
"secp256k1",
"gtest"
]
"secp256k1"
],
"features": {
"tests": {
"description": "Build the test suite (HYPERLIQUID_BUILD_TESTS)",
"dependencies": [
"gtest"
]
}
}
}
Loading