pub struct Client { /* private fields */ }Expand description
Lichen RPC client
Implementations§
Source§impl Client
impl Client
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Create a client using the LICHEN_RPC_URL env var, falling back to localhost:8899.
Sourcepub fn builder() -> ClientBuilder
pub fn builder() -> ClientBuilder
Create a client builder for custom configuration
Sourcepub async fn get_balance(&self, pubkey: &Pubkey) -> Result<Balance>
pub async fn get_balance(&self, pubkey: &Pubkey) -> Result<Balance>
Get account balance
Sourcepub async fn get_latest_block(&self) -> Result<Block>
pub async fn get_latest_block(&self) -> Result<Block>
Get latest block
Sourcepub async fn get_network_info(&self) -> Result<NetworkInfo>
pub async fn get_network_info(&self) -> Result<NetworkInfo>
Get network information
Sourcepub async fn get_validators(&self) -> Result<Vec<Value>>
pub async fn get_validators(&self) -> Result<Vec<Value>>
Get validators
Sourcepub async fn send_raw_transaction(&self, tx_base64: &str) -> Result<String>
pub async fn send_raw_transaction(&self, tx_base64: &str) -> Result<String>
Send raw transaction (base64-encoded bincode)
Sourcepub async fn send_transaction(&self, tx: &Transaction) -> Result<String>
pub async fn send_transaction(&self, tx: &Transaction) -> Result<String>
Send transaction (serializes with wire envelope and encodes automatically)
Sourcepub async fn get_transaction(&self, signature: &str) -> Result<Value>
pub async fn get_transaction(&self, signature: &str) -> Result<Value>
Get transaction by signature
Sourcepub async fn get_account_info(&self, pubkey: &Pubkey) -> Result<Value>
pub async fn get_account_info(&self, pubkey: &Pubkey) -> Result<Value>
Get account info
Sourcepub async fn get_transaction_history(
&self,
pubkey: &Pubkey,
limit: Option<u64>,
) -> Result<Value>
pub async fn get_transaction_history( &self, pubkey: &Pubkey, limit: Option<u64>, ) -> Result<Value>
Get transaction history for an account
Sourcepub async fn call_readonly_contract(
&self,
contract: &Pubkey,
function: &str,
args: Vec<u8>,
from: Option<&Pubkey>,
) -> Result<ReadonlyContractResult>
pub async fn call_readonly_contract( &self, contract: &Pubkey, function: &str, args: Vec<u8>, from: Option<&Pubkey>, ) -> Result<ReadonlyContractResult>
Execute a read-only contract call without submitting a transaction.
Sourcepub async fn get_recent_blockhash(&self) -> Result<String>
pub async fn get_recent_blockhash(&self) -> Result<String>
Get recent blockhash (for transaction building)
Sourcepub async fn get_validator_info(&self, pubkey: &Pubkey) -> Result<Value>
pub async fn get_validator_info(&self, pubkey: &Pubkey) -> Result<Value>
Get detailed validator information
Sourcepub async fn get_validator_performance(&self, pubkey: &Pubkey) -> Result<Value>
pub async fn get_validator_performance(&self, pubkey: &Pubkey) -> Result<Value>
Get validator performance metrics
Sourcepub async fn get_chain_status(&self) -> Result<Value>
pub async fn get_chain_status(&self) -> Result<Value>
Get comprehensive chain status
Sourcepub async fn stake(
&self,
staker: &Keypair,
validator: &Pubkey,
amount: u64,
) -> Result<String>
pub async fn stake( &self, staker: &Keypair, validator: &Pubkey, amount: u64, ) -> Result<String>
Create stake transaction
Sourcepub async fn unstake(
&self,
staker: &Keypair,
validator: &Pubkey,
amount: u64,
) -> Result<String>
pub async fn unstake( &self, staker: &Keypair, validator: &Pubkey, amount: u64, ) -> Result<String>
Create unstake transaction
Sourcepub async fn get_staking_status(&self, pubkey: &Pubkey) -> Result<Value>
pub async fn get_staking_status(&self, pubkey: &Pubkey) -> Result<Value>
Get staking status for an account
Sourcepub async fn get_staking_rewards(&self, pubkey: &Pubkey) -> Result<Value>
pub async fn get_staking_rewards(&self, pubkey: &Pubkey) -> Result<Value>
Get staking rewards for an account
Sourcepub async fn transfer(
&self,
from: &Keypair,
to: &Pubkey,
amount: u64,
) -> Result<String>
pub async fn transfer( &self, from: &Keypair, to: &Pubkey, amount: u64, ) -> Result<String>
Transfer native LICN (spores) from one account to another.
Sourcepub async fn deploy_contract(
&self,
deployer: &Keypair,
code: Vec<u8>,
init_data: Vec<u8>,
) -> Result<String>
pub async fn deploy_contract( &self, deployer: &Keypair, code: Vec<u8>, init_data: Vec<u8>, ) -> Result<String>
Deploy a WASM smart contract.
§Arguments
deployer- Deployer keypair (signer, pays deploy fee)code- WASM bytecode (must start with \0asm magic, max 512 KB)init_data- Optional initialization data passed to contract init
Sourcepub async fn call_contract(
&self,
caller: &Keypair,
contract: &Pubkey,
function: &str,
args: Vec<u8>,
value: u64,
) -> Result<String>
pub async fn call_contract( &self, caller: &Keypair, contract: &Pubkey, function: &str, args: Vec<u8>, value: u64, ) -> Result<String>
Call a function on a deployed WASM smart contract.
§Arguments
caller- Caller keypair (signer)contract- Contract account public keyfunction- Name of the contract function to invokeargs- Serialized function argumentsvalue- Native LICN to send with the call in spores
Sourcepub async fn upgrade_contract(
&self,
owner: &Keypair,
contract: &Pubkey,
code: Vec<u8>,
) -> Result<String>
pub async fn upgrade_contract( &self, owner: &Keypair, contract: &Pubkey, code: Vec<u8>, ) -> Result<String>
Upgrade a deployed WASM smart contract (owner only).
Sourcepub async fn get_metrics(&self) -> Result<Value>
pub async fn get_metrics(&self) -> Result<Value>
Get network metrics
Sourcepub async fn get_total_burned(&self) -> Result<Value>
pub async fn get_total_burned(&self) -> Result<Value>
Get total burned tokens
Sourcepub async fn get_contract_info(&self, contract_id: &Pubkey) -> Result<Value>
pub async fn get_contract_info(&self, contract_id: &Pubkey) -> Result<Value>
Get contract information
Sourcepub async fn get_contract_logs(&self, contract_id: &Pubkey) -> Result<Value>
pub async fn get_contract_logs(&self, contract_id: &Pubkey) -> Result<Value>
Get contract execution logs
Sourcepub async fn get_symbol_registry(&self, symbol: &str) -> Result<Value>
pub async fn get_symbol_registry(&self, symbol: &str) -> Result<Value>
Get a symbol-registry entry.
Sourcepub async fn get_lichenid_profile(&self, pubkey: &Pubkey) -> Result<Value>
pub async fn get_lichenid_profile(&self, pubkey: &Pubkey) -> Result<Value>
Get the complete LichenID profile for an address.
Sourcepub async fn get_lichenid_reputation(&self, pubkey: &Pubkey) -> Result<Value>
pub async fn get_lichenid_reputation(&self, pubkey: &Pubkey) -> Result<Value>
Get the LichenID reputation summary for an address.
Sourcepub async fn get_lichenid_skills(&self, pubkey: &Pubkey) -> Result<Value>
pub async fn get_lichenid_skills(&self, pubkey: &Pubkey) -> Result<Value>
Get LichenID skills for an address.
Sourcepub async fn get_lichenid_vouches(&self, pubkey: &Pubkey) -> Result<Value>
pub async fn get_lichenid_vouches(&self, pubkey: &Pubkey) -> Result<Value>
Get LichenID vouches for an address.
Sourcepub async fn resolve_lichen_name(&self, name: &str) -> Result<Value>
pub async fn resolve_lichen_name(&self, name: &str) -> Result<Value>
Resolve a .lichen name to its owner.
Sourcepub async fn get_name_auction(&self, name: &str) -> Result<Value>
pub async fn get_name_auction(&self, name: &str) -> Result<Value>
Get premium-name auction state for a .lichen label.
Sourcepub async fn get_lichenid_agent_directory(
&self,
options: Option<Value>,
) -> Result<Value>
pub async fn get_lichenid_agent_directory( &self, options: Option<Value>, ) -> Result<Value>
Get the LichenID agent directory.
Sourcepub async fn get_lichenid_stats(&self) -> Result<Value>
pub async fn get_lichenid_stats(&self) -> Result<Value>
Get aggregated LichenID statistics.
Sourcepub async fn get_sporepay_stats(&self) -> Result<Value>
pub async fn get_sporepay_stats(&self) -> Result<Value>
Get aggregated SporePay streaming statistics.
Sourcepub async fn get_lichenswap_stats(&self) -> Result<Value>
pub async fn get_lichenswap_stats(&self) -> Result<Value>
Get aggregated LichenSwap statistics.
Sourcepub async fn get_thalllend_stats(&self) -> Result<Value>
pub async fn get_thalllend_stats(&self) -> Result<Value>
Get aggregated ThallLend lending statistics.
Sourcepub async fn get_sporevault_stats(&self) -> Result<Value>
pub async fn get_sporevault_stats(&self) -> Result<Value>
Get aggregated SporeVault yield-vault statistics.
Sourcepub async fn get_neo_gas_rewards_stats(&self) -> Result<Value>
pub async fn get_neo_gas_rewards_stats(&self) -> Result<Value>
Get aggregated Neo GAS rewards vault statistics.
Sourcepub async fn get_neo_gas_rewards_position(
&self,
address: &Pubkey,
) -> Result<Value>
pub async fn get_neo_gas_rewards_position( &self, address: &Pubkey, ) -> Result<Value>
Get per-wallet Neo GAS rewards vault accounting.
Sourcepub async fn get_neo_zk_proof_service_status(&self) -> Result<Value>
pub async fn get_neo_zk_proof_service_status(&self) -> Result<Value>
Get Neo reserve/liability proof-service verifier metadata.
Sourcepub async fn verify_neo_reserve_liability_proof(
&self,
proof_envelope: Value,
) -> Result<Value>
pub async fn verify_neo_reserve_liability_proof( &self, proof_envelope: Value, ) -> Result<Value>
Verify a CLI-produced Neo reserve/liability proof envelope.
Sourcepub async fn get_bountyboard_stats(&self) -> Result<Value>
pub async fn get_bountyboard_stats(&self) -> Result<Value>
Get aggregated BountyBoard marketplace statistics.
pub async fn get_program(&self, program_id: &Pubkey) -> Result<Value>
pub async fn get_program_stats(&self, program_id: &Pubkey) -> Result<Value>
pub async fn get_programs(&self) -> Result<Value>
pub async fn get_program_calls(&self, program_id: &Pubkey) -> Result<Value>
pub async fn get_program_storage(&self, program_id: &Pubkey) -> Result<Value>
pub async fn get_collection(&self, collection_id: &Pubkey) -> Result<Value>
pub async fn get_nft( &self, collection_id: &Pubkey, token_id: u64, ) -> Result<Value>
pub async fn get_nfts_by_owner(&self, owner: &Pubkey) -> Result<Value>
pub async fn get_nfts_by_collection( &self, collection_id: &Pubkey, ) -> Result<Value>
pub async fn get_nft_activity( &self, collection_id: &Pubkey, token_id: u64, ) -> Result<Value>
Sourcepub async fn get_all_contracts(&self) -> Result<Value>
pub async fn get_all_contracts(&self) -> Result<Value>
Get all deployed contracts
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnsafeUnpin for Client
impl !UnwindSafe for Client
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.