From 7a1ba29a46cf8538cea152d15fc236e681ef889a Mon Sep 17 00:00:00 2001 From: Noah Gundotra Date: Wed, 16 Oct 2024 15:10:54 -0400 Subject: [PATCH] Stop parsing idls from program binaries when loading anchor programs (#390) This has been causing rate limiting issues when loading transactions that have a lot of program interactions because each instruction required fetching the entire program binary. Also need a key flagship program to use this feature on mainnet to be useful. --- app/providers/anchor.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/providers/anchor.tsx b/app/providers/anchor.tsx index f9dc1cbe..1148fb10 100644 --- a/app/providers/anchor.tsx +++ b/app/providers/anchor.tsx @@ -13,6 +13,7 @@ const cachedAnchorProgramPromises: Record< void | { __type: 'promise'; promise: Promise } | { __type: 'result'; result: Idl | null } > = {}; +// eslint-disable-next-line @typescript-eslint/no-unused-vars function useIdlFromSolanaProgramBinary(programAddress: string): Idl | null { const fetchAccountInfo = useFetchAccountInfo(); const programInfo = useAccountInfo(programAddress); @@ -112,9 +113,10 @@ function useIdlFromAnchorProgramSeed(programAddress: string, url: string): Idl | } export function useAnchorProgram(programAddress: string, url: string): { program: Program | null; idl: Idl | null } { - const idlFromBinary = useIdlFromSolanaProgramBinary(programAddress); + // TODO(ngundotra): Rewrite this to be more efficient + // const idlFromBinary = useIdlFromSolanaProgramBinary(programAddress); const idlFromAnchorProgram = useIdlFromAnchorProgramSeed(programAddress, url); - const idl = idlFromBinary ?? idlFromAnchorProgram; + const idl = idlFromAnchorProgram; const program: Program | null = useMemo(() => { if (!idl) return null; try {