cosmos

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2022 License: Apache-2.0 Imports: 63 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildSimTx

func BuildSimTx(txf sdkTx.Factory, msgs ...provider.RelayerMessage) ([]byte, error)

BuildSimTx creates an unsigned tx with an empty single signature and returns the encoded transaction or an error if the unsigned transaction cannot be built.

func BuildUnsignedTx

func BuildUnsignedTx(txf sdkTx.Factory, txConfig sdkCtx.TxConfig, msgs ...provider.RelayerMessage) (sdkCtx.TxBuilder, error)

BuildUnsignedTx builds a transaction to be signed given a set of messages. The transaction is initially created via the provided factory's generator. Once created, the fee, memo, and messages are set.

func CalculateGas

func CalculateGas(queryFunc func(string, []byte) ([]byte, int64, error), txf sdkTx.Factory, msgs ...provider.RelayerMessage) (txtypes.SimulateResponse, uint64, error)

CalculateGas simulates the execution of a transaction and returns the simulation response obtained by the query and the adjusted gas amount.

func CosmosMsg

func CosmosMsg(rm provider.RelayerMessage) sdk.Msg

func CosmosMsgs

func CosmosMsgs(rm ...provider.RelayerMessage) []sdk.Msg

func CreateMnemonic

func CreateMnemonic() (string, error)

CreateMnemonic creates a new mnemonic

func DefaultPageRequest

func DefaultPageRequest() *querytypes.PageRequest

func KeysDir

func KeysDir(home, chainID string) string

KeysDir returns the filesystem directory where keychain data is stored

func NewCosmosMessage

func NewCosmosMessage(msg sdk.Msg) provider.RelayerMessage

func SdkMsgFromRelayerMessage

func SdkMsgFromRelayerMessage(p provider.RelayerMessage) sdk.Msg

Types

type CosmosMessage

type CosmosMessage struct {
	Msg sdk.Msg
}

func (CosmosMessage) Type

func (cm CosmosMessage) Type() string

type CosmosProvider

type CosmosProvider struct {
	Config   *CosmosProviderConfig
	HomePath string

	Keybase  keys.Keyring
	Client   rpcclient.Client
	Encoding params.EncodingConfig
	Provider provtypes.Provider
	// contains filtered or unexported fields
}

func NewCosmosProvider

func NewCosmosProvider(config *CosmosProviderConfig, homePath string, debug bool) (*CosmosProvider, error)

func (*CosmosProvider) AcknowledgementFromSequence

func (cp *CosmosProvider) AcknowledgementFromSequence(dst provider.ChainProvider, dsth, seq uint64, dstChanId, dstPortId, srcChanId, srcPortId string) (provider.RelayerMessage, error)

AcknowledgementFromSequence relays an acknowledgement with a given seq on src, source is the sending chain, destination is the receiving chain

func (*CosmosProvider) AddKey

func (cp *CosmosProvider) AddKey(name string) (*provider.KeyOutput, error)

AddKey adds a key to the keystore and generate and return a mnemonic for it

func (*CosmosProvider) Address

func (cp *CosmosProvider) Address() string

Address returns the address of the configured ChainProvider as a string

func (*CosmosProvider) AutoUpdateClient

func (cp *CosmosProvider) AutoUpdateClient(dst provider.ChainProvider, thresholdTime time.Duration, srcClientId, dstClientId string) (time.Duration, error)

AutoUpdateClient update client automatically to prevent expiry

func (*CosmosProvider) CLIContext

func (cp *CosmosProvider) CLIContext(height int64) sdkCtx.Context

CLIContext returns an instance of client.Context derived from Chain

func (*CosmosProvider) ChainId

func (cp *CosmosProvider) ChainId() string

func (*CosmosProvider) ChannelCloseConfirm

func (cp *CosmosProvider) ChannelCloseConfirm(dstQueryProvider provider.QueryProvider, dsth int64, dstChanId, dstPortId, srcPortId, srcChanId string) (provider.RelayerMessage, error)

func (*CosmosProvider) ChannelCloseInit

func (cp *CosmosProvider) ChannelCloseInit(srcPortId, srcChanId string) provider.RelayerMessage

func (*CosmosProvider) ChannelOpenAck

func (cp *CosmosProvider) ChannelOpenAck(dstQueryProvider provider.QueryProvider, dstHeader ibcexported.Header, srcClientId, srcPortId, srcChanId, dstChanId, dstPortId string) ([]provider.RelayerMessage, error)

func (*CosmosProvider) ChannelOpenConfirm

func (cp *CosmosProvider) ChannelOpenConfirm(dstQueryProvider provider.QueryProvider, dstHeader ibcexported.Header, srcClientId, srcPortId, srcChanId, dstPortId, dstChanId string) ([]provider.RelayerMessage, error)

func (*CosmosProvider) ChannelOpenInit

func (cp *CosmosProvider) ChannelOpenInit(srcClientId, srcConnId, srcPortId, srcVersion, dstPortId string, order chantypes.Order, dstHeader ibcexported.Header) ([]provider.RelayerMessage, error)

func (*CosmosProvider) ChannelOpenTry

func (cp *CosmosProvider) ChannelOpenTry(dstQueryProvider provider.QueryProvider, dstHeader ibcexported.Header, srcPortId, dstPortId, srcChanId, dstChanId, srcVersion, srcConnectionId, srcClientId string) ([]provider.RelayerMessage, error)

func (*CosmosProvider) ConnectionOpenAck

func (cp *CosmosProvider) ConnectionOpenAck(dstQueryProvider provider.QueryProvider, dstHeader ibcexported.Header, srcClientId, srcConnId, dstClientId, dstConnId string) ([]provider.RelayerMessage, error)

func (*CosmosProvider) ConnectionOpenConfirm

func (cp *CosmosProvider) ConnectionOpenConfirm(dstQueryProvider provider.QueryProvider, dstHeader ibcexported.Header, dstConnId, srcClientId, srcConnId string) ([]provider.RelayerMessage, error)

func (*CosmosProvider) ConnectionOpenInit

func (cp *CosmosProvider) ConnectionOpenInit(srcClientId, dstClientId string, dstHeader ibcexported.Header) ([]provider.RelayerMessage, error)

func (*CosmosProvider) ConnectionOpenTry

func (cp *CosmosProvider) ConnectionOpenTry(dstQueryProvider provider.QueryProvider, dstHeader ibcexported.Header, srcClientId, dstClientId, srcConnId, dstConnId string) ([]provider.RelayerMessage, error)

func (*CosmosProvider) CreateClient

func (cp *CosmosProvider) CreateClient(clientState ibcexported.ClientState, dstHeader ibcexported.Header) (provider.RelayerMessage, error)

CreateClient creates an sdk.Msg to update the client on src with consensus state from dst

func (*CosmosProvider) CreateKeystore

func (cp *CosmosProvider) CreateKeystore(homePath string) error

CreateKeystore creates the on disk file for the keystore and attaches it to the provider object

func (*CosmosProvider) DeleteKey

func (cp *CosmosProvider) DeleteKey(name string) error

DeleteKey deletes a key tracked by the store

func (*CosmosProvider) Error

func (cp *CosmosProvider) Error(err error)

Error takes an error, wraps it in the chainID and logs the error

func (*CosmosProvider) ExportPrivKeyArmor

func (cp *CosmosProvider) ExportPrivKeyArmor(keyName string) (armor string, err error)

ExportPrivKeyArmor exports a privkey from the keychain associated with a particular keyName

func (*CosmosProvider) FindMatchingClient

func (cp *CosmosProvider) FindMatchingClient(counterparty provider.ChainProvider, clientState ibcexported.ClientState) (string, bool)

FindMatchingClient will determine if there exists a client with identical client and consensus states to the client which would have been created. Source is the chain that would be adding a client which would track the counterparty. Therefore we query source for the existing clients and check if any match the counterparty. The counterparty must have a matching consensus state to the latest consensus state of a potential match. The provided client state is the client state that will be created if there exist no matches.

func (*CosmosProvider) GenerateConnHandshakeProof

func (cp *CosmosProvider) GenerateConnHandshakeProof(height int64, clientId, connId string) (clientState ibcexported.ClientState, clientStateProof []byte, consensusProof []byte, connectionProof []byte, connectionProofHeight ibcexported.Height, err error)

GenerateConnHandshakeProof generates all the proofs needed to prove the existence of the connection state on this chain. A counterparty should use these generated proofs.

func (*CosmosProvider) GetAddress

func (cp *CosmosProvider) GetAddress() (sdk.AccAddress, error)

GetAddress returns the sdk.AccAddress associated with the configured key

func (*CosmosProvider) GetIBCUpdateHeader

func (cp *CosmosProvider) GetIBCUpdateHeader(srch int64, dst provider.ChainProvider, dstClientId string) (ibcexported.Header, error)

GetIBCUpdateHeader updates the off chain tendermint light client and returns an IBC Update Header which can be used to update an on chain light client on the destination chain. The source is used to construct the header data.

func (*CosmosProvider) GetLightSignedHeaderAtHeight

func (cp *CosmosProvider) GetLightSignedHeaderAtHeight(h int64) (ibcexported.Header, error)

func (*CosmosProvider) Init

func (cp *CosmosProvider) Init() error

func (*CosmosProvider) InjectTrustedFields

func (cp *CosmosProvider) InjectTrustedFields(header ibcexported.Header, dst provider.ChainProvider, dstClientId string) (ibcexported.Header, error)

InjectTrustedFields injects the necessary trusted fields for a header to update a light client stored on the destination chain, using the information provided by the source chain. TrustedHeight is the latest height of the IBC client on dst TrustedValidators is the validator set of srcChain at the TrustedHeight InjectTrustedFields returns a copy of the header with TrustedFields modified

func (*CosmosProvider) Key

func (cp *CosmosProvider) Key() string

func (*CosmosProvider) KeyAddOrRestore

func (cp *CosmosProvider) KeyAddOrRestore(keyName string, coinType uint32, mnemonic ...string) (*provider.KeyOutput, error)

KeyAddOrRestore is a helper function for add key and restores key when mnemonic is passed

func (*CosmosProvider) KeyExists

func (cp *CosmosProvider) KeyExists(name string) bool

KeyExists returns true if there is a specified key in provider's keybase

func (*CosmosProvider) KeystoreCreated

func (cp *CosmosProvider) KeystoreCreated(homePath string) bool

KeystoreCreated returns false if either files aren't on disk as expected or the keystore isn't set on the provider

func (*CosmosProvider) ListAddresses

func (cp *CosmosProvider) ListAddresses() (map[string]string, error)

ListAddresses lists the addresses in the keystore and their assoicated names

func (*CosmosProvider) Log

func (cp *CosmosProvider) Log(s string)

Log takes a string and logs the data

func (*CosmosProvider) LogFailedTx

func (cp *CosmosProvider) LogFailedTx(res *sdk.TxResponse, err error, msgs []sdk.Msg)

LogFailedTx takes the transaction and the messages to create it and logs the appropriate data

func (*CosmosProvider) LogSuccessTx

func (cp *CosmosProvider) LogSuccessTx(res *sdk.TxResponse, msgs []sdk.Msg)

LogSuccessTx take the transaction and the messages to create it and logs the appropriate data

func (*CosmosProvider) MakeEncodingConfig

func (cp *CosmosProvider) MakeEncodingConfig() params.EncodingConfig

MakeEncodingConfig returns the encoding txConfig for thpe CosmosProvider

func (*CosmosProvider) MsgRelayAcknowledgement

func (cp *CosmosProvider) MsgRelayAcknowledgement(dst provider.ChainProvider, dstChanId, dstPortId, srcChanId, srcPortId string, dsth int64, packet provider.RelayPacket) (provider.RelayerMessage, error)

MsgRelayAcknowledgement constructs the MsgAcknowledgement which is to be sent to the sending chain. The counterparty represents the receiving chain where the acknowledgement would be stored.

func (*CosmosProvider) MsgRelayRecvPacket

func (cp *CosmosProvider) MsgRelayRecvPacket(dst provider.ChainProvider, dsth int64, packet provider.RelayPacket, dstChanId, dstPortId, srcChanId, srcPortId string) (provider.RelayerMessage, error)

MsgRelayRecvPacket constructs the MsgRecvPacket which is to be sent to the receiving chain. The counterparty represents the sending chain where the packet commitment would be stored.

func (*CosmosProvider) MsgRelayTimeout

func (cp *CosmosProvider) MsgRelayTimeout(dst provider.ChainProvider, dsth int64, packet provider.RelayPacket, dstChanId, dstPortId, srcChanId, srcPortId string) (provider.RelayerMessage, error)

MsgRelayTimeout constructs the MsgTimeout which is to be sent to the sending chain. The counterparty represents the receiving chain where the receipts would have been stored.

func (*CosmosProvider) MsgTransfer

func (cp *CosmosProvider) MsgTransfer(amount sdk.Coin, dstChainId, dstAddr, srcPortId, srcChanId string, timeoutHeight, timeoutTimestamp uint64) provider.RelayerMessage

MsgTransfer creates a new transfer message

func (*CosmosProvider) MsgUpgradeClient

func (*CosmosProvider) MustGetAddress

func (cp *CosmosProvider) MustGetAddress() string

MustGetAddress used for brevity

func (*CosmosProvider) NewClientState

func (cp *CosmosProvider) NewClientState(dstUpdateHeader ibcexported.Header, dstTrustingPeriod, dstUbdPeriod time.Duration, allowUpdateAfterExpiry, allowUpdateAfterMisbehaviour bool) (ibcexported.ClientState, error)

func (*CosmosProvider) NewProtoCodec

func (cp *CosmosProvider) NewProtoCodec(interfaceRegistry types.InterfaceRegistry, accountPrefix string) *ProtoCodec

NewProtoCodec returns a reference to a new ProtoCodec

func (*CosmosProvider) Print

func (cp *CosmosProvider) Print(toPrint proto.Message, text, indent bool) error

Print fmt.Printlns the json or yaml representation of whatever is passed in CONTRACT: The cmd calling this function needs to have the "json" and "indent" flags set TODO: better "text" printing here would be a nice to have TODO: fix indenting all over the code base

func (*CosmosProvider) ProviderConfig

func (cp *CosmosProvider) ProviderConfig() provider.ProviderConfig

func (*CosmosProvider) QueryABCI

func (cp *CosmosProvider) QueryABCI(req abci.RequestQuery) (res abci.ResponseQuery, err error)

QueryABCI is an affordance for querying the ABCI server associated with a chain Similar to cliCtx.QueryABCI

func (*CosmosProvider) QueryBalance

func (cp *CosmosProvider) QueryBalance(keyName string) (sdk.Coins, error)

QueryBalance returns the amount of coins in the relayer account

func (*CosmosProvider) QueryBalanceWithAddress

func (cp *CosmosProvider) QueryBalanceWithAddress(address string) (sdk.Coins, error)

QueryBalanceWithAddress returns the amount of coins in the relayer account with address as input TODO add pagination support

func (*CosmosProvider) QueryChannel

func (cp *CosmosProvider) QueryChannel(height int64, channelid, portid string) (chanRes *chantypes.QueryChannelResponse, err error)

QueryChannel returns the channel associated with a channelID

func (*CosmosProvider) QueryChannelClient

func (cp *CosmosProvider) QueryChannelClient(height int64, channelid, portid string) (*clienttypes.IdentifiedClientState, error)

QueryChannelClient returns the client state of the client supporting a given channel

func (*CosmosProvider) QueryChannels

func (cp *CosmosProvider) QueryChannels() ([]*chantypes.IdentifiedChannel, error)

QueryChannels returns all the channels that are registered on a chain TODO add pagination support

func (*CosmosProvider) QueryClientConsensusState

func (cp *CosmosProvider) QueryClientConsensusState(chainHeight int64, clientid string, clientHeight ibcexported.Height) (*clienttypes.QueryConsensusStateResponse, error)

QueryClientConsensusState retrieves the latest consensus state for a client in state at a given height

func (*CosmosProvider) QueryClientState

func (cp *CosmosProvider) QueryClientState(height int64, clientid string) (ibcexported.ClientState, error)

QueryClientState retrevies the latest consensus state for a client in state at a given height and unpacks it to exported client state interface

func (*CosmosProvider) QueryClientStateResponse

func (cp *CosmosProvider) QueryClientStateResponse(height int64, srcClientId string) (*clienttypes.QueryClientStateResponse, error)

QueryClientStateResponse retrevies the latest consensus state for a client in state at a given height

func (*CosmosProvider) QueryClients

QueryClients queries all the clients! TODO add pagination support

func (*CosmosProvider) QueryConnection

func (cp *CosmosProvider) QueryConnection(height int64, connectionid string) (*conntypes.QueryConnectionResponse, error)

QueryConnection returns the remote end of a given connection

func (*CosmosProvider) QueryConnectionChannels

func (cp *CosmosProvider) QueryConnectionChannels(height int64, connectionid string) ([]*chantypes.IdentifiedChannel, error)

QueryConnectionChannels queries the channels associated with a connection

func (*CosmosProvider) QueryConnections

func (cp *CosmosProvider) QueryConnections() (conns []*conntypes.IdentifiedConnection, err error)

QueryConnections gets any connections on a chain TODO add pagination support

func (*CosmosProvider) QueryConnectionsUsingClient

func (cp *CosmosProvider) QueryConnectionsUsingClient(height int64, clientid string) (*conntypes.QueryConnectionsResponse, error)

QueryConnectionsUsingClient gets any connections that exist between chain and counterparty TODO add pagination support

func (*CosmosProvider) QueryConsensusState

func (cp *CosmosProvider) QueryConsensusState(height int64) (ibcexported.ConsensusState, int64, error)

QueryConsensusState returns a consensus state for a given chain to be used as a client in another chain, fetches latest height when passed 0 as arg

func (*CosmosProvider) QueryDenomTrace

func (cp *CosmosProvider) QueryDenomTrace(denom string) (*transfertypes.DenomTrace, error)

QueryDenomTrace takes a denom from IBC and queries the information about it

func (*CosmosProvider) QueryDenomTraces

func (cp *CosmosProvider) QueryDenomTraces(offset, limit uint64, height int64) ([]transfertypes.DenomTrace, error)

QueryDenomTraces returns all the denom traces from a given chain TODO add pagination support

func (*CosmosProvider) QueryHeaderAtHeight

func (cp *CosmosProvider) QueryHeaderAtHeight(height int64) (ibcexported.Header, error)

QueryHeaderAtHeight returns the header at a given height

func (*CosmosProvider) QueryLatestHeight

func (cp *CosmosProvider) QueryLatestHeight() (int64, error)

QueryLatestHeight queries the chain for the latest height and returns it

func (*CosmosProvider) QueryNextSeqRecv

func (cp *CosmosProvider) QueryNextSeqRecv(height int64, channelid, portid string) (recvRes *chantypes.QueryNextSequenceReceiveResponse, err error)

QueryNextSeqRecv returns the next seqRecv for a configured channel

func (*CosmosProvider) QueryPacketAcknowledgement

func (cp *CosmosProvider) QueryPacketAcknowledgement(height int64, channelid, portid string, seq uint64) (ackRes *chantypes.QueryPacketAcknowledgementResponse, err error)

QueryPacketAcknowledgement returns the packet ack proof at a given height

func (*CosmosProvider) QueryPacketAcknowledgements

func (cp *CosmosProvider) QueryPacketAcknowledgements(height uint64, channelid, portid string) (acknowledgements []*chantypes.PacketState, err error)

QueryPacketAcknowledgements returns an array of packet acks TODO add pagination support

func (*CosmosProvider) QueryPacketCommitment

func (cp *CosmosProvider) QueryPacketCommitment(height int64, channelid, portid string, seq uint64) (comRes *chantypes.QueryPacketCommitmentResponse, err error)

QueryPacketCommitment returns the packet commitment proof at a given height

func (*CosmosProvider) QueryPacketCommitments

func (cp *CosmosProvider) QueryPacketCommitments(height uint64, channelid, portid string) (commitments *chantypes.QueryPacketCommitmentsResponse, err error)

QueryPacketCommitments returns an array of packet commitments TODO add pagination support

func (*CosmosProvider) QueryPacketReceipt

func (cp *CosmosProvider) QueryPacketReceipt(height int64, channelid, portid string, seq uint64) (recRes *chantypes.QueryPacketReceiptResponse, err error)

QueryPacketReceipt returns the packet receipt proof at a given height

func (*CosmosProvider) QueryTx

func (cp *CosmosProvider) QueryTx(hashHex string) (*ctypes.ResultTx, error)

QueryTx takes a transaction hash and returns the transaction

func (*CosmosProvider) QueryTxs

func (cp *CosmosProvider) QueryTxs(page, limit int, events []string) ([]*ctypes.ResultTx, error)

QueryTxs returns an array of transactions given a tag

func (*CosmosProvider) QueryUnbondingPeriod

func (cp *CosmosProvider) QueryUnbondingPeriod() (time.Duration, error)

QueryUnbondingPeriod returns the unbonding period of the chain

func (*CosmosProvider) QueryUnreceivedAcknowledgements

func (cp *CosmosProvider) QueryUnreceivedAcknowledgements(height uint64, channelid, portid string, seqs []uint64) ([]uint64, error)

QueryUnreceivedAcknowledgements returns a list of unrelayed packet acks

func (*CosmosProvider) QueryUnreceivedPackets

func (cp *CosmosProvider) QueryUnreceivedPackets(height uint64, channelid, portid string, seqs []uint64) ([]uint64, error)

QueryUnreceivedPackets returns a list of unrelayed packet commitments

func (*CosmosProvider) QueryUpgradeProof

func (cp *CosmosProvider) QueryUpgradeProof(key []byte, height uint64) ([]byte, clienttypes.Height, error)

QueryUpgradeProof performs an abci query with the given key and returns the proto encoded merkle proof for the query and the height at which the proof will succeed on a tendermint verifier.

func (*CosmosProvider) QueryUpgradedClient

func (cp *CosmosProvider) QueryUpgradedClient(height int64) (*clienttypes.QueryClientStateResponse, error)

QueryUpgradedClient returns upgraded client info

func (*CosmosProvider) QueryUpgradedConsState

func (cp *CosmosProvider) QueryUpgradedConsState(height int64) (*clienttypes.QueryConsensusStateResponse, error)

QueryUpgradedConsState returns upgraded consensus state and height of client

func (*CosmosProvider) RelayPacketFromSequence

func (cp *CosmosProvider) RelayPacketFromSequence(src, dst provider.ChainProvider, srch, dsth, seq uint64, dstChanId, dstPortId, srcChanId, srcPortId, srcClientId string) (provider.RelayerMessage, provider.RelayerMessage, error)

RelayPacketFromSequence relays a packet with a given seq on src and returns recvPacket msgs, timeoutPacketmsgs and error

func (*CosmosProvider) RestoreKey

func (cp *CosmosProvider) RestoreKey(name, mnemonic string) (string, error)

RestoreKey restores a key from a mnemonic to the keystore at ta given name

func (*CosmosProvider) SendMessage

func (*CosmosProvider) SendMessages

func (*CosmosProvider) ShowAddress

func (cp *CosmosProvider) ShowAddress(name string) (address string, err error)

ShowAddress shows the address for a key from the store

func (*CosmosProvider) SubmitMisbehavior

func (cp *CosmosProvider) SubmitMisbehavior() (provider.RelayerMessage, error)

func (*CosmosProvider) Timeout

func (cp *CosmosProvider) Timeout() string

func (*CosmosProvider) TrustingPeriod

func (cp *CosmosProvider) TrustingPeriod() string

func (*CosmosProvider) TxFactory

func (cp *CosmosProvider) TxFactory(height int64) sdkTx.Factory

TxFactory returns an instance of tx.Factory derived from

func (*CosmosProvider) Type

func (cp *CosmosProvider) Type() string

func (*CosmosProvider) UpdateClient

func (cp *CosmosProvider) UpdateClient(srcClientId string, dstHeader ibcexported.Header) (provider.RelayerMessage, error)

func (*CosmosProvider) UseSDKContext

func (cp *CosmosProvider) UseSDKContext() func()

UseSDKContext uses a custom Bech32 account prefix and returns a restore func CONTRACT: When using this function, caller must ensure that lock contention doesn't cause program to hang. This function is only for use in codec calls

func (*CosmosProvider) WaitForNBlocks

func (cp *CosmosProvider) WaitForNBlocks(n int64) error

WaitForNBlocks blocks until the next block on a given chain

type CosmosProviderConfig

type CosmosProviderConfig struct {
	Key            string  `yaml:"key" json:"key"`
	ChainID        string  `yaml:"chain-id" json:"chain-id"`
	RPCAddr        string  `yaml:"rpc-addr" json:"rpc-addr"`
	AccountPrefix  string  `yaml:"account-prefix" json:"account-prefix"`
	GasAdjustment  float64 `yaml:"gas-adjustment" json:"gas-adjustment"`
	GasPrices      string  `yaml:"gas-prices" json:"gas-prices"`
	TrustingPeriod string  `yaml:"trusting-period" json:"trusting-period"`
	Timeout        string  `yaml:"timeout" json:"timeout"`
}

func (*CosmosProviderConfig) NewProvider

func (cp *CosmosProviderConfig) NewProvider(homepath string, debug bool) (provider.ChainProvider, error)

func (*CosmosProviderConfig) Validate

func (cp *CosmosProviderConfig) Validate() error

type ProtoCodec

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

ProtoCodec defines a codec that utilizes Protobuf for both binary and JSON encoding.

func (*ProtoCodec) InterfaceRegistry

func (pc *ProtoCodec) InterfaceRegistry() types.InterfaceRegistry

InterfaceRegistry returns the ProtoCodec interfaceRegistry

func (*ProtoCodec) Marshal

func (pc *ProtoCodec) Marshal(o codec.ProtoMarshaler) ([]byte, error)

Marshal implements BinaryCodec.Marshal method.

func (*ProtoCodec) MarshalInterface

func (pc *ProtoCodec) MarshalInterface(i proto.Message) ([]byte, error)

MarshalInterface is a convenience function for proto marshalling interfaces. It packs the provided value, which must be an interface, in an Any and then marshals it to bytes. NOTE: to marshal a concrete type, you should use Marshal instead

func (*ProtoCodec) MarshalInterfaceJSON

func (pc *ProtoCodec) MarshalInterfaceJSON(x proto.Message) ([]byte, error)

MarshalInterfaceJSON is a convenience function for proto marshalling interfaces. It packs the provided value in an Any and then marshals it to bytes. NOTE: to marshal a concrete type, you should use MarshalJSON instead

func (*ProtoCodec) MarshalJSON

func (pc *ProtoCodec) MarshalJSON(o proto.Message) ([]byte, error)

MarshalJSON implements JSONCodec.MarshalJSON method, it marshals to JSON using proto codec.

func (*ProtoCodec) MarshalLengthPrefixed

func (pc *ProtoCodec) MarshalLengthPrefixed(o codec.ProtoMarshaler) ([]byte, error)

MarshalLengthPrefixed implements BinaryCodec.MarshalLengthPrefixed method.

func (*ProtoCodec) MustMarshal

func (pc *ProtoCodec) MustMarshal(o codec.ProtoMarshaler) []byte

MustMarshal implements BinaryCodec.MustMarshal method.

func (*ProtoCodec) MustMarshalJSON

func (pc *ProtoCodec) MustMarshalJSON(o proto.Message) []byte

MustMarshalJSON implements JSONCodec.MustMarshalJSON method, it executes MarshalJSON except it panics upon failure.

func (*ProtoCodec) MustMarshalLengthPrefixed

func (pc *ProtoCodec) MustMarshalLengthPrefixed(o codec.ProtoMarshaler) []byte

MustMarshalLengthPrefixed implements BinaryCodec.MustMarshalLengthPrefixed method.

func (*ProtoCodec) MustUnmarshal

func (pc *ProtoCodec) MustUnmarshal(bz []byte, ptr codec.ProtoMarshaler)

MustUnmarshal implements BinaryCodec.MustUnmarshal method.

func (*ProtoCodec) MustUnmarshalJSON

func (pc *ProtoCodec) MustUnmarshalJSON(bz []byte, ptr proto.Message)

MustUnmarshalJSON implements JSONCodec.MustUnmarshalJSON method, it executes UnmarshalJSON except it panics upon failure.

func (*ProtoCodec) MustUnmarshalLengthPrefixed

func (pc *ProtoCodec) MustUnmarshalLengthPrefixed(bz []byte, ptr codec.ProtoMarshaler)

MustUnmarshalLengthPrefixed implements BinaryCodec.MustUnmarshalLengthPrefixed method.

func (*ProtoCodec) Unmarshal

func (pc *ProtoCodec) Unmarshal(bz []byte, ptr codec.ProtoMarshaler) error

Unmarshal implements BinaryMarshaler.Unmarshal method.

func (*ProtoCodec) UnmarshalInterface

func (pc *ProtoCodec) UnmarshalInterface(bz []byte, ptr interface{}) error

UnmarshalInterface is a convenience function for proto unmarshaling interfaces. It unmarshals an Any from bz bytes and then unpacks it to the `ptr`, which must be a pointer to a non empty interface with registered implementations. NOTE: to unmarshal a concrete type, you should use Unmarshal instead

Example:

var x MyInterface
err := cdc.UnmarshalInterface(bz, &x)

func (*ProtoCodec) UnmarshalInterfaceJSON

func (pc *ProtoCodec) UnmarshalInterfaceJSON(bz []byte, iface interface{}) error

UnmarshalInterfaceJSON is a convenience function for proto unmarshaling interfaces. It unmarshals an Any from bz bytes and then unpacks it to the `iface`, which must be a pointer to a non empty interface, implementing proto.Message with registered implementations. NOTE: to unmarshal a concrete type, you should use UnmarshalJSON instead

Example:

var x MyInterface  // must implement proto.Message
err := cdc.UnmarshalInterfaceJSON(&x, bz)

func (*ProtoCodec) UnmarshalJSON

func (pc *ProtoCodec) UnmarshalJSON(bz []byte, ptr proto.Message) error

UnmarshalJSON implements JSONCodec.UnmarshalJSON method, it unmarshals from JSON using proto codec.

func (*ProtoCodec) UnmarshalLengthPrefixed

func (pc *ProtoCodec) UnmarshalLengthPrefixed(bz []byte, ptr codec.ProtoMarshaler) error

UnmarshalLengthPrefixed implements BinaryCodec.UnmarshalLengthPrefixed method.

func (*ProtoCodec) UnpackAny

func (pc *ProtoCodec) UnpackAny(any *types.Any, iface interface{}) error

UnpackAny implements AnyUnpacker.UnpackAny method, it unpacks the value in any to the interface pointer passed in as iface.

Jump to

Keyboard shortcuts

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