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.

Modules§

deploy
Deploy module.
json_args_help
Functions for use in help commands.
simple_args_help
Functions for use in help commands.

Structs§

DeployStrParams
Container for Deploy construction options.
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.

Enums§

CliError
Error that can be returned by the cli API.
DictionaryItemStrParams
Various ways of uniquely identifying a dictionary item.
JsonArgsErrorDetails
Details of an error associated with parsing a JSON arg into a NamedArg.

Functions§

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 Deploy from the network.
get_dictionary_item
Retrieves a StoredValue from a dictionary at a given state root hash.
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_node_status
Retrieves the status of the specified node.
get_peers
Retrieves the IDs and addresses of the specified node’s peers.
get_state_root_hash
Retrieves a state root hash at a given Block.
get_validator_changes
Retrieves the status changes of the active validators on the network.
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_deploy
Creates a Deploy and outputs it to a file or stdout.
make_transfer
Creates a transfer Deploy and outputs it to a file or stdout.
put_deploy
Creates a Deploy and sends it to the network for execution.
query_balance
Retrieves a purse’s balance from global state.
query_global_state
Retrieves a StoredValue from global state.
send_deploy_file
Reads a previously-saved Deploy from a file and sends it to the network for execution.
sign_deploy_file
Reads a previously-saved Deploy from a file, cryptographically signs it, and outputs it to a file or stdout.
speculative_put_deploy
Creates a Deploy and sends it to the specified node for speculative execution.
speculative_send_deploy_file
Reads a previously-saved Deploy from a file and sends it to the specified node for speculative execution. For details of the parameters, see the module docs.
speculative_transfer
Creates a Deploy to transfer funds between purses, and sends it to the specified node for speculative execution.
transfer
Transfers funds between purses.