namesPkg

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: 27 Imported by: 0

README

chifra names

chifra names is a surprisingly useful tool. It allows one to associate textual names with Ethereum addresses. One may ask why this is necessary given that ENS exists. The answer is a single word: "privacy". ENS names are public. In many cases, users desire to keep personal addresses private. Try to do this on a website.

Like chifra abis, this tool is useful from the command line but is primarily used in support of other tools, especially chifra export where naming addresses becomes the single best way to turn unintelligible blockchain data into understandable information.

The various options allow you to search and filter the results. The tags option is used primarily by the TrueBlocks explorer.

You may use the TrueBlocks explorer to manage (add, edit, delete) address-name associations.

Purpose:
  Query addresses or names of well-known accounts.

Usage:
  chifra names [flags] <term> [term...]

Arguments:
  terms - a space separated list of one or more search terms (required)

Flags:
  -e, --expand            expand search to include all fields (search name, address, and symbol otherwise)
  -m, --match_case        do case-sensitive search
  -a, --all               include all (including custom) names in the search
  -c, --custom            include only custom named accounts in the search
  -p, --prefund           include prefund accounts in the search
  -s, --addr              display only addresses in the results (useful for scripting, assumes --no_header)
  -g, --tags              export the list of tags and subtags only
  -C, --clean             clean the data (addrs to lower case, sort by addr)
  -r, --regular           only available with --clean, cleans regular names database
  -d, --dry_run           only available with --clean or --autoname, outputs changes to stdout instead of updating databases
  -A, --autoname string   an address assumed to be a token, added automatically to names database if true
  -x, --fmt string        export format, one of [none|json*|txt|csv]
  -v, --verbose           enable verbose output
  -h, --help              display this help screen

Notes:
  - The tool will accept up to three terms, each of which must match against any field in the database.
  - The --match_case option enables case sensitive matching.

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 namesPkg handles the chifra names command. It is a surprisingly useful tool. It allows one to associate textual names with Ethereum addresses. One may ask why this is necessary given that ENS exists. The answer is a single word: "privacy". ENS names are public. In many cases, users desire to keep personal addresses private. Try to do this on a website. Like chifra abis, this tool is useful from the command line but is primarily used in support of other tools, especially chifra export where naming addresses becomes the single best way to turn unintelligible blockchain data into understandable information. The various options allow you to search and filter the results. The tags option is used primarily by the TrueBlocks explorer. You may use the TrueBlocks explorer to manage (add, edit, delete) address-name associations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResetOptions

func ResetOptions(testMode bool)

func RunNames

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

RunNames handles the names command for the command line. Returns error only as per cobra.

func ServeNames

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

ServeNames handles the names command for the API. Returns an error.

Types

type CrudData

type CrudData struct {
	Address     crudDataField[base.Address]
	Name        crudDataField[string]
	Tag         crudDataField[string]
	Source      crudDataField[string]
	Symbol      crudDataField[string]
	Decimals    crudDataField[string]
	Description crudDataField[string]
}

type NamesOptions

type NamesOptions struct {
	Terms     []string              `json:"terms,omitempty"`     // A space separated list of one or more search terms
	Expand    bool                  `json:"expand,omitempty"`    // Expand search to include all fields (search name, address, and symbol otherwise)
	MatchCase bool                  `json:"matchCase,omitempty"` // Do case-sensitive search
	All       bool                  `json:"all,omitempty"`       // Include all (including custom) names in the search
	Custom    bool                  `json:"custom,omitempty"`    // Include only custom named accounts in the search
	Prefund   bool                  `json:"prefund,omitempty"`   // Include prefund accounts in the search
	Addr      bool                  `json:"addr,omitempty"`      // Display only addresses in the results (useful for scripting, assumes --no_header)
	Tags      bool                  `json:"tags,omitempty"`      // Export the list of tags and subtags only
	Clean     bool                  `json:"clean,omitempty"`     // Clean the data (addrs to lower case, sort by addr)
	Regular   bool                  `json:"regular,omitempty"`   // Only available with --clean, cleans regular names database
	DryRun    bool                  `json:"dryRun,omitempty"`    // Only available with --clean or --autoname, outputs changes to stdout instead of updating databases
	Autoname  string                `json:"autoname,omitempty"`  // An address assumed to be a token, added automatically to names database if true
	Create    bool                  `json:"create,omitempty"`    // Create a new name record
	Update    bool                  `json:"update,omitempty"`    // Edit an existing name
	Delete    bool                  `json:"delete,omitempty"`    // Delete a name, but do not remove it
	Undelete  bool                  `json:"undelete,omitempty"`  // Undelete a previously deleted name
	Remove    bool                  `json:"remove,omitempty"`    // Remove a previously deleted name
	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

	AutonameAddr base.Address `json:"-"`
	// contains filtered or unexported fields
}

NamesOptions provides all command options for the chifra names command.

func GetNamesOptions

func GetNamesOptions(args []string, g *globals.GlobalOptions) *NamesOptions

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

func GetOptions

func GetOptions() *NamesOptions

func (*NamesOptions) HandleAutoname

func (opts *NamesOptions) HandleAutoname() error

func (*NamesOptions) HandleClean

func (opts *NamesOptions) HandleClean() error

func (*NamesOptions) HandleCrud

func (opts *NamesOptions) HandleCrud() (err error)

func (*NamesOptions) HandleShow

func (opts *NamesOptions) HandleShow() error

func (*NamesOptions) HandleTags

func (opts *NamesOptions) HandleTags() error

func (*NamesOptions) NamesInternal

func (opts *NamesOptions) NamesInternal() error

NamesInternal handles the internal workings of the names command. Returns an error.

func (*NamesOptions) String

func (opts *NamesOptions) 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