types

package
v0.0.0-...-61460eb Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT, Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

*

Copyright Cosmos-SDK Authors
Copyright 2016 All in Bits, Inc

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

*

Copyright Cosmos-SDK Authors
Copyright 2016 All in Bits, Inc

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

*

Copyright Cosmos-SDK Authors
Copyright 2016 All in Bits, Inc

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

*

Copyright Cosmos-SDK Authors
Copyright 2016 All in Bits, Inc

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

*

Copyright Cosmos-SDK Authors
Copyright 2016 All in Bits, Inc

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

*

Copyright Cosmos-SDK Authors
Copyright 2016 All in Bits, Inc

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

*

Copyright Cosmos-SDK Authors
Copyright 2016 All in Bits, Inc

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

*

Copyright Cosmos-SDK Authors
Copyright 2016 All in Bits, Inc

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

*

Copyright Cosmos-SDK Authors
Copyright 2016 All in Bits, Inc

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

*

Copyright Cosmos-SDK Authors
Copyright 2016 All in Bits, Inc

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

*

Copyright Cosmos-SDK Authors
Copyright 2016 All in Bits, Inc

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

*

Copyright Cosmos-SDK Authors
Copyright 2016 All in Bits, Inc

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

*

Copyright Cosmos-SDK Authors
Copyright 2016 All in Bits, Inc

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

*

Copyright Cosmos-SDK Authors
Copyright 2016 All in Bits, Inc

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Index

Constants

View Source
const (
	// number of decimal places
	Precision = 18

	// bytes required to represent the above precision
	// Ceiling[Log2[999 999 999 999 999 999]]
	DecimalPrecisionBits = 60
)

Variables

View Source
var (
	ErrInvalidLengthAny        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowAny          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupAny = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthBank        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowBank          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupBank = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthCoin        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowCoin          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupCoin = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrEmptyDecimalStr      = errors.New("decimal string cannot be empty")
	ErrInvalidDecimalLength = errors.New("invalid decimal length")
	ErrInvalidDecimalStr    = errors.New("invalid decimal string")
)

Decimal errors

View Source
var (
	ErrInvalidLengthDuration        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowDuration          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupDuration = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthKeys        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowKeys          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupKeys = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthMultisig        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowMultisig          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupMultisig = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthSigning        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowSigning          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupSigning = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthTx        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTx          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group")
)
View Source
var MaxSortableDec = OneDec().Quo(SmallestDec())

MaxSortableDec is the largest Dec that can be passed into SortableDecBytes() Its negative form is the least Dec that can be passed in.

View Source
var SignMode_name = map[int32]string{
	0:   "SIGN_MODE_UNSPECIFIED",
	1:   "SIGN_MODE_DIRECT",
	2:   "SIGN_MODE_TEXTUAL",
	127: "SIGN_MODE_LEGACY_AMINO_JSON",
}
View Source
var SignMode_value = map[string]int32{
	"SIGN_MODE_UNSPECIFIED":       0,
	"SIGN_MODE_DIRECT":            1,
	"SIGN_MODE_TEXTUAL":           2,
	"SIGN_MODE_LEGACY_AMINO_JSON": 127,
}

Functions

func DecEq

func DecEq(t *testing.T, exp, got Dec) (*testing.T, bool, string, string, string)

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

func DecsEqual

func DecsEqual(d1s, d2s []Dec) bool

test if two decimal arrays are equal

func DurationFromProto

func DurationFromProto(p *Duration) (time.Duration, error)

func EncodeVarintTx

func EncodeVarintTx(dAtA []byte, offset int, v uint64) int

func IntEq

func IntEq(t *testing.T, exp, got Int) (*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 RegistryMessageConverter

func RegistryMessageConverter(t string, fn ConverterFunc)

func SizeOfStdDuration

func SizeOfStdDuration(d time.Duration) int

func SkipTx

func SkipTx(dAtA []byte) (n int, err error)

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 SortableDecBytes

func SortableDecBytes(dec Dec) []byte

SortableDecBytes returns a byte slice representation of a Dec that can be sorted. Left and right pads with 0s so there are 18 digits to left and right of the decimal point. For this reason, there is a maximum and minimum value for this, enforced by ValidSortableDec.

func SovTx

func SovTx(x uint64) (n int)

func StdDurationMarshal

func StdDurationMarshal(d time.Duration) ([]byte, error)

func StdDurationMarshalTo

func StdDurationMarshalTo(d time.Duration, data []byte) (int, error)

func StdDurationUnmarshal

func StdDurationUnmarshal(d *time.Duration, data []byte) error

func ValidSortableDec

func ValidSortableDec(dec Dec) bool

ValidSortableDec ensures that a Dec is within the sortable bounds, a Dec can't have a precision of less than 10^-18. Max sortable decimal was set to the reciprocal of SmallestDec.

func ValidateDenom

func ValidateDenom(denom string) error

ValidateDenom is the default validation function for Coin.Denom.

Types

type Any

type Any struct {
	// nolint
	TypeUrl string `protobuf:"bytes,1,opt,name=type_url,json=typeUrl,proto3" json:"type_url,omitempty"`
	// Must be a valid serialized protocol buffer of the above specified type.
	Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`

	// nolint
	XXX_unrecognized []byte `json:"-"`
}

func NewAnyWithValue

func NewAnyWithValue(v Message) (*Any, error)

NewAnyWithValue constructs a new Any packed with the value provided or returns an error if that value couldn't be packed. This also caches the packed value so that it can be retrieved from GetCachedValue without unmarshaling

func NewAnyWithValueAndName

func NewAnyWithValueAndName(v Message) (*Any, error)

func (*Any) Marshal

func (m *Any) Marshal() (dAtA []byte, err error)

func (*Any) MarshalTo

func (m *Any) MarshalTo(dAtA []byte) (int, error)

func (*Any) MarshalToSizedBuffer

func (m *Any) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Any) Size

func (m *Any) Size() (n int)

func (*Any) Unmarshal

func (m *Any) Unmarshal(dAtA []byte) error

type Coin

type Coin struct {
	Denom  string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"`
	Amount Int    `protobuf:"bytes,2,opt,name=amount,proto3,customtype=Int" json:"amount"`
}

Coin defines a token with a denomination and an amount.

NOTE: The amount field is an Int which implements the custom method signatures required by gogoproto.

func NewCoin

func NewCoin(denom string, amount Int) Coin

NewCoin returns a new coin with a denomination and amount. It will panic if the amount is negative or if the denomination is invalid.

func NewInt64Coin

func NewInt64Coin(denom string, amount int64) Coin

NewInt64Coin returns a new coin with a denomination and amount. It will panic if the amount is negative.

func (Coin) Add

func (coin Coin) Add(coinB Coin) Coin

Add adds amounts of two coins with same denom. If the coins differ in denom then it panics.

func (Coin) AddAmount

func (coin Coin) AddAmount(amount Int) Coin

AddAmount adds an amount to the Coin.

func (Coin) IsEqual

func (coin Coin) IsEqual(other Coin) bool

IsEqual returns true if the two sets of Coins have the same value

func (Coin) IsGTE

func (coin Coin) IsGTE(other Coin) bool

IsGTE returns true if they are the same type and the receiver is an equal or greater value

func (Coin) IsLT

func (coin Coin) IsLT(other Coin) bool

IsLT returns true if they are the same type and the receiver is a smaller value

func (Coin) IsNegative

func (coin Coin) IsNegative() bool

IsNegative returns true if the coin amount is negative and false otherwise.

TODO: Remove once unsigned integers are used.

func (Coin) IsNil

func (coin Coin) IsNil() bool

IsNil returns true if the coin amount is nil and false otherwise.

func (Coin) IsPositive

func (coin Coin) IsPositive() bool

IsPositive returns true if coin amount is positive.

TODO: Remove once unsigned integers are used.

func (Coin) IsValid

func (coin Coin) IsValid() bool

IsValid returns true if the Coin has a non-negative amount and the denom is valid.

func (Coin) IsZero

func (coin Coin) IsZero() bool

IsZero returns if this represents no money

func (*Coin) Marshal

func (m *Coin) Marshal() (dAtA []byte, err error)

func (*Coin) MarshalTo

func (m *Coin) MarshalTo(dAtA []byte) (int, error)

func (*Coin) MarshalToSizedBuffer

func (m *Coin) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Coin) Size

func (m *Coin) Size() (n int)

func (Coin) String

func (coin Coin) String() string

String provides a human-readable representation of a coin

func (Coin) Sub

func (coin Coin) Sub(coinB Coin) Coin

Sub subtracts amounts of two coins with same denom. If the coins differ in denom then it panics.

func (Coin) SubAmount

func (coin Coin) SubAmount(amount Int) Coin

SubAmount subtracts an amount from the Coin.

func (*Coin) Unmarshal

func (m *Coin) Unmarshal(dAtA []byte) error

func (Coin) Validate

func (coin Coin) Validate() error

Validate returns an error if the Coin has a negative amount or if the denom is invalid.

type Coins

type Coins []Coin

Coins is a set of Coin, one per currency

func NewCoins

func NewCoins(coins ...Coin) Coins

NewCoins constructs a new coin set. The provided coins will be sanitized by removing zero coins and sorting the coin set. A panic will occur if the coin set is not valid.

func (Coins) Add

func (coins Coins) Add(coinsB ...Coin) Coins

Add adds two sets of coins.

e.g. {2A} + {A, 2B} = {3A, 2B} {2A} + {0B} = {2A}

NOTE: Add operates under the invariant that coins are sorted by denominations.

CONTRACT: Add will never return Coins where one Coin has a non-positive amount. In otherwords, IsValid will always return true. The function panics if `coins` or `coinsB` are not sorted (ascending).

func (Coins) AmountOf

func (coins Coins) AmountOf(denom string) Int

AmountOf returns the amount of a denom from coins

func (Coins) AmountOfNoDenomValidation

func (coins Coins) AmountOfNoDenomValidation(denom string) Int

AmountOfNoDenomValidation returns the amount of a denom from coins without validating the denomination.

func (Coins) DenomsSubsetOf

func (coins Coins) DenomsSubsetOf(coinsB Coins) bool

DenomsSubsetOf returns true if receiver's denom set is subset of coinsB's denoms.

func (Coins) Empty

func (coins Coins) Empty() bool

Empty returns true if there are no coins and false otherwise.

func (Coins) GetDenomByIndex

func (coins Coins) GetDenomByIndex(i int) string

GetDenomByIndex returns the Denom of the certain coin to make the findDup generic

func (Coins) IsAllGT

func (coins Coins) IsAllGT(coinsB Coins) bool

IsAllGT returns true if for every denom in coinsB, the denom is present at a greater amount in coins.

func (Coins) IsAllGTE

func (coins Coins) IsAllGTE(coinsB Coins) bool

IsAllGTE returns false if for any denom in coinsB, the denom is present at a smaller amount in coins; else returns true.

func (Coins) IsAllLT

func (coins Coins) IsAllLT(coinsB Coins) bool

IsAllLT returns True iff for every denom in coins, the denom is present at a smaller amount in coinsB.

func (Coins) IsAllLTE

func (coins Coins) IsAllLTE(coinsB Coins) bool

IsAllLTE returns true iff for every denom in coins, the denom is present at a smaller or equal amount in coinsB.

func (Coins) IsAllPositive

func (coins Coins) IsAllPositive() bool

IsAllPositive returns true if there is at least one coin and all currencies have a positive value.

func (Coins) IsAnyGT

func (coins Coins) IsAnyGT(coinsB Coins) bool

IsAnyGT returns true iff for any denom in coins, the denom is present at a greater amount in coinsB.

e.g. {2A, 3B}.IsAnyGT{A} = true {2A, 3B}.IsAnyGT{5C} = false {}.IsAnyGT{5C} = false {2A, 3B}.IsAnyGT{} = false

func (Coins) IsAnyGTE

func (coins Coins) IsAnyGTE(coinsB Coins) bool

IsAnyGTE returns true iff coins contains at least one denom that is present at a greater or equal amount in coinsB; it returns false otherwise.

NOTE: IsAnyGTE operates under the invariant that both coin sets are sorted by denominations and there exists no zero coins.

func (Coins) IsAnyNegative

func (coins Coins) IsAnyNegative() bool

IsAnyNegative returns true if there is at least one coin whose amount is negative; returns false otherwise. It returns false if the coin set is empty too.

TODO: Remove once unsigned integers are used.

func (Coins) IsAnyNil

func (coins Coins) IsAnyNil() bool

IsAnyNil returns true if there is at least one coin whose amount is nil; returns false otherwise. It returns false if the coin set is empty too.

func (Coins) IsEqual

func (coins Coins) IsEqual(coinsB Coins) bool

IsEqual returns true if the two sets of Coins have the same value

func (Coins) IsValid

func (coins Coins) IsValid() bool

IsValid calls Validate and returns true when the Coins are sorted, have positive amount, with a valid and unique denomination (i.e no duplicates).

func (Coins) IsZero

func (coins Coins) IsZero() bool

IsZero returns true if there are no coins or all coins are zero.

func (Coins) Len

func (coins Coins) Len() int

Len implements sort.Interface for Coins

func (Coins) Less

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

Less implements sort.Interface for Coins

func (Coins) MarshalJSON

func (coins Coins) MarshalJSON() ([]byte, error)

MarshalJSON implements a custom JSON marshaller for the Coins type to allow nil Coins to be encoded as an empty array.

func (Coins) SafeSub

func (coins Coins) SafeSub(coinsB Coins) (Coins, bool)

SafeSub performs the same arithmetic as Sub but returns a boolean if any negative coin amount was returned. The function panics if `coins` or `coinsB` are not sorted (ascending).

func (Coins) Sort

func (coins Coins) Sort() Coins

Sort is a helper function to sort the set of coins in-place

func (Coins) String

func (coins Coins) String() string

func (Coins) Sub

func (coins Coins) Sub(coinsB Coins) Coins

Sub subtracts a set of coins from another.

e.g. {2A, 3B} - {A} = {A, 3B} {2A} - {0B} = {2A} {A, B} - {A} = {B}

CONTRACT: Sub will never return Coins where one Coin has a non-positive amount. In otherwords, IsValid will always return true.

func (Coins) Swap

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

Swap implements sort.Interface for Coins

func (Coins) Validate

func (coins Coins) Validate() error

Validate checks that the Coins are sorted, have positive amount, with a valid and unique denomination (i.e no duplicates). Otherwise, it returns an error.

type CompactBitArray

type CompactBitArray struct {
	ExtraBitsStored uint32 `protobuf:"varint,1,opt,name=extra_bits_stored,json=extraBitsStored,proto3" json:"extra_bits_stored,omitempty"`
	Elems           []byte `protobuf:"bytes,2,opt,name=elems,proto3" json:"elems,omitempty"`
}

CompactBitArray is an implementation of a space efficient bit array. This is used to ensure that the encoded data takes up a minimal amount of space after proto encoding. This is not thread safe, and is not intended for concurrent usage.

func (*CompactBitArray) Marshal

func (m *CompactBitArray) Marshal() (dAtA []byte, err error)

func (*CompactBitArray) MarshalTo

func (m *CompactBitArray) MarshalTo(dAtA []byte) (int, error)

func (*CompactBitArray) MarshalToSizedBuffer

func (m *CompactBitArray) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*CompactBitArray) Size

func (m *CompactBitArray) Size() (n int)

func (*CompactBitArray) Unmarshal

func (m *CompactBitArray) Unmarshal(dAtA []byte) error

type ConverterFunc

type ConverterFunc func(string) *Any

func GetMessageConverter

func GetMessageConverter(t string) ConverterFunc

type Dec

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

NOTE: never use new(Dec) or else we will panic unmarshalling into the nil embedded big.Int

func MaxDec

func MaxDec(d1, d2 Dec) Dec

maximum decimal between two

func MinDec

func MinDec(d1, d2 Dec) Dec

minimum decimal between two

func MustNewDecFromStr

func MustNewDecFromStr(s string) Dec

Decimal from string, panic on error

func NewDec

func NewDec(i int64) Dec

create a new Dec from integer assuming whole number

func NewDecFromBigInt

func NewDecFromBigInt(i *big.Int) Dec

create a new Dec from big integer assuming whole numbers CONTRACT: prec <= Precision

func NewDecFromBigIntWithPrec

func NewDecFromBigIntWithPrec(i *big.Int, prec int64) Dec

create a new Dec from big integer assuming whole numbers CONTRACT: prec <= Precision

func NewDecFromInt

func NewDecFromInt(i Int) Dec

create a new Dec from big integer assuming whole numbers CONTRACT: prec <= Precision

func NewDecFromIntWithPrec

func NewDecFromIntWithPrec(i Int, prec int64) Dec

create a new Dec from big integer with decimal place at prec CONTRACT: prec <= Precision

func NewDecFromStr

func NewDecFromStr(str string) (Dec, error)

create a decimal from an input decimal string. valid must come in the form:

(-) whole integers (.) decimal integers

examples of acceptable input include:

-123.456
456.7890
345
-456789

NOTE - An error will return if more decimal places are provided in the string than the constant Precision.

CONTRACT - This function does not mutate the input str.

func NewDecWithPrec

func NewDecWithPrec(i, prec int64) Dec

create a new Dec from integer with decimal place at prec CONTRACT: prec <= Precision

func OneDec

func OneDec() Dec

func SmallestDec

func SmallestDec() Dec

func ZeroDec

func ZeroDec() Dec

func (Dec) Abs

func (d Dec) Abs() Dec

func (Dec) Add

func (d Dec) Add(d2 Dec) Dec

addition

func (Dec) ApproxRoot

func (d Dec) ApproxRoot(root uint64) (guess Dec, err error)

ApproxRoot returns an approximate estimation of a Dec's positive real nth root using Newton's method (where n is positive). The algorithm starts with some guess and computes the sequence of improved guesses until an answer converges to an approximate answer. It returns `|d|.ApproxRoot() * -1` if input is negative. A maximum number of 100 iterations is used a backup boundary condition for cases where the answer never converges enough to satisfy the main condition.

func (Dec) ApproxSqrt

func (d Dec) ApproxSqrt() (Dec, error)

ApproxSqrt is a wrapper around ApproxRoot for the common special case of finding the square root of a number. It returns -(sqrt(abs(d)) if input is negative.

func (Dec) BigInt

func (d Dec) BigInt() *big.Int

BigInt returns a copy of the underlying big.Int.

func (Dec) Ceil

func (d Dec) Ceil() Dec

Ceil returns the smallest interger value (as a decimal) that is greater than or equal to the given decimal.

func (Dec) Equal

func (d Dec) Equal(d2 Dec) bool

func (Dec) Float64

func (d Dec) Float64() (float64, error)

Float64 returns the float64 representation of a Dec. Will return the error if the conversion failed.

func (Dec) Format

func (d Dec) Format(s fmt.State, verb rune)

format decimal state

func (Dec) GT

func (d Dec) GT(d2 Dec) bool

func (Dec) GTE

func (d Dec) GTE(d2 Dec) bool

func (Dec) IsInteger

func (d Dec) IsInteger() bool

is integer, e.g. decimals are zero

func (Dec) IsNegative

func (d Dec) IsNegative() bool

func (Dec) IsNil

func (d Dec) IsNil() bool

func (Dec) IsPositive

func (d Dec) IsPositive() bool

func (Dec) IsZero

func (d Dec) IsZero() bool

func (Dec) LT

func (d Dec) LT(d2 Dec) bool

func (Dec) LTE

func (d Dec) LTE(d2 Dec) bool

func (Dec) Marshal

func (d Dec) Marshal() ([]byte, error)

Marshal implements the gogo proto custom type interface.

func (Dec) MarshalAmino

func (d Dec) MarshalAmino() ([]byte, error)

Override Amino binary serialization by proxying to protobuf.

func (Dec) MarshalJSON

func (d Dec) MarshalJSON() ([]byte, error)

MarshalJSON marshals the decimal

func (*Dec) MarshalTo

func (d *Dec) MarshalTo(data []byte) (n int, err error)

MarshalTo implements the gogo proto custom type interface.

func (Dec) MarshalYAML

func (d Dec) MarshalYAML() (interface{}, error)

MarshalYAML returns the YAML representation.

func (Dec) Mul

func (d Dec) Mul(d2 Dec) Dec

multiplication

func (Dec) MulInt

func (d Dec) MulInt(i Int) Dec

multiplication

func (Dec) MulInt64

func (d Dec) MulInt64(i int64) Dec

MulInt64 - multiplication with int64

func (Dec) MulTruncate

func (d Dec) MulTruncate(d2 Dec) Dec

multiplication truncate

func (Dec) MustFloat64

func (d Dec) MustFloat64() float64

MustFloat64 returns the float64 representation of a Dec. Would panic if the conversion failed.

func (Dec) Neg

func (d Dec) Neg() Dec

func (Dec) Power

func (d Dec) Power(power uint64) Dec

Power returns a the result of raising to a positive integer power

func (Dec) Quo

func (d Dec) Quo(d2 Dec) Dec

quotient

func (Dec) QuoInt

func (d Dec) QuoInt(i Int) Dec

quotient

func (Dec) QuoInt64

func (d Dec) QuoInt64(i int64) Dec

QuoInt64 - quotient with int64

func (Dec) QuoRoundUp

func (d Dec) QuoRoundUp(d2 Dec) Dec

quotient, round up

func (Dec) QuoTruncate

func (d Dec) QuoTruncate(d2 Dec) Dec

quotient truncate

func (Dec) RoundInt

func (d Dec) RoundInt() Int

RoundInt round the decimal using bankers rounding

func (Dec) RoundInt64

func (d Dec) RoundInt64() int64

RoundInt64 rounds the decimal using bankers rounding

func (*Dec) Size

func (d *Dec) Size() int

Size implements the gogo proto custom type interface.

func (Dec) String

func (d Dec) String() string

func (Dec) Sub

func (d Dec) Sub(d2 Dec) Dec

subtraction

func (Dec) TruncateDec

func (d Dec) TruncateDec() Dec

TruncateDec truncates the decimals from the number and returns a Dec

func (Dec) TruncateInt

func (d Dec) TruncateInt() Int

TruncateInt truncates the decimals from the number and returns an Int

func (Dec) TruncateInt64

func (d Dec) TruncateInt64() int64

TruncateInt64 truncates the decimals from the number and returns an int64

func (*Dec) Unmarshal

func (d *Dec) Unmarshal(data []byte) error

Unmarshal implements the gogo proto custom type interface.

func (*Dec) UnmarshalAmino

func (d *Dec) UnmarshalAmino(bz []byte) error

func (*Dec) UnmarshalJSON

func (d *Dec) UnmarshalJSON(bz []byte) error

UnmarshalJSON defines custom decoding scheme

type DecCoin

type DecCoin struct {
	Denom  string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"`
	Amount Dec    `protobuf:"bytes,2,opt,name=amount,proto3,customtype=Dec" json:"amount"`
}

DecCoin defines a token with a denomination and a decimal amount.

NOTE: The amount field is an Dec which implements the custom method signatures required by gogoproto.

func (*DecCoin) Marshal

func (m *DecCoin) Marshal() (dAtA []byte, err error)

func (*DecCoin) MarshalTo

func (m *DecCoin) MarshalTo(dAtA []byte) (int, error)

func (*DecCoin) MarshalToSizedBuffer

func (m *DecCoin) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*DecCoin) Size

func (m *DecCoin) Size() (n int)

func (*DecCoin) Unmarshal

func (m *DecCoin) Unmarshal(dAtA []byte) error

type Duration

type Duration struct {
	// Signed seconds of the span of time. Must be from -315,576,000,000
	// to +315,576,000,000 inclusive. Note: these bounds are computed from:
	// 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
	Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"`
	// Signed fractions of a second at nanosecond resolution of the span
	// of time. Durations less than one second are represented with a 0
	// `seconds` field and a positive or negative `nanos` field. For durations
	// of one second or more, a non-zero value for the `nanos` field must be
	// of the same sign as the `seconds` field. Must be from -999,999,999
	// to +999,999,999 inclusive.
	Nanos                int32    `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func DurationProto

func DurationProto(d time.Duration) *Duration

DurationProto converts a time.Duration to a Duration.

func (*Duration) Marshal

func (m *Duration) Marshal() (dAtA []byte, err error)

func (*Duration) MarshalTo

func (m *Duration) MarshalTo(dAtA []byte) (int, error)

func (*Duration) MarshalToSizedBuffer

func (m *Duration) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Duration) Size

func (m *Duration) Size() (n int)

func (*Duration) Unmarshal

func (m *Duration) Unmarshal(dAtA []byte) error

type Input

type Input struct {
	Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
	Coins   Coins  `protobuf:"bytes,2,rep,name=coins,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"coins"`
}

Input models transaction input.

func (*Input) Marshal

func (m *Input) Marshal() (dAtA []byte, err error)

func (*Input) MarshalToSizedBuffer

func (m *Input) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Input) Size

func (m *Input) Size() (n int)

func (*Input) Unmarshal

func (m *Input) Unmarshal(dAtA []byte) error

type Int

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

Int wraps big.Int with a 257 bit range bound Checks overflow, underflow and division by zero Exists in range from -(2^256 - 1) to 2^256 - 1

func MaxInt

func MaxInt(i, i2 Int) Int

MaxInt returns the maximum between two integers.

func MinInt

func MinInt(i1, i2 Int) Int

return the minimum of the ints

func NewInt

func NewInt(n int64) Int

NewInt constructs Int from int64

func NewIntFromBigInt

func NewIntFromBigInt(i *big.Int) Int

NewIntFromBigInt constructs Int from big.Int

func NewIntFromString

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

NewIntFromString constructs Int from string

func NewIntFromUint64

func NewIntFromUint64(n uint64) Int

NewIntFromUint64 constructs an Int from a uint64.

func NewIntWithDecimal

func NewIntWithDecimal(n int64, dec int) Int

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

func OneInt

func OneInt() Int

OneInt returns Int value with one

func ZeroInt

func ZeroInt() Int

ZeroInt returns Int value with zero

func (Int) Abs

func (i Int) Abs() Int

Abs returns the absolute value of Int.

func (Int) Add

func (i Int) Add(i2 Int) (res Int)

Add adds Int from another

func (Int) AddRaw

func (i Int) AddRaw(i2 int64) Int

AddRaw adds int64 to Int

func (Int) BigInt

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

BigInt converts Int to big.Int

func (Int) Equal

func (i Int) Equal(i2 Int) bool

Equal compares two Ints

func (Int) GT

func (i Int) GT(i2 Int) bool

GT returns true if first Int is greater than second

func (Int) GTE

func (i Int) GTE(i2 Int) bool

GTE returns true if receiver Int is greater than or equal to the parameter Int.

func (Int) Int64

func (i Int) Int64() int64

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

func (Int) IsInt64

func (i Int) IsInt64() bool

IsInt64 returns true if Int64() not panics

func (Int) IsNegative

func (i Int) IsNegative() bool

IsNegative returns true if Int is negative

func (Int) IsNil

func (i Int) IsNil() bool

IsNil returns true if Int is uninitialized

func (Int) IsPositive

func (i Int) IsPositive() bool

IsPositive returns true if Int is positive

func (Int) IsUint64

func (i Int) IsUint64() bool

IsUint64 returns true if Uint64() not panics

func (Int) IsZero

func (i Int) IsZero() bool

IsZero returns true if Int is zero

func (Int) LT

func (i Int) LT(i2 Int) bool

LT returns true if first Int is lesser than second

func (Int) LTE

func (i Int) LTE(i2 Int) bool

LTE returns true if first Int is less than or equal to second

func (Int) Marshal

func (i Int) Marshal() ([]byte, error)

Marshal implements the gogo proto custom type interface.

func (Int) MarshalAmino

func (i Int) MarshalAmino() ([]byte, error)

Override Amino binary serialization by proxying to protobuf.

func (Int) MarshalJSON

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

MarshalJSON defines custom encoding scheme

func (*Int) MarshalTo

func (i *Int) MarshalTo(data []byte) (n int, err error)

MarshalTo implements the gogo proto custom type interface.

func (Int) MarshalYAML

func (i Int) MarshalYAML() (interface{}, error)

MarshalYAML returns the YAML representation.

func (Int) Mod

func (i Int) Mod(i2 Int) Int

Mod returns remainder after dividing with Int

func (Int) ModRaw

func (i Int) ModRaw(i2 int64) Int

ModRaw returns remainder after dividing with int64

func (Int) Mul

func (i Int) Mul(i2 Int) (res Int)

Mul multiples two Ints

func (Int) MulRaw

func (i Int) MulRaw(i2 int64) Int

MulRaw multipies Int and int64

func (Int) Neg

func (i Int) Neg() (res Int)

Neg negates Int

func (Int) Quo

func (i Int) Quo(i2 Int) (res Int)

Quo divides Int with Int

func (Int) QuoRaw

func (i Int) QuoRaw(i2 int64) Int

QuoRaw divides Int with int64

func (Int) Sign

func (i Int) Sign() int

Sign returns sign of Int

func (*Int) Size

func (i *Int) Size() int

Size implements the gogo proto custom type interface.

func (Int) String

func (i Int) String() string

Human readable string

func (Int) Sub

func (i Int) Sub(i2 Int) (res Int)

Sub subtracts Int from another

func (Int) SubRaw

func (i Int) SubRaw(i2 int64) Int

SubRaw subtracts int64 from Int

func (Int) Uint64

func (i Int) Uint64() uint64

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

func (*Int) Unmarshal

func (i *Int) Unmarshal(data []byte) error

Unmarshal implements the gogo proto custom type interface.

func (*Int) UnmarshalAmino

func (i *Int) UnmarshalAmino(bz []byte) error

func (*Int) UnmarshalJSON

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

UnmarshalJSON defines custom decoding scheme

type Message

type Message interface {
	MessageName() string
	Marshal() (dAtA []byte, err error)
	Unmarshal(dAtA []byte) error
}

type MsgMultiSend

type MsgMultiSend struct {
	Inputs  []Input  `protobuf:"bytes,1,rep,name=inputs,proto3" json:"inputs"`
	Outputs []Output `protobuf:"bytes,2,rep,name=outputs,proto3" json:"outputs"`
}

MsgMultiSend represents an arbitrary multi-in, multi-out send message.

func (*MsgMultiSend) Marshal

func (m *MsgMultiSend) Marshal() (dAtA []byte, err error)

func (*MsgMultiSend) MarshalToSizedBuffer

func (m *MsgMultiSend) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MsgMultiSend) MessageName

func (m *MsgMultiSend) MessageName() string

func (*MsgMultiSend) Size

func (m *MsgMultiSend) Size() (n int)

func (*MsgMultiSend) Unmarshal

func (m *MsgMultiSend) Unmarshal(dAtA []byte) error

type MsgSend

type MsgSend struct {
	FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty" yaml:"from_address"`
	ToAddress   string `protobuf:"bytes,2,opt,name=to_address,json=toAddress,proto3" json:"to_address,omitempty" yaml:"to_address"`
	Amount      Coins  `protobuf:"bytes,3,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount"`
}

MsgSend represents a message to send coins from one account to another.

func (*MsgSend) Marshal

func (m *MsgSend) Marshal() (dAtA []byte, err error)

func (*MsgSend) MarshalToSizedBuffer

func (m *MsgSend) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MsgSend) MessageName

func (m *MsgSend) MessageName() string

func (*MsgSend) Size

func (m *MsgSend) Size() (n int)

func (*MsgSend) Unmarshal

func (m *MsgSend) Unmarshal(dAtA []byte) error

type MultiSignature

type MultiSignature struct {
	Signatures       [][]byte `protobuf:"bytes,1,rep,name=signatures,proto3" json:"signatures,omitempty"`
	XXX_unrecognized []byte   `json:"-"`
}

MultiSignature wraps the signatures from a multisig.LegacyAminoPubKey. See cosmos.tx.v1betata1.ModeInfo.Multi for how to specify which signers signed and with which modes.

func (*MultiSignature) Marshal

func (m *MultiSignature) Marshal() (dAtA []byte, err error)

func (*MultiSignature) MarshalTo

func (m *MultiSignature) MarshalTo(dAtA []byte) (int, error)

func (*MultiSignature) MarshalToSizedBuffer

func (m *MultiSignature) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MultiSignature) Size

func (m *MultiSignature) Size() (n int)

func (*MultiSignature) Unmarshal

func (m *MultiSignature) Unmarshal(dAtA []byte) error

type Output

type Output struct {
	Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
	Coins   Coins  `protobuf:"bytes,2,rep,name=coins,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"coins"`
}

Output models transaction outputs.

func (*Output) Marshal

func (m *Output) Marshal() (dAtA []byte, err error)

func (*Output) MarshalToSizedBuffer

func (m *Output) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Output) Size

func (m *Output) Size() (n int)

func (*Output) Unmarshal

func (m *Output) Unmarshal(dAtA []byte) error

type PackError

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

func NewPackError

func NewPackError(detail string) *PackError

func (PackError) Error

func (p PackError) Error() string

type PrivKey

type PrivKey struct {
	Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
}

PrivKey defines a secp256k1 private key.

func (*PrivKey) GetKey

func (m *PrivKey) GetKey() []byte

func (*PrivKey) Marshal

func (m *PrivKey) Marshal() (dAtA []byte, err error)

func (*PrivKey) MarshalTo

func (m *PrivKey) MarshalTo(dAtA []byte) (int, error)

func (*PrivKey) MarshalToSizedBuffer

func (m *PrivKey) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*PrivKey) MessageName

func (m *PrivKey) MessageName() string

func (*PrivKey) Size

func (m *PrivKey) Size() (n int)

func (*PrivKey) Unmarshal

func (m *PrivKey) Unmarshal(dAtA []byte) error

type PubKey

type PubKey struct {
	Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
}

PubKey defines a secp256k1 public key Key is the compressed form of the pubkey. The first byte depends is a 0x02 byte if the y-coordinate is the lexicographically largest of the two associated with the x-coordinate. Otherwise the first byte is a 0x03. This prefix is followed with the x-coordinate.

func (*PubKey) GetKey

func (m *PubKey) GetKey() []byte

func (*PubKey) Marshal

func (m *PubKey) Marshal() (dAtA []byte, err error)

func (*PubKey) MarshalTo

func (m *PubKey) MarshalTo(dAtA []byte) (int, error)

func (*PubKey) MarshalToSizedBuffer

func (m *PubKey) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*PubKey) MessageName

func (m *PubKey) MessageName() string

func (*PubKey) Size

func (m *PubKey) Size() (n int)

func (*PubKey) Unmarshal

func (m *PubKey) Unmarshal(dAtA []byte) error

type SignMode

type SignMode int32

SignMode represents a signing mode with its own security guarantees.

const (
	// SIGN_MODE_UNSPECIFIED specifies an unknown signing mode and will be
	// rejected
	SignMode_SIGN_MODE_UNSPECIFIED SignMode = 0
	// SIGN_MODE_DIRECT specifies a signing mode which uses SignDoc and is
	// verified with raw bytes from Tx
	SignMode_SIGN_MODE_DIRECT SignMode = 1
	// SIGN_MODE_TEXTUAL is a future signing mode that will verify some
	// human-readable textual representation on top of the binary representation
	// from SIGN_MODE_DIRECT
	SignMode_SIGN_MODE_TEXTUAL SignMode = 2
	// SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses
	// Amino JSON and will be removed in the future
	SignMode_SIGN_MODE_LEGACY_AMINO_JSON SignMode = 127
)

type SignatureDescriptor

type SignatureDescriptor struct {
	// public_key is the public key of the signer
	PublicKey *Any                      `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
	Data      *SignatureDescriptor_Data `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
	// sequence is the sequence of the account, which describes the
	// number of committed transactions signed by a given address. It is used to prevent
	// replay attacks.
	Sequence uint64 `protobuf:"varint,3,opt,name=sequence,proto3" json:"sequence,omitempty"`
}

SignatureDescriptor is a convenience type which represents the full data for a signature including the public key of the signer, signing modes and the signature itself. It is primarily used for coordinating signatures between clients.

func (*SignatureDescriptor) Marshal

func (m *SignatureDescriptor) Marshal() (dAtA []byte, err error)

func (*SignatureDescriptor) MarshalTo

func (m *SignatureDescriptor) MarshalTo(dAtA []byte) (int, error)

func (*SignatureDescriptor) MarshalToSizedBuffer

func (m *SignatureDescriptor) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*SignatureDescriptor) Size

func (m *SignatureDescriptor) Size() (n int)

func (*SignatureDescriptor) Unmarshal

func (m *SignatureDescriptor) Unmarshal(dAtA []byte) error

type SignatureDescriptor_Data

type SignatureDescriptor_Data struct {
	// sum is the oneof that specifies whether this represents single or multi-signature data
	//
	// Types that are valid to be assigned to Sum:
	//	*SignatureDescriptor_Data_Single_
	//	*SignatureDescriptor_Data_Multi_
	Sum isSignatureDescriptor_Data_Sum `protobuf_oneof:"sum"`
}

Data represents signature data

func (*SignatureDescriptor_Data) Marshal

func (m *SignatureDescriptor_Data) Marshal() (dAtA []byte, err error)

func (*SignatureDescriptor_Data) MarshalTo

func (m *SignatureDescriptor_Data) MarshalTo(dAtA []byte) (int, error)

func (*SignatureDescriptor_Data) MarshalToSizedBuffer

func (m *SignatureDescriptor_Data) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*SignatureDescriptor_Data) Size

func (m *SignatureDescriptor_Data) Size() (n int)

func (*SignatureDescriptor_Data) Unmarshal

func (m *SignatureDescriptor_Data) Unmarshal(dAtA []byte) error

type SignatureDescriptor_Data_Multi

type SignatureDescriptor_Data_Multi struct {
	// bitarray specifies which keys within the multisig are signing
	Bitarray *CompactBitArray `protobuf:"bytes,1,opt,name=bitarray,proto3" json:"bitarray,omitempty"`
	// signatures is the signatures of the multi-signature
	Signatures []*SignatureDescriptor_Data `protobuf:"bytes,2,rep,name=signatures,proto3" json:"signatures,omitempty"`
}

Multi is the signature data for a multisig public key

func (*SignatureDescriptor_Data_Multi) Marshal

func (m *SignatureDescriptor_Data_Multi) Marshal() (dAtA []byte, err error)

func (*SignatureDescriptor_Data_Multi) MarshalTo

func (m *SignatureDescriptor_Data_Multi) MarshalTo(dAtA []byte) (int, error)

func (*SignatureDescriptor_Data_Multi) MarshalToSizedBuffer

func (m *SignatureDescriptor_Data_Multi) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*SignatureDescriptor_Data_Multi) Size

func (m *SignatureDescriptor_Data_Multi) Size() (n int)

func (*SignatureDescriptor_Data_Multi) Unmarshal

func (m *SignatureDescriptor_Data_Multi) Unmarshal(dAtA []byte) error

type SignatureDescriptor_Data_Multi_

type SignatureDescriptor_Data_Multi_ struct {
	Multi *SignatureDescriptor_Data_Multi `protobuf:"bytes,2,opt,name=multi,proto3,oneof" json:"multi,omitempty"`
}

func (*SignatureDescriptor_Data_Multi_) MarshalTo

func (m *SignatureDescriptor_Data_Multi_) MarshalTo(dAtA []byte) (int, error)

func (*SignatureDescriptor_Data_Multi_) MarshalToSizedBuffer

func (m *SignatureDescriptor_Data_Multi_) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*SignatureDescriptor_Data_Multi_) Size

func (m *SignatureDescriptor_Data_Multi_) Size() (n int)

type SignatureDescriptor_Data_Single

type SignatureDescriptor_Data_Single struct {
	// mode is the signing mode of the single signer
	Mode SignMode `protobuf:"varint,1,opt,name=mode,proto3,enum=cosmos.tx.signing.v1beta1.SignMode" json:"mode,omitempty"`
	// signature is the raw signature bytes
	Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"`
}

Single is the signature data for a single signer

func (*SignatureDescriptor_Data_Single) Marshal

func (m *SignatureDescriptor_Data_Single) Marshal() (dAtA []byte, err error)

func (*SignatureDescriptor_Data_Single) MarshalTo

func (m *SignatureDescriptor_Data_Single) MarshalTo(dAtA []byte) (int, error)

func (*SignatureDescriptor_Data_Single) MarshalToSizedBuffer

func (m *SignatureDescriptor_Data_Single) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*SignatureDescriptor_Data_Single) Size

func (m *SignatureDescriptor_Data_Single) Size() (n int)

func (*SignatureDescriptor_Data_Single) Unmarshal

func (m *SignatureDescriptor_Data_Single) Unmarshal(dAtA []byte) error

type SignatureDescriptor_Data_Single_

type SignatureDescriptor_Data_Single_ struct {
	Single *SignatureDescriptor_Data_Single `protobuf:"bytes,1,opt,name=single,proto3,oneof" json:"single,omitempty"`
}

func (*SignatureDescriptor_Data_Single_) MarshalTo

func (m *SignatureDescriptor_Data_Single_) MarshalTo(dAtA []byte) (int, error)

func (*SignatureDescriptor_Data_Single_) MarshalToSizedBuffer

func (m *SignatureDescriptor_Data_Single_) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*SignatureDescriptor_Data_Single_) Size

func (m *SignatureDescriptor_Data_Single_) Size() (n int)

type SignatureDescriptors

type SignatureDescriptors struct {
	// signatures are the signature descriptors
	Signatures []*SignatureDescriptor `protobuf:"bytes,1,rep,name=signatures,proto3" json:"signatures,omitempty"`
}

SignatureDescriptors wraps multiple SignatureDescriptor's.

func (*SignatureDescriptors) Marshal

func (m *SignatureDescriptors) Marshal() (dAtA []byte, err error)

func (*SignatureDescriptors) MarshalTo

func (m *SignatureDescriptors) MarshalTo(dAtA []byte) (int, error)

func (*SignatureDescriptors) MarshalToSizedBuffer

func (m *SignatureDescriptors) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*SignatureDescriptors) Size

func (m *SignatureDescriptors) Size() (n int)

func (*SignatureDescriptors) Unmarshal

func (m *SignatureDescriptors) Unmarshal(dAtA []byte) error

type StdAny

type StdAny struct {
	T string      `json:"type" yaml:"type"`
	V interface{} `json:"value" yaml:"value"`
}

type StdFee

type StdFee struct {
	Amount  Coins  `json:"amount" yaml:"amount"`
	Gas     string `json:"gas" yaml:"gas"`
	Payer   string `json:"payer,omitempty" yaml:"payer"`
	Granter string `json:"granter,omitempty" yaml:"granter"`
}

StdFee includes the amount of coins paid in fees and the maximum gas to be used by the transaction. The ratio yields an effective "gasprice", which must be above some miminum to be accepted into the mempool.

type StdSignDoc

type StdSignDoc struct {
	AccountNumber string   `json:"account_number" yaml:"account_number"`
	Sequence      string   `json:"sequence" yaml:"sequence"`
	ChainID       string   `json:"chain_id" yaml:"chain_id"`
	Fee           StdFee   `json:"fee" yaml:"fee"`
	Msgs          []StdAny `json:"msgs" yaml:"msgs"`
	Memo          string   `json:"memo" yaml:"memo"`
	TimeoutHeight string   `json:"timeout_height,omitempty" yaml:"timeout_height"`
}

StdSignDoc is replay-prevention structure. It includes the result of msg.GetSignBytes(), as well as the ChainID (prevent cross chain replay) and the Sequence numbers for each signature (prevent inchain replay and enforce tx ordering per account). Convert StdSignDoc to bytes using Amino/JSON, sign it, fill in StdTx, serialize StdTx with Amino/JSON, and then broadcast the transaction bytes

type StdSignature

type StdSignature struct {
	Signature     string `json:"signature" yaml:"signature"`
	AccountNumber uint64 `json:"account_number" yaml:"account_number"`
	Sequence      uint64 `json:"sequence" yaml:"sequence"`
	PubKey        StdAny `json:"pub_key" yaml:"pub_key"`
}

StdSignature represents a sig

type StdTx

type StdTx struct {
	Msgs          []StdAny       `json:"msg" yaml:"msg"`
	Fee           StdFee         `json:"fee" yaml:"fee"`
	Signatures    []StdSignature `json:"signatures" yaml:"signatures"`
	Memo          string         `json:"memo" yaml:"memo"`
	TimeoutHeight uint64         `json:"timeout_height" yaml:"timeout_height"`
}

StdTx is the legacy transaction format for wrapping a Msg with Fee and Signatures. It only works with Amino, please prefer the new protobuf Tx in types/tx. NOTE: the first signature is the fee payer (Signatures must not be nil).

Directories

Path Synopsis
*
*
*

Jump to

Keyboard shortcuts

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