How can my smart contract or application access USD/HBAR exchange rate info from a file on the Hedera network (Hedera File Service)?
The file I'm interested in is 0.0.112. I tried doing a query with the SDK from my application and it seems to get me the info, but how can I use this in a contract and how real-time is this price info?
async function main() {
const fileQuery = new FileContentsQuery().setFileId("0.0.112");
const contents = await fileQuery.execute(client);
console.log(contents.toString());
}
main();