fix(system-program): add base pubkey to create_account_with_seed

This commit is contained in:
Rob Walker
2019-12-29 14:16:32 -08:00
committed by Michael Vines
parent 0907750fea
commit e0e3094370
4 changed files with 8 additions and 4 deletions

View File

@ -223,6 +223,7 @@ declare module '@solana/web3.js' {
static createAccountWithSeed(
from: PublicKey,
newAccount: PublicKey,
base: PublicKey,
seed: string,
lamports: number,
space: number,

View File

@ -9720,8 +9720,7 @@
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.1.tgz",
"integrity": "sha512-QLg82fGkfnJ/4iy1xZ81/9SIJiq1NGFUMGs6ParyjBZr6jW2Ufj/snDqTHixNlHdPNwN2RLVD0Pi3igeK9+JfA==",
"dev": true,
"optional": true
"dev": true
},
"hook-std": {
"version": "2.0.0",
@ -9859,8 +9858,7 @@
"version": "2.7.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-2.7.0.tgz",
"integrity": "sha1-q259nYhqrKiwhbwzEreaGYQz8Oc=",
"dev": true,
"optional": true
"dev": true
},
"acorn-globals": {
"version": "1.0.9",

View File

@ -148,6 +148,7 @@ const SystemInstructionLayout = Object.freeze({
index: 3,
layout: BufferLayout.struct([
BufferLayout.u32('instruction'),
Layout.publicKey('base'),
Layout.rustString('seed'),
BufferLayout.ns64('lamports'),
BufferLayout.ns64('space'),
@ -246,6 +247,7 @@ export class SystemProgram {
static createAccountWithSeed(
from: PublicKey,
newAccount: PublicKey,
base: PublicKey,
seed: string,
lamports: number,
space: number,
@ -253,6 +255,7 @@ export class SystemProgram {
): Transaction {
const type = SystemInstructionLayout.CreateWithSeed;
const data = encodeData(type, {
base: base.toBuffer(),
seed,
lamports,
space,

View File

@ -58,6 +58,7 @@ test('createAccountWithSeed', () => {
transaction = SystemProgram.createAccountWithSeed(
from.publicKey,
newAccount.publicKey,
from.publicKey,
'hi there',
123,
BudgetProgram.space,
@ -133,6 +134,7 @@ test('SystemInstruction createWithSeed', () => {
const create = SystemProgram.createAccountWithSeed(
from.publicKey,
to.publicKey,
from.publicKey,
'hi there',
amount,
space,