keetanetwork-client 0.2.0

Async REST client for transmitting vote staples to a KeetaNet node
docs.rs failed to build keetanetwork-client-0.2.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.

Async REST client for a KeetaNet node.

Provides [KeetaClient], a wrapper for assembling and transmitting vote staples. The transport layer is generated at build time from the committed OpenAPI document (openapi/keetanet-node.yaml) via progenitor and exposed as the [generated] module.

Example

use std::sync::Arc;

use keetanetwork_account::GenericAccount;
use keetanetwork_block::AccountRef;
use keetanetwork_client::KeetaClient;
# use keetanetwork_account::doc_utils::create_ed25519_test_keys;

# #[tokio::main]
# async fn main() -> Result<(), keetanetwork_client::ClientError> {
let client = KeetaClient::new("http://localhost:8080/api").with_network(0u8);

let (_, _, signer) = create_ed25519_test_keys(None);
let account: AccountRef = Arc::new(GenericAccount::Ed25519(signer));

let blocks = client
    .builder(&account)
    .with_previous(account.to_opening_hash())
    .set_rep(&account)
    .build()
    .await?;

assert_eq!(blocks.len(), 1);
assert_eq!(blocks[0].data().account().to_string(), account.to_string());
# Ok(())
# }

no_std

The orchestrator ([KeetaClient]) is no_std+alloc: it is written against the [Runtime] and [NodeTransport]/[TransportFactory] interfaces and constructed with [KeetaClient::with_parts], so a no_std consumer supplies its own executor and HTTP backend.