Skip to main content

AccumulateClient

Struct AccumulateClient 

Source
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: AccOptions

Implementations§

Source§

impl AccumulateClient

Source

pub async fn new_with_options( v2_url: Url, v3_url: Url, options: AccOptions, ) -> Result<Self, JsonRpcError>

Create a new client with custom options

Source

pub async fn status(&self) -> Result<StatusResponse, JsonRpcError>

Get node status

Source

pub async fn query_tx( &self, hash: &str, ) -> Result<TransactionResponse, JsonRpcError>

Query transaction by hash

Source

pub async fn query_account(&self, url: &str) -> Result<Account, JsonRpcError>

Query account by URL

Source

pub async fn faucet( &self, account_url: &str, ) -> Result<FaucetResponse, JsonRpcError>

Request tokens from faucet (DevNet/TestNet only)

Source

pub async fn submit_v2( &self, tx: &Value, ) -> Result<TransactionResponse, JsonRpcError>

Submit a transaction to V2 API

Source

pub async fn submit( &self, envelope: &TransactionEnvelope, ) -> Result<V3SubmitResponse, JsonRpcError>

Submit a single transaction to V3 API

Source

pub async fn submit_multi( &self, envelopes: &[TransactionEnvelope], ) -> Result<Vec<V3SubmitResponse>, JsonRpcError>

Submit multiple transactions to V3 API

Source

pub async fn query( &self, url: &str, ) -> Result<QueryResponse<Account>, JsonRpcError>

Query using V3 API

Source

pub async fn query_block( &self, height: i64, ) -> Result<QueryResponse<Value>, JsonRpcError>

Query block by height using V3 API

Source

pub async fn node_info( &self, opts: NodeInfoOptions, ) -> Result<V3NodeInfo, JsonRpcError>

Get node information (V3 API)

Source

pub async fn find_service( &self, opts: FindServiceOptions, ) -> Result<Vec<FindServiceResult>, JsonRpcError>

Find services in the network (V3 API)

Source

pub async fn consensus_status( &self, opts: ConsensusStatusOptions, ) -> Result<V3ConsensusStatus, JsonRpcError>

Get consensus status (V3 API)

Source

pub async fn network_status( &self, opts: NetworkStatusOptions, ) -> Result<V3NetworkStatus, JsonRpcError>

Get network status (V3 API)

Source

pub async fn metrics( &self, opts: MetricsOptions, ) -> Result<V3Metrics, JsonRpcError>

Get network metrics (V3 API)

Source

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

Source

pub async fn list_snapshots( &self, opts: ListSnapshotsOptions, ) -> Result<Vec<V3SnapshotInfo>, JsonRpcError>

List available snapshots (V3 API)

Source

pub async fn submit_with_options( &self, envelope: &TransactionEnvelope, opts: SubmitOptions, ) -> Result<Vec<V3Submission>, JsonRpcError>

Submit a transaction with options (V3 API)

Source

pub async fn faucet_v3( &self, account_url: &str, opts: V3FaucetOptions, ) -> Result<V3Submission, JsonRpcError>

Request tokens from faucet with options (V3 API)

Source

pub async fn query_advanced( &self, url: &str, query: &V3Query, ) -> Result<QueryResponse<Value>, JsonRpcError>

Query using advanced query types (V3 API)

Source

pub async fn query_chain( &self, url: &str, query: ChainQuery, ) -> Result<QueryResponse<Value>, JsonRpcError>

Query chain data for an account (V3 API)

Source

pub async fn query_data( &self, url: &str, query: DataQuery, ) -> Result<QueryResponse<Value>, JsonRpcError>

Query data entries for a data account (V3 API)

Source

pub async fn query_directory( &self, url: &str, query: DirectoryQuery, ) -> Result<QueryResponse<Value>, JsonRpcError>

Query directory (sub-accounts) of an identity (V3 API)

Source

pub async fn query_pending( &self, url: &str, query: PendingQuery, ) -> Result<QueryResponse<Value>, JsonRpcError>

Query pending transactions for an account (V3 API)

Source

pub async fn query_block_v3( &self, url: &str, query: BlockQuery, ) -> Result<QueryResponse<Value>, JsonRpcError>

Query block information (V3 API - advanced)

Source

pub async fn search_anchor( &self, query: AnchorSearchQuery, ) -> Result<QueryResponse<Value>, JsonRpcError>

Search by anchor hash (V3 API)

Source

pub async fn search_public_key( &self, query: PublicKeySearchQuery, ) -> Result<QueryResponse<Value>, JsonRpcError>

Search signers by public key (V3 API)

Source

pub async fn search_public_key_hash( &self, query: PublicKeyHashSearchQuery, ) -> Result<QueryResponse<Value>, JsonRpcError>

Search signers by public key hash (V3 API)

Source

pub async fn search_delegate( &self, query: DelegateSearchQuery, ) -> Result<QueryResponse<Value>, JsonRpcError>

Search for delegated keys (V3 API)

Source

pub async fn search_message_hash( &self, query: MessageHashSearchQuery, ) -> Result<QueryResponse<Value>, JsonRpcError>

Search by message/transaction hash (V3 API)

Source

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)

Source

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 transaction
  • tx_body - The transaction body as a JSON Value
  • keypair - The Ed25519 signing key
§Returns

A signed transaction envelope compatible with binary encoding

Source

pub fn encode_envelope( &self, envelope: &CodecTransactionEnvelope, ) -> Result<Vec<u8>, JsonRpcError>

Encode transaction envelope to binary using codec

Source

pub fn decode_envelope( &self, data: &[u8], ) -> Result<CodecTransactionEnvelope, JsonRpcError>

Decode transaction envelope from binary using codec

Source

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)

Source

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)

Source

pub fn get_urls(&self) -> (String, String)

Get the base URLs for V2 and V3 clients

Source

pub fn validate_account_url(url: &str) -> bool

Validate account URL format

Source

pub fn create_token_transfer( &self, from: &str, to: &str, amount: u64, token_url: Option<&str>, ) -> Value

Create a simple token transfer transaction body

Source

pub fn create_account( &self, url: &str, public_key: &[u8], _account_type: &str, ) -> Value

Create account creation transaction body

Source§

impl AccumulateClient

Source

pub async fn from_endpoints(v2: Url, v3: Url, opts: AccOptions) -> Result<Self>

Create a new client from explicit V2 and V3 endpoints

Source

pub async fn from_env() -> Result<Self>

Create a new client from environment variables

Reads the following environment variables:

  • ACCUMULATE_V2_URL: V2 endpoint URL
  • ACCUMULATE_V3_URL: V3 endpoint URL
  • ACCUMULATE_TIMEOUT_MS: Request timeout in milliseconds (optional, defaults to 30000)
Source

pub async fn devnet(opts: AccOptions) -> Result<Self>

Create a client configured for DevNet

Source

pub async fn testnet(opts: AccOptions) -> Result<Self>

Create a client configured for TestNet

Source

pub async fn mainnet(opts: AccOptions) -> Result<Self>

Create a client configured for MainNet

Source

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

Source§

fn clone(&self) -> AccumulateClient

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

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

Performs copy-assignment from source. Read more
Source§

impl Debug for AccumulateClient

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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, 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> 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<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, 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> ErasedDestructor for T
where T: 'static,