pyth-lazer-stellar-sdk
Rust SDK for consuming Pyth Lazer price updates inside Soroban (Stellar) smart contracts. It lets a contract cross-contract call a deployed pyth-lazer-stellar verifier and decode the verified payload bytes into typed values. The crate is #![no_std] and builds for the wasm32-unknown-unknown target.
Install
[]
= "0.2"
Usage
use PythLazerClient;
use ;
;
verify_update returns a VerifiedPayload — a newtype wrapping the decoded
Update that signals the bytes passed on-chain verification. Read fields
directly (it derefs to Update) or call .into_inner() to take ownership of
the Update.
⚠️ Security:
parse_payloaddoes not verify signatures.
parse_payloadis also exported for callers that already hold verified payload bytes. It performs no signature verification — it decodes whatever bytes it is handed. OnlyPythLazerClient::verify_updateestablishes the trust boundary (it verifies via the on-chain verifier contract before parsing). Passing unverified, attacker-supplied bytes toparse_payloadyields a fully-formed but unsignedUpdatewhose values are entirely attacker-controlled and must not be trusted.
Integration guide
See the full consumer integration guide at docs.pyth.network/lazer/price-feeds/pro/integrate-as-consumer/stellar.
Publishing
This crate is published to crates.io via
.github/workflows/publish-rust-lazer-stellar-sdk.yml. To cut a new release:
- Bump
versioninCargo.toml(semver). - Commit + merge to
main. - Tag:
git tag rust-pyth-lazer-stellar-sdk-v<X.Y.Z> && git push origin rust-pyth-lazer-stellar-sdk-v<X.Y.Z> - The workflow runs
cargo publishfrom the tag. It can also be triggered manually viaworkflow_dispatch.