Expand description
The freechains
module implements freechains client utilities for
Freechains server version v0.9.0
.
Main use comes from Client struct.
§Examples
List all server chains.
use freechains::{Client, ClientError};
let client = Client::new("0.0.0.0:8300");
let chain_ids = client.chains()?;
Join and post on a public chain.
use freechains::{Client, ChainId, ClientError};
let client = Client::new("0.0.0.0:8300");
// Join public chain
let chain_id = ChainId::new("#forum")?;
client.join_chain(&chain_id, &[chain_pubkey1, chain_pubkey2])?;
// Generate public and private keys
let (pubkey, pvtkey) = client.crypto_pubpvt("strong_password")?;
let chain_client = client.chain(&chain_id);
// Post on public chain
chain_client.post(Some(&pvtkey), false, b"Hello, forum!")?;
Structs§
- Chain
Client - Freechains chain client actions. Must be created from Client.
- ChainId
- Freechains chain identifier. Contains its type and name.
- Client
- Freechains client. For more usage examples, check module documentation,
- Content
Block - Representation of freechains content block response. It is created from content.
- Host
Client - Freechains host client actions. Must be created from Client.
- Invalid
Chain Name Error - Error returned when a chain is created with invalid name.
- Like
Block - Representation of freechains like field from content block response ContentBlock.
- Payload
Block - Representation of freechains payload field from content block response ContentBlock.
- Peer
Client - Freechains peer client actions. Must be created from Client.
- Signature
Block - Representation of freechains signature field from content block response ContentBlock.
- TcpStream
Connector - Connector which uses TcpStream as underlying stream.
Enums§
- Chain
Type - Type of freechains chain.
- Client
Error - Error returned when dealing with client-server actions.
Constants§
- HOST_
VERSION - Freechains host version supported.
Traits§
- Connect
- A trait for objects that can connect to a ReadWrite stream.
- Read
Write - A trait for objects that implements Read and Write.
Type Aliases§
- Chains
Ids - Vector of chain ids.