setLockup static method
TransactionInstruction
setLockup({
- required Pubkey stakeAccount,
- required Pubkey authority,
- required LockupArgs lockup,
Set stake lockup.
If a lockup is not active, the withdraw authority may set a new lockup. If a lockup is active, the lockup custodian may update the lockup parameters.
Keys:
[w]
stakeAccount
- Initialized stake account.[s]
authority
- Lockup authority or withdraw authority.
Data:
lockup
Implementation
static TransactionInstruction setLockup({
// Keys
required final Pubkey stakeAccount,
required final Pubkey authority,
// Data
required final LockupArgs lockup,
}) {
// 0. `[w]` Initialized stake account
// 1. `[s]` Lockup authority or withdraw authority
final List<AccountMeta> keys = [
AccountMeta.writable(stakeAccount),
AccountMeta.signer(authority),
];
final List<Iterable<u8>> data = [
Lockup.codec.encode(lockup.toJson()),
];
return _instance.createTransactionIntruction(
StakeInstruction.setLockup,
keys: keys,
data: data,
);
}