feat: add support for more system instructions

This commit is contained in:
Justin Starry
2020-05-09 18:33:36 +08:00
committed by Michael Vines
parent 09d1b7f39f
commit c584fbdf39
5 changed files with 323 additions and 44 deletions

67
web3.js/module.d.ts vendored
View File

@ -578,17 +578,6 @@ declare module '@solana/web3.js' {
programId: PublicKey;
};
export type TransferParams = {
fromPubkey: PublicKey;
toPubkey: PublicKey;
lamports: number;
};
export type AssignParams = {
fromPubkey: PublicKey;
programId: PublicKey;
};
export type CreateAccountWithSeedParams = {
fromPubkey: PublicKey;
newAccountPubkey: PublicKey;
@ -599,6 +588,37 @@ declare module '@solana/web3.js' {
programId: PublicKey;
};
export type AllocateParams = {
accountPubkey: PublicKey;
space: number;
};
export type AllocateWithSeedParams = {
accountPubkey: PublicKey;
basePubkey: PublicKey;
seed: string;
space: number;
programId: PublicKey;
};
export type AssignParams = {
accountPubkey: PublicKey;
programId: PublicKey;
};
export type AssignWithSeedParams = {
accountPubkey: PublicKey;
basePubkey: PublicKey;
seed: string;
programId: PublicKey;
};
export type TransferParams = {
fromPubkey: PublicKey;
toPubkey: PublicKey;
lamports: number;
};
export type CreateNonceAccountParams = {
fromPubkey: PublicKey;
noncePubkey: PublicKey;
@ -642,11 +662,14 @@ declare module '@solana/web3.js' {
static programId: PublicKey;
static createAccount(params: CreateAccountParams): Transaction;
static transfer(params: TransferParams): Transaction;
static assign(params: AssignParams): Transaction;
static createAccountWithSeed(
params: CreateAccountWithSeedParams,
): Transaction;
static allocate(
params: AllocateParams | AllocateWithSeedParams,
): Transaction;
static assign(params: AssignParams | AssignWithSeedParams): Transaction;
static transfer(params: TransferParams): Transaction;
static createNonceAccount(
params: CreateNonceAccountParams | CreateNonceAccountWithSeedParams,
): Transaction;
@ -657,9 +680,12 @@ declare module '@solana/web3.js' {
export type SystemInstructionType =
| 'Create'
| 'Assign'
| 'Transfer'
| 'CreateWithSeed'
| 'Allocate'
| 'AllocateWithSeed'
| 'Assign'
| 'AssignWithSeed'
| 'Transfer'
| 'AdvanceNonceAccount'
| 'WithdrawNonceAccount'
| 'InitializeNonceAccount'
@ -676,11 +702,18 @@ declare module '@solana/web3.js' {
static decodeCreateAccount(
instruction: TransactionInstruction,
): CreateAccountParams;
static decodeTransfer(instruction: TransactionInstruction): TransferParams;
static decodeAssign(instruction: TransactionInstruction): AssignParams;
static decodeCreateWithSeed(
instruction: TransactionInstruction,
): CreateAccountWithSeedParams;
static decodeAllocate(instruction: TransactionInstruction): AllocateParams;
static decodeAllocateWithSeed(
instruction: TransactionInstruction,
): AllocateWithSeedParams;
static decodeAssign(instruction: TransactionInstruction): AssignParams;
static decodeAssignWithSeed(
instruction: TransactionInstruction,
): AssignWithSeedParams;
static decodeTransfer(instruction: TransactionInstruction): TransferParams;
static decodeNonceInitialize(
instruction: TransactionInstruction,
): InitializeNonceParams;