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

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

@ -891,6 +891,15 @@ declare module '@solana/web3.js' {
lamports: number;
};
export type TransferWithSeedParams = {
fromPubkey: PublicKey;
basePubkey: PublicKey;
toPubkey: PublicKey;
lamports: number;
seed: string;
programId: PublicKey;
};
export type CreateNonceAccountParams = {
fromPubkey: PublicKey;
noncePubkey: PublicKey;
@ -943,7 +952,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;
@ -960,6 +971,7 @@ declare module '@solana/web3.js' {
| 'Assign'
| 'AssignWithSeed'
| 'Transfer'
| 'TransferWithSeed'
| 'AdvanceNonceAccount'
| 'WithdrawNonceAccount'
| 'InitializeNonceAccount'
@ -988,6 +1000,9 @@ declare module '@solana/web3.js' {
instruction: TransactionInstruction,
): AssignWithSeedParams;
static decodeTransfer(instruction: TransactionInstruction): TransferParams;
static decodeTransferWithSeed(
instruction: TransactionInstruction,
): TransferWithSeedParams;
static decodeNonceInitialize(
instruction: TransactionInstruction,
): InitializeNonceParams;