Crates.io | near-providers |
lib.rs | near-providers |
version | 0.1.0-alpha |
source | src |
created_at | 2024-03-20 09:39:28.541971 |
updated_at | 2024-03-20 09:39:28.541971 |
description | High-level abstractions for interacting with the NEAR blockchain, simplifying JSON RPC calls. |
homepage | |
repository | |
max_upload_size | |
id | 1180254 |
size | 103,001 |
The near-providers
crate provides a high-level abstraction over the near-jsonrpc-client
for interacting with the NEAR blockchain. It simplifies the process of sending transactions, querying chain status, and performing other chain-related tasks by encapsulating the JSON RPC calls into easy-to-use methods.
Provider
trait to allow for easy extension with more providers in the future.This crate requires Rust and Cargo. Ensure you have the latest version of Rust installed. You can install Rust using rustup
.
near-providers
to Your CrateTo use near-providers
, add it as a dependency in your Cargo.toml
:
[dependencies]
near-providers = "0.1.0-alpha"
Below is an example of creating a new account, deploying a contract, and querying account state:
use near_providers::JsonRpcProvider;
#[tokio::main]
async fn main() {
let provider = JsonRpcProvider::new("https://rpc.testnet.near.org");
match provider.status().await {
Ok(status) => println!("Chain status: {:?}", status),
Err(e) => eprintln!("Error fetching chain status: {:?}", e),
}
}
The crate includes examples that demonstrate how to use various features. To run an example, use the following command:
cargo run --example <example_name>
For instance, to test the send_transaction
function:
cargo run --example contract_change_method_commit
We welcome contributions to the near-providers
crate! Please feel free to submit pull requests or open issues to suggest improvements or add new features.