Documentation ¶
Index ¶
- Constants
- Variables
- func DefaultTxDecoder(cdc *codec.Codec) types2.TxDecoder
- func ErrGenesisFile(codespace sdk.CodespaceType, err error) error
- func ErrInvalidParam(desc string) error
- func ErrNewDB(codespace sdk.CodespaceType, err error) error
- func ErrUnexpectedResponse(desc string) error
- func GetCodec() *codec.Codec
- func IsValidPrivateKey(from types2.AccAddress, identity []byte) bool
- func MarshalBigInt(i *big.Int) (string, error)
- func MarshalJSONIndent(cdc *amino.Codec, obj interface{}) ([]byte, error)
- func MustMarshalBigInt(i *big.Int) string
- func MustUnmarshalBigInt(s string) *big.Int
- func PackPbMsgs(msgs []types2.PbMsg) []*codectypes.Any
- func SignCommonTx(from types2.AccAddress, nonce, gas uint64, msgs []types2.Msg, priv string, ...) ([]byte, error)
- func SignPbTx(from types2.AccAddress, nonce, gas uint64, msgs []types2.PbMsg, priv string, ...) ([]byte, error)
- func UnmarshalBigInt(s string) (*big.Int, error)
- type CodeType
- type CommonTx
- func (msg *CommonTx) Bytes() []byte
- func (msg *CommonTx) GetFromAddress() types2.AccAddress
- func (msg *CommonTx) GetGas() uint64
- func (msg *CommonTx) GetMsgs() []types2.Msg
- func (msg *CommonTx) GetNonce() uint64
- func (msg *CommonTx) GetSignBytes() []byte
- func (tx *CommonTx) GetSignature() []byte
- func (tx *CommonTx) SetPubKey(pub []byte)
- func (tx *CommonTx) SetSignature(sig []byte)
- func (tx CommonTx) ValidateBasic() error
- type EncodingConfig
- type MsgEthereumTx
- func (msg MsgEthereumTx) Bytes() []byte
- func (msg *MsgEthereumTx) ChainID() *big.Int
- func (msg MsgEthereumTx) Cost() *big.Int
- func (msg *MsgEthereumTx) DecodeRLP(s *rlp.Stream) error
- func (msg *MsgEthereumTx) EncodeRLP(w io.Writer) error
- func (msg MsgEthereumTx) Fee() *big.Int
- func (msg *MsgEthereumTx) From() sdk.AccAddress
- func (msg MsgEthereumTx) GetFromAddress() sdk.AccAddress
- func (msg MsgEthereumTx) GetGas() uint64
- func (msg MsgEthereumTx) GetMsgs() []sdk.Msg
- func (msg MsgEthereumTx) GetNonce() uint64
- func (msg MsgEthereumTx) GetSignBytes() []byte
- func (msg MsgEthereumTx) GetSignature() []byte
- func (msg MsgEthereumTx) GetSigners() []sdk.AccAddress
- func (msg MsgEthereumTx) MsgType() string
- func (msg MsgEthereumTx) RLPSignBytes(chainID *big.Int) ethcmn.Hash
- func (msg MsgEthereumTx) RawSignatureValues() (v, r, s *big.Int)
- func (msg MsgEthereumTx) Route() string
- func (msg MsgEthereumTx) SetPubKey([]byte)
- func (msg MsgEthereumTx) SetSignature([]byte)
- func (msg *MsgEthereumTx) Sign(chainID *big.Int, priv *ecdsa.PrivateKey) error
- func (msg MsgEthereumTx) String() string
- func (msg MsgEthereumTx) To() *ethcmn.Address
- func (msg MsgEthereumTx) ValidateBasic() error
- func (msg *MsgEthereumTx) VerifySig(chainID *big.Int) (ethcmn.Address, error)
- type PbTx
- func (msg *PbTx) Bytes() []byte
- func (*PbTx) Descriptor() ([]byte, []int)
- func (m *PbTx) GetFrom() []byte
- func (msg *PbTx) GetFromAddress() types2.AccAddress
- func (m *PbTx) GetGas() uint64
- func (m *PbTx) GetMsgs() []types2.Msg
- func (m *PbTx) GetNonce() uint64
- func (m *PbTx) GetPubKey() []byte
- func (msg *PbTx) GetSignBytes() []byte
- func (m *PbTx) GetSignature() []byte
- func (m *PbTx) Marshal() (dAtA []byte, err error)
- func (m *PbTx) MarshalTo(dAtA []byte) (int, error)
- func (m *PbTx) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*PbTx) ProtoMessage()
- func (m *PbTx) Reset()
- func (tx *PbTx) SetPubKey(pub []byte)
- func (tx *PbTx) SetSignature(sig []byte)
- func (m *PbTx) Size() (n int)
- func (m *PbTx) String() string
- func (m *PbTx) Unmarshal(dAtA []byte) error
- func (tx *PbTx) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error
- func (tx PbTx) ValidateBasic() error
- func (m *PbTx) XXX_DiscardUnknown()
- func (m *PbTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *PbTx) XXX_Merge(src proto.Message)
- func (m *PbTx) XXX_Size() int
- func (m *PbTx) XXX_Unmarshal(b []byte) error
- type TxData
Constants ¶
const ( RouterKey = "vm" TypeMsgEthereumTx = "MsgEthereumTx" )
Variables ¶
var ( ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") )
var ModuleCdc = GetCodec()
Functions ¶
func DefaultTxDecoder ¶
DefaultTxDecoder logic for standard transfer decoding
func ErrGenesisFile ¶
func ErrGenesisFile(codespace sdk.CodespaceType, err error) error
func ErrInvalidParam ¶
func ErrUnexpectedResponse ¶
func IsValidPrivateKey ¶
func IsValidPrivateKey(from types2.AccAddress, identity []byte) bool
func MarshalBigInt ¶
MarshalBigInt marshalls big int into text string for consistent encoding
func MarshalJSONIndent ¶
attempt to make some pretty json
func MustMarshalBigInt ¶
MustMarshalBigInt marshalls big int into text string for consistent encoding. It panics if an error is encountered.
func MustUnmarshalBigInt ¶
MustUnmarshalBigInt unmarshalls string from *big.Int. It panics if an error is encountered.
func PackPbMsgs ¶
func PackPbMsgs(msgs []types2.PbMsg) []*codectypes.Any
func SignCommonTx ¶
Types ¶
type CommonTx ¶
type CommonTx struct { From types2.AccAddress `json:"from"` Nonce uint64 `json:"nonce"` Gas uint64 `json:"gas"` Msgs []types2.Msg `json:"msgs"` PubKey []byte `json:"pub_key"` Signature []byte `json:"signature"` }
func NewCommonTx ¶
func (*CommonTx) GetFromAddress ¶
func (msg *CommonTx) GetFromAddress() types2.AccAddress
func (*CommonTx) GetSignBytes ¶
func (*CommonTx) GetSignature ¶
func (*CommonTx) SetSignature ¶
func (CommonTx) ValidateBasic ¶
type EncodingConfig ¶
type EncodingConfig struct { InterfaceRegistry types.InterfaceRegistry Marshaler codec.Marshaler //TxConfig client.TxConfig Amino *codec.Codec }
func GetEncodingConfig ¶
func GetEncodingConfig() *EncodingConfig
type MsgEthereumTx ¶
type MsgEthereumTx struct { Data TxData // contains filtered or unexported fields }
MsgEthereumTx encapsulates an Ethereum transaction as an SDK message.
func NewMsgEthereumTx ¶
func NewMsgEthereumTx( nonce uint64, to *ethcmn.Address, amount *big.Int, gasLimit uint64, gasPrice *big.Int, payload []byte, ) MsgEthereumTx
NewMsgEthereumTx returns a reference to a new Ethereum transaction message.
func NewMsgEthereumTxContract ¶
func NewMsgEthereumTxContract( nonce uint64, amount *big.Int, gasLimit uint64, gasPrice *big.Int, payload []byte, ) MsgEthereumTx
NewMsgEthereumTxContract returns a reference to a new Ethereum transaction message designated for contract creation.
func (MsgEthereumTx) Bytes ¶
func (msg MsgEthereumTx) Bytes() []byte
func (*MsgEthereumTx) ChainID ¶
func (msg *MsgEthereumTx) ChainID() *big.Int
ChainID returns which chain id this transaction was signed for (if at all)
func (MsgEthereumTx) Cost ¶
func (msg MsgEthereumTx) Cost() *big.Int
Cost returns amount + gasprice * gaslimit.
func (*MsgEthereumTx) DecodeRLP ¶
func (msg *MsgEthereumTx) DecodeRLP(s *rlp.Stream) error
DecodeRLP implements the rlp.Decoder interface.
func (*MsgEthereumTx) EncodeRLP ¶
func (msg *MsgEthereumTx) EncodeRLP(w io.Writer) error
EncodeRLP implements the rlp.Encoder interface.
func (*MsgEthereumTx) From ¶
func (msg *MsgEthereumTx) From() sdk.AccAddress
From loads the ethereum sender address from the sigcache and returns an sdk.AccAddress from its bytes
func (MsgEthereumTx) GetFromAddress ¶
func (msg MsgEthereumTx) GetFromAddress() sdk.AccAddress
func (MsgEthereumTx) GetGas ¶
func (msg MsgEthereumTx) GetGas() uint64
GetGas implements the GasTx interface. It returns the GasLimit of the transaction.
func (MsgEthereumTx) GetMsgs ¶
func (msg MsgEthereumTx) GetMsgs() []sdk.Msg
GetMsgs returns a single MsgEthereumTx as an sdk.Msg.
func (MsgEthereumTx) GetNonce ¶
func (msg MsgEthereumTx) GetNonce() uint64
func (MsgEthereumTx) GetSignBytes ¶
func (msg MsgEthereumTx) GetSignBytes() []byte
GetSignBytes returns the Amino bytes of an Ethereum transaction message used for signing.
NOTE: This method cannot be used as a chain ID is needed to create valid bytes to sign over. Use 'RLPSignBytes' instead.
func (MsgEthereumTx) GetSignature ¶
func (msg MsgEthereumTx) GetSignature() []byte
func (MsgEthereumTx) GetSigners ¶
func (msg MsgEthereumTx) GetSigners() []sdk.AccAddress
GetSigners returns the expected signers for an Ethereum transaction message. For such a message, there should exist only a single 'signer'.
NOTE: This method panics if 'VerifySig' hasn't been called first.
func (MsgEthereumTx) MsgType ¶
func (msg MsgEthereumTx) MsgType() string
Type returns the types value of an MsgEthereumTx.
func (MsgEthereumTx) RLPSignBytes ¶
func (msg MsgEthereumTx) RLPSignBytes(chainID *big.Int) ethcmn.Hash
RLPSignBytes returns the RLP hash of an Ethereum transaction message with a given chainID used for signing.
func (MsgEthereumTx) RawSignatureValues ¶
func (msg MsgEthereumTx) RawSignatureValues() (v, r, s *big.Int)
RawSignatureValues returns the V, R, S signature values of the transaction. The return values should not be modified by the caller.
func (MsgEthereumTx) Route ¶
func (msg MsgEthereumTx) Route() string
Route returns the route value of an MsgEthereumTx.
func (MsgEthereumTx) SetPubKey ¶
func (msg MsgEthereumTx) SetPubKey([]byte)
func (MsgEthereumTx) SetSignature ¶
func (msg MsgEthereumTx) SetSignature([]byte)
func (*MsgEthereumTx) Sign ¶
func (msg *MsgEthereumTx) Sign(chainID *big.Int, priv *ecdsa.PrivateKey) error
Sign calculates a secp256k1 ECDSA signature and signs the transaction. It takes a private key and chainID to sign an Ethereum transaction according to EIP155 standard. It mutates the transaction as it populates the V, R, S fields of the Transaction's Signature.
func (MsgEthereumTx) String ¶
func (msg MsgEthereumTx) String() string
func (MsgEthereumTx) To ¶
func (msg MsgEthereumTx) To() *ethcmn.Address
To returns the recipient address of the transaction. It returns nil if the transaction is a contract creation.
func (MsgEthereumTx) ValidateBasic ¶
func (msg MsgEthereumTx) ValidateBasic() error
ValidateBasic implements the sdk.Msg interface. It performs basic validation checks of a Transaction. If returns an error if validation fails.
type PbTx ¶
type PbTx struct { From []byte `protobuf:"bytes,1,opt,name=from,proto3" json:"from,omitempty"` Nonce uint64 `protobuf:"varint,2,opt,name=nonce,proto3" json:"nonce,omitempty"` Gas uint64 `protobuf:"varint,3,opt,name=gas,proto3" json:"gas,omitempty"` Msgs []*codectypes.Any `protobuf:"bytes,4,rep,name=msgs,proto3" json:"msgs,omitempty"` PubKey []byte `protobuf:"bytes,5,opt,name=pub_key,json=pubKey,proto3" json:"pub_key,omitempty"` Signature []byte `protobuf:"bytes,6,opt,name=signature,proto3" json:"signature,omitempty"` }
func (*PbTx) Descriptor ¶
func (*PbTx) GetFromAddress ¶
func (msg *PbTx) GetFromAddress() types2.AccAddress
func (*PbTx) GetSignBytes ¶
func (*PbTx) GetSignature ¶
func (*PbTx) ProtoMessage ¶
func (*PbTx) ProtoMessage()
func (*PbTx) SetSignature ¶
func (*PbTx) UnpackInterfaces ¶
func (tx *PbTx) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error
func (PbTx) ValidateBasic ¶
func (*PbTx) XXX_DiscardUnknown ¶
func (m *PbTx) XXX_DiscardUnknown()
func (*PbTx) XXX_Unmarshal ¶
type TxData ¶
type TxData struct { AccountNonce uint64 `json:"nonce"` Price *big.Int `json:"gasPrice"` GasLimit uint64 `json:"gas"` Recipient *ethcmn.Address `json:"to" rlp:"nil"` // nil means contract creation Amount *big.Int `json:"value"` Payload []byte `json:"input"` // signature values V *big.Int `json:"v"` R *big.Int `json:"r"` S *big.Int `json:"s"` // hash is only used when marshaling to JSON Hash *ethcmn.Hash `json:"hash" rlp:"-"` }
TxData implements the Ethereum transaction data structure. It is used solely as intended in Ethereum abiding by the protocol.
func (TxData) MarshalAmino ¶
MarshalAmino defines custom encoding scheme for TxData
func (*TxData) UnmarshalAmino ¶
UnmarshalAmino defines custom decoding scheme for TxData