Skip to content

Commit

Permalink
feat(lazer/sdk/rust): add rust client for Lazer (#2310)
Browse files Browse the repository at this point in the history
* feat: add rust consumer sdk for lazer

Co-Authored-By: Tejas Badadare <[email protected]>

* feat: rename crate to pyth-lazer-sdk and client to LazerClient

Co-Authored-By: Tejas Badadare <[email protected]>

* fix: update base64 encoding to use Engine::encode

Co-Authored-By: Tejas Badadare <[email protected]>

* fix: add base64 Engine trait import

Co-Authored-By: Tejas Badadare <[email protected]>

* feat: add example for pyth-lazer-sdk

Co-Authored-By: Tejas Badadare <[email protected]>

* fix: fix example

* refactor: separate client new() and start() functions, improve unsubscribe example

Co-Authored-By: Tejas Badadare <[email protected]>

* refactor: use Bearer token authentication in header and improve unsubscribe handling

Co-Authored-By: Tejas Badadare <[email protected]>

* refactor: make access token required parameter

Co-Authored-By: Tejas Badadare <[email protected]>

* fix: remove invalid client return from start function

Co-Authored-By: Tejas Badadare <[email protected]>

* style: improve code formatting and fix example documentation

Co-Authored-By: Tejas Badadare <[email protected]>

* 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 <[email protected]>
Co-authored-by: Tejas Badadare <[email protected]>
  • Loading branch information
3 people authored Jan 31, 2025
1 parent dd39029 commit 4f8631d
Show file tree
Hide file tree
Showing 7 changed files with 496 additions and 4 deletions.
121 changes: 120 additions & 1 deletion lazer/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lazer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
resolver = "2"
members = [
"sdk/rust/protocol",
"sdk/rust/client",
"contracts/solana/programs/pyth-lazer-solana-contract",
]

Expand Down
26 changes: 26 additions & 0 deletions lazer/sdk/rust/client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[package]
name = "pyth-lazer-client"
version = "0.1.0"
edition = "2021"
description = "A Rust client for Pyth Lazer"
license = "Apache-2.0"

[dependencies]
pyth-lazer-protocol = { path = "../protocol" }
tokio = { version = "1", features = ["full"] }
tokio-tungstenite = { version = "0.20", features = ["native-tls"] }
futures-util = "0.3"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
base64 = "0.22.1"
anyhow = "1.0"
tracing = "0.1"
url = "2.4"

[dev_dependencies]
bincode = "1.3.3"
ed25519-dalek = { version = "2.1.1", features = ["rand_core"] }
hex = "0.4.3"
libsecp256k1 = "0.7.1"
bs58 = "0.5.1"
alloy-primitives = "0.8.19"
Loading

0 comments on commit 4f8631d

Please sign in to comment.