Concepts
Patch
Mutate any field on any cloned account before or between transactions. The patch engine is IDL-aware for Anchor and uses native layouts for SPL Token and Token-2022.
Three modes
- IDL field set. Anchor accounts decoded against the stored IDL, field-level setter, re-encoded with discriminator preserved.
- Native layout. SPL Token mint authority, Token-2022 extensions, lookup table addresses, all addressed by named field.
- Raw splice. Byte offset + length + new bytes. Final escape hatch for non-Anchor, non-native data.
Scope
Patches live at two scopes. project patches auto-apply to every session in the project on creation or reset. session patches apply only to one session and disappear on reset.
terminal
# project-scoped: every session sees this pnpm cli patch set pool.admin --project <pid> \ --account <poolPda> --value <walletPubkey> # session-scoped: scratch mutation pnpm cli patch set vault.balance --session <sid> \ --account <vaultPda> --value 1000000000
IDL field example
Patch a Meteora DLMM pool admin to your local wallet. Reley decodes the account, sets admin to the new pubkey, re-encodes, and writes the new buffer back to the SVM sandbox account store.
output
$ reley patch pool --set admin=$W using IDL meteora_dlmm@0.30.1 field admin: PublicKey encoded 32B ✓ patch staged · scope: project · auto-apply on reset
Native layout example
output
$ reley patch mint --set mintAuthority=$W --account <USDC> using layout spl_token::Mint v1 field mintAuthority: COption<Pubkey> ✓ USDC mintable to wallet $W in session 'main'
note
Patches are not transactions. They mutate the SVM sandbox account store directly. Use them to set up preconditions; use transactions to test the code paths your program actually runs.