fix: adding Merge decode function and making unit tests pass

This commit is contained in:
Alex Harley
2021-08-05 12:46:38 +02:00
committed by Tyera Eulberg
parent 4a6f63c750
commit 224adb7645
2 changed files with 33 additions and 2 deletions

View File

@ -220,6 +220,21 @@ describe('StakeProgram', () => {
expect(params).to.eql(StakeInstruction.decodeSplit(stakeInstruction));
});
it('merge', () => {
const stakePubkey = Keypair.generate().publicKey;
const sourceStakePubKey = Keypair.generate().publicKey;
const authorizedPubkey = Keypair.generate().publicKey;
const params = {
stakePubkey,
sourceStakePubKey,
authorizedPubkey,
};
const transaction = StakeProgram.merge(params);
expect(transaction.instructions).to.have.length(1);
const [stakeInstruction] = transaction.instructions;
expect(params).to.eql(StakeInstruction.decodeMerge(stakeInstruction));
});
it('withdraw', () => {
const stakePubkey = Keypair.generate().publicKey;
const authorizedPubkey = Keypair.generate().publicKey;