Skip to content

Commit 4f8631d

Browse files
feat(lazer/sdk/rust): add rust client for Lazer (#2310)
* feat: add rust consumer sdk for lazer Co-Authored-By: Tejas Badadare <tejas@dourolabs.xyz> * feat: rename crate to pyth-lazer-sdk and client to LazerClient Co-Authored-By: Tejas Badadare <tejas@dourolabs.xyz> * fix: update base64 encoding to use Engine::encode Co-Authored-By: Tejas Badadare <tejas@dourolabs.xyz> * fix: add base64 Engine trait import Co-Authored-By: Tejas Badadare <tejas@dourolabs.xyz> * feat: add example for pyth-lazer-sdk Co-Authored-By: Tejas Badadare <tejas@dourolabs.xyz> * fix: fix example * refactor: separate client new() and start() functions, improve unsubscribe example Co-Authored-By: Tejas Badadare <tejas@dourolabs.xyz> * refactor: use Bearer token authentication in header and improve unsubscribe handling Co-Authored-By: Tejas Badadare <tejas@dourolabs.xyz> * refactor: make access token required parameter Co-Authored-By: Tejas Badadare <tejas@dourolabs.xyz> * fix: remove invalid client return from start function Co-Authored-By: Tejas Badadare <tejas@dourolabs.xyz> * style: improve code formatting and fix example documentation Co-Authored-By: Tejas Badadare <tejas@dourolabs.xyz> * fix: formatting, example * refactor: rename, remove doctest * fix: example * feat: add close() * refactor: move binary msg parsing to protocol crate, improve examples, source token from env for easier testing * feat: bump protocol ver * fix: don't ser/de the binary message, leave that to the client. only b64 encode. add parse and verify to the example. * fix: explicitly choose JsonBinaryEncoding::Base64 instead of default() --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Tejas Badadare <tejas@dourolabs.xyz> Co-authored-by: Tejas Badadare <tejasbadadare@gmail.com>
1 parent dd39029 commit 4f8631d

File tree

7 files changed

+496
-4
lines changed

7 files changed

+496
-4
lines changed

lazer/Cargo.lock

Lines changed: 120 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lazer/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
resolver = "2"
33
members = [
44
"sdk/rust/protocol",
5+
"sdk/rust/client",
56
"contracts/solana/programs/pyth-lazer-solana-contract",
67
]
78

lazer/sdk/rust/client/Cargo.toml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[package]
2+
name = "pyth-lazer-client"
3+
version = "0.1.0"
4+
edition = "2021"
5+
description = "A Rust client for Pyth Lazer"
6+
license = "Apache-2.0"
7+
8+
[dependencies]
9+
pyth-lazer-protocol = { path = "../protocol" }
10+
tokio = { version = "1", features = ["full"] }
11+
tokio-tungstenite = { version = "0.20", features = ["native-tls"] }
12+
futures-util = "0.3"
13+
serde = { version = "1.0", features = ["derive"] }
14+
serde_json = "1.0"
15+
base64 = "0.22.1"
16+
anyhow = "1.0"
17+
tracing = "0.1"
18+
url = "2.4"
19+
20+
[dev_dependencies]
21+
bincode = "1.3.3"
22+
ed25519-dalek = { version = "2.1.1", features = ["rand_core"] }
23+
hex = "0.4.3"
24+
libsecp256k1 = "0.7.1"
25+
bs58 = "0.5.1"
26+
alloy-primitives = "0.8.19"

0 commit comments

Comments
 (0)