Last active
July 10, 2024 20:35
-
-
Save mgild/01e1293943953d787364fc34a4c471cb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export async function fetchAllLutKeys( | |
queue: Queue, | |
feeds: PullFeed[] | |
): Promise<PublicKey[]> { | |
const oracles = await queue.fetchOracleKeys(); | |
const lutOwners: any[] = []; | |
lutOwners.push(queue); | |
for (const feed of feeds) { | |
lutOwners.push(feed); | |
} | |
for (const oracle of oracles) { | |
lutOwners.push(new Oracle(queue.program, oracle)); | |
} | |
const lutPromises = lutOwners.map((lutOwner) => { | |
return lutOwner.loadLookupTable(); | |
}); | |
const luts = await Promise.all(lutPromises); | |
const keyset = new Set<PublicKey>(); | |
for (const lut of luts) { | |
for (const key of lut.state.addresses) { | |
keyset.add(key.toString()); | |
} | |
} | |
return Array.from(keyset).map((key) => new PublicKey(key)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment