solData
criterion provides advanced validation of Solana transaction instruction data using Interface Definition Language (IDL) specifications. This criterion allows you to decode and validate instruction parameters against specific rules, ensuring that transactions meet precise requirements before signing.
A solData
criterion uses IDL specifications to identify which Solana programs to validate against and defines instruction-specific validation rules including instruction names and parameter constraints.
The idls
field specifies which programs to validate, while the conditions
field defines the validation rules.
The idls
field is a list that can include either:
bool
string
pubkey
u8
, u16
, u32
, u64
, u128
, u256
i8
, i16
, i32
, i64
, i128
, i256
f32
, f64
Program Type | Discriminator Format | Size | Example |
---|---|---|---|
SystemProgram | 4-byte little-endian u32 | 4 bytes | Transfer = [2,0,0,0] |
SPL Token | 1-byte enum index | 1 byte | Transfer = 3 |
Associated Token | Borsh-encoded enum | 1 byte | Create = 0 |
Anchor Programs | SHA256 hash of “global:instruction_name” | 8 bytes | transfer = [163,52,200,...] |
"SystemProgram"
- Native Solana system program"TokenProgram"
- SPL Token program"AssociatedTokenProgram"
- Associated Token Account programsolData
criteria allow you to validate specific instruction parameters against defined constraints.
==
, <=
, >=
, <
, >
, !=
) for single value comparison, or (in
, not in
) for list comparisonsAnchor-formatted instructions for the above policy examples:
@coral-xyz/anchor
).The SDK provides utilities for loading program IDLs, generating type-safe instruction builders, and creating properly formatted transactions, which can simplify the process of working with custom programs in your solData policies.solData
criterion enables sophisticated policy controls for any Solana program, from native system operations to complex DeFi protocols. By providing custom IDL specifications, you can validate instruction parameters for both your own programs and popular ecosystem protocols.
solData
policies provide granular control over inputs to your instruction parameters.