standard

package
v0.99.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package standard contains interfaces for well-defined standards and a function for checking if an arbitrary manifest complies with them.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMethodMissing         = errors.New("method missing")
	ErrEventMissing          = errors.New("event missing")
	ErrInvalidReturnType     = errors.New("invalid return type")
	ErrInvalidParameterCount = errors.New("invalid parameter count")
	ErrInvalidParameterName  = errors.New("invalid parameter name")
	ErrInvalidParameterType  = errors.New("invalid parameter type")
	ErrSafeMethodMismatch    = errors.New("method has wrong safe flag")
)

Various validation errors.

Functions

func Check

func Check(m *manifest.Manifest, standards ...string) error

Check checks if the manifest complies with all provided standards. Currently, only NEP-17 is supported.

func CheckABI added in v0.94.0

func CheckABI(m *manifest.Manifest, standards ...string) error

CheckABI is similar to Check but doesn't check parameter names.

func Comply

func Comply(m *manifest.Manifest, st *Standard) error

Comply if m has all methods and event from st manifest and they have the same signature. Parameter names are ignored.

func ComplyABI added in v0.94.0

func ComplyABI(m *manifest.Manifest, st *Standard) error

ComplyABI is similar to comply but doesn't check parameter names.

Types

type Standard added in v0.94.0

type Standard struct {
	// Manifest describes mandatory methods and events.
	manifest.Manifest
	// Base contains base standard.
	Base *Standard
	// Optional contains optional contract methods.
	// If contract contains method with the same name and parameter count,
	// it must have signature declared by this contract.
	Optional []manifest.Method
}

Standard represents smart-contract standard.

Jump to

Keyboard shortcuts

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