Skip to content

Instantly share code, notes, and snippets.

@mgild
Last active April 18, 2024 23:20
Show Gist options
  • Save mgild/de63b8414a7ef2bbc31931b0b13d54f4 to your computer and use it in GitHub Desktop.
Save mgild/de63b8414a7ef2bbc31931b0b13d54f4 to your computer and use it in GitHub Desktop.
const coder = new BorshAccountsCoder(program.idl);
const oracles = await queue.fetchOracleKeys();
const oracleAccounts = await utils.rpc.getMultipleAccounts(
program.provider.connection,
oracles
);
const oracleDatas = oracleAccounts
.map((x: any) => coder.decode("OracleAccountData", x.account.data));
// TODO: now filter out all oracles that keys are not currently verified and keys expire in more than an hour
// Then choose a random one after the filter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment