Documentation ¶
Overview ¶
statePkg implements the chifra state command.
The chifra state tool retrieves the balance of an address (or list of addresses) at the given block (or blocks). Specify multiple addresses and/or multiple blocks if you wish, but you must specify at least one address. If no block is specified, the latest block is reported.
You may also query to see if an address is a smart contract as well as retrieve a contract's byte code.
Index ¶
- func ResetOptions(testMode bool)
- func RunState(cmd *cobra.Command, args []string) error
- func ServeState(w http.ResponseWriter, r *http.Request) error
- type StateOptions
- func (opts *StateOptions) GetAddressOrProxy() base.Address
- func (opts *StateOptions) HandleCall(rCtx *output.RenderCtx) error
- func (opts *StateOptions) HandleDecache(rCtx *output.RenderCtx) error
- func (opts *StateOptions) HandleSend(rCtx *output.RenderCtx) error
- func (opts *StateOptions) HandleShow(rCtx *output.RenderCtx) error
- func (opts *StateOptions) StateInternal(rCtx *output.RenderCtx) error
- func (opts *StateOptions) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResetOptions ¶
func ResetOptions(testMode bool)
func RunState ¶
RunState handles the state command for the command line. Returns error only as per cobra.
func ServeState ¶
func ServeState(w http.ResponseWriter, r *http.Request) error
ServeState handles the state command for the API. Returns an error.
Types ¶
type StateOptions ¶
type StateOptions struct { Addrs []string `json:"addrs,omitempty"` // One or more addresses (0x...) from which to retrieve balances Blocks []string `json:"blocks,omitempty"` // An optional list of one or more blocks at which to report balances, defaults to 'latest' BlockIds []identifiers.Identifier `json:"blockIds,omitempty"` // Block identifiers Parts []string `json:"parts,omitempty"` // Control which state to export Changes bool `json:"changes,omitempty"` // Only report a balance when it changes from one block to the next NoZero bool `json:"noZero,omitempty"` // Suppress the display of zero balance accounts Call bool `json:"call,omitempty"` // Write-only call (a query) to a smart contract Send bool `json:"send,omitempty"` // Writes a transaction to an address (see docs for more information) Calldata string `json:"calldata,omitempty"` // For commands (--call or --send), provides the call data (in various forms) for the command (may be empty for --send) Articulate bool `json:"articulate,omitempty"` // For commands only, articulate the retrieved data if ABIs can be found ProxyFor string `json:"proxyFor,omitempty"` // For commands only, redirects calls to this implementation Globals globals.GlobalOptions `json:"globals,omitempty"` // The global options Conn *rpc.Connection `json:"conn,omitempty"` // The connection to the RPC server BadFlag error `json:"badFlag,omitempty"` // An error flag if needed // EXISTING_CODE Calls []string `json:"-"` }
StateOptions provides all command options for the chifra state command.
func GetOptions ¶
func GetOptions() *StateOptions
func GetStateOptions ¶
func GetStateOptions(args []string, g *globals.GlobalOptions) *StateOptions
GetStateOptions returns the options for this tool so other tools may use it.
func StateFinishParseInternal ¶
func StateFinishParseInternal(w io.Writer, values url.Values) *StateOptions
func (*StateOptions) GetAddressOrProxy ¶
func (opts *StateOptions) GetAddressOrProxy() base.Address
func (*StateOptions) HandleCall ¶
func (opts *StateOptions) HandleCall(rCtx *output.RenderCtx) error
func (*StateOptions) HandleDecache ¶
func (opts *StateOptions) HandleDecache(rCtx *output.RenderCtx) error
func (*StateOptions) HandleSend ¶
func (opts *StateOptions) HandleSend(rCtx *output.RenderCtx) error
func (*StateOptions) HandleShow ¶
func (opts *StateOptions) HandleShow(rCtx *output.RenderCtx) error
func (*StateOptions) StateInternal ¶
func (opts *StateOptions) StateInternal(rCtx *output.RenderCtx) error
StateInternal handles the internal workings of the state command. Returns an error.
func (*StateOptions) String ¶
func (opts *StateOptions) String() string
String implements the Stringer interface