Expand description
Batch account operations.
Common multi-account patterns as single methods with clearer intent and fewer repeated unsafe blocks.
Functions§
- close_
and_ transfer - Transfer all lamports from
sourcetodestinationand zero the source. - realloc_
checked - Checked realloc that also ensures the account remains rent-exempt after resizing.
- realloc_
checked_ with - Reaping-safe
realloc_checked: tops the account up to rent-exemption using the liveRentsysvar, so it stays correct after a rent reprice. - require_
account_ type - Assert that an account has the expected discriminator AND is owned by the given program. This two-check combo is the most common “is this the right account type?” pattern in Solana programs.
- require_
address - Assert that an account’s address matches an expected address.
- require_
rent_ exempt - Verify that an account is rent-exempt using the hardcoded current rent constants (the fast, syscall-free path).
- require_
rent_ exempt_ with - Verify that an account is rent-exempt against a live
crate::sysvar::Rentsysvar (RECOMMENDED for reaping-relevant checks). - require_
same_ address - Assert that two accounts have the same address.
- transfer_
lamports - Transfer
amountlamports between two accounts without CPI. - zero_
data - Zero the data bytes of an account without changing lamports or owner.