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§
- cli
- An API suitable for use by a CLI binary.
- keygen
- Cryptographic key generation.
- rpcs
- The JSON-RPC request and response types.
- types
- Various data types of the Casper network.
Structs§
- Success
Response - A successful response to a JSON-RPC request.
Enums§
- Error
- Errors that may be returned by
casper_client
functions. - Json
RpcId - An identifier for a JSON-RPC, provided by the client and returned in the response.
- Output
Kind - An output abstraction for associating a
Write
object with some metadata. - Validate
Response Error - Error that can be returned when validating data returned from a JSON-RPC method.
- Verbosity
- The level of verbosity of the output to stdout.
Constants§
- MAX_
SERIALIZED_ SIZE_ OF_ DEPLOY - The maximum permissible size in bytes of a Deploy when serialized via
ToBytes
.
Functions§
- build_
archive - Builds an archive from the specified path.
- get_
account - Retrieves an
Account
at a givenBlock
. - get_
auction_ info - Retrieves the bids and validators at a given
Block
. - get_
balance - Retrieves a purse’s balance at a given state root hash.
- get_
block - Retrieves a
Block
from the network. - get_
block_ transfers - Retrieves all
Transfer
items for a givenBlock
. - get_
chainspec - Retrieves the Chainspec of the network.
- get_
deploy - Retrieves a
Deploy
and its metadata (i.e. execution results) from the network. - get_
dictionary_ item - Retrieves a
StoredValue
from a dictionary at a given state root hash. - get_
entity - Retrieves an
crate::rpcs::v2_0_0::get_entity::EntityOrAccount
at a givenBlock
. - get_
era_ info Deprecated - Retrieves era information from the network at a given switch
Block
. - get_
era_ summary - Retrieves era information from the network at a given
Block
. - get_
node_ status - Retrieves the status of the specified node.
- get_
peers - Retrieves the IDs and addresses of the specified node’s peers.
- get_
reward - Retrieves a
GetRewardResult
at a givenEraIdentifier
. - get_
state_ root_ hash - Retrieves a state root hash at a given
Block
. - get_
transaction - Retrieves a
Transaction
and its metadata (i.e. execution results) from the network. - get_
validator_ changes - Retrieves the status changes of the active validators on the network.
- list_
rpcs - Retrieves the interface description (the schema including examples in OpenRPC format) of the JSON-RPC server’s API.
- output_
deploy Deprecated - Outputs a
Deploy
to a file or stdout. - output_
transaction - Outputs a
Transaction
to a file or stdout. - put_
deploy Deprecated - Puts a
Deploy
to the network for execution. - put_
transaction - Puts a
Transaction
to the network for execution - query_
balance - Retrieves a purse’s balance from global state at a given
Block
or state root hash. - query_
balance_ details - Retrieves a purse’s balance from global state at a given
Block
or state root hash. - query_
global_ state - Retrieves a
StoredValue
from global state at a givenBlock
or state root hash. - read_
deploy_ file Deprecated - Reads a previously-saved
Deploy
from a file. - read_
transaction_ file - Reads a previously-saved
Transaction
from a file. - send_
verification_ request - Verifies the smart contract code against the one deployed at transaction hash.
- sign_
deploy_ file Deprecated - Reads a previously-saved
Deploy
from a file, cryptographically signs it, and outputs it to a file or stdout. - sign_
transaction_ file - Reads a previously-saved
Transaction
from a file, cryptographically signs it, and outputs it to a file or stdout. - speculative_
exec Deprecated - Puts a
Deploy
to a single node for speculative execution on that node only. - speculative_
exec_ txn - Puts a
Transaction
to a single node for speculative execution on that node only. - verify_
contract - Verifies the smart contract code against the one deployed at given deploy or transaction hash.