StakeInstruction.withdraw constructor
StakeInstruction.withdraw({
- required Ed25519HDPublicKey stake,
- required Ed25519HDPublicKey recipient,
- required Ed25519HDPublicKey authority,
- required int lamports,
- Ed25519HDPublicKey? lockupAuthority,
Withdraw unstaked lamports from the stake account.
Implementation
factory StakeInstruction.withdraw({
required Ed25519HDPublicKey stake,
required Ed25519HDPublicKey recipient,
required Ed25519HDPublicKey authority,
required int lamports,
Ed25519HDPublicKey? lockupAuthority,
}) =>
StakeInstruction._(
accounts: [
AccountMeta.writeable(pubKey: stake, isSigner: false),
AccountMeta.writeable(pubKey: recipient, isSigner: false),
AccountMeta.readonly(
pubKey: Ed25519HDPublicKey.fromBase58(Sysvar.clock),
isSigner: false,
),
AccountMeta.readonly(
pubKey: Ed25519HDPublicKey.fromBase58(Sysvar.stakeHistory),
isSigner: false,
),
AccountMeta.readonly(
pubKey: authority,
isSigner: true,
),
if (lockupAuthority != null)
AccountMeta.readonly(
pubKey: lockupAuthority,
isSigner: true,
),
],
data: ByteArray.merge([
StakeProgram.withdrawInstructionIndex,
ByteArray.u64(lamports),
]),
);