feat: use bpf_loader2 as the default loader (#11457)
This commit is contained in:
@ -944,7 +944,7 @@ declare module '@solana/web3.js' {
|
|||||||
|
|
||||||
// === src/bpf-loader.js ===
|
// === src/bpf-loader.js ===
|
||||||
declare export class BpfLoader {
|
declare export class BpfLoader {
|
||||||
static programId: PublicKey;
|
static programId(version: ?number): PublicKey;
|
||||||
static getMinNumSignatures(dataLength: number): number;
|
static getMinNumSignatures(dataLength: number): number;
|
||||||
static load(
|
static load(
|
||||||
connection: Connection,
|
connection: Connection,
|
||||||
|
@ -12,8 +12,12 @@ export class BpfLoader {
|
|||||||
/**
|
/**
|
||||||
* Public key that identifies the BpfLoader
|
* Public key that identifies the BpfLoader
|
||||||
*/
|
*/
|
||||||
static get programId(): PublicKey {
|
static programId(version: number = 2): PublicKey {
|
||||||
return new PublicKey('BPFLoader1111111111111111111111111111111111');
|
if (version === 1) {
|
||||||
|
return new PublicKey('BPFLoader1111111111111111111111111111111111');
|
||||||
|
} else {
|
||||||
|
return new PublicKey('BPFLoader2111111111111111111111111111111111');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -40,6 +44,6 @@ export class BpfLoader {
|
|||||||
program: Account,
|
program: Account,
|
||||||
elf: Buffer | Uint8Array | Array<number>,
|
elf: Buffer | Uint8Array | Array<number>,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
return Loader.load(connection, payer, program, BpfLoader.programId, elf);
|
return Loader.load(connection, payer, program, BpfLoader.programId(), elf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user