• I am building an application where I need to get the price of token with oracle that we can derive the feed accounts based on the base asset (USD) and the other side of the pair Sol, or tokens (mint). So basically users can pay with any token for their USD.
Currently, I am having a list of token/USD pair pyth sponsored accounts. In the frontend, I have to manually check the token spent and send that particular pyth sponsored feed account.
I am looking for a way to better handle this. Like I need to pass in the mint account and it just gives me feed_id or better gives the price directly instead of me having to maintain a list of the price accounts. Everything must happen on chain though.
I came with the same question. As final result i want to get FX rate for SOL/USD pair. Solana programs are using mint addresses (PubKeys) and not XXX string currency code. So you need to follow this steps to do the mapping.
Mint Address → Token Symbol → Pyth Price Feed ID
One issue here that token symbols are not unique (PYUSD) (USDC) (USDG) (USDT).
Off chain json price feeds do not contain mint information.
What about sponsored feeds on solana? no mint information in pyth-sdk-solana.
So in most of scenarios you should maintain this type of mapping.
Ah yes this is true. Unfortunately we do not maintain mint information ourselves, although we’ve received some requests about it. At this time you’d need to maintain your own mapping.