Struct GolemBaseClient

Source
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

Source

pub async fn send_transaction( &self, tx: GolemBaseTransaction, ) -> Result<TransactionResult, Error>

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Source

pub fn get_reqwest_client(&self) -> ClientRef<'_>

Gets the underlying Reqwest client used for HTTP requests.

Source

pub fn get_owner_address(&self) -> Address

Gets the Ethereum address of the client owner.

Source

pub async fn get_chain_id(&self) -> Result<u64>

Gets the chain ID from the provider. Returns the chain ID as a u64.

Source

pub async fn get_balance(&self, account: Address) -> Result<BigDecimal>

Gets an account’s ETH balance as a BigDecimal.

Source

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.

Source

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>§

Source

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.

Source

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.

Source

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.

Source

pub async fn get_storage_value<T: TryFrom<Vec<u8>>>( &self, key: Hash, ) -> Result<T, Error>
where <T as TryFrom<Vec<u8>>>::Error: Display,

Gets the storage value associated with the given entity key. Decodes the value from base64 and attempts to convert it to the requested type.

Source

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.

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> GolemBaseClient

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Deref for GolemBaseClient

Source§

type Target = GolemBaseRoClient

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> TryClone for T
where T: Clone,

Source§

fn try_clone(&self) -> Result<T, Error>

Clones self, possibly returning an error.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,