Help us shape the future of Go! Take the 2026 Go Developer Survey

validator

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidValidation = errors.New("invalid validation input")

ErrInvalidValidation is a sentinel error for any error not being caused by a given input failing validation.

Functions

This section is empty.

Types

type Configuration added in v1.3.4

type Configuration interface {
	Check(identifier.Network) error
}

type Validator

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

Validator validates Rosetta object identifiers.

func New

func New(params dps.Params, index dps.Reader, config Configuration) *Validator

New returns a new Validator.

func (*Validator) Account

func (v *Validator) Account(account identifier.Account) (flow.Address, error)

Account validates the given account identifier, and if successful, returns a matching Flow Address.

func (*Validator) Block

func (v *Validator) Block(rosBlockID identifier.Block) (uint64, flow.Identifier, error)

Block tries to extrapolate the block identifier to a full version of itself. If both index and hash are zero values, it is assumed that the latest block is referenced.

func (*Validator) CompleteBlockID added in v1.3.0

func (v *Validator) CompleteBlockID(rosBlockID identifier.Block) error

CompleteBlockID verifies that both index and hash are populated in the block ID.

func (*Validator) Currency

func (v *Validator) Currency(currency identifier.Currency) (string, uint, error)

Currency validates the given currency identifier and if it is, returns its symbol and decimals.

func (*Validator) Request added in v1.3.0

func (v *Validator) Request(request interface{}) error

Request runs the registered validators on the provided request. It either returns a typed error with contextual information, or a plain error describing what failed.

func (*Validator) Transaction

func (v *Validator) Transaction(transaction identifier.Transaction) (flow.Identifier, error)

Transaction validates a transaction identifier, and if its valid, returns a matching Flow Identifier.

Jump to

Keyboard shortcuts

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