From 47d19a738f09920ba712f6c626b54c0403ab0e27 Mon Sep 17 00:00:00 2001 From: Noah Gundotra Date: Wed, 16 Oct 2024 15:06:09 -0400 Subject: [PATCH 1/2] remove idl parsing when loading programs --- app/providers/anchor.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/providers/anchor.tsx b/app/providers/anchor.tsx index f9dc1cbe..9f9b04e4 100644 --- a/app/providers/anchor.tsx +++ b/app/providers/anchor.tsx @@ -112,9 +112,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 { From ee2568d47466bf9bff27712ec7c5d45289e57f78 Mon Sep 17 00:00:00 2001 From: Noah Gundotra Date: Wed, 16 Oct 2024 15:08:24 -0400 Subject: [PATCH 2/2] fix lint --- app/providers/anchor.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/app/providers/anchor.tsx b/app/providers/anchor.tsx index 9f9b04e4..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);