go-ethereum: github.com/ethereum/go-ethereum/signer/fourbyte Index | Files

package fourbyte

import "github.com/ethereum/go-ethereum/signer/fourbyte"

Package fourbyte contains the 4byte database.

Index

Package Files

4byte.go abi.go fourbyte.go validation.go

func Asset Uses

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDigest Uses

func AssetDigest(name string) ([sha256.Size]byte, error)

AssetDigest returns the digest of the file with the given name. It returns an error if the asset could not be found or the digest could not be loaded.

func AssetDir Uses

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"}, AssetDir("data/img") would return []string{"a.png", "b.png"}, AssetDir("foo.txt") and AssetDir("notexist") would return an error, and AssetDir("") will return []string{"data"}.

func AssetInfo Uses

func AssetInfo(name string) (os.FileInfo, error)

AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetNames Uses

func AssetNames() []string

AssetNames returns the names of the assets.

func AssetString Uses

func AssetString(name string) (string, error)

AssetString returns the asset contents as a string (instead of a []byte).

func Digests Uses

func Digests() (map[string][sha256.Size]byte, error)

Digests returns a map of all known files and their checksums.

func MustAsset Uses

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.

func MustAssetString Uses

func MustAssetString(name string) string

MustAssetString is like AssetString but panics when Asset would return an error. It simplifies safe initialization of global variables.

func RestoreAsset Uses

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory.

func RestoreAssets Uses

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively.

type Database Uses

type Database struct {
    // contains filtered or unexported fields
}

Database is a 4byte database with the possibility of maintaining an immutable set (embedded) into the process and a mutable set (loaded and written to file).

func New Uses

func New() (*Database, error)

New loads the standard signature database embedded in the package.

func NewFromFile Uses

func NewFromFile(path string) (*Database, error)

NewFromFile loads signature database from file, and errors if the file is not valid JSON. The constructor does no other validation of contents. This method does not load the embedded 4byte database.

The provided path will be used to write new values into if they are submitted via the API.

func NewWithFile Uses

func NewWithFile(path string) (*Database, error)

NewWithFile loads both the standard signature database (embedded resource file) as well as a custom database. The latter will be used to write new values into if they are submitted via the API.

func (*Database) AddSelector Uses

func (db *Database) AddSelector(selector string, data []byte) error

AddSelector inserts a new 4byte entry into the database. If custom database saving is enabled, the new dataset is also persisted to disk.

Node, this method does _not_ validate the correctness of the data. It assumes the caller has already done so.

func (*Database) Selector Uses

func (db *Database) Selector(id []byte) (string, error)

Selector checks the given 4byte ID against the known ABI methods.

This method does not validate the match, it's assumed the caller will do.

func (*Database) Size Uses

func (db *Database) Size() (int, int)

Size returns the number of 4byte entries in the embedded and custom datasets.

func (*Database) ValidateCallData Uses

func (db *Database) ValidateCallData(selector *string, data []byte, messages *core.ValidationMessages)

ValidateCallData checks if the ABI call-data + method selector (if given) can be parsed and seems to match.

func (*Database) ValidateTransaction Uses

func (db *Database) ValidateTransaction(selector *string, tx *core.SendTxArgs) (*core.ValidationMessages, error)

ValidateTransaction does a number of checks on the supplied transaction, and returns either a list of warnings, or an error (indicating that the transaction should be immediately rejected).

Package fourbyte imports 16 packages (graph) and is imported by 3 packages. Updated 2020-05-01. Refresh now. Tools for package owners.