fix: fixes needed for createAccountWithSeed and sol-lamport ratio
This commit is contained in:
committed by
Michael Vines
parent
8541868587
commit
bed42ac26b
@ -243,6 +243,7 @@ export class StakeProgram {
|
|||||||
static createAccountWithSeed(
|
static createAccountWithSeed(
|
||||||
from: PublicKey,
|
from: PublicKey,
|
||||||
stakeAccount: PublicKey,
|
stakeAccount: PublicKey,
|
||||||
|
base: PublicKey,
|
||||||
seed: string,
|
seed: string,
|
||||||
authorized: Authorized,
|
authorized: Authorized,
|
||||||
lockup: Lockup,
|
lockup: Lockup,
|
||||||
@ -251,6 +252,7 @@ export class StakeProgram {
|
|||||||
let transaction = SystemProgram.createAccountWithSeed(
|
let transaction = SystemProgram.createAccountWithSeed(
|
||||||
from,
|
from,
|
||||||
stakeAccount,
|
stakeAccount,
|
||||||
|
base,
|
||||||
seed,
|
seed,
|
||||||
lamports,
|
lamports,
|
||||||
this.space,
|
this.space,
|
||||||
|
@ -38,6 +38,7 @@ test('createAccountWithSeed', () => {
|
|||||||
transaction = StakeProgram.createAccountWithSeed(
|
transaction = StakeProgram.createAccountWithSeed(
|
||||||
from.publicKey,
|
from.publicKey,
|
||||||
newAccountPubkey,
|
newAccountPubkey,
|
||||||
|
from.publicKey,
|
||||||
seed,
|
seed,
|
||||||
new Authorized(authorized.publicKey, authorized.publicKey),
|
new Authorized(authorized.publicKey, authorized.publicKey),
|
||||||
new Lockup(0, 0, from.publicKey),
|
new Lockup(0, 0, from.publicKey),
|
||||||
@ -187,6 +188,7 @@ test('StakeInstructions', () => {
|
|||||||
const createWithSeed = StakeProgram.createAccountWithSeed(
|
const createWithSeed = StakeProgram.createAccountWithSeed(
|
||||||
from.publicKey,
|
from.publicKey,
|
||||||
newAccountPubkey,
|
newAccountPubkey,
|
||||||
|
from.publicKey,
|
||||||
seed,
|
seed,
|
||||||
new Authorized(authorized.publicKey, authorized.publicKey),
|
new Authorized(authorized.publicKey, authorized.publicKey),
|
||||||
new Lockup(0, 0, from.publicKey),
|
new Lockup(0, 0, from.publicKey),
|
||||||
@ -244,8 +246,8 @@ test('live staking actions', async () => {
|
|||||||
|
|
||||||
const from = new Account();
|
const from = new Account();
|
||||||
const authorized = new Account();
|
const authorized = new Account();
|
||||||
await connection.requestAirdrop(from.publicKey, LAMPORTS_PER_SOL);
|
await connection.requestAirdrop(from.publicKey, 2 * LAMPORTS_PER_SOL);
|
||||||
await connection.requestAirdrop(authorized.publicKey, LAMPORTS_PER_SOL);
|
await connection.requestAirdrop(authorized.publicKey, 2 * LAMPORTS_PER_SOL);
|
||||||
|
|
||||||
const minimumAmount = await connection.getMinimumBalanceForRentExemption(
|
const minimumAmount = await connection.getMinimumBalanceForRentExemption(
|
||||||
StakeProgram.space,
|
StakeProgram.space,
|
||||||
@ -263,6 +265,7 @@ test('live staking actions', async () => {
|
|||||||
let createAndInitializeWithSeed = StakeProgram.createAccountWithSeed(
|
let createAndInitializeWithSeed = StakeProgram.createAccountWithSeed(
|
||||||
from.publicKey,
|
from.publicKey,
|
||||||
newAccountPubkey,
|
newAccountPubkey,
|
||||||
|
from.publicKey,
|
||||||
seed,
|
seed,
|
||||||
new Authorized(authorized.publicKey, authorized.publicKey),
|
new Authorized(authorized.publicKey, authorized.publicKey),
|
||||||
new Lockup(0, 0, new PublicKey('0x00')),
|
new Lockup(0, 0, new PublicKey('0x00')),
|
||||||
|
Reference in New Issue
Block a user