Get IDL Address

Get the address of the programs IDL

New Way

Old Way

import { PublicKey } from '@solana/web3.js';

const getIDLAddress = async () => {

    const programId = new PublicKey('SQDS4ep65T869zMMBKyuUq6aD6EgTu8psMjkvj52pCf');
    const [base] = PublicKey.findProgramAddressSync([], programId);
    const idlAddress = await PublicKey.createWithSeed(base, "anchor:idl", programId);

    console.log('IDL Address:', idlAddress.toString());
}

getIDLAddress();