Skip to content

Commit

Permalink
fix: align web3 stake split instruction constuction with rust
Browse files Browse the repository at this point in the history
  • Loading branch information
t-nelson committed Jul 10, 2020
1 parent e64d24d commit 7d58259
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/stake-program.js
Expand Up @@ -558,13 +558,12 @@ export class StakeProgram {
const {stakePubkey, authorizedPubkey, splitStakePubkey, lamports} = params;

let transaction = SystemProgram.createAccount({
fromPubkey: stakePubkey,
fromPubkey: authorizedPubkey,
newAccountPubkey: splitStakePubkey,
lamports: 0,
space: this.space,
programId: this.programId,
});
transaction.instructions[0].keys[0].isSigner = false;
const type = STAKE_INSTRUCTION_LAYOUTS.Split;
const data = encodeData(type, {lamports});

Expand Down
2 changes: 1 addition & 1 deletion test/stake-program.test.js
Expand Up @@ -142,7 +142,7 @@ test('split', () => {
expect(transaction.instructions).toHaveLength(2);
const [systemInstruction, stakeInstruction] = transaction.instructions;
const systemParams = {
fromPubkey: stakePubkey,
fromPubkey: authorizedPubkey,
newAccountPubkey: splitStakePubkey,
lamports: 0,
space: StakeProgram.space,
Expand Down

0 comments on commit 7d58259

Please sign in to comment.