types

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2019 License: Apache-2.0 Imports: 21 Imported by: 74

README

基础类型定义

Address

版本: v0.1

日期: 2018年09月27日

简介

由公钥生成的唯一钱包地址 采用加密方法:ed25519

数据类型

byte数组

方法定义
  • byte和string类型转换
  • 判断空
  • 判断两个地址是否相等
  • Marshal返回byte数组/Unmashal设置地址值
  • MarshalJson/UnmarshalJson
  • 由公钥生成地址
  • 已知公钥和地址,地址是否由该公钥生成

Coin

版本: v0.1

日期: 2018年09月27日

简介

链上的代币

数据类型
QOS

QOS公链提供的统一代币体系

type QOS struct {
	Name 	string 	`json:"coin_name"`
	Amount 	BigInt	`json:"amount"`
}
QSC

供联盟链自定义的代币统称

type QSC struct {
	Name	string	`json:"coin_name"`
	Amount	BigInt	`json:"amount"`
}
方法定义
  • 成员变量的getters/setters

Documentation

Index

Constants

View Source
const (
	// Base error codes
	CodeOK                CodeType = 0
	CodeInternal          CodeType = 1
	CodeTxDecode          CodeType = 2
	CodeInvalidSequence   CodeType = 3
	CodeUnauthorized      CodeType = 4
	CodeInsufficientFunds CodeType = 5
	CodeUnknownRequest    CodeType = 6
	CodeInvalidAddress    CodeType = 7
	CodeInvalidPubKey     CodeType = 8
	CodeUnknownAddress    CodeType = 9
	CodeInsufficientCoins CodeType = 10
	CodeInvalidCoins      CodeType = 11
	CodeOutOfGas          CodeType = 12
	CodeMemoTooLarge      CodeType = 13
	CodeInsufficientFee   CodeType = 14
	CodeTooManySignatures CodeType = 15

	// CodespaceRoot is a codespace for error codes in this file only.
	// Notice that 0 is an "unset" codespace, which can be overridden with
	// Error.WithDefaultCodespace().
	CodespaceUndefined CodespaceType = ""
	CodespaceRoot      CodespaceType = "sdk"
)

SDK error codes

View Source
const (
	StoreTypeMulti     = types.StoreTypeMulti
	StoreTypeDB        = types.StoreTypeDB
	StoreTypeIAVL      = types.StoreTypeIAVL
	StoreTypeTransient = types.StoreTypeTransient
)

nolint - reexport

View Source
const (
	PREF_ADD = "address" // 地址前缀
)
View Source
const SortableTimeFormat = "2006-01-02T15:04:05.000000000"

Slight modification of the RFC3339Nano but it right pads all zeros and drops the time zone info

Variables

View Source
var (
	TagAction = "action"
)

common tags

Functions

func AddUint64Overflow added in v0.0.10

func AddUint64Overflow(a, b uint64) (uint64, bool)

AddUint64Overflow performs the addition operation on two uint64 integers and returns a boolean on whether or not the result overflows.

func AppendMsgToErr added in v0.0.10

func AppendMsgToErr(msg string, err string) string

appends a message to the head of the given error

func Bool2Byte

func Bool2Byte(in bool) []byte

函数:bool 转化为 []byte

func CheckQscName added in v0.0.2

func CheckQscName(qscName string) bool

功能:检查 QscName 的合法性 备注:合法(3-10个字符,数字-字母-下划线)

func CodeToDefaultMsg

func CodeToDefaultMsg(code CodeType) string

NOTE: Don't stringer this, we'll put better messages in later.

func DecoderTx added in v0.0.2

func DecoderTx(cdc *go_amino.Codec, txBytes []byte) (Tx, Error)

func DiffKVStores added in v0.2.0

func DiffKVStores(a KVStore, b KVStore, prefixesToSkip [][]byte) (kvA cmn.KVPair, kvB cmn.KVPair, count int64, equal bool)

Compare two KVstores, return either the first key/value pair at which they differ and whether or not they are equal, skipping value comparison for a set of provided prefixes

func FormatTimeBytes added in v0.0.10

func FormatTimeBytes(t time.Time) []byte

Formats a time.Time into a []byte that can be sorted

func GetAddrFromBech32

func GetAddrFromBech32(bech32Addr string) (address []byte, err error)

由Bech32编码的地址解码为byte数组 prefix_type 验证类型是否相符

func GetChainID added in v0.0.7

func GetChainID(rootDir string) (string, error)

func GetGenesisDoc added in v0.0.7

func GetGenesisDoc(rootDir string) (*tmtypes.GenesisDoc, error)

func InclusiveEndBytes added in v0.2.0

func InclusiveEndBytes(inclusiveBytes []byte) (exclusiveBytes []byte)

InclusiveEndBytes returns the []byte that would end a range query such that the input would be included

func Int2Byte

func Int2Byte(in int64) []byte

函数:int64 转化为 []byte

func IntEq added in v0.0.10

func IntEq(t *testing.T, exp, got BigInt) (*testing.T, bool, string, string, string)

intended to be used with require/assert: require.True(IntEq(...))

func MustSortJSON

func MustSortJSON(toSortJSON []byte) []byte

MustSortJSON is like SortJSON but panic if an error occurs, e.g., if the passed JSON isn't valid.

func ParseTimeBytes added in v0.0.10

func ParseTimeBytes(bz []byte) (time.Time, error)

Parses a []byte encoded using FormatTimeKey back into a time.Time

func PrefixEndBytes added in v0.2.0

func PrefixEndBytes(prefix []byte) []byte

PrefixEndBytes returns the []byte that would end a range query for all []byte with a certain prefix Deals with last byte of prefix being FF without overflowing

func SortJSON

func SortJSON(toSortJSON []byte) ([]byte, error)

SortedJSON takes any JSON and returns it sorted by keys. Also, all white-spaces are removed. This method can be used to canonicalize JSON to be returned by GetSignBytes, e.g. for the ledger integration. If the passed JSON isn't valid it will return an error.

func UintOverflow added in v0.0.10

func UintOverflow(x Uint) bool

UintOverflow returns true if a given unsigned integer overflows and false otherwise.

Types

type Address

type Address crypto.Address

地址,类型byte数组

func (Address) Bytes

func (add Address) Bytes() []byte

地址转换为bytes

func (Address) Empty

func (add Address) Empty() bool

判断地址是否为空

func (Address) EqualsTo

func (add Address) EqualsTo(anotherAdd Address) bool

判断两地址是否相同

func (Address) Marshal

func (add Address) Marshal() ([]byte, error)

photobuf: marshal得到地址原始byte数组

func (Address) MarshalJSON

func (add Address) MarshalJSON() ([]byte, error)

用Bech32编码将地址marshal为Json

func (Address) String

func (add Address) String() string

将base64的地址转换成bech32编码的字符串

func (*Address) Unmarshal

func (add *Address) Unmarshal(data []byte) error

photobuf:Unmarshal设置地址的byte数组值

func (*Address) UnmarshalJSON

func (add *Address) UnmarshalJSON(bech32Addr []byte) error

将Bech32编码的地址Json进行UnMarshal

type BaseCoin added in v0.0.2

type BaseCoin struct {
	Name   string `json:"coin_name"`
	Amount BigInt `json:"amount"`
}

func NewBaseCoin added in v0.0.2

func NewBaseCoin(name string, amount BigInt) *BaseCoin

func NewInt64BaseCoin added in v0.0.7

func NewInt64BaseCoin(name string, amount int64) *BaseCoin

func ParseCoins added in v0.0.10

func ParseCoins(str string) ([]*BaseCoin, error)

func (*BaseCoin) GetAmount added in v0.0.2

func (coin *BaseCoin) GetAmount() BigInt

func (*BaseCoin) GetName added in v0.0.2

func (coin *BaseCoin) GetName() string

func (*BaseCoin) IsEqual added in v0.0.2

func (coin *BaseCoin) IsEqual(another Coin) bool

同名币,判断数量是否相等

func (*BaseCoin) IsGreaterThan added in v0.0.2

func (coin *BaseCoin) IsGreaterThan(another Coin) bool

同名币,判断数量是否更大

func (*BaseCoin) IsLessThan added in v0.0.2

func (coin *BaseCoin) IsLessThan(another Coin) bool

同名币,判断数量是否更小

func (*BaseCoin) IsNegative added in v0.0.2

func (coin *BaseCoin) IsNegative() bool

判断币的数量是否为负值

func (*BaseCoin) IsNotNegative added in v0.0.4

func (coin *BaseCoin) IsNotNegative() bool

判断币的数量是否为非负值

func (*BaseCoin) IsPositive added in v0.0.2

func (coin *BaseCoin) IsPositive() bool

判断币的数量是否为正值

func (*BaseCoin) IsZero added in v0.0.2

func (coin *BaseCoin) IsZero() bool

判断币的数量是否为零

func (*BaseCoin) Minus added in v0.0.2

func (coin *BaseCoin) Minus(coinB Coin) Coin

对同名币的数量做减法运算;如果不同名则返回原值

func (*BaseCoin) MinusByAmount added in v0.0.2

func (coin *BaseCoin) MinusByAmount(amountminus BigInt)

减掉一定数量的币

func (*BaseCoin) Plus added in v0.0.2

func (coin *BaseCoin) Plus(coinB Coin) Coin

对同名币的数量做加法运算;如果不同名则返回原值

func (*BaseCoin) PlusByAmount added in v0.0.2

func (coin *BaseCoin) PlusByAmount(amountplus BigInt)

增加一定数量的币

func (*BaseCoin) SameNameAs added in v0.0.2

func (coin *BaseCoin) SameNameAs(another Coin) bool

判断是否与另一币同名

func (*BaseCoin) SetAmount added in v0.0.2

func (coin *BaseCoin) SetAmount(amount BigInt)

func (*BaseCoin) String added in v0.0.2

func (coin *BaseCoin) String() string

将币的信息输出为可读字符串

type BaseCoins added in v0.0.4

type BaseCoins []*BaseCoin

BaseCoin集合

func (BaseCoins) AmountOf added in v0.0.4

func (coins BaseCoins) AmountOf(name string) BigInt

返回coins内给定币种币值

func (BaseCoins) IsEqual added in v0.0.4

func (coins BaseCoins) IsEqual(coinsB BaseCoins) bool

返回coins是否和coinsB一致

func (BaseCoins) IsGTE added in v0.0.4

func (coins BaseCoins) IsGTE(coinsB BaseCoins) bool

返回coins内币种币值是否均大于等于coinsB对应值

func (BaseCoins) IsLT added in v0.0.4

func (coins BaseCoins) IsLT(coinsB BaseCoins) bool

返回coins内币种币值是否均小于coinsB对应值

func (BaseCoins) IsNotNegative added in v0.0.4

func (coins BaseCoins) IsNotNegative() bool

返回coins内币种币值是否均大于等于0

func (BaseCoins) IsPositive added in v0.0.4

func (coins BaseCoins) IsPositive() bool

返回coins内币种币值是否均大于0

func (BaseCoins) IsValid added in v0.0.4

func (coins BaseCoins) IsValid() bool

校验 1.排序好 2.amount没有0值

func (BaseCoins) IsZero added in v0.0.4

func (coins BaseCoins) IsZero() bool

返回coins内币种币值是否均等于0

func (BaseCoins) Len added in v0.0.4

func (coins BaseCoins) Len() int

func (BaseCoins) Less added in v0.0.4

func (coins BaseCoins) Less(i, j int) bool

func (BaseCoins) Minus added in v0.0.4

func (coins BaseCoins) Minus(coinsB BaseCoins) BaseCoins

相减

func (BaseCoins) Negative added in v0.0.4

func (coins BaseCoins) Negative() BaseCoins

返回相反值

func (BaseCoins) Plus added in v0.0.4

func (coins BaseCoins) Plus(coinsB BaseCoins) BaseCoins

BaseCoins相加 注意:任何一个BaseCoin如果amount有0值将不会返回正确值

func (BaseCoins) Sort added in v0.0.4

func (coins BaseCoins) Sort() BaseCoins

func (BaseCoins) String added in v0.0.4

func (coins BaseCoins) String() string

func (BaseCoins) Swap added in v0.0.4

func (coins BaseCoins) Swap(i, j int)

type BigInt

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

BigInt wraps integer with 256 bit range bound Checks overflow, underflow and division by zero Exists in range from -(2^255-1) to 2^255-1

func MinInt

func MinInt(i1, i2 BigInt) BigInt

Return the minimum of the ints

func NewInt

func NewInt(n int64) BigInt

NewInt constructs BigInt from int64

func NewIntFromBigInt

func NewIntFromBigInt(i *big.Int) BigInt

NewIntFromBigInt constructs BigInt from big.BigInt

func NewIntFromString

func NewIntFromString(s string) (res BigInt, ok bool)

NewIntFromString constructs BigInt from string

func NewIntWithDecimal

func NewIntWithDecimal(n int64, dec int) BigInt

NewIntWithDecimal constructs BigInt with decimal Result value is n*10^dec

func OneInt

func OneInt() BigInt

OneInt returns BigInt value with one

func ZeroInt

func ZeroInt() BigInt

ZeroInt returns BigInt value with zero

func (BigInt) Add

func (i BigInt) Add(i2 BigInt) (res BigInt)

Add adds BigInt from another

func (BigInt) AddRaw

func (i BigInt) AddRaw(i2 int64) BigInt

AddRaw adds int64 to BigInt

func (BigInt) BigInt

func (i BigInt) BigInt() *big.Int

BigInt converts BigInt to big.BigInt

func (BigInt) Div

func (i BigInt) Div(i2 BigInt) (res BigInt)

Div divides BigInt with BigInt

func (BigInt) DivRaw

func (i BigInt) DivRaw(i2 int64) BigInt

DivRaw divides BigInt with int64

func (BigInt) Equal

func (i BigInt) Equal(i2 BigInt) bool

Equal compares two Ints

func (BigInt) GT

func (i BigInt) GT(i2 BigInt) bool

GT returns true if first BigInt is greater than second

func (BigInt) Int64

func (i BigInt) Int64() int64

Int64 converts BigInt to int64 Panics if the value is out of range

func (BigInt) IsInt64

func (i BigInt) IsInt64() bool

IsInt64 returns true if Int64() not panics

func (BigInt) IsNil added in v0.0.4

func (bi BigInt) IsNil() bool

判断bigint中的实体数值是否为空

func (BigInt) IsZero

func (i BigInt) IsZero() bool

IsZero returns true if BigInt is zero

func (BigInt) LT

func (i BigInt) LT(i2 BigInt) bool

LT returns true if first BigInt is lesser than second

func (BigInt) MarshalAmino

func (i BigInt) MarshalAmino() (string, error)

MarshalAmino defines custom encoding scheme

func (BigInt) MarshalJSON

func (i BigInt) MarshalJSON() ([]byte, error)

MarshalJSON defines custom encoding scheme

func (BigInt) Mod

func (i BigInt) Mod(i2 BigInt) BigInt

Mod returns remainder after dividing with BigInt

func (BigInt) ModRaw

func (i BigInt) ModRaw(i2 int64) BigInt

ModRaw returns remainder after dividing with int64

func (BigInt) Mul

func (i BigInt) Mul(i2 BigInt) (res BigInt)

Mul multiples two Ints

func (BigInt) MulRaw

func (i BigInt) MulRaw(i2 int64) BigInt

MulRaw multipies BigInt and int64

func (BigInt) Neg

func (i BigInt) Neg() (res BigInt)

Neg negates BigInt

func (BigInt) NilToZero added in v0.0.4

func (i BigInt) NilToZero() BigInt

BigInt nil值转换成0值

func (BigInt) Sign

func (i BigInt) Sign() int

Sign returns sign of BigInt

func (BigInt) String

func (i BigInt) String() string

Human readable string

func (BigInt) Sub

func (i BigInt) Sub(i2 BigInt) (res BigInt)

Sub subtracts BigInt from another

func (BigInt) SubRaw

func (i BigInt) SubRaw(i2 int64) BigInt

SubRaw subtracts int64 from BigInt

func (*BigInt) UnmarshalAmino

func (i *BigInt) UnmarshalAmino(text string) error

UnmarshalAmino defines custom decoding scheme

func (*BigInt) UnmarshalJSON

func (i *BigInt) UnmarshalJSON(bz []byte) error

UnmarshalJSON defines custom decoding scheme

type CacheKVStore added in v0.2.0

type CacheKVStore = types.CacheKVStore

nolint - reexport

type CacheMultiStore added in v0.2.0

type CacheMultiStore = types.CacheMultiStore

nolint - reexport

type CacheWrap added in v0.2.0

type CacheWrap = types.CacheWrap

nolint - reexport

type CacheWrapper added in v0.2.0

type CacheWrapper = types.CacheWrapper

nolint - reexport

type CodeType

type CodeType uint32

CodeType - ABCI code identifier within codespace

func (CodeType) IsOK added in v0.0.10

func (code CodeType) IsOK() bool

IsOK - is everything okay?

type CodespaceType

type CodespaceType string

CodespaceType - codespace identifier

type Coin

type Coin interface {
	// getters and setters
	GetName() string
	GetAmount() BigInt
	SetAmount(amount BigInt)

	// 判断是否同种币
	SameNameAs(Coin) bool
	String() string

	// 判断币的数量
	IsZero() bool
	IsPositive() bool
	IsNotNegative() bool
	IsNegative() bool
	IsGreaterThan(Coin) bool
	IsLessThan(Coin) bool
	IsEqual(Coin) bool

	// 币的数量运算
	Plus(coinB Coin) Coin
	Minus(coinB Coin) Coin
}

币的通用接口

type CommitID added in v0.2.0

type CommitID = types.CommitID

nolint - reexport

type CommitKVStore added in v0.2.0

type CommitKVStore = types.CommitKVStore

nolint - reexport

type CommitMultiStore added in v0.2.0

type CommitMultiStore = types.CommitMultiStore

nolint - reexport

type CommitStore added in v0.2.0

type CommitStore = types.CommitStore

nolint - reexport

type Committer added in v0.2.0

type Committer = types.Committer

nolint - reexport

type Error

type Error interface {

	// convenience
	TraceSDK(format string, args ...interface{}) Error

	// set codespace
	WithDefaultCodespace(CodespaceType) Error

	Code() CodeType
	Codespace() CodespaceType
	ABCILog() string
	Result() Result
	QueryResult() abci.ResponseQuery
	// contains filtered or unexported methods
}

sdk Error type

func ErrInsufficientCoins

func ErrInsufficientCoins(msg string) Error

func ErrInsufficientFee added in v0.0.10

func ErrInsufficientFee(msg string) Error

func ErrInsufficientFunds

func ErrInsufficientFunds(msg string) Error

func ErrInternal

func ErrInternal(msg string) Error

nolint

func ErrInvalidAddress

func ErrInvalidAddress(msg string) Error

func ErrInvalidCoins

func ErrInvalidCoins(msg string) Error

func ErrInvalidPubKey

func ErrInvalidPubKey(msg string) Error

func ErrInvalidSequence

func ErrInvalidSequence(msg string) Error

func ErrMemoTooLarge

func ErrMemoTooLarge(msg string) Error

func ErrOutOfGas

func ErrOutOfGas(msg string) Error

func ErrTooManySignatures added in v0.0.10

func ErrTooManySignatures(msg string) Error

func ErrTxDecode

func ErrTxDecode(msg string) Error

func ErrUnauthorized

func ErrUnauthorized(msg string) Error

func ErrUnknownAddress

func ErrUnknownAddress(msg string) Error

func ErrUnknownRequest

func ErrUnknownRequest(msg string) Error

func NewError

func NewError(codespace CodespaceType, code CodeType, format string, args ...interface{}) Error

NewError - create an error.

type ErrorGasOverflow added in v0.0.10

type ErrorGasOverflow = types.ErrorGasOverflow

nolint - reexport

type ErrorOutOfGas

type ErrorOutOfGas = types.ErrorOutOfGas

nolint - reexport

type Gas

type Gas = types.Gas

nolint - reexport

type GasConfig

type GasConfig = types.GasConfig

nolint - reexport

type GasMeter

type GasMeter = types.GasMeter

nolint - reexport

func NewGasMeter

func NewGasMeter(limit Gas) GasMeter

nolint - reexport

func NewInfiniteGasMeter

func NewInfiniteGasMeter() GasMeter

nolint - reexport

type GenesisState added in v0.0.5

type GenesisState struct {
	QCPs []*QCPConfig `json:"qcps"`
}

app_state in genesis.json

type Iterator added in v0.2.0

type Iterator = types.Iterator

nolint - reexport

func KVStorePrefixIterator added in v0.2.0

func KVStorePrefixIterator(kvs KVStore, prefix []byte) Iterator

Iterator over all the keys with a certain prefix in ascending order

func KVStoreReversePrefixIterator added in v0.2.0

func KVStoreReversePrefixIterator(kvs KVStore, prefix []byte) Iterator

Iterator over all the keys with a certain prefix in descending order.

type KVPair added in v0.2.0

type KVPair = types.KVPair

key-value result for iterator queries

type KVStore added in v0.2.0

type KVStore = types.KVStore

nolint - reexport

type KVStoreKey added in v0.2.0

type KVStoreKey = types.KVStoreKey

nolint - reexport

func NewKVStoreKey added in v0.2.0

func NewKVStoreKey(name string) *KVStoreKey

NewKVStoreKey returns a new pointer to a KVStoreKey. Use a pointer so keys don't collide.

type MultiStore added in v0.2.0

type MultiStore = types.MultiStore

nolint - reexport

type PruningOptions added in v0.2.0

type PruningOptions = types.PruningOptions

nolint - reexport

type QCPConfig added in v0.0.5

type QCPConfig struct {
	Name    string        `json:"name"`
	ChainId string        `json:"chain_id"`
	PubKey  crypto.PubKey `json:"pub_key"`
}

QCP配置

type Queryable added in v0.2.0

type Queryable = types.Queryable

nolint - reexport

type Result

type Result struct {

	// Code is the response code, is stored back on the chain.
	Code CodeType

	// Codespace is the string referring to the domain of an error
	Codespace CodespaceType

	// Data is any data returned from the app.
	Data []byte

	// Log is just debug information. NOTE: nondeterministic.
	Log string

	// GasWanted is the maximum units of work we allow this tx to perform.
	GasWanted uint64

	// GasUsed is the amount of gas actually consumed. NOTE: unimplemented
	GasUsed uint64

	// Tx fee amount and denom.
	FeeAmount int64
	FeeDenom  string

	// Tags are used for transaction indexing and pubsub.
	Tags Tags
}

Result is the union of ResponseDeliverTx and ResponseCheckTx.

func (Result) IsOK

func (res Result) IsOK() bool

TODO: In the future, more codes may be OK.

type Store added in v0.2.0

type Store = types.Store

nolint - reexport

type StoreKey added in v0.2.0

type StoreKey = types.StoreKey

nolint - reexport

type StoreType added in v0.2.0

type StoreType = types.StoreType

nolint - reexport

type StringTag added in v0.2.0

type StringTag struct {
	Key   string `json:"key"`
	Value string `json:"value,omitempty"`
}

A KVPair where the Key and Value are both strings, rather than []byte

func TagToStringTag added in v0.2.0

func TagToStringTag(tag Tag) StringTag

Conversion function from a []byte tag to a string tag

func (StringTag) String added in v0.2.0

func (st StringTag) String() string

type StringTags added in v0.2.0

type StringTags []StringTag

A slice of StringTag

func TagsToStringTags added in v0.2.0

func TagsToStringTags(tags Tags) StringTags

Conversion function from Tags to a StringTags

func (StringTags) String added in v0.2.0

func (st StringTags) String() string

type Tag

type Tag = cmn.KVPair

Type synonym for convenience

func MakeTag

func MakeTag(k string, v string) Tag

Make a tag from a key and a value

type Tags

type Tags cmn.KVPairs

Type synonym for convenience

func EmptyTags

func EmptyTags() Tags

New empty tags

func NewTags

func NewTags(tags ...interface{}) Tags

New variadic tags, must be k string, v []byte repeating

func (Tags) AppendTag

func (t Tags) AppendTag(k string, v string) Tags

Append a single tag

func (Tags) AppendTags

func (t Tags) AppendTags(tags Tags) Tags

Append two lists of tags

func (Tags) ToKVPairs

func (t Tags) ToKVPairs() []cmn.KVPair

Turn tags into KVPair list

type TraceContext added in v0.2.0

type TraceContext = types.TraceContext

TraceContext contains TraceKVStore context data. It will be written with every trace operation.

type TransientStoreKey added in v0.2.0

type TransientStoreKey = types.TransientStoreKey

nolint - reexport

func NewTransientStoreKey added in v0.2.0

func NewTransientStoreKey(name string) *TransientStoreKey

Constructs new TransientStoreKey Must return a pointer according to the ocap principle

type Tx

type Tx interface {
	Type() string
}

Tx: 对stdTx及qcpTx类型的封装

type Uint

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

BigInt wraps integer with 256 bit range bound Checks overflow, underflow and division by zero Exists in range from 0 to 2^256-1

func MinUint

func MinUint(i1, i2 Uint) Uint

Return the minimum of the Uints

func NewUint

func NewUint(n uint64) Uint

NewUint constructs Uint from int64

func NewUintFromBigInt

func NewUintFromBigInt(i *big.Int) Uint

NewUintFromBigUint constructs Uint from big.Uint

func NewUintFromString

func NewUintFromString(s string) (res Uint, ok bool)

NewUintFromString constructs Uint from string

func NewUintWithDecimal

func NewUintWithDecimal(n uint64, dec int) Uint

NewUintWithDecimal constructs Uint with decimal Result value is n*10^dec

func OneUint

func OneUint() Uint

OneUint returns Uint value with one

func ZeroUint

func ZeroUint() Uint

ZeroUint returns Uint value with zero

func (Uint) Add

func (i Uint) Add(i2 Uint) (res Uint)

Add adds Uint from another

func (Uint) AddRaw

func (i Uint) AddRaw(i2 uint64) Uint

AddRaw adds uint64 to Uint

func (Uint) BigInt

func (i Uint) BigInt() *big.Int

BigInt converts Uint to big.Unt

func (Uint) Div

func (i Uint) Div(i2 Uint) (res Uint)

Div divides Uint with Uint

func (Uint) DivRaw

func (i Uint) DivRaw(i2 uint64) Uint

Div divides Uint with uint64

func (Uint) Equal

func (i Uint) Equal(i2 Uint) bool

Equal compares two Uints

func (Uint) GT

func (i Uint) GT(i2 Uint) bool

GT returns true if first Uint is greater than second

func (Uint) IsNil added in v0.0.10

func (i Uint) IsNil() bool

func (Uint) IsUint64

func (i Uint) IsUint64() bool

IsUint64 returns true if Uint64() not panics

func (Uint) IsZero

func (i Uint) IsZero() bool

IsZero returns true if Uint is zero

func (Uint) LT

func (i Uint) LT(i2 Uint) bool

LT returns true if first Uint is lesser than second

func (Uint) MarshalAmino

func (i Uint) MarshalAmino() (string, error)

MarshalAmino defines custom encoding scheme

func (Uint) MarshalJSON

func (i Uint) MarshalJSON() ([]byte, error)

MarshalJSON defines custom encoding scheme

func (Uint) Mod

func (i Uint) Mod(i2 Uint) Uint

Mod returns remainder after dividing with Uint

func (Uint) ModRaw

func (i Uint) ModRaw(i2 uint64) Uint

ModRaw returns remainder after dividing with uint64

func (Uint) Mul

func (i Uint) Mul(i2 Uint) (res Uint)

Mul multiples two Uints

func (Uint) MulRaw

func (i Uint) MulRaw(i2 uint64) Uint

MulRaw multipies Uint and uint64

func (Uint) NilToZero added in v0.0.10

func (i Uint) NilToZero() Uint

func (Uint) Sign

func (i Uint) Sign() int

Sign returns sign of Uint

func (Uint) String

func (i Uint) String() string

Human readable string

func (Uint) Sub

func (i Uint) Sub(i2 Uint) (res Uint)

Sub subtracts Uint from another

func (Uint) SubRaw

func (i Uint) SubRaw(i2 uint64) Uint

SubRaw subtracts uint64 from Uint

func (Uint) Uint64

func (i Uint) Uint64() uint64

Uint64 converts Uint to uint64 Panics if the value is out of range

func (*Uint) UnmarshalAmino

func (i *Uint) UnmarshalAmino(text string) error

UnmarshalAmino defines custom decoding scheme

func (*Uint) UnmarshalJSON

func (i *Uint) UnmarshalJSON(bz []byte) error

UnmarshalJSON defines custom decoding scheme

Jump to

Keyboard shortcuts

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