#json-rpc #unc #rpc #rpc-client #api #api-client #async

unc-jsonrpc-client

Lower-level API for interfacing with the unc Protocol via JSONRPC

11 releases (5 breaking)

new 0.10.2 May 15, 2024
0.10.0 May 8, 2024
0.7.3 Apr 12, 2024
0.6.1 Mar 21, 2024
0.1.0 Mar 6, 2024

#3 in #unc

Download history 232/week @ 2024-03-04 258/week @ 2024-03-11 272/week @ 2024-03-18 213/week @ 2024-04-01 332/week @ 2024-04-08 61/week @ 2024-04-15 13/week @ 2024-04-22 142/week @ 2024-05-06

229 downloads per month
Used in 5 crates (4 directly)

MIT/Apache and GPL-2.0-or-later

125KB
1.5K SLoC

unc-jsonrpc-client

Lower-level API for interfacing with the unc Protocol via JSONRPC.

Crates.io Documentation MIT or Apache 2.0 Licensed Dependency Status

Usage

Each one of the valid JSON RPC methods are defined in the methods module. For instance, to make a tx request, you start with the tx module and construct a request using the methods::tx::RpcTransactionStatusRequest struct.

use unc_jsonrpc_client::{methods, JsonRpcClient};
use unc_jsonrpc_primitives::types::transactions::TransactionInfo;

let mainnet_client = JsonRpcClient::connect("https://archival-rpc.mainnet.unc.org");

let tx_status_request = methods::tx::RpcTransactionStatusRequest {
    transaction_info: TransactionInfo::TransactionId {
        hash: "9FtHUFBQsZ2MG77K3x3MJ9wjX3UT8zE1TczCrhZEcG8U".parse()?,
        account_id: "miraclx.unc".parse()?,
    },
};

// call a method on the server via the connected client
let tx_status = mainnet_client.call(tx_status_request).await?;

println!("{:?}", tx_status);

Check out the examples folder for a comprehensive list of helpful demos. You can run the examples with cargo. For example: cargo run --example view_account.

Releasing

Versioning and releasing of this crate is automated and managed by custom fork of cargo-workspaces. To publish a new version of this crate, you can do so by bumping the version under the [workspace.metadata.workspaces] section in the package manifest and submit a PR.

We have CI Infrastructure put in place to automate the process of publishing all crates once a version change has merged into master.

However, before you release, make sure the CHANGELOG is up to date and that the [Unreleased] section is present but empty.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as below, without any additional terms or conditions.

License

Licensed under either of

at your option.

Dependencies

~38–56MB
~897K SLoC