Base and Quote oracle symbols are always fetched from the market itself. They can be in a different representation than plain symbols (i.e hashes for pyth oracle).
Copy
Ask AI
import { getNetworkEndpoints, Network } from "@injectivelabs/networks";import { IndexerGrpcOracleApi, IndexerGrpcDerivativesApi,} from "@injectivelabs/sdk-ts/client/indexer";const endpoints = getNetworkEndpoints(Network.Testnet);const indexerGrpcDerivativesApi = new IndexerGrpcDerivativesApi(endpoints.indexer);const indexerGrpcOracleApi = new IndexerGrpcOracleApi(endpoints.indexer);// Fetch the list of derivative marketsconst markets = await indexerGrpcDerivativesApi.fetchMarkets();// Find the specific market by tickerconst market = markets.find((market) => market.ticker === "INJ/USDT PERP");if (!market) { throw new Error("Market not found");}// These values are a part of the market object// fetched from the indexer i.e `oracleBase` and `oracleQuote`const baseSymbol = market.oracleBase;const quoteSymbol = market.oracleQuote;const oracleType = market.oracleType;const oraclePrice = await indexerGrpcOracleApi.fetchOraclePriceNoThrow({ baseSymbol, quoteSymbol, oracleType,});console.log(oraclePrice);