pub struct AccumulateClient {
pub v2_client: JsonRpcClient,
pub v3_client: JsonRpcClient,
pub options: AccOptions,
}Expand description
Main client for Accumulate blockchain API
Fields§
§v2_client: JsonRpcClient§v3_client: JsonRpcClient§options: AccOptionsImplementations§
Source§impl AccumulateClient
impl AccumulateClient
Sourcepub async fn new_with_options(
v2_url: Url,
v3_url: Url,
options: AccOptions,
) -> Result<Self, JsonRpcError>
pub async fn new_with_options( v2_url: Url, v3_url: Url, options: AccOptions, ) -> Result<Self, JsonRpcError>
Create a new client with custom options
Sourcepub async fn status(&self) -> Result<StatusResponse, JsonRpcError>
pub async fn status(&self) -> Result<StatusResponse, JsonRpcError>
Get node status
Sourcepub async fn query_tx(
&self,
hash: &str,
) -> Result<TransactionResponse, JsonRpcError>
pub async fn query_tx( &self, hash: &str, ) -> Result<TransactionResponse, JsonRpcError>
Query transaction by hash
Sourcepub async fn query_account(&self, url: &str) -> Result<Account, JsonRpcError>
pub async fn query_account(&self, url: &str) -> Result<Account, JsonRpcError>
Query account by URL
Sourcepub async fn faucet(
&self,
account_url: &str,
) -> Result<FaucetResponse, JsonRpcError>
pub async fn faucet( &self, account_url: &str, ) -> Result<FaucetResponse, JsonRpcError>
Request tokens from faucet (DevNet/TestNet only)
Sourcepub async fn submit_v2(
&self,
tx: &Value,
) -> Result<TransactionResponse, JsonRpcError>
pub async fn submit_v2( &self, tx: &Value, ) -> Result<TransactionResponse, JsonRpcError>
Submit a transaction to V2 API
Sourcepub async fn submit(
&self,
envelope: &TransactionEnvelope,
) -> Result<V3SubmitResponse, JsonRpcError>
pub async fn submit( &self, envelope: &TransactionEnvelope, ) -> Result<V3SubmitResponse, JsonRpcError>
Submit a single transaction to V3 API
Sourcepub async fn submit_multi(
&self,
envelopes: &[TransactionEnvelope],
) -> Result<Vec<V3SubmitResponse>, JsonRpcError>
pub async fn submit_multi( &self, envelopes: &[TransactionEnvelope], ) -> Result<Vec<V3SubmitResponse>, JsonRpcError>
Submit multiple transactions to V3 API
Sourcepub async fn query(
&self,
url: &str,
) -> Result<QueryResponse<Account>, JsonRpcError>
pub async fn query( &self, url: &str, ) -> Result<QueryResponse<Account>, JsonRpcError>
Query using V3 API
Sourcepub async fn query_block(
&self,
height: i64,
) -> Result<QueryResponse<Value>, JsonRpcError>
pub async fn query_block( &self, height: i64, ) -> Result<QueryResponse<Value>, JsonRpcError>
Query block by height using V3 API
Sourcepub async fn node_info(
&self,
opts: NodeInfoOptions,
) -> Result<V3NodeInfo, JsonRpcError>
pub async fn node_info( &self, opts: NodeInfoOptions, ) -> Result<V3NodeInfo, JsonRpcError>
Get node information (V3 API)
Sourcepub async fn find_service(
&self,
opts: FindServiceOptions,
) -> Result<Vec<FindServiceResult>, JsonRpcError>
pub async fn find_service( &self, opts: FindServiceOptions, ) -> Result<Vec<FindServiceResult>, JsonRpcError>
Find services in the network (V3 API)
Sourcepub async fn consensus_status(
&self,
opts: ConsensusStatusOptions,
) -> Result<V3ConsensusStatus, JsonRpcError>
pub async fn consensus_status( &self, opts: ConsensusStatusOptions, ) -> Result<V3ConsensusStatus, JsonRpcError>
Get consensus status (V3 API)
Sourcepub async fn network_status(
&self,
opts: NetworkStatusOptions,
) -> Result<V3NetworkStatus, JsonRpcError>
pub async fn network_status( &self, opts: NetworkStatusOptions, ) -> Result<V3NetworkStatus, JsonRpcError>
Get network status (V3 API)
Sourcepub async fn metrics(
&self,
opts: MetricsOptions,
) -> Result<V3Metrics, JsonRpcError>
pub async fn metrics( &self, opts: MetricsOptions, ) -> Result<V3Metrics, JsonRpcError>
Get network metrics (V3 API)
Sourcepub async fn validate(
&self,
envelope: &TransactionEnvelope,
opts: ValidateOptions,
) -> Result<Vec<V3Submission>, JsonRpcError>
pub async fn validate( &self, envelope: &TransactionEnvelope, opts: ValidateOptions, ) -> Result<Vec<V3Submission>, JsonRpcError>
Validate a transaction envelope without submitting (V3 API) Returns the expected result of the transaction
Sourcepub async fn list_snapshots(
&self,
opts: ListSnapshotsOptions,
) -> Result<Vec<V3SnapshotInfo>, JsonRpcError>
pub async fn list_snapshots( &self, opts: ListSnapshotsOptions, ) -> Result<Vec<V3SnapshotInfo>, JsonRpcError>
List available snapshots (V3 API)
Sourcepub async fn submit_with_options(
&self,
envelope: &TransactionEnvelope,
opts: SubmitOptions,
) -> Result<Vec<V3Submission>, JsonRpcError>
pub async fn submit_with_options( &self, envelope: &TransactionEnvelope, opts: SubmitOptions, ) -> Result<Vec<V3Submission>, JsonRpcError>
Submit a transaction with options (V3 API)
Sourcepub async fn faucet_v3(
&self,
account_url: &str,
opts: V3FaucetOptions,
) -> Result<V3Submission, JsonRpcError>
pub async fn faucet_v3( &self, account_url: &str, opts: V3FaucetOptions, ) -> Result<V3Submission, JsonRpcError>
Request tokens from faucet with options (V3 API)
Sourcepub async fn query_advanced(
&self,
url: &str,
query: &V3Query,
) -> Result<QueryResponse<Value>, JsonRpcError>
pub async fn query_advanced( &self, url: &str, query: &V3Query, ) -> Result<QueryResponse<Value>, JsonRpcError>
Query using advanced query types (V3 API)
Sourcepub async fn query_chain(
&self,
url: &str,
query: ChainQuery,
) -> Result<QueryResponse<Value>, JsonRpcError>
pub async fn query_chain( &self, url: &str, query: ChainQuery, ) -> Result<QueryResponse<Value>, JsonRpcError>
Query chain data for an account (V3 API)
Sourcepub async fn query_data(
&self,
url: &str,
query: DataQuery,
) -> Result<QueryResponse<Value>, JsonRpcError>
pub async fn query_data( &self, url: &str, query: DataQuery, ) -> Result<QueryResponse<Value>, JsonRpcError>
Query data entries for a data account (V3 API)
Sourcepub async fn query_directory(
&self,
url: &str,
query: DirectoryQuery,
) -> Result<QueryResponse<Value>, JsonRpcError>
pub async fn query_directory( &self, url: &str, query: DirectoryQuery, ) -> Result<QueryResponse<Value>, JsonRpcError>
Query directory (sub-accounts) of an identity (V3 API)
Sourcepub async fn query_pending(
&self,
url: &str,
query: PendingQuery,
) -> Result<QueryResponse<Value>, JsonRpcError>
pub async fn query_pending( &self, url: &str, query: PendingQuery, ) -> Result<QueryResponse<Value>, JsonRpcError>
Query pending transactions for an account (V3 API)
Sourcepub async fn query_block_v3(
&self,
url: &str,
query: BlockQuery,
) -> Result<QueryResponse<Value>, JsonRpcError>
pub async fn query_block_v3( &self, url: &str, query: BlockQuery, ) -> Result<QueryResponse<Value>, JsonRpcError>
Query block information (V3 API - advanced)
Sourcepub async fn search_anchor(
&self,
query: AnchorSearchQuery,
) -> Result<QueryResponse<Value>, JsonRpcError>
pub async fn search_anchor( &self, query: AnchorSearchQuery, ) -> Result<QueryResponse<Value>, JsonRpcError>
Search by anchor hash (V3 API)
Sourcepub async fn search_public_key(
&self,
query: PublicKeySearchQuery,
) -> Result<QueryResponse<Value>, JsonRpcError>
pub async fn search_public_key( &self, query: PublicKeySearchQuery, ) -> Result<QueryResponse<Value>, JsonRpcError>
Search signers by public key (V3 API)
Sourcepub async fn search_public_key_hash(
&self,
query: PublicKeyHashSearchQuery,
) -> Result<QueryResponse<Value>, JsonRpcError>
pub async fn search_public_key_hash( &self, query: PublicKeyHashSearchQuery, ) -> Result<QueryResponse<Value>, JsonRpcError>
Search signers by public key hash (V3 API)
Sourcepub async fn search_delegate(
&self,
query: DelegateSearchQuery,
) -> Result<QueryResponse<Value>, JsonRpcError>
pub async fn search_delegate( &self, query: DelegateSearchQuery, ) -> Result<QueryResponse<Value>, JsonRpcError>
Search for delegated keys (V3 API)
Sourcepub async fn search_message_hash(
&self,
query: MessageHashSearchQuery,
) -> Result<QueryResponse<Value>, JsonRpcError>
pub async fn search_message_hash( &self, query: MessageHashSearchQuery, ) -> Result<QueryResponse<Value>, JsonRpcError>
Search by message/transaction hash (V3 API)
Sourcepub fn create_envelope(
&self,
tx_body: &Value,
keypair: &SigningKey,
) -> Result<TransactionEnvelope, JsonRpcError>
pub fn create_envelope( &self, tx_body: &Value, keypair: &SigningKey, ) -> Result<TransactionEnvelope, JsonRpcError>
Create a signed transaction envelope for V3 Updated for ed25519-dalek v2.x API (uses SigningKey instead of Keypair)
Sourcepub fn create_envelope_binary_compatible(
&self,
principal: String,
tx_body: &Value,
keypair: &SigningKey,
) -> Result<CodecTransactionEnvelope, JsonRpcError>
pub fn create_envelope_binary_compatible( &self, principal: String, tx_body: &Value, keypair: &SigningKey, ) -> Result<CodecTransactionEnvelope, JsonRpcError>
Create a binary-encoded transaction envelope using codec for bit-for-bit TS parity
This method creates a transaction envelope that can be encoded to binary format matching the TypeScript SDK implementation exactly. Updated for ed25519-dalek v2.x API (uses SigningKey instead of Keypair)
§Arguments
principal- The principal account URL for the transactiontx_body- The transaction body as a JSON Valuekeypair- The Ed25519 signing key
§Returns
A signed transaction envelope compatible with binary encoding
Sourcepub fn encode_envelope(
&self,
envelope: &CodecTransactionEnvelope,
) -> Result<Vec<u8>, JsonRpcError>
pub fn encode_envelope( &self, envelope: &CodecTransactionEnvelope, ) -> Result<Vec<u8>, JsonRpcError>
Encode transaction envelope to binary using codec
Sourcepub fn decode_envelope(
&self,
data: &[u8],
) -> Result<CodecTransactionEnvelope, JsonRpcError>
pub fn decode_envelope( &self, data: &[u8], ) -> Result<CodecTransactionEnvelope, JsonRpcError>
Decode transaction envelope from binary using codec
Sourcepub fn generate_keypair() -> SigningKey
pub fn generate_keypair() -> SigningKey
Generate a new Ed25519 signing key using Ed25519Signer Updated for ed25519-dalek v2.x API (returns SigningKey instead of Keypair)
Sourcepub fn keypair_from_seed(seed: &[u8; 32]) -> Result<SigningKey, JsonRpcError>
pub fn keypair_from_seed(seed: &[u8; 32]) -> Result<SigningKey, JsonRpcError>
Create signing key from seed Updated for ed25519-dalek v2.x API (returns SigningKey instead of Keypair)
Sourcepub fn validate_account_url(url: &str) -> bool
pub fn validate_account_url(url: &str) -> bool
Validate account URL format
Source§impl AccumulateClient
impl AccumulateClient
Sourcepub async fn from_endpoints(v2: Url, v3: Url, opts: AccOptions) -> Result<Self>
pub async fn from_endpoints(v2: Url, v3: Url, opts: AccOptions) -> Result<Self>
Create a new client from explicit V2 and V3 endpoints
Sourcepub async fn from_env() -> Result<Self>
pub async fn from_env() -> Result<Self>
Create a new client from environment variables
Reads the following environment variables:
ACCUMULATE_V2_URL: V2 endpoint URLACCUMULATE_V3_URL: V3 endpoint URLACCUMULATE_TIMEOUT_MS: Request timeout in milliseconds (optional, defaults to 30000)
Sourcepub async fn devnet(opts: AccOptions) -> Result<Self>
pub async fn devnet(opts: AccOptions) -> Result<Self>
Create a client configured for DevNet
Sourcepub async fn testnet(opts: AccOptions) -> Result<Self>
pub async fn testnet(opts: AccOptions) -> Result<Self>
Create a client configured for TestNet
Sourcepub async fn mainnet(opts: AccOptions) -> Result<Self>
pub async fn mainnet(opts: AccOptions) -> Result<Self>
Create a client configured for MainNet
Sourcepub async fn custom(base_url: &str, opts: AccOptions) -> Result<Self>
pub async fn custom(base_url: &str, opts: AccOptions) -> Result<Self>
Create a client configured for a custom endpoint
Trait Implementations§
Source§impl Clone for AccumulateClient
impl Clone for AccumulateClient
Source§fn clone(&self) -> AccumulateClient
fn clone(&self) -> AccumulateClient
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more