Skip to content

chore(pricefeed)-add-solana-anchor #522

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pages/price-feeds/troubleshoot.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ The following guide helps users integrating pyth price feeds to solve common iss
Please select the component where you are facing the issue to get the troubleshooting steps.

- [EVM Price Feeds Contract](troubleshoot/evm)
- [SVM Price Feeds Contract](troubleshoot/svm)
3 changes: 2 additions & 1 deletion pages/price-feeds/troubleshoot/_meta.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"evm": "EVM Price Feeds Contract"
"evm": "EVM Price Feeds Contract",
"svm": "SVM Price Feeds Contract"
}
18 changes: 18 additions & 0 deletions pages/price-feeds/troubleshoot/svm.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Troubleshoot Solana Price Feeds Contract

This reference page is designed to help you troubleshoot common issues you may encounter when using Pyth Price Feeds on SVM chains.
Follow the steps provided below to diagnose and resolve the issue.

1. `error[E0277]: the trait bound PriceUpdateV2: anchor_lang::AccountDeserialize is not satisfied{:rust}`

This error happens when a program using the [`pyth-solana-receiver-sdk`](https://github.com/pyth-network/pyth-crosschain/tree/main/target_chains/solana/pyth_solana_receiver_sdk) fails to compile. It is caused by an `anchor-lang` version mismatch.
Make sure the transitive version of `anchor-lang` brought by `pyth-solana-receiver-sdk`
matches the version of `anchor-lang` of your program's `Cargo.toml`.

You can fix it by following these steps:

- Check the version of `anchor-lang` in your [`Cargo.toml`](https://github.com/guibescos/anchor-pyth/blob/broken-build/programs/anchor-pyth/Cargo.toml) (in the example `0.29.0{:js}`) call it `x.y.z`
- Check the version of `anchor-lang` in the `pyth-solana-receiver-sdk` tree in [`Cargo.lock`](https://github.com/guibescos/anchor-pyth/blob/broken-build/Cargo.lock#L1400) (in the example `0.30.1{:js}`) call it `a.b.c`
- Run `cargo update -p anchor-lang@a.b.c --precise x.y.z{:bash}`
replacing `a.b.c` and `x.y.z` by the versions in the previous steps. For example:\
`cargo update -p anchor-lang@0.30.1 --precise 0.29.0{:bash}`
7 changes: 6 additions & 1 deletion pages/price-feeds/use-real-time-data/solana.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,19 @@ Pyth provides two SDKs for Solana applications to cover the on- and off-chain po

### Rust SDK

The [pyth-solana-receiver-sdk crate](https://github.com/pyth-network/pyth-crosschain/tree/main/target_chains/solana/pyth_solana_receiver_sdk) can be used to consume Pyth prices inside Solana programs written in Rust.
The [pyth-solana-receiver-sdk](https://github.com/pyth-network/pyth-crosschain/tree/main/target_chains/solana/pyth_solana_receiver_sdk) crate can be used to consume Pyth prices inside Solana programs written in Rust.
Add this crate to the dependencies section of your `Cargo.toml` file:

```toml copy
[dependencies]
pyth-solana-receiver-sdk ="x.y.z" # get the latest version from https://crates.io/crates/pyth-solana-receiver-sdk
```

<Callout type="warning" emoji="⚓">
At the time of writing, [pyth-solana-receiver-sdk](https://github.com/pyth-network/pyth-crosschain/tree/main/target_chains/solana/pyth_solana_receiver_sdk) is compatible with Anchor `v0.28.0{:js}`, `v0.29.0{:js}`, and `v0.30.1{:js}`.
If you are on `v0.30.0{:js}` or any other version, please move to `v0.30.1{:js}`.
</Callout>

### Typescript SDK

Pyth provides two Typescript packages, [@pythnetwork/price-service-client](https://github.com/pyth-network/pyth-crosschain/tree/main/price_service/client/js) and [@pythnetwork/pyth-solana-receiver](https://github.com/pyth-network/pyth-crosschain/tree/main/target_chains/solana/sdk/js/pyth_solana_receiver), for fetching Pyth prices and submitting them to the blockchain respectively.
Expand Down
Loading