Crate casper_client
source ·Expand description
Casper client library
The crate provides functions for interacting with a Casper network.
Most of the functions involve sending a JSON-RPC request to a specified node on the chosen network, and providing the RPC response.
Common Parameters
Many of the functions have similar parameters. Descriptions for these common ones follow:
rpc_id: JsonRpcId
- The JSON-RPC identifier, applied to the request and returned in the response.node_address: &str
- The hostname or IP and port of the server, e.g.http://127.0.0.1:7777
.verbosity: Verbosity
- WhenLow
, nothing is printed to stdout. ForMedium
, the request and response are printed tostdout
with long string fields (e.g. hex-formatted raw Wasm bytes) shortened to a string indicating the char count of the field.High
verbosity is the same asMedium
except without abbreviation of long fields.maybe_block_identifier: Option<BlockIdentifier>
- The identifier of theBlock
to use, either block height or block hash. IfNone
, the latestBlock
known on the server will be used.
Modules
- An API suitable for use by a CLI binary.
- Cryptographic key generation.
- The JSON-RPC request and response types.
- Various data types of the Casper network.
Structs
- A successful response to a JSON-RPC request.
Enums
- Errors that may be returned by
casper_client
functions. - An identifier for a JSON-RPC, provided by the client and returned in the response.
- An output abstraction for associating a
Write
object with some metadata. - The various types which can be used as the
target
runtime argument of a native transfer. - Error that can be returned when validating data returned from a JSON-RPC method.
- The level of verbosity of the output to stdout.
Functions
- Retrieves the bids and validators at a given
Block
. - Retrieves a purse’s balance at a given state root hash.
- Retrieves a
Block
from the network. - Retrieves the Chainspec of the network.
- Retrieves a
Deploy
and its metadata (i.e. execution results) from the network. - Retrieves a
StoredValue
from a dictionary at a given state root hash. - get_era_infoDeprecatedRetrieves era information from the network at a given switch
Block
. - Retrieves era information from the network at a given
Block
. - Retrieves the status of the specified node.
- Retrieves the IDs and addresses of the specified node’s peers.
- Retrieves a state root hash at a given
Block
. - Retrieves the status changes of the active validators on the network.
- Retrieves the interface description (the schema including examples in OpenRPC format) of the JSON-RPC server’s API.
- Outputs a
Deploy
to a file or stdout. - Puts a
Deploy
to the network for execution. - Retrieves a purse’s balance from global state at a given
Block
or state root hash. - Retrieves a
StoredValue
from global state at a givenBlock
or state root hash. - Reads a previously-saved
Deploy
from a file. - Reads a previously-saved
Deploy
from a file, cryptographically signs it, and outputs it to a file or stdout. - Puts a
Deploy
to a single node for speculative execution on that node only.