'How do i fetch the idl of any program deployed on solana mainnet by its program address?

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



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source