common

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2022 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CnsIsName int32 = iota
	CnsIsAddress
	CnsIsUndefined
)

Variables

This section is empty.

Functions

func AbiParse

func AbiParse(abiFilePath, str string) []byte

===============================Abi Parsing======================================== AbiParse gets the abi bytes by the input parameters provided The abi file can be obtained through following ways: 1. user provide the abi file path 2. abiBytes of precompiled contracts (see precompiled/bindata.go) (currently, the following features are not enabled) a. get the abi files from default abi file locations b. get the abi bytes on chain (wasm contract only).

func ChainParamConvert

func ChainParamConvert(param, paramName string) interface{}

ChainParamConvert convert the string to chain defined type

func CombineFuncParams

func CombineFuncParams(args ...string) []string

CombineFuncParams combines the function parameters

func CombineRule

func CombineRule(addr, api string) string

CombineRule combines firewall rules

func ConvertSelect

func ConvertSelect(param, paramName string) (interface{}, error)

func IsNameOrAddress

func IsNameOrAddress(str string) int32

IsNameOrAddress Judge whether the input string is an address or a name

func ParamParse

func ParamParse(param, paramName string) interface{}

ParamParse convert the user inputs to the value needed

func ParamValidWrap

func ParamValidWrap(param, paramName string) bool

Types

type Cns

type Cns struct {
	/// To     common.Address
	Name   string // the cns name of contract
	TxType uint64 // the transaction type of the contract execution (EXECUTE_CONTRACT or CNS_TX_TYPE)
}

func CnsParse

func CnsParse(contract string) (*Cns, common.Address, error)

CnsParse judge whether the input string is contract address or contract name and return the corresponding infos

func NewCns

func NewCns(name string, txType uint64) *Cns

type Convert

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

convert, convert user input from key to value

func NewConvert

func NewConvert(key1, key2 string, value1, value2 interface{}, paramName string) *Convert

Some of the contract function inputs are numbers, these numbers are hard for users to remember the meanings behind them, Thus, to simplify the user input, we convert the meaningful strings to number automatically For example, if user input: "valid", the converter will convert the string to 1

func (*Convert) Convert

func (conv *Convert) Convert(param string) (interface{}, error)

func (*Convert) Parse

func (conv *Convert) Parse(param interface{}) string

Jump to

Keyboard shortcuts

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