slurpPkg

package
v0.0.0-...-2a3d9f8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2024 License: GPL-3.0 Imports: 22 Imported by: 0

README

chifra slurp

chifra slurp is the first tool we built in the Ethereum space. It even has its own website.

While it's useful, it has two shortcomings. First, it is fully centralized, pulling its data from http://etherscan.io. Second, is that it does not report every transaction for a given account. This is actually a shortcoming with API providers. It's too complicated to explain here, but see our blog.

While chifra slurp has its shortcomings, it does provides some nice features. You may use it to pull any transaction initiated by an EOA for example or to explore mining rewards. Visit the above referenced website for more information.

Currently supported API providers:

Purpose:
  Fetch data from Etherscan and other APIs for any address.

Usage:
  chifra slurp [flags] <address> [address...] [block...]

Arguments:
  addrs - one or more addresses to slurp from Etherscan (required)
  blocks - an optional range of blocks to slurp

Flags:
  -r, --parts strings    which types of transactions to request
                         One or more of [ ext | int | token | nfts | 1155 | miner | uncles | withdrawals | some | all ]
  -p, --appearances      show only the blocknumber.tx_id appearances of the exported transactions
  -a, --articulate       articulate the retrieved data if ABIs can be found
  -S, --source string    the source of the slurped data
                         One of [ etherscan | key | covalent | alchemy ] (default "etherscan")
  -U, --count            for --appearances mode only, display only the count of records
  -g, --page uint        the page to retrieve (page number)
      --page_id string   the page to retrieve (page ID)
  -P, --per_page uint    the number of records to request on each page (default 1000)
  -s, --sleep float      seconds to sleep between requests (default 0.25)
  -H, --ether            specify value in ether
  -o, --cache            force the results of the query into the cache
  -D, --decache          removes related items from the cache
  -x, --fmt string       export format, one of [none|json*|txt|csv]
  -v, --verbose          enable verbose output
  -h, --help             display this help screen

Notes:
  - An address must be either an ENS name or start with '0x' and be forty-two characters long.
  - Portions of this software are Powered by Etherscan.io, Covalent, Alchemy, TrueBlocks Key APIs.
  - See slurp/README on how to configure keys for API providers.
  - The withdrawals option is only available on certain chains. It is ignored otherwise.
  - If the value of --source is key, --parts is ignored.
  - The --types option is deprecated, use --parts instead.

Data models produced by this tool:

Adding provider API key

Call chifra config edit to edit the configuration file.

For TrueBlocks Key, add keyEndpoint = "your-key-endpoint-url" to chains.mainnet section.

For all other providers add an entry to keys section like this:

[keys]
  [keys.etherscan]
    apiKey = "etherscan-apikey"
  [keys.covalent]
    apiKey = "covalent-apikey"
  [keys.alchemy]
    apiKey = "alchemy-apikey"

Other Options

All tools accept the following additional flags, although in some cases, they have no meaning.

  -v, --version         display the current version of the tool
      --output string   write the results to file 'fn' and return the filename
      --append          for --output command only append to instead of replace contents of file
      --file string     specify multiple sets of command line options in a file

Note: For the --file string option, you may place a series of valid command lines in a file using any valid flags. In some cases, this may significantly improve performance. A semi-colon at the start of any line makes it a comment.

Note: If you use --output --append option and at the same time the --file option, you may not switch export formats in the command file. For example, a command file with two different commands, one with --fmt csv and the other with --fmt json will produce both invalid CSV and invalid JSON.

Copyright (c) 2024, TrueBlocks, LLC. All rights reserved. Generated with goMaker.

Documentation

Overview

slurpPkg implements the chifra slurp command.

chifra slurp is the first tool we built in the Ethereum space. It even has its [own website](http://ethslurp.com).

While it's useful, it has two shortcomings. First, it is fully centralized, pulling its data from [http://etherscan.io](http://etherscan.io). Second, is that it does not report every transaction for a given account. This is actually a shortcoming with API providers. It's too complicated to explain here, but see our blog.

While chifra slurp has its shortcomings, it does provides some nice features. You may use it to pull any transaction initiated by an EOA for example or to explore mining rewards. Visit the above referenced website for more information.

Currently supported API providers: - [TrueBlocks Key](https://key.trueblocks.io) - Etherscan - Covalent - Alchemy

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResetOptions

func ResetOptions(testMode bool)

func RunSlurp

func RunSlurp(cmd *cobra.Command, args []string) error

RunSlurp handles the slurp command for the command line. Returns error only as per cobra.

func ServeSlurp

func ServeSlurp(w http.ResponseWriter, r *http.Request) error

ServeSlurp handles the slurp command for the API. Returns an error.

Types

type SlurpOptions

type SlurpOptions struct {
	Addrs       []string                 `json:"addrs,omitempty"`       // One or more addresses to slurp from Etherscan
	Blocks      []string                 `json:"blocks,omitempty"`      // An optional range of blocks to slurp
	BlockIds    []identifiers.Identifier `json:"blockIds,omitempty"`    // Block identifiers
	Parts       []string                 `json:"parts,omitempty"`       // Which types of transactions to request
	Appearances bool                     `json:"appearances,omitempty"` // Show only the blocknumber.tx_id appearances of the exported transactions
	Articulate  bool                     `json:"articulate,omitempty"`  // Articulate the retrieved data if ABIs can be found
	Source      string                   `json:"source,omitempty"`      // The source of the slurped data
	Count       bool                     `json:"count,omitempty"`       // For --appearances mode only, display only the count of records
	Page        uint64                   `json:"page,omitempty"`        // The page to retrieve (page number)
	PageId      string                   `json:"pageId,omitempty"`      // The page to retrieve (page ID)
	PerPage     uint64                   `json:"perPage,omitempty"`     // The number of records to request on each page
	Sleep       float64                  `json:"sleep,omitempty"`       // Seconds to sleep between requests
	Types       []string                 `json:"types,omitempty"`       // Deprecated, use --parts instead
	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

}

SlurpOptions provides all command options for the chifra slurp command.

func GetOptions

func GetOptions() *SlurpOptions

func GetSlurpOptions

func GetSlurpOptions(args []string, g *globals.GlobalOptions) *SlurpOptions

GetSlurpOptions returns the options for this tool so other tools may use it.

func SlurpFinishParseInternal

func SlurpFinishParseInternal(w io.Writer, values url.Values) *SlurpOptions

func (*SlurpOptions) Addresses

func (opts *SlurpOptions) Addresses() []base.Address

EXISTING_CODE

func (*SlurpOptions) HandleAppearances

func (opts *SlurpOptions) HandleAppearances(rCtx *output.RenderCtx) error

func (*SlurpOptions) HandleCount

func (opts *SlurpOptions) HandleCount(rCtx *output.RenderCtx) error

func (*SlurpOptions) HandleDecache

func (opts *SlurpOptions) HandleDecache(rCtx *output.RenderCtx) error

func (*SlurpOptions) HandleShow

func (opts *SlurpOptions) HandleShow(rCtx *output.RenderCtx) error

func (*SlurpOptions) Provider

func (opts *SlurpOptions) Provider() (provider.Provider, error)

Provider returns 3rd party RPC provider based on --source

func (*SlurpOptions) Query

func (opts *SlurpOptions) Query() *provider.Query

func (*SlurpOptions) SlurpInternal

func (opts *SlurpOptions) SlurpInternal(rCtx *output.RenderCtx) error

SlurpInternal handles the internal workings of the slurp command. Returns an error.

func (*SlurpOptions) String

func (opts *SlurpOptions) String() string

String implements the Stringer interface

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL