fix: fixes needed for createAccountWithSeed and sol-lamport ratio

This commit is contained in:
Tyera Eulberg 2019-12-31 11:00:45 -07:00 committed by Michael Vines
parent 8541868587
commit bed42ac26b
2 changed files with 7 additions and 2 deletions

View File

@ -243,6 +243,7 @@ export class StakeProgram {
static createAccountWithSeed(
from: PublicKey,
stakeAccount: PublicKey,
base: PublicKey,
seed: string,
authorized: Authorized,
lockup: Lockup,
@ -251,6 +252,7 @@ export class StakeProgram {
let transaction = SystemProgram.createAccountWithSeed(
from,
stakeAccount,
base,
seed,
lamports,
this.space,

View File

@ -38,6 +38,7 @@ test('createAccountWithSeed', () => {
transaction = StakeProgram.createAccountWithSeed(
from.publicKey,
newAccountPubkey,
from.publicKey,
seed,
new Authorized(authorized.publicKey, authorized.publicKey),
new Lockup(0, 0, from.publicKey),
@ -187,6 +188,7 @@ test('StakeInstructions', () => {
const createWithSeed = StakeProgram.createAccountWithSeed(
from.publicKey,
newAccountPubkey,
from.publicKey,
seed,
new Authorized(authorized.publicKey, authorized.publicKey),
new Lockup(0, 0, from.publicKey),
@ -244,8 +246,8 @@ test('live staking actions', async () => {
const from = new Account();
const authorized = new Account();
await connection.requestAirdrop(from.publicKey, LAMPORTS_PER_SOL);
await connection.requestAirdrop(authorized.publicKey, LAMPORTS_PER_SOL);
await connection.requestAirdrop(from.publicKey, 2 * LAMPORTS_PER_SOL);
await connection.requestAirdrop(authorized.publicKey, 2 * LAMPORTS_PER_SOL);
const minimumAmount = await connection.getMinimumBalanceForRentExemption(
StakeProgram.space,
@ -263,6 +265,7 @@ test('live staking actions', async () => {
let createAndInitializeWithSeed = StakeProgram.createAccountWithSeed(
from.publicKey,
newAccountPubkey,
from.publicKey,
seed,
new Authorized(authorized.publicKey, authorized.publicKey),
new Lockup(0, 0, new PublicKey('0x00')),