fix: use bpf-loader-deprecated explicitly (#11818)
This commit is contained in:
7
web3.js/src/bpf-loader-deprecated.js
Normal file
7
web3.js/src/bpf-loader-deprecated.js
Normal file
@ -0,0 +1,7 @@
|
||||
// @flow
|
||||
|
||||
import {PublicKey} from './publickey';
|
||||
|
||||
export const BPF_LOADER_DEPRECATED_PROGRAM_ID = new PublicKey(
|
||||
'BPFLoader1111111111111111111111111111111111',
|
||||
);
|
@ -5,21 +5,14 @@ import {PublicKey} from './publickey';
|
||||
import {Loader} from './loader';
|
||||
import type {Connection} from './connection';
|
||||
|
||||
export const BPF_LOADER_PROGRAM_ID = new PublicKey(
|
||||
'BPFLoader2111111111111111111111111111111111',
|
||||
);
|
||||
|
||||
/**
|
||||
* Factory class for transactions to interact with a program loader
|
||||
*/
|
||||
export class BpfLoader {
|
||||
/**
|
||||
* Public key that identifies the BpfLoader
|
||||
*/
|
||||
static programId(version: number = 2): PublicKey {
|
||||
if (version === 1) {
|
||||
return new PublicKey('BPFLoader1111111111111111111111111111111111');
|
||||
} else {
|
||||
return new PublicKey('BPFLoader2111111111111111111111111111111111');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Minimum number of signatures required to load a program not including
|
||||
* retries
|
||||
@ -37,21 +30,15 @@ export class BpfLoader {
|
||||
* @param payer Account that will pay program loading fees
|
||||
* @param program Account to load the program into
|
||||
* @param elf The entire ELF containing the BPF program
|
||||
* @param version The version of the BPF loader to use
|
||||
* @param loaderProgramId The program id of the BPF loader to use
|
||||
*/
|
||||
static load(
|
||||
connection: Connection,
|
||||
payer: Account,
|
||||
program: Account,
|
||||
elf: Buffer | Uint8Array | Array<number>,
|
||||
version: number = 2,
|
||||
loaderProgramId: PublicKey,
|
||||
): Promise<void> {
|
||||
return Loader.load(
|
||||
connection,
|
||||
payer,
|
||||
program,
|
||||
BpfLoader.programId(version),
|
||||
elf,
|
||||
);
|
||||
return Loader.load(connection, payer, program, loaderProgramId, elf);
|
||||
}
|
||||
}
|
||||
|
@ -1754,11 +1754,7 @@ export class Connection {
|
||||
publicKey: PublicKey,
|
||||
commitment: ?Commitment,
|
||||
): Promise<RpcResponseAndContext<AccountInfo<Buffer> | null>> {
|
||||
const args = this._buildArgs(
|
||||
[publicKey.toBase58()],
|
||||
commitment,
|
||||
'base64',
|
||||
);
|
||||
const args = this._buildArgs([publicKey.toBase58()], commitment, 'base64');
|
||||
const unsafeRes = await this._rpcRequest('getAccountInfo', args);
|
||||
const res = GetAccountInfoAndContextRpcResult(unsafeRes);
|
||||
if (res.error) {
|
||||
@ -1868,11 +1864,7 @@ export class Connection {
|
||||
programId: PublicKey,
|
||||
commitment: ?Commitment,
|
||||
): Promise<Array<{pubkey: PublicKey, account: AccountInfo<Buffer>}>> {
|
||||
const args = this._buildArgs(
|
||||
[programId.toBase58()],
|
||||
commitment,
|
||||
'base64',
|
||||
);
|
||||
const args = this._buildArgs([programId.toBase58()], commitment, 'base64');
|
||||
const unsafeRes = await this._rpcRequest('getProgramAccounts', args);
|
||||
const res = GetProgramAccountsRpcResult(unsafeRes);
|
||||
if (res.error) {
|
||||
|
Reference in New Issue
Block a user