initializeChecked static method
Initialize a stake with authorization information.
This instruction is similar to initialize
except that the withdraw authority must be a
signer, and no lockup is applied to the account.
Keys:
[w]
stakeAccount
- Uninitialized stake account.[]
authority
- The stake authority.[s]
withdrawAuthority
- The withdraw authority.
Implementation
static TransactionInstruction initializeChecked({
required final Pubkey stakeAccount,
required final Pubkey authority,
required final Pubkey withdrawAuthority,
}) {
// `[w]` Uninitialized stake account
// `[]` Rent sysvar
// `[]` The stake authority
// `[s]` The withdraw authority
final List<AccountMeta> keys = [
AccountMeta.writable(stakeAccount),
AccountMeta(sysvarRentPubkey),
AccountMeta(authority),
AccountMeta.signer(withdrawAuthority),
];
return _instance.createTransactionIntruction(
StakeInstruction.initializeChecked,
keys: keys,
);
}