Documentation ¶
Overview ¶
abisPkg implements the chifra abis command.
The chifra abis tool retrieves one or more ABI files for the given address(es). It searches for ABIs, sequentially, in the following locations:
- the current working folder, - the TrueBlocks local cache, - Etherscan, - (in the future) ENS and Sourcify.
While this tool may be used from the command line, its primary purpose is in support of the --articulate option for tools such as chifra export and chifra logs.
If possible, the tool will follow proxied addresses searching for the ABI, but that does not always work. In that case, you may use the --proxy_for option.
The --known option prints a list of semi-standard function signatures such as the ERC20 standard, ERC 721 standard, various functions from OpenZeppelin, various Uniswap functions, etc. As an optimization, the known signatures are searched first during articulation.
The --encode option generates a 32-byte encoding for a given cannonical function or event signature. For functions, you may manually extract the first four bytes of the hash.
The --find option is experimental. Please see the notes below for more information.
Index ¶
- func ResetOptions(testMode bool)
- func RunAbis(cmd *cobra.Command, args []string) error
- func ServeAbis(w http.ResponseWriter, r *http.Request) error
- type AbisOptions
- func (opts *AbisOptions) AbisInternal(rCtx *output.RenderCtx) error
- func (opts *AbisOptions) ForEveryAbi(known bool, vFunc walk.ForEveryFunc, errorChan chan error)
- func (opts *AbisOptions) HandleCount(rCtx *output.RenderCtx) error
- func (opts *AbisOptions) HandleDecache(rCtx *output.RenderCtx) error
- func (opts *AbisOptions) HandleEncode(rCtx *output.RenderCtx) error
- func (opts *AbisOptions) HandleFind(rCtx *output.RenderCtx) error
- func (opts *AbisOptions) HandleList(rCtx *output.RenderCtx) error
- func (opts *AbisOptions) HandleMany(rCtx *output.RenderCtx) (err error)
- func (opts *AbisOptions) HandleShow(rCtx *output.RenderCtx) (err error)
- func (opts *AbisOptions) LoadAbis(addrs []string, loadKnown bool) ([]*types.Function, string, error)
- func (opts *AbisOptions) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResetOptions ¶
func ResetOptions(testMode bool)
Types ¶
type AbisOptions ¶
type AbisOptions struct { Addrs []string `json:"addrs,omitempty"` // A list of one or more smart contracts whose ABIs to display Known bool `json:"known,omitempty"` // Load common 'known' ABIs from cache ProxyFor string `json:"proxyFor,omitempty"` // Redirects the query to this implementation List bool `json:"list,omitempty"` // A list of downloaded abi files Count bool `json:"count,omitempty"` // Show the number of abis downloaded Find []string `json:"find,omitempty"` // Search for function or event declarations given a four- or 32-byte code(s) Hint []string `json:"hint,omitempty"` // For the --find option only, provide hints to speed up the search Encode string `json:"encode,omitempty"` // Generate the 32-byte encoding for a given cannonical function or event signature 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 }
AbisOptions provides all command options for the chifra abis command.
func AbisFinishParseInternal ¶
func AbisFinishParseInternal(w io.Writer, values url.Values) *AbisOptions
func GetAbisOptions ¶
func GetAbisOptions(args []string, g *globals.GlobalOptions) *AbisOptions
GetAbisOptions returns the options for this tool so other tools may use it.
func GetOptions ¶
func GetOptions() *AbisOptions
func (*AbisOptions) AbisInternal ¶
func (opts *AbisOptions) AbisInternal(rCtx *output.RenderCtx) error
AbisInternal handles the internal workings of the abis command. Returns an error.
func (*AbisOptions) ForEveryAbi ¶
func (opts *AbisOptions) ForEveryAbi(known bool, vFunc walk.ForEveryFunc, errorChan chan error)
func (*AbisOptions) HandleCount ¶
func (opts *AbisOptions) HandleCount(rCtx *output.RenderCtx) error
HandleCount handles the chifra abis --count command.
func (*AbisOptions) HandleDecache ¶
func (opts *AbisOptions) HandleDecache(rCtx *output.RenderCtx) error
func (*AbisOptions) HandleEncode ¶
func (opts *AbisOptions) HandleEncode(rCtx *output.RenderCtx) error
func (*AbisOptions) HandleFind ¶
func (opts *AbisOptions) HandleFind(rCtx *output.RenderCtx) error
func (*AbisOptions) HandleList ¶
func (opts *AbisOptions) HandleList(rCtx *output.RenderCtx) error
HandleList handles the chifra abis --list command.
func (*AbisOptions) HandleMany ¶
func (opts *AbisOptions) HandleMany(rCtx *output.RenderCtx) (err error)
func (*AbisOptions) HandleShow ¶
func (opts *AbisOptions) HandleShow(rCtx *output.RenderCtx) (err error)
func (*AbisOptions) String ¶
func (opts *AbisOptions) String() string
String implements the Stringer interface