pub trait ProgramClient: Sized {
const PROGRAM_ID: Pubkey;
// Required methods
fn build_client(
program: Program<Arc<Keypair>>,
keypair: Arc<Keypair>,
) -> Self;
fn program(&self) -> &Program<Arc<Keypair>>;
fn keypair(&self) -> Arc<Keypair>;
// Provided methods
fn new_from_keypair(
cluster: Cluster,
keypair: Keypair,
config: CommitmentConfig,
) -> Result<Self> { ... }
fn send_v0_transaction<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
instructions: &'life1 [Instruction],
lookup_tables: &'life2 [AddressLookupTableAccount],
) -> Pin<Box<dyn Future<Output = Result<Signature>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn load_lst_registry<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(Vec<AccountMeta>, AddressLookupTableAccount)>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
fn load_lookup_table<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 Pubkey,
) -> Pin<Box<dyn Future<Output = Result<AddressLookupTableAccount>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn load_multiple_lookup_tables<'life0, 'life1, 'async_trait>(
&'life0 self,
pubkeys: &'life1 [Pubkey],
) -> Pin<Box<dyn Future<Output = Result<Vec<AddressLookupTableAccount>>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}Expand description
Abstracts the construction of client structs with anchor_client::Program.
Required Associated Constants§
const PROGRAM_ID: Pubkey
Required Methods§
fn build_client(program: Program<Arc<Keypair>>, keypair: Arc<Keypair>) -> Self
fn program(&self) -> &Program<Arc<Keypair>>
fn keypair(&self) -> Arc<Keypair>
Provided Methods§
Sourcefn new_from_keypair(
cluster: Cluster,
keypair: Keypair,
config: CommitmentConfig,
) -> Result<Self>
fn new_from_keypair( cluster: Cluster, keypair: Keypair, config: CommitmentConfig, ) -> Result<Self>
Sourcefn send_v0_transaction<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
instructions: &'life1 [Instruction],
lookup_tables: &'life2 [AddressLookupTableAccount],
) -> Pin<Box<dyn Future<Output = Result<Signature>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn send_v0_transaction<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
instructions: &'life1 [Instruction],
lookup_tables: &'life2 [AddressLookupTableAccount],
) -> Pin<Box<dyn Future<Output = Result<Signature>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Builds a versioned transaction from instructions and lookup tables.
§Errors
- Failed to get the latest blockhash
- Failed to compile the message
- Failed to create the transaction
- Failed to send the transaction
Sourcefn load_lst_registry<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(Vec<AccountMeta>, AddressLookupTableAccount)>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn load_lst_registry<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(Vec<AccountMeta>, AddressLookupTableAccount)>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Creates remaining_accounts array from LST registry table with all
headers writable.
§Errors
- Lookup table account doesn’t exist
- Malformed structure (preamble cannot be split at 16)
Sourcefn load_lookup_table<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 Pubkey,
) -> Pin<Box<dyn Future<Output = Result<AddressLookupTableAccount>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_lookup_table<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 Pubkey,
) -> Pin<Box<dyn Future<Output = Result<AddressLookupTableAccount>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Loads an address lookup table by public key.
§Errors
- Failed to fetch the account
- Failed to deserialize account data
Sourcefn load_multiple_lookup_tables<'life0, 'life1, 'async_trait>(
&'life0 self,
pubkeys: &'life1 [Pubkey],
) -> Pin<Box<dyn Future<Output = Result<Vec<AddressLookupTableAccount>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_multiple_lookup_tables<'life0, 'life1, 'async_trait>(
&'life0 self,
pubkeys: &'life1 [Pubkey],
) -> Pin<Box<dyn Future<Output = Result<Vec<AddressLookupTableAccount>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Loads address lookup tables at given addresses.
§Errors
- Failed to fetch lookup table account
- Failed to deserialize
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".