fix(system-program): add base pubkey to create_account_with_seed
This commit is contained in:
committed by
Michael Vines
parent
0907750fea
commit
e0e3094370
@ -223,6 +223,7 @@ declare module '@solana/web3.js' {
|
|||||||
static createAccountWithSeed(
|
static createAccountWithSeed(
|
||||||
from: PublicKey,
|
from: PublicKey,
|
||||||
newAccount: PublicKey,
|
newAccount: PublicKey,
|
||||||
|
base: PublicKey,
|
||||||
seed: string,
|
seed: string,
|
||||||
lamports: number,
|
lamports: number,
|
||||||
space: number,
|
space: number,
|
||||||
|
6
web3.js/package-lock.json
generated
6
web3.js/package-lock.json
generated
@ -9720,8 +9720,7 @@
|
|||||||
"version": "4.2.1",
|
"version": "4.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.1.tgz",
|
||||||
"integrity": "sha512-QLg82fGkfnJ/4iy1xZ81/9SIJiq1NGFUMGs6ParyjBZr6jW2Ufj/snDqTHixNlHdPNwN2RLVD0Pi3igeK9+JfA==",
|
"integrity": "sha512-QLg82fGkfnJ/4iy1xZ81/9SIJiq1NGFUMGs6ParyjBZr6jW2Ufj/snDqTHixNlHdPNwN2RLVD0Pi3igeK9+JfA==",
|
||||||
"dev": true,
|
"dev": true
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"hook-std": {
|
"hook-std": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
@ -9859,8 +9858,7 @@
|
|||||||
"version": "2.7.0",
|
"version": "2.7.0",
|
||||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-2.7.0.tgz",
|
"resolved": "https://registry.npmjs.org/acorn/-/acorn-2.7.0.tgz",
|
||||||
"integrity": "sha1-q259nYhqrKiwhbwzEreaGYQz8Oc=",
|
"integrity": "sha1-q259nYhqrKiwhbwzEreaGYQz8Oc=",
|
||||||
"dev": true,
|
"dev": true
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"acorn-globals": {
|
"acorn-globals": {
|
||||||
"version": "1.0.9",
|
"version": "1.0.9",
|
||||||
|
@ -148,6 +148,7 @@ const SystemInstructionLayout = Object.freeze({
|
|||||||
index: 3,
|
index: 3,
|
||||||
layout: BufferLayout.struct([
|
layout: BufferLayout.struct([
|
||||||
BufferLayout.u32('instruction'),
|
BufferLayout.u32('instruction'),
|
||||||
|
Layout.publicKey('base'),
|
||||||
Layout.rustString('seed'),
|
Layout.rustString('seed'),
|
||||||
BufferLayout.ns64('lamports'),
|
BufferLayout.ns64('lamports'),
|
||||||
BufferLayout.ns64('space'),
|
BufferLayout.ns64('space'),
|
||||||
@ -246,6 +247,7 @@ export class SystemProgram {
|
|||||||
static createAccountWithSeed(
|
static createAccountWithSeed(
|
||||||
from: PublicKey,
|
from: PublicKey,
|
||||||
newAccount: PublicKey,
|
newAccount: PublicKey,
|
||||||
|
base: PublicKey,
|
||||||
seed: string,
|
seed: string,
|
||||||
lamports: number,
|
lamports: number,
|
||||||
space: number,
|
space: number,
|
||||||
@ -253,6 +255,7 @@ export class SystemProgram {
|
|||||||
): Transaction {
|
): Transaction {
|
||||||
const type = SystemInstructionLayout.CreateWithSeed;
|
const type = SystemInstructionLayout.CreateWithSeed;
|
||||||
const data = encodeData(type, {
|
const data = encodeData(type, {
|
||||||
|
base: base.toBuffer(),
|
||||||
seed,
|
seed,
|
||||||
lamports,
|
lamports,
|
||||||
space,
|
space,
|
||||||
|
@ -58,6 +58,7 @@ test('createAccountWithSeed', () => {
|
|||||||
transaction = SystemProgram.createAccountWithSeed(
|
transaction = SystemProgram.createAccountWithSeed(
|
||||||
from.publicKey,
|
from.publicKey,
|
||||||
newAccount.publicKey,
|
newAccount.publicKey,
|
||||||
|
from.publicKey,
|
||||||
'hi there',
|
'hi there',
|
||||||
123,
|
123,
|
||||||
BudgetProgram.space,
|
BudgetProgram.space,
|
||||||
@ -133,6 +134,7 @@ test('SystemInstruction createWithSeed', () => {
|
|||||||
const create = SystemProgram.createAccountWithSeed(
|
const create = SystemProgram.createAccountWithSeed(
|
||||||
from.publicKey,
|
from.publicKey,
|
||||||
to.publicKey,
|
to.publicKey,
|
||||||
|
from.publicKey,
|
||||||
'hi there',
|
'hi there',
|
||||||
amount,
|
amount,
|
||||||
space,
|
space,
|
||||||
|
Reference in New Issue
Block a user