Crate hpl_events
source ·Modules
Macros
- Defines the program’s ID. This should be used at the root of all Anchor based programs.
- Logs an event that can be subscribed to by clients. Uses the
sol_log_data
syscall which results in the following log: - Returns with the given error. Use this with a custom error type.
- Generates an
Error::AnchorError
that includes file and line information. - Print a message to the log.
- Ensures a condition is true, otherwise returns with the given error. Use this with or without a custom error type.
- Ensures two NON-PUBKEY values are equal.
- Ensures the first NON-PUBKEY value is greater than the second NON-PUBKEY value.
- Ensures the first NON-PUBKEY value is greater than or equal to the second NON-PUBKEY value.
- Ensures two pubkeys values are equal.
- Ensures two pubkeys are not equal.
- Ensures two NON-PUBKEY values are not equal.
- Creates a
Source
Structs
- Wrapper around
AccountInfo
that verifies program ownership and deserializes underlying data into a Rust type. - Account information
- Type facilitating on demand zero copy deserialization.
- Describes a single account read or written by a program during instruction execution.
- A representation of network time.
- Provides non-argument inputs to the program.
- Context specifying non-argument inputs for cross-program-invocations.
- Instructions sysvar, dummy type.
- Type validating that the account is one of a set of given Programs
- Wrapper around
AccountInfo
that verifies program ownership and deserializes underlying data into a Rust type. - Type validating that the account is the given Program
- The address of a Solana account.
- Configuration of network rent.
- Type validating that the account signed the transaction. No other ownership or type checks are done. If this is used, one should not try to access the underlying account data.
- A bitvector indicating which slots are present in the past epoch.
- Type validating that the account is owned by the system program
- Type validating that the account is a sysvar and deserializing it.
- Explicit wrapper for AccountInfo types to emphasize that no checks are performed
Enums
- Error codes that can be returned by internal framework code.
- Reasons the program may fail
- Upgradeable loader account states
Constants
- The starting point for user defined error codes.
Statics
- The static program ID
Traits
- A data structure that can be deserialized and stored into account storage, i.e. an
AccountInfo
’s mutable data slice. - A data structure that can be serialized and stored into account storage, i.e. an
AccountInfo
’s mutable data slice. - A data structure of validated accounts that can be deserialized from the input to a Solana program. Implementations of this trait should perform any and all requisite constraint checks on accounts to ensure the accounts maintain any invariants required for the program to run securely. In most cases, it’s recommended to use the
Accounts
derive macro to implement this trait. - The close procedure to initiate garabage collection of an account, allowing one to retrieve the rent exemption.
- The exit procedure for an account. Any cleanup or persistence to storage should be done here.
- A data-structure that can be de-serialized from binary format by NBOR.
- A data-structure that can be serialized into binary format by NBOR.
- Defines the id of a program.
- Defines the Pubkey of an account.
- Lamports related utility methods for accounts.
- Defines an address expected to own an account.
- A type that holds sysvar data.
- Defines the space of an account for initialization.
- Transformation to an
AccountInfo
struct. - Transformation to
AccountInfo
structs. - Transformation to
AccountMeta
structs.
Functions
- Confirms that a given pubkey is equivalent to the program ID
- Safety
- Returns the program ID
- Convenience function for accessing the next item in an
AccountInfo
iterator.
Type Aliases
Attribute Macros
- Executes the given access control method before running the decorated instruction handler. Any method in scope of the attribute can be invoked with any arguments from the associated instruction handler.
- An attribute for a data structure representing a Solana account.
- A marker attribute used to mark const values that should be included in the generated IDL but functionally does nothing.
- Generates
Error
andtype Result<T> = Result<T, Error>
types to be used as return types from Anchor instruction handlers. Importantly, the attribute implementsFrom
on theErrorCode
to support converting from the user defined error enum into the generatedError
. - The
#[program]
attribute defines the module containing all instruction handlers defining all entries into a Solana program. - A data structure that can be used as an internal field for a zero copy deserialized account, i.e., a struct marked with
#[account(zero_copy)]
.