This crate exposes utilities to interact with the contract on the CosmWasm ecosystem. You can also look at the example contract which demonstrates how to read price feeds from on-chain CosmWasm applications.
Add this crate to the dependencies section of your CosmWasm contract's Cargo.toml
file:
[dependencies]
pyth-sdk-cw = "1.0.0"
Simply import the structs exposed by the crate and use them while interacting with the pyth contract. For example:
```rust // to query Pyth contract use pythsdkcw::{ PriceFeedResponse, querypricefeed, };
... { let pricefeedresponse: PriceFeedResponse = querypricefeed(&deps.querier, state.pythcontractaddr, state.pricefeedid)?; let pricefeed = pricefeedresponse.pricefeed; } .... ```
Pyth is currently available on the following cosmwasm chains:
| Network | Contract address |
| --------- | -------------------------------------------- |
| Injective | inj1z60tg0tekdzcasenhuuwq3htjcd5slmgf7gpez
|
Available price feeds on these networks can be find below:
| Network | Available Price Feeds | | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------ | | Injective Testnet | https://pyth.network/developers/price-feed-ids#injective-testnet |