Module program_id

Source

Re-exports§

pub use anchor_lang::solana_program;

Modules§

account_info
Account information.
address_lookup_table
The address lookup table program.
address_lookup_table_accountDeprecated
alt_bn128
big_mod_exp
blake3
Hashing with the blake3 hash function.
borsh
borsh0_9
Utilities for the borsh serialization format, version 0.9.
borsh0_10
Utilities for the borsh serialization format, version 0.10.
borsh1
Utilities for the borsh serialization format, version 1.
bpf_loader
The latest BPF loader native program.
bpf_loader_deprecated
The original and now deprecated Solana BPF loader.
bpf_loader_upgradeable
An upgradeable BPF loader native program.
clock
Information about the network’s clock, ticks, slots, etc.
compute_units
config
The config native program.
debug_account_data
Debug-formatting of account data.
decode_error
Converting custom error codes to enums.
ed25519_program
The ed25519 native program.
entrypoint
The Rust-based BPF program entrypoint supported by the latest BPF loader.
entrypoint_deprecated
The Rust-based BPF program entrypoint supported by the original BPF loader.
epoch_rewards
A type to hold data for the EpochRewards sysvar.
epoch_schedule
Configuration for epochs and slots.
feature
Runtime features.
fee_calculator
Calculation of transaction fees.
hash
Hashing with the SHA-256 hash function, and a general Hash type.
incinerator
A designated address for burning lamports.
instruction
Types for directing the execution of Solana programs.
keccak
Hashing with the keccak (SHA-3) hash function.
lamports
Defines the LamportsError type.
last_restart_slot
Information about the last restart slot (hard fork).
loader_instruction
Instructions for the non-upgradable BPF loader.
loader_upgradeable_instruction
Instructions for the upgradable BPF loader.
loader_v4
The v4 built-in loader program.
loader_v4_instruction
Instructions for the v4 built-in loader program.
log
Logging utilities for Rust-based Solana programs.
message
Sequences of Instructions executed within a single transaction.
native_token
Definitions for the native SOL token and its fractional lamports.
nonce
Durable transaction nonces.
poseidon
Hashing with the Poseidon hash function.
program
Cross-program invocation.
program_error
The ProgramError type and related definitions.
program_memory
Basic low-level memory operations.
program_option
A C representation of Rust’s Option, used across the FFI boundary for Solana program interfaces.
program_pack
The Pack serialization trait.
program_stubs
Implementations of syscalls used when solana-program is built for non-SBF targets.
program_utils
Contains a single utility function for deserializing from bincode.
pubkey
Solana account addresses.
rent
Configuration for network rent.
sanitize
A trait for sanitizing values and members of over the wire messages.
sdk_ids
A vector of Solana SDK IDs.
secp256k1_program
The secp256k1 native program.
secp256k1_recover
Public key recovery from secp256k1 ECDSA signatures.
serde_varint
Integers that serialize to variable size.
serialize_utils
Helpers for reading and writing bytes.
short_vec
Compact serde-encoding of vectors with small length.
slot_hashes
A type to hold data for the SlotHashes sysvar.
slot_history
A type to hold data for the SlotHistory sysvar.
stake
The stake native program.
stake_history
A type to hold data for the StakeHistory sysvar.
syscalls
Declarations of Solana program syscalls.
system_instruction
Instructions and constructors for the system program.
system_program
The system native program.
sysvar
Access to special accounts with dynamically-updated data.
thiserror
githubcrates-iodocs-rs
vote
The vote native program.

Macros§

custom_heap_default
Define the default global allocator.
custom_panic_default
Define the default global panic handler.
declare_deprecated_id
declare_deprecated_sysvar_id
Same as declare_sysvar_id except that it reports that this ID has been deprecated.
declare_id
Defines the program’s ID. This should be used at the root of all Anchor based programs.
declare_program
Declare an external program based on its IDL.
declare_sysvar_id
Declares an ID that implements SysvarId.
emit
Logs an event that can be subscribed to by clients. Uses the sol_log_data syscall which results in the following log:
entrypoint
Declare the program entrypoint and set up global handlers.
entrypoint_deprecated
Declare the program entrypoint.
err
Returns with the given error. Use this with a custom error type.
error
Generates an Error::AnchorError that includes file and line information.
impl_sysvar_get
Implements the Sysvar::get method for both SBF and host targets.
infoDeprecated
Print a message to the log.
msg
Print a message to the log.
pubkey
require
Ensures a condition is true, otherwise returns with the given error. Use this with or without a custom error type.
require_eq
Ensures two NON-PUBKEY values are equal.
require_gt
Ensures the first NON-PUBKEY value is greater than the second NON-PUBKEY value.
require_gte
Ensures the first NON-PUBKEY value is greater than or equal to the second NON-PUBKEY value.
require_keys_eq
Ensures two pubkeys values are equal.
require_keys_neq
Ensures two pubkeys are not equal.
require_neq
Ensures two NON-PUBKEY values are not equal.
source
Creates a Source
unchecked_div_by_const
Convenience macro for doing integer division where the operation’s safety can be checked at compile-time.

Structs§

Account
Wrapper around AccountInfo that verifies program ownership and deserializes underlying data into a Rust type.
AccountInfo
Account information
AccountLoader
Type facilitating on demand zero copy deserialization.
AccountMeta
Describes a single account read or written by a program during instruction execution.
AnchorError
Clock
A representation of network time.
Context
Provides non-argument inputs to the program.
CpiContext
Context specifying non-argument inputs for cross-program-invocations.
EpochSchedule
Instructions
Instructions sysvar, dummy type.
Interface
Type validating that the account is one of a set of given Programs
InterfaceAccount
Wrapper around AccountInfo that verifies program ownership and deserializes underlying data into a Rust type.
Program
Type validating that the account is the given Program
ProgramData
ProgramErrorWithOrigin
Pubkey
The address of a Solana account.
Rent
Configuration of network rent.
Rewards
SWITCHBOARD_ATTESTATION_PROGRAM_ID
SWITCHBOARD_PROGRAM_ID
Signer
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.
SlotHashes
SlotHistory
A bitvector indicating which slots are present in the past epoch.
Source
StakeHistory
System
SystemAccount
Type validating that the account is owned by the system program
Sysvar
Type validating that the account is a sysvar and deserializing it.
UncheckedAccount
Explicit wrapper for AccountInfo types to emphasize that no checks are performed

Enums§

ComparedValues
Error
ErrorCode
Error codes that can be returned by internal framework code.
ErrorOrigin
ProgramError
Reasons the program may fail
UpgradeableLoaderState
Upgradeable loader account states

Constants§

ERROR_CODE_OFFSET
The starting point for user defined error codes.

Traits§

AccountDeserialize
A data structure that can be deserialized and stored into account storage, i.e. an AccountInfo’s mutable data slice.
AccountSerialize
A data structure that can be serialized and stored into account storage, i.e. an AccountInfo’s mutable data slice.
Accounts
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.
AccountsClose
The close procedure to initiate garabage collection of an account, allowing one to retrieve the rent exemption.
AccountsExit
The exit procedure for an account. Any cleanup or persistence to storage should be done here.
AnchorDeserialize
A data-structure that can be de-serialized from binary format by NBOR.
AnchorSerialize
A data-structure that can be serialized into binary format by NBOR.
Id
Defines the id of a program.
Key
Defines the Pubkey of an account.
Lamports
Lamports related utility methods for accounts.
Owner
Defines an address expected to own an account.
SolanaSysvar
A type that holds sysvar data.
Space
Defines the space of an account for initialization.
ToAccountInfo
Transformation to an AccountInfo struct.
ToAccountInfos
Transformation to AccountInfo structs.
ToAccountMetas
Transformation to AccountMeta structs.

Functions§

next_account_info
Convenience function for accessing the next item in an AccountInfo iterator.

Type Aliases§

Result

Attribute Macros§

access_control
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.
account
An attribute for a data structure representing a Solana account.
constant
A marker attribute used to mark const values that should be included in the generated IDL but functionally does nothing.
error_code
Generates Error and type Result<T> = Result<T, Error> types to be used as return types from Anchor instruction handlers. Importantly, the attribute implements From on the ErrorCode to support converting from the user defined error enum into the generated Error.
event
The event attribute allows a struct to be used with emit! so that programs can log significant events in their programs that clients can subscribe to. Currently, this macro is for structs only.
program
The #[program] attribute defines the module containing all instruction handlers defining all entries into a Solana program.
wasm_bindgen
A list of all the attributes can be found here: https://rustwasm.github.io/docs/wasm-bindgen/reference/attributes/index.html
zero_copy
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)].

Derive Macros§

Accounts
Implements an Accounts deserializer on the given struct. Can provide further functionality through the use of attributes.
AnchorDeserialize
AnchorSerialize
InitSpace
Implements a Space trait on the given struct or enum.