pub struct GolemBaseClient { /* private fields */ }
Expand description
A client for interacting with the GolemBase system. Provides methods for account management, entity operations, balance queries, and event subscriptions.
Implementations§
Source§impl GolemBaseClient
impl GolemBaseClient
pub async fn send_transaction( &self, tx: GolemBaseTransaction, ) -> Result<TransactionResult, Error>
Sourcepub async fn create_entities(
&self,
creates: Vec<Create>,
) -> Result<Vec<EntityResult>, Error>
pub async fn create_entities( &self, creates: Vec<Create>, ) -> Result<Vec<EntityResult>, Error>
Creates one or more new entities in GolemBase and returns their results. Sends a transaction to the storage contract and parses the resulting logs.
Sourcepub async fn update_entities(
&self,
updates: Vec<Update>,
) -> Result<Vec<EntityResult>, Error>
pub async fn update_entities( &self, updates: Vec<Update>, ) -> Result<Vec<EntityResult>, Error>
Updates one or more entities in GolemBase and returns their results. Sends a transaction to the storage contract and parses the resulting logs.
Sourcepub async fn delete_entities(
&self,
deletes: Vec<Hash>,
) -> Result<Vec<DeleteResult>, Error>
pub async fn delete_entities( &self, deletes: Vec<Hash>, ) -> Result<Vec<DeleteResult>, Error>
Deletes one or more entities in GolemBase and returns their results. Sends a transaction to the storage contract and parses the resulting logs.
Sourcepub async fn extend_entities(
&self,
extensions: Vec<Extend>,
) -> Result<Vec<ExtendResult>, Error>
pub async fn extend_entities( &self, extensions: Vec<Extend>, ) -> Result<Vec<ExtendResult>, Error>
Extends the BTL (block time to live) of one or more entities and returns their results. Sends a transaction to the storage contract and parses the resulting logs for old and new expiration blocks.
Sourcepub async fn create_raw_transaction(
&self,
payload: GolemBaseTransaction,
) -> Result<TransactionReceipt, Error>
pub async fn create_raw_transaction( &self, payload: GolemBaseTransaction, ) -> Result<TransactionReceipt, Error>
Creates and sends a raw transaction to the GolemBase storage contract. Encodes the transaction payload and sends it to the contract address.
Source§impl GolemBaseClient
impl GolemBaseClient
Sourcepub fn get_reqwest_client(&self) -> ClientRef<'_>
pub fn get_reqwest_client(&self) -> ClientRef<'_>
Gets the underlying Reqwest client used for HTTP requests.
Sourcepub fn get_owner_address(&self) -> Address
pub fn get_owner_address(&self) -> Address
Gets the Ethereum address of the client owner.
Sourcepub async fn get_chain_id(&self) -> Result<u64>
pub async fn get_chain_id(&self) -> Result<u64>
Gets the chain ID from the provider.
Returns the chain ID as a u64
.
Sourcepub async fn get_balance(&self, account: Address) -> Result<BigDecimal>
pub async fn get_balance(&self, account: Address) -> Result<BigDecimal>
Gets an account’s ETH balance as a BigDecimal
.
Sourcepub async fn get_current_block_number(&self) -> Result<u64>
pub async fn get_current_block_number(&self) -> Result<u64>
Gets the current block number from the chain.
Returns the latest block number as a u64
.
Sourcepub fn builder() -> GolemBaseClientBuilder
pub fn builder() -> GolemBaseClientBuilder
Creates a new builder for GolemBaseClient
with the given wallet and RPC URL.
Initializes the provider and sets up default configuration.
Methods from Deref<Target = GolemBaseRoClient>§
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 GolemBase. 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 GolemBase. 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 GolemBase 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 GolemBase 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.
Trait Implementations§
Source§impl Clone for GolemBaseClient
impl Clone for GolemBaseClient
Source§fn clone(&self) -> GolemBaseClient
fn clone(&self) -> GolemBaseClient
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for GolemBaseClient
impl !RefUnwindSafe for GolemBaseClient
impl Send for GolemBaseClient
impl Sync for GolemBaseClient
impl Unpin for GolemBaseClient
impl !UnwindSafe for GolemBaseClient
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> 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