4

What is the expected way to interact with the BPFUpgradeLoader using the Solana Web3 JS SDK? It appears the web3.BPF_LOADER_PROGRAM_ID is marked as deprecated, but it offers no clear alternative.

What is the proper way to do this? I needed to change the upgrade authority from one public key to another as part of a script and wanted to do this in the most idiomatic way possible. I don't want to ignore the deprecated notice and send a transaction to the loader program. Is there a better way to do this?

1 Answer 1

2

The @solana/web3.js v2 compatible clients for the loader programs can be found in the @solana-program org. Presently they are:

You can use the v3 loader to update the authority.

import { getSetAuthorityInstruction } from '@solana-program/loader-v3';

// Create a `TransactionSigner` instance. This is one way.
// There are many others: https://tinyurl.com/4ez3xyvh
const currentAuthoritySigner = await createSignerFromKeyPair(currentAuthorityKeyPair);

// Create the 'set authority' instruction for use in your transaction.
const setAuthorityInstruction = getSetAuthorityInstruction({
    bufferOrProgramDataAccount: programAddress,
    currentAuthority: currentAuthoritySigner,
    newAuthority: newAuthorityAddress,
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.