Expand description
§jiminy-core
Account layout, validation, math, PDA, and all the zero-copy primitives your pinocchio program needs before it touches a token.
This is the systems layer. Everything here works with raw AccountView
bytes and has zero dependencies beyond pinocchio itself. If your program
never calls SPL Token, this crate is all you need.
ⓘ
use jiminy_core::prelude::*;§Modules
| Module | |
|---|---|
account | Header, reader, writer, cursor, lifecycle, pod, overlay, collection, list, bits |
abi | Alignment-1 LE field types (LeU64, LeBool, …) and borrow-splitting refs |
check | Validation checks, asserts, PDA derivation & verification |
compat | Optional solana-zero-copy integration (feature: solana-zero-copy) |
instruction | Transaction introspection (sysvar Instructions) |
interface | Cross-program ABI interfaces (jiminy_interface!) |
math | Checked arithmetic, BPS, scaling |
sysvar | Clock & Rent sysvar readers |
state | State machine transition checks |
time | Deadline, cooldown, staleness checks |
event | Zero-alloc event emission via sol_log_data |
programs | Well-known program IDs (feature: programs) |
§Macros
All macros are declarative (macro_rules!). No proc macros.
| Macro | |
|---|---|
require! | if !cond { return Err(e) } – the universal guard |
require_keys_eq! | Two addresses must match |
check_accounts_unique! | Pairwise uniqueness for any N accounts |
error_codes! | Define numbered error codes without a proc macro |
instruction_dispatch! | Byte-tag instruction routing |
jiminy_interface! | Read-only interface for foreign program accounts |
impl_pod! | Batch unsafe impl Pod |
segmented_layout! | Fixed prefix + dynamic segments for variable-length accounts |
§What does NOT belong here
Token/mint readers, Token-2022 screening, CPI guards, Ed25519, Merkle,
oracles, AMM math, lending, staking, vesting – see jiminy-solana,
jiminy-finance, and other domain crates.
Re-exports§
pub use pinocchio;
Modules§
- abi
- Jiminy ABI field primitives — alignment-1 wire types.
- account
- Account-centric types: header, zero-copy IO, lifecycle, POD, iteration.
- check
- Account and instruction validation checks.
- compat
- Compatibility modules for optional external crate integrations.
- event
- Zero-alloc event emission via
sol_log_data. - instruction
- Unified instruction access via Sysvar Instructions.
- interface
- Cross-program ABI interface for read-only foreign account access.
- math
- prelude
- Convenience re-exports for the common jiminy-core usage pattern.
- programs
- state
- State machine transition checks.
- sysvar
- Zero-copy sysvar readers.
- time
- Time and deadline constraint checks for DeFi programs.
Macros§
- check_
account - Composable account constraint macro.
- check_
account_ strict - Strict account validation. Like
check_account!but requiresowner,disc, andlayout_idas the first three arguments. Forgetting any of them is a compile error. - check_
accounts_ unique - Verify that all passed accounts have unique addresses.
- close_
account - Close a Jiminy account: transfer lamports and write close sentinel.
- derive_
ata_ const - Derive an ATA address at compile time. Requires known bump.
- derive_
pda - Derive a PDA with a known bump. Cheap (~100 CU, no curve check).
- derive_
pda_ const - Derive a PDA at compile time. Requires
constseeds and bump. - emit
- Emit byte slices as a structured event log entry.
- error_
codes - Define numbered program error codes that map to
ProgramError::Custom. - find_
pda - Find a PDA and return
(Address, u8)with the canonical bump. - impl_
pod - Implement
Podfor a list of types in one shot. - init_
account - Initialize a Jiminy account: CPI CreateAccount, zero-init, write header.
- instruction_
dispatch - Route instruction data to handler functions based on a single-byte tag.
- jiminy_
interface - Declare a read-only interface for a foreign program’s account layout.
- require
- Require a boolean condition: return
$err(converted viaInto) if false. - require_
accounts_ ne - Require two accounts to have different addresses.
- require_
eq - Require
a == bfor scalar types. - require_
flag - Require bit
nto be set in$byte, else return$err. - require_
gt - Require
a > b. - require_
gte - Require
a >= b. - require_
keys_ eq - Require two
Addressvalues to be equal. - require_
keys_ neq - Require two
Addressvalues to be different. - require_
lt - Require
a < b. - require_
lte - Require
a <= b. - require_
neq - Require
a != bfor scalar types. - require_
pda - Derive a PDA from seeds, verify the account matches, and return the bump.
- segmented_
layout - Declare a segmented zero-copy account layout.
- zero_
copy_ layout - Declare a zero-copy account layout with typed field accessors.
Structs§
- Account
View - Wrapper struct for a
RuntimeAccount. - Address
- The address of a Solana account.
Enums§
- Program
Error - Reasons the program may fail