Add StakeInstruction::AuthorizeWithSeed (#11700)

* Add StakeInstruction::AuthorizeWithSeed

* chore: add authorize-with-seed to web.js

* fix: add address_owner

* Add SystemInstruction::TransferWithSeed

* Update ABI hash

* chore: better variable names

* Add AuthorizeWithSeedArgs

* Reorder and rename arguments for clarity
This commit is contained in:
Greg Fitzgerald
2020-08-21 12:28:01 -06:00
committed by GitHub
parent 247f27af37
commit f02a78d8ff
9 changed files with 469 additions and 40 deletions

View File

@ -128,6 +128,27 @@ test('authorize', () => {
expect(params).toEqual(StakeInstruction.decodeAuthorize(stakeInstruction));
});
test('authorizeWithSeed', () => {
const stakePubkey = new Account().publicKey;
const authorityBase = new Account().publicKey;
const authoritySeed = 'test string';
const authorityOwner = new Account().publicKey;
const newAuthorizedPubkey = new Account().publicKey;
const stakeAuthorizationType = StakeAuthorizationLayout.Staker;
const params = {
stakePubkey,
authorityBase,
authoritySeed,
authorityOwner,
newAuthorizedPubkey,
stakeAuthorizationType,
};
const transaction = StakeProgram.authorizeWithSeed(params);
expect(transaction.instructions).toHaveLength(1);
const [stakeInstruction] = transaction.instructions;
expect(params).toEqual(StakeInstruction.decodeAuthorizeWithSeed(stakeInstruction));
});
test('split', () => {
const stakePubkey = new Account().publicKey;
const authorizedPubkey = new Account().publicKey;