pub struct ArkivRoClient { /* private fields */ }
Expand description
A client for interacting with the Arkiv system. Provides methods for account management, entity operations, balance queries, and event subscriptions.
§Example Usage
A client builder is provided for both ArkivClient
and ArkivRoClient
,
however, an instance of ArkivClient
can be dereferenced to ArkivRoClient
like so:
use arkiv_sdk::{ArkivClient, ArkivRoClient, PrivateKeySigner, Url};
let keypath = dirs::config_dir()
.ok_or("Failed to get config directory")?
.join("golembase")
.join("wallet.json");
let signer = PrivateKeySigner::decrypt_keystore(keypath, "password")?;
let url = Url::parse("http://localhost:8545")?;
let client = ArkivClient::builder()
.wallet(signer)
.rpc_url(url)
.build();
let ro_client: &ArkivRoClient = *client;
Implementations§
Source§impl ArkivRoClient
impl ArkivRoClient
Sourcepub async fn get_entity_count(&self) -> Result<u64, Error>
pub async fn get_entity_count(&self) -> Result<u64, Error>
Gets the total count of entities in Arkiv. Returns the number of entities currently stored.
Sourcepub async fn get_all_entity_keys(&self) -> Result<Vec<Hash>, Error>
pub async fn get_all_entity_keys(&self) -> Result<Vec<Hash>, Error>
Gets the entity keys of all entities in Arkiv. Returns a vector of all entity keys.
Sourcepub async fn get_entities_of_owner(
&self,
address: Address,
) -> Result<Vec<Hash>, Error>
pub async fn get_entities_of_owner( &self, address: Address, ) -> Result<Vec<Hash>, Error>
Gets the entity keys of all entities owned by the given address. Returns a vector of entity keys for the specified owner.
Sourcepub async fn get_storage_value<T: TryFrom<Vec<u8>>>(
&self,
key: Hash,
) -> Result<T, Error>
pub async fn get_storage_value<T: TryFrom<Vec<u8>>>( &self, key: Hash, ) -> Result<T, Error>
Gets the storage value associated with the given entity key. Decodes the value from base64 and attempts to convert it to the requested type.
Sourcepub async fn query_entities(
&self,
query: &str,
) -> Result<Vec<SearchResult>, Error>
pub async fn query_entities( &self, query: &str, ) -> Result<Vec<SearchResult>, Error>
Queries entities in Arkiv based on annotations.
Returns a vector of SearchResult
matching the query string.
Sourcepub async fn query_entity_keys(&self, query: &str) -> Result<Vec<Hash>, Error>
pub async fn query_entity_keys(&self, query: &str) -> Result<Vec<Hash>, Error>
Queries entities in Arkiv based on annotations and returns only their keys. Returns a vector of entity keys matching the query string.
Sourcepub async fn get_entities_to_expire_at_block(
&self,
block_number: u64,
) -> Result<Vec<Hash>, Error>
pub async fn get_entities_to_expire_at_block( &self, block_number: u64, ) -> Result<Vec<Hash>, Error>
Gets all entity keys for entities that will expire at the given block number. Returns a vector of entity keys expiring at the specified block.
Sourcepub async fn get_entity_metadata(
&self,
key: Hash,
) -> Result<EntityMetaData, Error>
pub async fn get_entity_metadata( &self, key: Hash, ) -> Result<EntityMetaData, Error>
Gets metadata for a specific entity.
Returns an EntityMetaData
struct for the given entity key.
Source§impl ArkivRoClient
impl ArkivRoClient
Sourcepub fn builder() -> ArkivRoClientBuilder
pub fn builder() -> ArkivRoClientBuilder
Creates a new builder for ArkivClient
with the given wallet and RPC URL.
Initializes the provider and sets up default configuration.
Trait Implementations§
Source§impl Clone for ArkivRoClient
impl Clone for ArkivRoClient
Source§fn clone(&self) -> ArkivRoClient
fn clone(&self) -> ArkivRoClient
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for ArkivRoClient
impl !RefUnwindSafe for ArkivRoClient
impl Send for ArkivRoClient
impl Sync for ArkivRoClient
impl Unpin for ArkivRoClient
impl !UnwindSafe for ArkivRoClient
Blanket Implementations§
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<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 more