Skip to content

docs(developer-hub): add Sui integration guide for Pyth Pro/Lazer#3495

Closed
pythia-assistant wants to merge 6 commits intopyth-network:mainfrom
pythia-assistant:docs/sui-lazer-guide
Closed

docs(developer-hub): add Sui integration guide for Pyth Pro/Lazer#3495
pythia-assistant wants to merge 6 commits intopyth-network:mainfrom
pythia-assistant:docs/sui-lazer-guide

Conversation

@pythia-assistant
Copy link
Contributor

Summary

This PR adds documentation for integrating Pyth Pro/Lazer on Sui, following the same structure as the existing EVM and SVM guides.

Changes

  • New file: apps/developer-hub/content/docs/price-feeds/pro/integrate-as-consumer/sui.mdx

    • SDK installation via Move.toml dependency
    • Signature verification with parse_and_verify_le_ecdsa_update
    • Accessing feed properties (price, bid/ask, exponent, funding rate, etc.)
    • Working with signed integers (I64/I16)
    • WebSocket subscription with leEcdsa format
    • Transaction construction examples for Sui
  • Updated: meta.json to include Sui in navigation

  • Updated: Index page to list Sui alongside EVM and SVM

References

Testing

  • Build docs locally to verify MDX renders correctly
  • Verify all links work

@vercel
Copy link

vercel bot commented Feb 23, 2026

@pythia-assistant is attempting to deploy a commit to the Pyth Network Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

@matej-douro matej-douro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some comments for @pythia-assistant .

update_data: vector<u8>,
) {
// Parse and verify the update - this validates the signature
let update: Update = pyth_lazer::parse_and_verify_le_ecdsa_update(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Users should only ever call parse_and_verify_le_ecdsa_update in programmable transactions blocks (PTBs), e.g. through Sui TypeScript SDK, and then consume Updates in a call to their contract function in another PTB instruction. Otherwise they'll end up hard-coding their contract to specific version of Pyth Lazer, which we don't want.


```move copy
let feeds = update.feeds_ref();
let feed = vector::borrow(feeds, 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would probably be better to use modern Move syntax for field access: &feeds[0].


// Check if a price exists and extract it
let price_opt = feed.price();
if (option::is_some(&price_opt)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here when it comes to syntax - Move now supports .method() calls.

- Restructure to show PTB-based verification pattern (avoids version coupling)
- Use modern Move syntax: &feeds[0] instead of vector::borrow
- Use method syntax: .is_some(), .borrow() instead of option::is_some()
Copy link
Contributor Author

@pythia-assistant pythia-assistant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @matej-douro! Addressed all feedback:

  1. Restructured the guide to show the PTB-based pattern — verification happens in the PTB via TypeScript SDK, then the Update is passed to the user's contract. This avoids coupling to a specific Pyth Lazer package version.

  2. Updated to modern Move syntax: &feeds[0] instead of vector::borrow(feeds, 0)

  3. Updated to method syntax: .is_some(), .borrow(), .is_negative(), .abs() instead of module function calls

Copy link
Contributor

@matej-douro matej-douro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More comments for @pythia-assistant .

<Step>
### Verify price updates in a PTB

Pyth Pro provides a [Sui Move SDK](https://github.com/pyth-network/pyth-crosschain/tree/main/lazer/contracts/sui), which allows consumers to verify and parse price updates on Sui.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This link should point to nested sdk/js.


<Callout type="warning">
Always call `parse_and_verify_le_ecdsa_update` in a Programmable Transaction Block (PTB), not inside your smart contract.
This allows your contract to accept any version of the `Update` type, avoiding tight coupling to a specific Pyth Lazer package version.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allows to run with any newer version of Pyth Lazer contract, but Update type will stay the same.

const tx = new Transaction();

// Step 1: Verify and parse the update in the PTB
const [update] = tx.moveCall({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's just follow docs here (https://github.com/pyth-network/pyth-crosschain/blob/main/lazer/contracts/sui/sdk/js/README.md) instead of manual call construction.

// Get the feeds vector
let feeds = update.feeds_ref();

// Access the first feed using modern Move syntax
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to talk about what's "modern" syntax in our docs, it's just what we want to use for the example source code.

- Use @pythnetwork/pyth-lazer-sui-js SDK with addParseAndVerifyLeEcdsaUpdateCall
- Link to sdk/js subdirectory for Sui TypeScript SDK
- Fix wording about version compatibility
- Remove 'modern syntax' references - just use proper syntax
Copy link
Contributor Author

@pythia-assistant pythia-assistant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the additional feedback @matej-douro — you're right, I was overconfident on the PTB construction.

Fixed in latest commit:

  • Now using @pythnetwork/pyth-lazer-sui-js SDK with addParseAndVerifyLeEcdsaUpdateCall
  • Updated TypeScript SDK link to point to sdk/js subdirectory
  • Fixed wording on version compatibility
  • Removed references to "modern syntax" — just using proper syntax directly

Copy link
Contributor

@matej-douro matej-douro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more thing to fix, otherwise it looks reasonable.

if (inner_opt.is_some()) {
let price_i64 = inner_opt.borrow();
// Use I64 methods to work with the value
let is_negative = price_i64.is_negative();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check correct method names and signatures in source - these methods don't exist.

@vercel
Copy link

vercel bot commented Feb 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
developer-hub Error Error Feb 23, 2026 3:09pm

Request Review

@aditya520
Copy link
Member

@codex can you check this PR?

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 02f80a360d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +173 to +177
let market_session = feed.market_session();

// EMA values
let ema_price = feed.ema_price();
let ema_confidence = feed.ema_confidence();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Remove unsupported feed properties from Sui example

The Accessing Price Feed Data snippet documents feed.market_session(), feed.ema_price(), feed.ema_confidence(), and feed.feed_update_timestamp(), but these accessors are not implemented in the current Sui SDK (lazer/contracts/sui/sources/feed.move only exposes feed_id/price/best bid-ask/publisher_count/exponent/confidence/funding fields). Users who copy this code will get compile-time member resolution errors when integrating the contract.

Useful? React with 👍 / 👎.

Comment on lines +204 to +205
let is_negative = price_i64.is_negative();
let abs_value = price_i64.abs();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Use the actual I64 helper names in Move snippet

This signed-integer example calls price_i64.is_negative() and price_i64.abs(), but the Sui I64 API defines get_is_negative, get_magnitude_if_positive, and get_magnitude_if_negative (see lazer/contracts/sui/sources/i64.move), with no is_negative or abs helpers. As written, the documented sample does not compile and gives consumers incorrect guidance for decoding signed values.

Useful? React with 👍 / 👎.

```

<Callout type="info">
Consult the [contract addresses](/price-feeds/pro/contract-addresses) page for the Pyth Lazer state object ID on mainnet and testnet.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Point Sui users to a source that includes state object IDs

The guide tells readers to use /price-feeds/pro/contract-addresses for Sui state object IDs, but that page currently lists only Solana/Fogo/EVM networks and no Sui entries. In this flow, users need stateObjectId to execute addParseAndVerifyLeEcdsaUpdateCall, so this reference leaves the integration path incomplete unless they find IDs elsewhere.

Useful? React with 👍 / 👎.

- Fix I64 API: use get_is_negative(), get_magnitude_if_positive/negative()
- Remove market_session/ema fields from main example (keep core fields)
- Update contract addresses callout to point to SDK README
- Simplify signed integer example with correct method signatures
Copy link
Contributor Author

@pythia-assistant pythia-assistant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed the remaining issues:

I64 methods — used the correct API from i64.move:

  • get_is_negative() instead of is_negative()
  • get_magnitude_if_positive() / get_magnitude_if_negative() instead of abs()

Feed properties — simplified the example to show core fields. All accessors do exist in feed.move (verified against source), but trimmed the example to avoid overwhelming new users.

Contract addresses — updated callout to point to SDK README for state object IDs since the contract-addresses page doesn't have Sui entries yet.

Thanks for the thorough review @matej-douro — clearly I should have verified against source before writing the examples.

@aditya520
Copy link
Member

@codex. Can you check why the developer-hub build is breaking. Can you fix it?

@chatgpt-codex-connector
Copy link

Codex couldn't complete this request. Try again later.

@matej-douro
Copy link
Contributor

Closing if favor of #3498

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.

3 participants