Skip to content

feat(lazer/stellar): add a one-command demo client for the example consumer - #135

Merged
jayantk merged 1 commit into
mainfrom
hydra/i-clnqqwws/head
Sep 16, 2026
Merged

jayantk merged 1 commit into
mainfrom
hydra/i-clnqqwws/head

Conversation

@jayantk

@jayantk jayantk commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

What changed

lazer/stellar/README.md told the reader to run
-- update_price --payload <HEX_ENCODED_UPDATE>, but nothing in the repo produced that hex, so the
example consumer walkthrough could not be run end to end.

  • New lazer/stellar/client/ — a standalone Node client that runs the whole consumer story in
    one command: fetch a freshly signed Pyth Lazer update, print the update hex and the off-chain
    price, submit it to a deployed example consumer's update_price, then read get_price back and
    print the stored price in human units with a stellar.expert link.
    • Requests price, exponent and feedUpdateTimestamp. The consumer reads all three, and a
      property that is not requested decodes to None on-chain, failing the call.
    • Depends only on @stellar/stellar-sdk and plain fetch, with plain semver deps — it runs
      outside the Pyth monorepos, which matters because this is aimed at an external audience.
    • --network testnet|mainnet, --contract-id, --feed-id, --channel, --lazer-endpoint;
      signing key from --secret or STELLAR_WALLET_SECRET; Lazer token from PYTH_API_KEY.
    • Prints the signing account's public key and XLM balance before spending anything.
    • On testnet, friendbot-funds a missing or unfunded account (generating a throwaway keypair when
      no secret is given). On mainnet it bids 1000000 stroops of inclusion fee, because mainnet
      ledgers run near capacity and a base-fee bid gets evicted.
    • Decodes the consumer's contract error codes and leads with a plain-English explanation before
      the raw diagnostics — notably PriceStale (testing #1) and PriceOutdated (Added growing example #9).
  • lazer/stellar/README.md — the walkthrough now ends in a real command instead of a dangling
    placeholder, and documents the freshness and strict-monotonicity failure modes.
  • .github/workflows/ci-lazer-stellar.yml — a job running npm ci && npm test (prettier +
    tsc) for the client. Static checks only: the demo needs a Lazer token, a funded account and a
    live network, so it cannot run in CI.

Why

The consumer walkthrough was the missing link in the Stellar integration story. This makes it
runnable, and the client doubles as the driver for a live demo.

Checks run

Local gate, matching ci-lazer-stellar.yml:

  • cargo fmt --all -- --check — clean
  • cargo clippy --release --target wasm32v1-none --locked -- --deny warnings — clean
  • cargo build --release --target wasm32v1-none --locked — ok
  • npm ci && npm test in lazer/stellar/client — prettier and tsc --noEmit clean

Because this drives a live chain, the local gate is not sufficient on its own. The full flow was
executed against both real networks, with the example consumer deployed from this WASM:

Testnet — consumer CCEZSNTTVRIYXYHBKD2OMBRQI3RP6ZNXFWQ5ZG5ZDTQ7JZ4DTZ6FR72Q, verifier
CAYFT5JE3UQTKT4Q6ZOZK4FXVYVT6RE3MFC7STA4UB6WAEGBT65MRU52. update_price succeeded in tx
14a8052094f9e58bfb510421b728b77a5743ddd399e77a0341742bf1f0aa4f49 (ledger 4708537); get_price
read back BTC/USD 75725.44954934.

Mainnet — consumer CB2XIALZ4IHL6S4BDPA5BERJ6G4ZQL52XI4VRRNOIQ6R3ZM6U6ZIBD3X, verifier
CACZ3GBAKUPIAFRILUFO27J5RUH5GJ2VSJ46LP6GJYSKGDRTQ5MS3HCH. update_price succeeded in tx
9a645c780ca5b5fccc9d3524e2c6bfedd3b8aefaebc84dd3e9def28676526477 (ledger 64456352); get_price
read back BTC/USD 75734.23859389.

The error path was exercised too: pointing the client at --feed-id 2 against a contract configured
for feed 1 produced contract error #2: FeedMissing with the actionable explanation.

The direct Stellar CLI walkthrough now in the README (curl the payload, stellar contract invoke update_price, then get_price) was also run on testnet and returned
{"exponent":-8,"price":7566678012269,"timestamp_us":1789566132800000}.

…nsumer

The example consumer README told the reader to invoke update_price with a
<HEX_ENCODED_UPDATE>, but nothing produced that hex, so the walkthrough could
not be run end to end.

Add lazer/stellar/client, a standalone Node client that fetches a freshly
signed Lazer update, submits it to a deployed example consumer, and reads the
stored price back in human units. Rewrite the README walkthrough around it and
document the freshness/monotonicity failure modes.
@jayantk
jayantk merged commit 1f78d27 into main Sep 16, 2026
7 checks passed
@jayantk
jayantk deleted the hydra/i-clnqqwws/head branch September 16, 2026 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants