transactionsPkg

package
v0.0.0-...-3f8eaf4 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: GPL-3.0 Imports: 25 Imported by: 0

README

chifra transactions

The chifra transactions tool retrieves transactions directly from the Ethereum node (using the --raw option) or from the TrueBlocks cache (if present). You may specify multiple transaction identifiers per invocation. Unlike the Ethereum RPC, the reported transactions include the transaction's receipt and generated logs.

The --articulate option fetches the ABI from each encountered smart contract (including those encountered in a trace--if the --trace option is enabled) to better describe the reported data.

The --trace option attaches an array transaction traces to the output (if the node you're querying has --tracing enabled), while the --uniq option displays a list of uniq address appearances instead of the underlying data (including uniq addresses in traces if enabled).

Purpose:
  Retrieve one or more transactions from the chain or local cache.

Usage:
  chifra transactions [flags] <tx_id> [tx_id...]

Arguments:
  transactions - a space-separated list of one or more transaction identifiers (required)

Flags:
  -a, --articulate        articulate the retrieved data if ABIs can be found
  -t, --traces            include the transaction's traces in the results
  -u, --uniq              display a list of uniq addresses found in the transaction
  -f, --flow string       for the uniq option only, export only from or to (including trace from or to)
                          One of [ from | to ]
  -l, --logs              display only the logs found in the transaction(s)
  -m, --emitter strings   for the --logs option only, filter logs to show only those logs emitted by the given address(es)
  -B, --topic strings     for the --logs option only, filter logs to show only those with this topic(s)
  -H, --ether             specify value in ether
  -w, --raw               report JSON data from the source with minimal processing
  -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:
  - The transactions list may be one or more transaction hashes, blockNumber.transactionID pairs, or a blockHash.transactionID pairs.
  - This tool checks for valid input syntax, but does not check that the transaction requested actually exists.
  - If the queried node does not store historical state, the results for most older transactions are undefined.
  - The --decache option removes the all transaction(s) and all traces in those transactions from the cache.

Data models produced by this tool:

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.

Documentation

Overview

Package transactionsPkg handles the chifra transactions command. It The tool retrieves transactions directly from the Ethereum node (using the --raw option) or from the TrueBlocks cache (if present). You may specify multiple transaction identifiers per invocation. Unlike the Ethereum RPC, the reported transactions include the transaction's receipt and generated logs. The --articulate option fetches the ABI from each encountered smart contract (including those encountered in a trace--if the --trace option is enabled) to better describe the reported data. The --trace option attaches an array transaction traces to the output (if the node you're querying has --tracing enabled), while the --uniq option displays a list of uniq address appearances instead of the underlying data (including uniq addresses in traces if enabled).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResetOptions

func ResetOptions(testMode bool)

func RunTransactions

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

RunTransactions handles the transactions command for the command line. Returns error only as per cobra.

func ServeTransactions

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

ServeTransactions handles the transactions command for the API. Returns an error.

Types

type TransactionsOptions

type TransactionsOptions struct {
	Transactions   []string                 `json:"transactions,omitempty"`   // A space-separated list of one or more transaction identifiers
	TransactionIds []identifiers.Identifier `json:"transactionIds,omitempty"` // Transaction identifiers
	Articulate     bool                     `json:"articulate,omitempty"`     // Articulate the retrieved data if ABIs can be found
	Traces         bool                     `json:"traces,omitempty"`         // Include the transaction's traces in the results
	Uniq           bool                     `json:"uniq,omitempty"`           // Display a list of uniq addresses found in the transaction
	Flow           string                   `json:"flow,omitempty"`           // For the uniq option only, export only from or to (including trace from or to)
	Logs           bool                     `json:"logs,omitempty"`           // Display only the logs found in the transaction(s)
	Emitter        []string                 `json:"emitter,omitempty"`        // For the --logs option only, filter logs to show only those logs emitted by the given address(es)
	Topic          []string                 `json:"topic,omitempty"`          // For the --logs option only, filter logs to show only those with this topic(s)
	CacheTraces    bool                     `json:"cacheTraces,omitempty"`    // Force the transaction's traces into the cache
	Seed           bool                     `json:"seed,omitempty"`           // Find the source of the funds sent to the receiver
	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
	AccountForAddr base.Address `json:"-"`
}

TransactionsOptions provides all command options for the chifra transactions command.

func GetOptions

func GetOptions() *TransactionsOptions

func GetTransactionsOptions

func GetTransactionsOptions(args []string, g *globals.GlobalOptions) *TransactionsOptions

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

func (*TransactionsOptions) HandleDecache

func (opts *TransactionsOptions) HandleDecache() error

func (*TransactionsOptions) HandleLogs

func (opts *TransactionsOptions) HandleLogs() error

func (*TransactionsOptions) HandleSeed

func (opts *TransactionsOptions) HandleSeed() (err error)

func (*TransactionsOptions) HandleShow

func (opts *TransactionsOptions) HandleShow() (err error)

func (*TransactionsOptions) HandleUniq

func (opts *TransactionsOptions) HandleUniq() (err error)

func (*TransactionsOptions) String

func (opts *TransactionsOptions) String() string

String implements the Stringer interface

func (*TransactionsOptions) TransactionsInternal

func (opts *TransactionsOptions) TransactionsInternal() error

TransactionsInternal handles the internal workings of the transactions command. Returns an error.

Jump to

Keyboard shortcuts

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