chore: migrate to typescript
This commit is contained in:
committed by
Justin Starry
parent
3eb9f7b3eb
commit
f912c63b22
43
web3.js/src/bpf-loader.ts
Normal file
43
web3.js/src/bpf-loader.ts
Normal file
@ -0,0 +1,43 @@
|
||||
import {Account} from './account';
|
||||
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 {
|
||||
/**
|
||||
* Minimum number of signatures required to load a program not including
|
||||
* retries
|
||||
*
|
||||
* Can be used to calculate transaction fees
|
||||
*/
|
||||
static getMinNumSignatures(dataLength: number): number {
|
||||
return Loader.getMinNumSignatures(dataLength);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a BPF program
|
||||
*
|
||||
* @param connection The connection to use
|
||||
* @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 loaderProgramId The program id of the BPF loader to use
|
||||
* @return true if program was loaded successfully, false if program was already loaded
|
||||
*/
|
||||
static load(
|
||||
connection: Connection,
|
||||
payer: Account,
|
||||
program: Account,
|
||||
elf: Buffer | Uint8Array | Array<number>,
|
||||
loaderProgramId: PublicKey,
|
||||
): Promise<boolean> {
|
||||
return Loader.load(connection, payer, program, loaderProgramId, elf);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user