setLockupChecked static method
TransactionInstruction
setLockupChecked({
- required Pubkey stakeAccount,
- required Pubkey authority,
- required Pubkey? custodian,
- required LockupCheckedArgs lockup,
Set stake lockup.
This instruction behaves like SetLockup
with the additional requirement that the new lockup
authority also be a signer.
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.[s]
custodian
- New lockup authority (optional).
Implementation
static TransactionInstruction setLockupChecked({
// Keys
required final Pubkey stakeAccount,
required final Pubkey authority,
required final Pubkey? custodian,
// Data
required final LockupCheckedArgs lockup,
}) {
// 0. `[w]` Initialized stake account
// 1. `[s]` Lockup authority or withdraw authority
// 2. `[s]` New lockup authority (optional)
final List<AccountMeta> keys = [
AccountMeta.writable(stakeAccount),
AccountMeta.signer(authority),
if (custodian != null)
AccountMeta.signer(custodian),
];
final List<Iterable<u8>> data = [
LockupCheckedArgs.codec.encode(lockup.toJson()),
];
return _instance.createTransactionIntruction(
StakeInstruction.setLockupChecked,
keys: keys,
data: data,
);
}