solana-web3: add TransferWithSeed implementation (#14570)

* fix: add handling for TransferWithSeed system instruction

* chore: add failing Assign/AllocateWithSeed test

* fix: broken Allocate/AssignWithSeed methods
This commit is contained in:
Tyera Eulberg
2021-01-14 09:59:31 -07:00
committed by GitHub
parent b37dbed479
commit 1eb7681a85
4 changed files with 291 additions and 11 deletions

View File

@ -899,6 +899,15 @@ declare module '@solana/web3.js' {
lamports: number,
|};
declare export type TransferWithSeedParams = {|
fromPubkey: PublicKey,
basePubkey: PublicKey,
toPubkey: PublicKey,
lamports: number,
seed: string,
programId: PublicKey,
|};
declare export type CreateNonceAccountParams = {|
fromPubkey: PublicKey,
noncePubkey: PublicKey,
@ -951,7 +960,9 @@ declare module '@solana/web3.js' {
static assign(
params: AssignParams | AssignWithSeedParams,
): TransactionInstruction;
static transfer(params: TransferParams): TransactionInstruction;
static transfer(
params: TransferParams | TransferWithSeedParams,
): TransactionInstruction;
static createNonceAccount(
params: CreateNonceAccountParams | CreateNonceAccountWithSeedParams,
): Transaction;
@ -968,6 +979,7 @@ declare module '@solana/web3.js' {
| 'Assign'
| 'AssignWithSeed'
| 'Transfer'
| 'TransferWithSeed'
| 'AdvanceNonceAccount'
| 'WithdrawNonceAccount'
| 'InitializeNonceAccount'
@ -996,6 +1008,9 @@ declare module '@solana/web3.js' {
instruction: TransactionInstruction,
): AssignWithSeedParams;
static decodeTransfer(instruction: TransactionInstruction): TransferParams;
static decodeTransferWithSeed(
instruction: TransactionInstruction,
): TransferWithSeedParams;
static decodeNonceInitialize(
instruction: TransactionInstruction,
): InitializeNonceParams;