Documentation ¶
Overview ¶
tokensPkg implements the chifra tokens command.
Given the address of an ERC20 token contract, the chifra tokens tool reports token balances for one or more additional addresses. Alternatively, the tool can report the token balances for multiple ERC20 tokens for a single addresses.
In normal operation the **first item** in the address_list is assumed to be an ERC20 token contract whose balances are being queried, whereas the remainder of the list is assumed to be addresses on which to report.
In --byAcct mode, **all addresses** in the address_list are assumed to be ERC20 token contracts, except the final one which is the account whose token balances are reported.
You may optionally specify one or more blocks at which to report. If no block is specified, the latest block is assumed. You may also optionally specify which parts of the token data to extract.
Index ¶
- func ResetOptions(testMode bool)
- func RunTokens(cmd *cobra.Command, args []string) error
- func ServeTokens(w http.ResponseWriter, r *http.Request) error
- type TokensOptions
- func (opts *TokensOptions) HandleDecache(rCtx *output.RenderCtx) error
- func (opts *TokensOptions) HandleParts(rCtx *output.RenderCtx) error
- func (opts *TokensOptions) HandleShow(rCtx *output.RenderCtx) error
- func (opts *TokensOptions) String() string
- func (opts *TokensOptions) TokensInternal(rCtx *output.RenderCtx) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResetOptions ¶
func ResetOptions(testMode bool)
func RunTokens ¶
RunTokens handles the tokens command for the command line. Returns error only as per cobra.
func ServeTokens ¶
func ServeTokens(w http.ResponseWriter, r *http.Request) error
ServeTokens handles the tokens command for the API. Returns an error.
Types ¶
type TokensOptions ¶
type TokensOptions struct { Addrs []string `json:"addrs,omitempty"` // Two or more addresses (0x...), the first is an ERC20 token, balances for the rest are reported 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"` // Which parts of the token information to retrieve ByAcct bool `json:"byAcct,omitempty"` // Consider each address an ERC20 token except the last, whose balance is reported for each token 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 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 }
TokensOptions provides all command options for the chifra tokens command.
func GetOptions ¶
func GetOptions() *TokensOptions
func GetTokensOptions ¶
func GetTokensOptions(args []string, g *globals.GlobalOptions) *TokensOptions
GetTokensOptions returns the options for this tool so other tools may use it.
func TokensFinishParseInternal ¶
func TokensFinishParseInternal(w io.Writer, values url.Values) *TokensOptions
func (*TokensOptions) HandleDecache ¶
func (opts *TokensOptions) HandleDecache(rCtx *output.RenderCtx) error
func (*TokensOptions) HandleParts ¶
func (opts *TokensOptions) HandleParts(rCtx *output.RenderCtx) error
func (*TokensOptions) HandleShow ¶
func (opts *TokensOptions) HandleShow(rCtx *output.RenderCtx) error
func (*TokensOptions) String ¶
func (opts *TokensOptions) String() string
String implements the Stringer interface
func (*TokensOptions) TokensInternal ¶
func (opts *TokensOptions) TokensInternal(rCtx *output.RenderCtx) error
TokensInternal handles the internal workings of the tokens command. Returns an error.