pub struct MinaClient { /* private fields */ }Expand description
Client for interacting with a Mina daemon via its GraphQL API.
§Examples
use mina_sdk::MinaClient;
let client = MinaClient::new("http://127.0.0.1:3085/graphql");
let status = client.get_sync_status().await?;
println!("Sync status: {status}");Implementations§
Source§impl MinaClient
impl MinaClient
Sourcepub fn with_config(config: ClientConfig) -> Self
pub fn with_config(config: ClientConfig) -> Self
Create a new client with custom configuration.
§Panics
Panics if retries is 0, retry_delay is negative, or timeout is zero.
Sourcepub async fn execute_query(
&self,
query: &str,
variables: Option<Value>,
query_name: &str,
) -> Result<Value>
pub async fn execute_query( &self, query: &str, variables: Option<Value>, query_name: &str, ) -> Result<Value>
Execute a raw GraphQL query and return the data field of the response.
This method is public to allow downstream crates (e.g. mina-perf-testing) to run custom queries through the same client with retry logic.
Sourcepub fn graphql_uri(&self) -> &str
pub fn graphql_uri(&self) -> &str
Get the GraphQL endpoint URI.
Sourcepub async fn get_sync_status(&self) -> Result<SyncStatus>
pub async fn get_sync_status(&self) -> Result<SyncStatus>
Get the node’s sync status.
Sourcepub async fn get_daemon_status(&self) -> Result<DaemonStatus>
pub async fn get_daemon_status(&self) -> Result<DaemonStatus>
Get comprehensive daemon status.
Sourcepub async fn get_network_id(&self) -> Result<String>
pub async fn get_network_id(&self) -> Result<String>
Get the network identifier.
Sourcepub async fn get_account(
&self,
public_key: &str,
token_id: Option<&str>,
) -> Result<AccountData>
pub async fn get_account( &self, public_key: &str, token_id: Option<&str>, ) -> Result<AccountData>
Get account data for a public key.
Sourcepub async fn get_best_chain(
&self,
max_length: Option<u32>,
) -> Result<Vec<BlockInfo>>
pub async fn get_best_chain( &self, max_length: Option<u32>, ) -> Result<Vec<BlockInfo>>
Get blocks from the best chain.
Sourcepub async fn get_pooled_user_commands(
&self,
public_key: Option<&str>,
) -> Result<Vec<PooledUserCommand>>
pub async fn get_pooled_user_commands( &self, public_key: Option<&str>, ) -> Result<Vec<PooledUserCommand>>
Get pending user commands from the transaction pool.
Sourcepub async fn send_payment(
&self,
sender: &str,
receiver: &str,
amount: Currency,
fee: Currency,
memo: Option<&str>,
nonce: Option<u64>,
) -> Result<SendPaymentResult>
pub async fn send_payment( &self, sender: &str, receiver: &str, amount: Currency, fee: Currency, memo: Option<&str>, nonce: Option<u64>, ) -> Result<SendPaymentResult>
Send a payment transaction.
Requires the sender’s account to be unlocked on the node.
Sourcepub async fn send_delegation(
&self,
sender: &str,
delegate_to: &str,
fee: Currency,
memo: Option<&str>,
nonce: Option<u64>,
) -> Result<SendDelegationResult>
pub async fn send_delegation( &self, sender: &str, delegate_to: &str, fee: Currency, memo: Option<&str>, nonce: Option<u64>, ) -> Result<SendDelegationResult>
Send a stake delegation transaction.
Requires the sender’s account to be unlocked on the node.
Sourcepub async fn set_snark_worker(
&self,
public_key: Option<&str>,
) -> Result<Option<String>>
pub async fn set_snark_worker( &self, public_key: Option<&str>, ) -> Result<Option<String>>
Set or unset the SNARK worker key.
Pass None to disable the SNARK worker.
Sourcepub async fn set_snark_work_fee(&self, fee: Currency) -> Result<String>
pub async fn set_snark_work_fee(&self, fee: Currency) -> Result<String>
Set the fee for SNARK work.