diff --git a/web3.js/module.flow.js b/web3.js/module.flow.js index d674915790..b94e7176f7 100644 --- a/web3.js/module.flow.js +++ b/web3.js/module.flow.js @@ -944,7 +944,7 @@ declare module '@solana/web3.js' { // === src/bpf-loader.js === declare export class BpfLoader { - static programId: PublicKey; + static programId(version: ?number): PublicKey; static getMinNumSignatures(dataLength: number): number; static load( connection: Connection, diff --git a/web3.js/src/bpf-loader.js b/web3.js/src/bpf-loader.js index 054a2ba3dd..c92e2353a8 100644 --- a/web3.js/src/bpf-loader.js +++ b/web3.js/src/bpf-loader.js @@ -12,8 +12,12 @@ export class BpfLoader { /** * Public key that identifies the BpfLoader */ - static get programId(): PublicKey { - return new PublicKey('BPFLoader1111111111111111111111111111111111'); + static programId(version: number = 2): PublicKey { + if (version === 1) { + return new PublicKey('BPFLoader1111111111111111111111111111111111'); + } else { + return new PublicKey('BPFLoader2111111111111111111111111111111111'); + } } /** @@ -40,6 +44,6 @@ export class BpfLoader { program: Account, elf: Buffer | Uint8Array | Array, ): Promise { - return Loader.load(connection, payer, program, BpfLoader.programId, elf); + return Loader.load(connection, payer, program, BpfLoader.programId(), elf); } }