std

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthCodec        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowCodec          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupCodec = fmt.Errorf("proto: unexpected end of group")
)

Functions

This section is empty.

Types

type Codec

type Codec struct {
	codec.Marshaler

	// Keep reference to the amino codec to allow backwards compatibility along
	// with type, and interface registration.
	Amino *codec.Codec
	// contains filtered or unexported fields
}

Codec defines the application-level codec. This codec contains all the required module-specific codecs that are to be provided upon initialization.

func NewAppCodec

func NewAppCodec(amino *codec.Codec, anyUnpacker types.AnyUnpacker) *Codec

type Message

type Message struct {
	// sum defines the set of all allowed valid messages defined in modules.
	//
	// Types that are valid to be assigned to Sum:
	//	*Message_MsgSend
	Sum isMessage_Sum `protobuf_oneof:"sum"`
}

Message defines the set of valid concrete message types that can be used to construct a transaction.

func (*Message) Descriptor

func (*Message) Descriptor() ([]byte, []int)

func (*Message) GetMsg

func (*Message) GetMsgSend

func (m *Message) GetMsgSend() *bank.MsgSend

func (*Message) GetSum

func (m *Message) GetSum() isMessage_Sum

func (*Message) Marshal

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

func (*Message) MarshalTo

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

func (*Message) MarshalToSizedBuffer

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

func (*Message) ProtoMessage

func (*Message) ProtoMessage()

func (*Message) Reset

func (m *Message) Reset()

func (*Message) SetMsg

func (*Message) Size

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

func (*Message) String

func (m *Message) String() string

func (*Message) Unmarshal

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

func (*Message) XXX_DiscardUnknown

func (m *Message) XXX_DiscardUnknown()

func (*Message) XXX_Marshal

func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Message) XXX_Merge

func (m *Message) XXX_Merge(src proto.Message)

func (*Message) XXX_OneofWrappers

func (*Message) XXX_OneofWrappers() []interface{}

XXX_OneofWrappers is for the internal use of the proto package.

func (*Message) XXX_Size

func (m *Message) XXX_Size() int

func (*Message) XXX_Unmarshal

func (m *Message) XXX_Unmarshal(b []byte) error

type Message_MsgSend

type Message_MsgSend struct {
	MsgSend *bank.MsgSend `protobuf:"bytes,1,opt,name=msg_send,json=msgSend,proto3,oneof" json:"msg_send,omitempty"`
}

func (*Message_MsgSend) MarshalTo

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

func (*Message_MsgSend) MarshalToSizedBuffer

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

func (*Message_MsgSend) Size

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

type SignDoc

type SignDoc struct {
	StdSignDocBase `protobuf:"bytes,1,opt,name=base,proto3,embedded=base" json:""`
	Msgs           []Message `protobuf:"bytes,2,rep,name=msgs,proto3" json:"msgs"`
}

SignDoc defines a standard application-level signing document to compose signatures for a Transaction.

func NewSignDoc

func NewSignDoc(num, seq uint64, cid, memo string, fee StdFee, msgs ...Message) *SignDoc

func (*SignDoc) CanonicalSignBytes

func (sd *SignDoc) CanonicalSignBytes() ([]byte, error)

CanonicalSignBytes returns the canonical JSON bytes to sign over, where the SignDoc is derived from a Transaction. The JSON encoding ensures all field names adhere to their proto definition, default values are omitted, and follows the JSON Canonical Form.

func (*SignDoc) Descriptor

func (*SignDoc) Descriptor() ([]byte, []int)

func (*SignDoc) GetMsgs

func (m *SignDoc) GetMsgs() []Message

func (*SignDoc) Marshal

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

func (*SignDoc) MarshalTo

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

func (*SignDoc) MarshalToSizedBuffer

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

func (*SignDoc) ProtoMessage

func (*SignDoc) ProtoMessage()

func (*SignDoc) Reset

func (m *SignDoc) Reset()

func (*SignDoc) Size

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

func (*SignDoc) String

func (m *SignDoc) String() string

func (*SignDoc) Unmarshal

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

func (*SignDoc) XXX_DiscardUnknown

func (m *SignDoc) XXX_DiscardUnknown()

func (*SignDoc) XXX_Marshal

func (m *SignDoc) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SignDoc) XXX_Merge

func (m *SignDoc) XXX_Merge(src proto.Message)

func (*SignDoc) XXX_Size

func (m *SignDoc) XXX_Size() int

func (*SignDoc) XXX_Unmarshal

func (m *SignDoc) XXX_Unmarshal(b []byte) error

type StdFee

type StdFee struct {
	Amount github_com_bianjieai_irita_sdk_go_types.Coins `protobuf:"bytes,1,rep,name=amount,proto3,castrepeated=github.com/bianjieai/irita-sdk-go/types.Coins" json:"amount"`
	Gas    uint64                                        `protobuf:"varint,2,opt,name=gas,proto3" json:"gas,omitempty"`
}

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.

func NewStdFee

func NewStdFee(gas uint64, amount sdk.Coins) StdFee

NewStdFee returns a new instance of StdFee

func (*StdFee) Descriptor

func (*StdFee) Descriptor() ([]byte, []int)

func (*StdFee) Equal

func (this *StdFee) Equal(that interface{}) bool

func (StdFee) GetAmount

func (m StdFee) GetAmount() sdk.Coins

func (StdFee) GetGas

func (m StdFee) GetGas() uint64

func (*StdFee) Marshal

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

func (*StdFee) MarshalTo

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

func (*StdFee) MarshalToSizedBuffer

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

func (*StdFee) ProtoMessage

func (*StdFee) ProtoMessage()

func (*StdFee) Reset

func (m *StdFee) Reset()

func (*StdFee) SetAmount

func (m *StdFee) SetAmount(amount sdk.Coins)

func (*StdFee) SetGas

func (m *StdFee) SetGas(gas uint64)

func (*StdFee) Size

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

func (*StdFee) String

func (m *StdFee) String() string

func (*StdFee) Unmarshal

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

func (*StdFee) XXX_DiscardUnknown

func (m *StdFee) XXX_DiscardUnknown()

func (*StdFee) XXX_Marshal

func (m *StdFee) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*StdFee) XXX_Merge

func (m *StdFee) XXX_Merge(src proto.Message)

func (*StdFee) XXX_Size

func (m *StdFee) XXX_Size() int

func (*StdFee) XXX_Unmarshal

func (m *StdFee) XXX_Unmarshal(b []byte) error

type StdSignDocBase

type StdSignDocBase struct {
	ChainID       string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty" yaml:"chain_id"`
	AccountNumber uint64 `protobuf:"varint,2,opt,name=account_number,json=accountNumber,proto3" json:"account_number,omitempty" yaml:"account_number"`
	Sequence      uint64 `protobuf:"varint,3,opt,name=sequence,proto3" json:"sequence,omitempty"`
	Memo          string `protobuf:"bytes,4,opt,name=memo,proto3" json:"memo,omitempty"`
	Fee           StdFee `protobuf:"bytes,5,opt,name=fee,proto3" json:"fee"`
}

StdSignDocBase defines the base structure for which applications can extend to define the concrete structure that signers sign over.

func NewStdSignDocBase

func NewStdSignDocBase(num, seq uint64, cid, memo string, fee StdFee) StdSignDocBase

func (*StdSignDocBase) Descriptor

func (*StdSignDocBase) Descriptor() ([]byte, []int)

func (*StdSignDocBase) GetAccountNumber

func (m *StdSignDocBase) GetAccountNumber() uint64

func (*StdSignDocBase) GetChainID

func (m *StdSignDocBase) GetChainID() string

func (*StdSignDocBase) GetFee

func (m *StdSignDocBase) GetFee() StdFee

func (*StdSignDocBase) GetMemo

func (m *StdSignDocBase) GetMemo() string

func (*StdSignDocBase) GetSequence

func (m *StdSignDocBase) GetSequence() uint64

func (*StdSignDocBase) Marshal

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

func (*StdSignDocBase) MarshalTo

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

func (*StdSignDocBase) MarshalToSizedBuffer

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

func (*StdSignDocBase) ProtoMessage

func (*StdSignDocBase) ProtoMessage()

func (*StdSignDocBase) Reset

func (m *StdSignDocBase) Reset()

func (*StdSignDocBase) Size

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

func (*StdSignDocBase) String

func (m *StdSignDocBase) String() string

func (*StdSignDocBase) Unmarshal

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

func (*StdSignDocBase) XXX_DiscardUnknown

func (m *StdSignDocBase) XXX_DiscardUnknown()

func (*StdSignDocBase) XXX_Marshal

func (m *StdSignDocBase) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*StdSignDocBase) XXX_Merge

func (m *StdSignDocBase) XXX_Merge(src proto.Message)

func (*StdSignDocBase) XXX_Size

func (m *StdSignDocBase) XXX_Size() int

func (*StdSignDocBase) XXX_Unmarshal

func (m *StdSignDocBase) XXX_Unmarshal(b []byte) error

type StdSignature

type StdSignature struct {
	PubKey    []byte `protobuf:"bytes,1,opt,name=pub_key,json=pubKey,proto3" json:"public_key,omitempty" yaml:"public_key"`
	Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"`
}

StdSignature defines a signature structure that contains the signature of a transaction and an optional public key.

func NewStdSignature

func NewStdSignature(pk crypto.PubKey, sig []byte) StdSignature

func (*StdSignature) Descriptor

func (*StdSignature) Descriptor() ([]byte, []int)

func (StdSignature) GetPubKey

func (m StdSignature) GetPubKey() crypto.PubKey

func (StdSignature) GetSignature

func (m StdSignature) GetSignature() []byte

func (*StdSignature) Marshal

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

func (*StdSignature) MarshalTo

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

func (*StdSignature) MarshalToSizedBuffer

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

func (*StdSignature) ProtoMessage

func (*StdSignature) ProtoMessage()

func (*StdSignature) Reset

func (m *StdSignature) Reset()

func (*StdSignature) SetPubKey

func (m *StdSignature) SetPubKey(pk crypto.PubKey) error

func (*StdSignature) SetSignature

func (m *StdSignature) SetSignature(signature []byte)

func (*StdSignature) Size

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

func (*StdSignature) String

func (m *StdSignature) String() string

func (*StdSignature) Unmarshal

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

func (*StdSignature) XXX_DiscardUnknown

func (m *StdSignature) XXX_DiscardUnknown()

func (*StdSignature) XXX_Marshal

func (m *StdSignature) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*StdSignature) XXX_Merge

func (m *StdSignature) XXX_Merge(src proto.Message)

func (*StdSignature) XXX_Size

func (m *StdSignature) XXX_Size() int

func (*StdSignature) XXX_Unmarshal

func (m *StdSignature) XXX_Unmarshal(b []byte) error

type StdTxBase

type StdTxBase struct {
	Fee        StdFee         `protobuf:"bytes,1,opt,name=fee,proto3" json:"fee"`
	Signatures []StdSignature `protobuf:"bytes,2,rep,name=signatures,proto3" json:"signatures"`
	Memo       string         `protobuf:"bytes,3,opt,name=memo,proto3" json:"memo,omitempty"`
}

StdTxBase defines a transaction base which application-level concrete transaction types can extend.

func NewStdTxBase

func NewStdTxBase(fee StdFee, sigs []StdSignature, memo string) StdTxBase

func (*StdTxBase) Descriptor

func (*StdTxBase) Descriptor() ([]byte, []int)

func (*StdTxBase) GetFee

func (m *StdTxBase) GetFee() StdFee

func (*StdTxBase) GetMemo

func (m *StdTxBase) GetMemo() string

func (*StdTxBase) GetSignatures

func (m *StdTxBase) GetSignatures() []StdSignature

func (*StdTxBase) Marshal

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

func (*StdTxBase) MarshalTo

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

func (*StdTxBase) MarshalToSizedBuffer

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

func (*StdTxBase) ProtoMessage

func (*StdTxBase) ProtoMessage()

func (*StdTxBase) Reset

func (m *StdTxBase) Reset()

func (*StdTxBase) Size

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

func (*StdTxBase) String

func (m *StdTxBase) String() string

func (*StdTxBase) Unmarshal

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

func (*StdTxBase) XXX_DiscardUnknown

func (m *StdTxBase) XXX_DiscardUnknown()

func (*StdTxBase) XXX_Marshal

func (m *StdTxBase) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*StdTxBase) XXX_Merge

func (m *StdTxBase) XXX_Merge(src proto.Message)

func (*StdTxBase) XXX_Size

func (m *StdTxBase) XXX_Size() int

func (*StdTxBase) XXX_Unmarshal

func (m *StdTxBase) XXX_Unmarshal(b []byte) error

type Transaction

type Transaction struct {
	StdTxBase `protobuf:"bytes,1,opt,name=base,proto3,embedded=base" json:""`
	Msgs      []Message `protobuf:"bytes,2,rep,name=msgs,proto3" json:"msgs"`
}

Transaction defines the application-level transaction that can be signed and processed by the state-machine. It contains a base of common fields and repeated set of Message types.

func NewTransaction

func NewTransaction(fee StdFee, memo string, sdkMsgs []sdk.Msg) (*Transaction, error)

func (Transaction) CanonicalSignBytes

func (tx Transaction) CanonicalSignBytes(cid string, num, seq uint64) ([]byte, error)

CanonicalSignBytes returns the canonical JSON bytes to sign over for the Transaction given a chain ID, account sequence and account number. The JSON encoding ensures all field names adhere to their proto definition, default values are omitted, and follows the JSON Canonical Form.

func (*Transaction) Descriptor

func (*Transaction) Descriptor() ([]byte, []int)

func (Transaction) GetFee

func (tx Transaction) GetFee() sdk.Fee

GetFee returns the transaction's fee.

func (Transaction) GetMemo

func (tx Transaction) GetMemo() string

GetMemo returns the transaction's memo.

func (Transaction) GetMsgs

func (tx Transaction) GetMsgs() []sdk.Msg

GetMsgs returns all the messages in a Transaction as a slice of sdk.Msg.

func (Transaction) GetSignatures

func (tx Transaction) GetSignatures() []sdk.Signature

GetSignatures returns all the transaction's signatures.

func (Transaction) GetSigners

func (tx Transaction) GetSigners() []sdk.AccAddress

GetSigners returns the addresses that must sign the transaction. Addresses are returned in a deterministic order. They are accumulated from the GetSigners method for each Msg in the order they appear in tx.GetMsgs(). Duplicate addresses will be omitted.

func (*Transaction) Marshal

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

func (*Transaction) MarshalTo

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

func (*Transaction) MarshalToSizedBuffer

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

func (*Transaction) ProtoMessage

func (*Transaction) ProtoMessage()

func (*Transaction) Reset

func (m *Transaction) Reset()

func (*Transaction) SetFee

func (tx *Transaction) SetFee(fee clientx.ClientFee) error

SetFee sets the transaction's fee. It will overwrite any existing fee set.

func (*Transaction) SetMemo

func (tx *Transaction) SetMemo(memo string)

SetMemo sets the transaction's memo. It will overwrite any existing memo set.

func (*Transaction) SetMsgs

func (tx *Transaction) SetMsgs(sdkMsgs ...sdk.Msg) error

SetMsgs sets the messages for a Transaction. It will overwrite any existing messages set.

func (*Transaction) SetSignatures

func (tx *Transaction) SetSignatures(sdkSigs ...clientx.ClientSignature) error

SetSignatures sets the transaction's signatures. It will overwrite any existing signatures set.

func (*Transaction) Size

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

func (*Transaction) String

func (m *Transaction) String() string

func (*Transaction) Unmarshal

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

func (Transaction) ValidateBasic

func (tx Transaction) ValidateBasic() error

ValidateBasic does a simple and lightweight validation check that doesn't require access to any other information.

func (*Transaction) XXX_DiscardUnknown

func (m *Transaction) XXX_DiscardUnknown()

func (*Transaction) XXX_Marshal

func (m *Transaction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Transaction) XXX_Merge

func (m *Transaction) XXX_Merge(src proto.Message)

func (*Transaction) XXX_Size

func (m *Transaction) XXX_Size() int

func (*Transaction) XXX_Unmarshal

func (m *Transaction) XXX_Unmarshal(b []byte) error

type TxGenerator

type TxGenerator struct{}

TxGenerator defines a transaction generator that allows clients to construct transactions.

func (TxGenerator) NewFee

func (g TxGenerator) NewFee() clientx.ClientFee

func (TxGenerator) NewSignature

func (g TxGenerator) NewSignature() clientx.ClientSignature

func (TxGenerator) NewTx

func (TxGenerator) NewTx() clientx.ClientTx

NewTx returns a reference to an empty Transaction type.

Jump to

Keyboard shortcuts

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