fix: align web3 stake split instruction constuction with rust
This commit is contained in:
committed by
Trent Nelson
parent
a8b1d71ae6
commit
19813b0ab2
@ -558,13 +558,12 @@ export class StakeProgram {
|
|||||||
const {stakePubkey, authorizedPubkey, splitStakePubkey, lamports} = params;
|
const {stakePubkey, authorizedPubkey, splitStakePubkey, lamports} = params;
|
||||||
|
|
||||||
let transaction = SystemProgram.createAccount({
|
let transaction = SystemProgram.createAccount({
|
||||||
fromPubkey: stakePubkey,
|
fromPubkey: authorizedPubkey,
|
||||||
newAccountPubkey: splitStakePubkey,
|
newAccountPubkey: splitStakePubkey,
|
||||||
lamports: 0,
|
lamports: 0,
|
||||||
space: this.space,
|
space: this.space,
|
||||||
programId: this.programId,
|
programId: this.programId,
|
||||||
});
|
});
|
||||||
transaction.instructions[0].keys[0].isSigner = false;
|
|
||||||
const type = STAKE_INSTRUCTION_LAYOUTS.Split;
|
const type = STAKE_INSTRUCTION_LAYOUTS.Split;
|
||||||
const data = encodeData(type, {lamports});
|
const data = encodeData(type, {lamports});
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ test('split', () => {
|
|||||||
expect(transaction.instructions).toHaveLength(2);
|
expect(transaction.instructions).toHaveLength(2);
|
||||||
const [systemInstruction, stakeInstruction] = transaction.instructions;
|
const [systemInstruction, stakeInstruction] = transaction.instructions;
|
||||||
const systemParams = {
|
const systemParams = {
|
||||||
fromPubkey: stakePubkey,
|
fromPubkey: authorizedPubkey,
|
||||||
newAccountPubkey: splitStakePubkey,
|
newAccountPubkey: splitStakePubkey,
|
||||||
lamports: 0,
|
lamports: 0,
|
||||||
space: StakeProgram.space,
|
space: StakeProgram.space,
|
||||||
|
Reference in New Issue
Block a user