Add StakeInstruction::AuthorizeWithSeed (#11700) (#11779)

* 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

(cherry picked from commit f02a78d8ff)

Co-authored-by: Greg Fitzgerald <greg@solana.com>
This commit is contained in:
mergify[bot]
2020-08-21 19:39:36 +00:00
committed by GitHub
parent 4be9d5030d
commit 6775e01747
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;