Module cli

Module cli 

Source
Expand description

An API suitable for use by a CLI binary.

It provides functions and types largely based around strings and integers, as would be expected to be input by a CLI user. The functions then parse these inputs into the expected Rust types and pass them through to the equivalent API functions defined in the root of the library.

§Common Parameters

Many of the functions have similar parameters. Descriptions for these common ones follow:

  • maybe_rpc_id - The JSON-RPC identifier, applied to the request and returned in the response. If it can be parsed as an i64 it will be used as a JSON integer. If empty, a random i64 will be assigned. Otherwise the provided string will be used verbatim.
  • node_address - The hostname or IP and port of the server, e.g. http://127.0.0.1:7777.
  • verbosity_level - When 1, the JSON-RPC request will be printed to stdout with long string fields (e.g. hex-formatted raw Wasm bytes) shortened to a string indicating the char count of the field. When verbosity_level is greater than 1, the request will be printed to stdout with no abbreviation of long fields. When verbosity_level is 0, the request will not be printed to stdout.
  • maybe_block_id - Must be a hex-encoded, 32-byte hash digest or a u64 representing the Block height or empty. If empty, the latest Block known on the server will be used.

Re-exports§

pub use deploy::make_deploy;
pub use deploy::make_transfer;
pub use deploy::put_deploy;
pub use deploy::put_deploy_with_min_bid_override;
pub use deploy::send_deploy_file;
pub use deploy::sign_deploy_file;
pub use deploy::speculative_put_deploy;
pub use deploy::speculative_send_deploy_file;
pub use deploy::speculative_transfer;
pub use deploy::transfer;

Modules§

deploy
Functions facilitating sending of Deploys to the network
json_args_help
Functions for use in help commands.
parse
This module contains structs and helpers which are used by multiple subcommands related to creating deploys.
simple_args_help
Functions for use in help commands.

Structs§

DeployBuilder
A builder for constructing a Deploy.
DeployStrParams
Container for Deploy construction options.
JsonArg
Represents a JSON argument with a name, type, and value.
JsonArgsError
Error associated with parsing a JSON arg into a NamedArg.
PaymentStrParams
Container for payment-related arguments used while constructing a Deploy.
SessionStrParams
Container for session-related arguments used while constructing a Deploy.
TransactionStrParams
Container for Transaction construction options.
TransactionV1Builder
A builder for constructing TransactionV1 instances with various configuration options.

Enums§

CliError
Error that can be returned by the cli API.
DeployBuilderError
Errors returned while building a Deploy using a DeployBuilder.
DictionaryItemStrParams
Various ways of uniquely identifying a dictionary item.
FromDecStrErr
Conversion from decimal string error
JsonArgsErrorDetails
Details of an error associated with parsing a JSON arg into a NamedArg.
TransactionBuilderParams
An enum representing the parameters needed to construct a transaction builder for the commands concerning the creation of a transaction
TransactionV1BuilderError
Errors returned while building a TransactionV1 using a TransactionV1Builder.

Functions§

arg_json_session_parse
Parse session arguments into runtime args.
arg_simple_session_parse
Parse session arguments into runtime args.
get_account
Retrieves an Account at a given Block.
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 Block from the network.
get_chainspec
Retrieves the Chainspec of the network.
get_deploy
Retrieves a casper_types::Deploy 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 given Block.
get_era_infoDeprecated
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_maybe_secret_key
Retrieves a SecretKey based on the provided secret key string and configuration options.
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 an GetRewardResult at a given era.
get_state_root_hash
Retrieves a state root hash at a given Block.
get_system_hash_registry
Retrieve the system hash registry
get_transaction
Retrieves a casper_types::Transaction from the network.
get_validator_changes
Retrieves the status changes of the active validators on the network.
insert_arg
Insert a value built from a single arg into runtime_args.
json_pretty_print
JSON-encode and pretty-print the given value to stdout at the given verbosity level.
list_rpcs
Retrieves the interface description (the schema including examples in OpenRPC format) of the JSON-RPC server’s API.
make_transaction
Creates a Transaction and outputs it to a file or stdout if the std-fs-io feature is enabled.
put_transaction
Creates a Transaction and sends it to the network for execution.
query_balance
Retrieves a purse’s balance from global state.
query_balance_details
Retrieves a purse’s balance and hold information from global state.
query_global_state
Retrieves a StoredValue from global state.
send_transaction_file
Reads a previously-saved [TransactionV1] from a file and sends it to the network for execution.
sign_transaction_file
Reads a previously-saved [TransactionV1] from a file, cryptographically signs it, and outputs it to a file or stdout.
speculative_send_transaction_file
Reads a previously-saved [TransactionV1] from a file and sends it to the network for execution.
verify_contract
Verifies the smart contract code against the one installed by deploy or transaction with given hash.