Reputation: 649
I want to fetch the IDL that anchor normally generates for any deployed solana program by just its program address on the client side
How to do this?
UPDATE:
My bad I didnt take the time to research this properly, you can use this line of code const idl = await fetchIdl(programId);
to fetch the idl as the answer states
Upvotes: 3
Views: 5661
Reputation: 8412
There's a function specifically made for that in the @project-serum/anchor
package called fetchIdl
, ie:
const idl = await fetchIdl(programId);
Check out its implementation if you like: https://github.com/project-serum/anchor/blob/8ffb22d936f0f6468d8f00a1e8a3c24b07e5490e/ts/src/program/index.ts#L324-L349
Upvotes: 7