Expand description
Library for writing safer Solana programs.
Re-exports§
pub use validate::Validate;
Modules§
- assert
- Various assertions.
- prelude
- The prelude contains all commonly used components of the crate. All programs should include it via
use tensor_vipers::prelude::*;
. - validate
- Validations for accounts.
Macros§
- assert_
does_ not_ throw - Asserts that the given assertion block does not throw any errors.
- assert_
is_ ata - Asserts that the given anchor_spl::token::TokenAccount is an associated token account.
- assert_
is_ zero_ token_ account - Asserts that a token account is “zero”.
- assert_
keys Deprecated - Asserts that two accounts share the same key.
- assert_
keys_ eq - Asserts that two accounts share the same key.
- assert_
keys_ neq - Asserts that two accounts do not share the same key.
- assert_
owner Deprecated - Asserts that an account is owned by the given program.
- assert_
throws - Asserts that the given assertion block throws a specific error.
- format_
err - Formats an error as a
&str
. - invariant
- Asserts that an invariant holds, otherwise logs the given message.
This is a drop-in replacement for
require!
. - log_
code_ location - Logs where in the code the macro was invoked.
- program_
err - Returns the given error as a program error.
- test_
assertion - Runs a block, returning a [anchor_lang::prelude::Result<()>].
- throw_
err - Throws an error.
- try_
or_ err - Tries to unwrap the Result, otherwise returns the error
- unwrap_
bump - Unwraps a bump seed.
- unwrap_
checked - Unwraps the result of a block of checked integer math.
- unwrap_
int - Unwraps the result of a checked integer operation.
- unwrap_
opt - Attempts to unwrap an Option, and if it fails, prints an error.
- unwrap_
opt_ block - Unwraps a block which returns an Option.
- unwrap_
or_ err - Ensures an Option can be unwrapped, otherwise returns the error.
Structs§
- CmpError
- A comparable error: an error that can be compared (via equality) to other errors.
Enums§
- Vipers
Error - Vipers validation error.
Statics§
- ID
- The static program ID
Traits§
- AsKey
Ref - Defines the Pubkey of an account, fetching it as a reference.
- Into
CmpError - Conversions into a CmpError.
Functions§
- check_
id - Confirms that a given pubkey is equivalent to the program ID
- id
- Returns the program ID
- now
- Helper for getting the current timestamp as any convertible type.
- now_i64
- Helper for getting the current timestamp.
- validate_
derived_ address - Validates a derived program address.