client

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2022 License: Apache-2.0 Imports: 89 Imported by: 37

Documentation

Index

Constants

This section is empty.

Variables

Functions

func BuildSimTx

func BuildSimTx(txf tx.Factory, msgs ...sdk.Msg) ([]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 CheckTendermintError

func CheckTendermintError(err error, tx tmtypes.Tx) *sdk.TxResponse

CheckTendermintError checks if the error returned from BroadcastTx is a Tendermint error that is returned before the tx is submitted due to precondition checks that failed. If an Tendermint error is detected, this function returns the correct code back in TxResponse.

TODO: Avoid brittle string matching in favor of error matching. This requires a change to Tendermint's RPCError type to allow retrieval or matching against a concrete error type.

func CosmosMsg added in v0.1.3

func CosmosMsg(rm provider.RelayerMessage) sdk.Msg

func CosmosMsgs added in v0.1.3

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 GetHeightFromMetadata

func GetHeightFromMetadata(md metadata.MD) (int64, error)

func GetProveFromMetadata

func GetProveFromMetadata(md metadata.MD) (bool, error)

func NewCosmosMessage added in v0.1.3

func NewCosmosMessage(msg sdk.Msg) provider.RelayerMessage

func NewRPCClient

func NewRPCClient(addr string, timeout time.Duration) (*rpchttp.HTTP, error)

func SetHeightOnContext

func SetHeightOnContext(ctx context.Context, height int64) context.Context

func SetProveOnContext

func SetProveOnContext(ctx context.Context, prove bool) context.Context

Types

type ChainClient

type ChainClient struct {
	Config         *ChainClientConfig
	Keybase        keyring.Keyring
	KeyringOptions []keyring.Option
	RPCClient      rpcclient.Client
	LightProvider  provtypes.Provider
	Input          io.Reader
	Output         io.Writer

	Codec  Codec
	Logger log.Logger
}

func GetTestClient

func GetTestClient() *ChainClient

func NewChainClient

func NewChainClient(ccc *ChainClientConfig, homepath string, input io.Reader, output io.Writer, kro ...keyring.Option) (*ChainClient, error)

func (*ChainClient) AccountFromKeyOrAddress added in v0.1.3

func (cc *ChainClient) AccountFromKeyOrAddress(keyOrAddress string) (out sdk.AccAddress, err error)

AccountFromKeyOrAddress returns an account from either a key or an address if empty string is passed in this returns the default key's address

func (*ChainClient) AcknowledgementFromSequence added in v0.1.3

func (cc *ChainClient) 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 (*ChainClient) AddKey

func (cc *ChainClient) AddKey(name string) (output *provider.KeyOutput, err error)

func (*ChainClient) Address added in v0.1.3

func (cc *ChainClient) Address() (string, error)

Address returns the chains configured address as a string

func (*ChainClient) AutoUpdateClient added in v0.1.3

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

AutoUpdateClient update client automatically to prevent expiry

func (*ChainClient) BroadcastTx

func (cc *ChainClient) BroadcastTx(ctx context.Context, tx []byte) (res *sdk.TxResponse, err error)

BroadcastTx broadcasts a transactions either synchronously or asynchronously based on the context parameters. The result of the broadcast is parsed into an intermediate structure which is logged if the context has a logger defined.

func (*ChainClient) CalculateGas

func (cc *ChainClient) CalculateGas(txf tx.Factory, msgs ...sdk.Msg) (txtypes.SimulateResponse, uint64, error)

func (*ChainClient) ChainId added in v0.1.3

func (cc *ChainClient) ChainId() string

func (*ChainClient) ChannelCloseConfirm added in v0.1.3

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

func (*ChainClient) ChannelCloseInit added in v0.1.3

func (cc *ChainClient) ChannelCloseInit(srcPortId, srcChanId string) (provider.RelayerMessage, error)

func (*ChainClient) ChannelOpenAck added in v0.1.3

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

func (*ChainClient) ChannelOpenConfirm added in v0.1.3

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

func (*ChainClient) ChannelOpenInit added in v0.1.3

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

func (*ChainClient) ChannelOpenTry added in v0.1.3

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

func (*ChainClient) ConnectionOpenAck added in v0.1.3

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

func (*ChainClient) ConnectionOpenConfirm added in v0.1.3

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

func (*ChainClient) ConnectionOpenInit added in v0.1.3

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

func (*ChainClient) ConnectionOpenTry added in v0.1.3

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

func (*ChainClient) CreateClient added in v0.1.3

func (cc *ChainClient) 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 (*ChainClient) CreateKeystore

func (cc *ChainClient) CreateKeystore(path string) error

func (*ChainClient) DecodeBech32AccAddr

func (cc *ChainClient) DecodeBech32AccAddr(addr string) (sdk.AccAddress, error)

func (*ChainClient) DecodeBech32AccPub

func (cc *ChainClient) DecodeBech32AccPub(addr string) (sdk.AccAddress, error)

func (*ChainClient) DecodeBech32ConsAddr

func (cc *ChainClient) DecodeBech32ConsAddr(addr string) (sdk.AccAddress, error)

func (*ChainClient) DecodeBech32ConsPub

func (cc *ChainClient) DecodeBech32ConsPub(addr string) (sdk.AccAddress, error)

func (*ChainClient) DecodeBech32ValAddr

func (cc *ChainClient) DecodeBech32ValAddr(addr string) (sdk.ValAddress, error)

func (*ChainClient) DecodeBech32ValPub

func (cc *ChainClient) DecodeBech32ValPub(addr string) (sdk.AccAddress, error)

func (*ChainClient) DeleteKey

func (cc *ChainClient) DeleteKey(name string) error

func (*ChainClient) EncodeBech32AccAddr

func (cc *ChainClient) EncodeBech32AccAddr(addr sdk.AccAddress) (string, error)

func (*ChainClient) EncodeBech32AccPub

func (cc *ChainClient) EncodeBech32AccPub(addr sdk.AccAddress) (string, error)

func (*ChainClient) EncodeBech32ConsAddr

func (cc *ChainClient) EncodeBech32ConsAddr(addr sdk.AccAddress) (string, error)

func (*ChainClient) EncodeBech32ConsPub

func (cc *ChainClient) EncodeBech32ConsPub(addr sdk.AccAddress) (string, error)

func (*ChainClient) EncodeBech32ValAddr

func (cc *ChainClient) EncodeBech32ValAddr(addr sdk.ValAddress) (string, error)

func (*ChainClient) EncodeBech32ValPub

func (cc *ChainClient) EncodeBech32ValPub(addr sdk.AccAddress) (string, error)

func (*ChainClient) EnsureExists

func (cc *ChainClient) EnsureExists(clientCtx client.Context, addr sdk.AccAddress) error

EnsureExists returns an error if no account exists for the given address else nil.

func (*ChainClient) ExportPrivKeyArmor

func (cc *ChainClient) ExportPrivKeyArmor(keyName string) (armor string, err error)

func (*ChainClient) FindMatchingClient added in v0.1.3

func (cc *ChainClient) 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 (*ChainClient) GenerateConnHandshakeProof added in v0.1.3

func (cc *ChainClient) 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 (*ChainClient) GetAccount

func (cc *ChainClient) GetAccount(clientCtx client.Context, addr sdk.AccAddress) (client.Account, error)

GetAccount queries for an account given an address and a block height. An error is returned if the query or decoding fails.

func (*ChainClient) GetAccountNumberSequence

func (cc *ChainClient) GetAccountNumberSequence(clientCtx client.Context, addr sdk.AccAddress) (uint64, uint64, error)

GetAccountNumberSequence returns sequence and account number for the given address. It returns an error if the account couldn't be retrieved from the state.

func (*ChainClient) GetAccountWithHeight

func (cc *ChainClient) GetAccountWithHeight(clientCtx client.Context, addr sdk.AccAddress) (client.Account, int64, error)

GetAccountWithHeight queries for an account given an address. Returns the height of the query with the account. An error is returned if the query or decoding fails.

func (*ChainClient) GetIBCUpdateHeader added in v0.1.3

func (cc *ChainClient) 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 (*ChainClient) GetKeyAddress

func (cc *ChainClient) GetKeyAddress() (sdk.AccAddress, error)

func (*ChainClient) GetLightSignedHeaderAtHeight added in v0.1.3

func (cc *ChainClient) GetLightSignedHeaderAtHeight(h int64) (ibcexported.Header, error)

func (*ChainClient) HandleAndPrintMsgSend added in v0.1.3

func (cc *ChainClient) HandleAndPrintMsgSend(res *sdk.TxResponse, err error) error

func (*ChainClient) Init added in v0.1.3

func (cc *ChainClient) Init() error

func (*ChainClient) InjectTrustedFields added in v0.1.3

func (cc *ChainClient) 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 (*ChainClient) Invoke

func (cc *ChainClient) Invoke(ctx context.Context, method string, req, reply interface{}, opts ...grpc.CallOption) (err error)

Invoke implements the grpc ClientConn.Invoke method

func (*ChainClient) Key added in v0.1.3

func (cc *ChainClient) Key() string

func (*ChainClient) KeyAddOrRestore

func (cc *ChainClient) KeyAddOrRestore(keyName string, coinType uint32, mnemonic ...string) (*provider.KeyOutput, error)

func (*ChainClient) KeyExists

func (cc *ChainClient) KeyExists(name string) bool

func (*ChainClient) KeystoreCreated

func (cc *ChainClient) KeystoreCreated(path string) bool

func (*ChainClient) ListAddresses

func (cc *ChainClient) ListAddresses() (map[string]string, error)

func (*ChainClient) Log added in v0.1.3

func (cc *ChainClient) Log(s string)

Log takes a string and logs the data

func (*ChainClient) MarshalProto

func (cc *ChainClient) MarshalProto(res proto.Message) ([]byte, error)

func (*ChainClient) MsgRelayAcknowledgement added in v0.1.3

func (cc *ChainClient) 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 (*ChainClient) MsgRelayRecvPacket added in v0.1.3

func (cc *ChainClient) 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 (*ChainClient) MsgRelayTimeout added in v0.1.3

func (cc *ChainClient) 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 (*ChainClient) MsgTransfer added in v0.1.3

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

MsgTransfer creates a new transfer message

func (*ChainClient) MsgUpgradeClient added in v0.1.3

func (*ChainClient) MustEncodeAccAddr added in v0.1.3

func (cc *ChainClient) MustEncodeAccAddr(addr sdk.AccAddress) string

func (*ChainClient) MustEncodeValAddr added in v0.1.3

func (cc *ChainClient) MustEncodeValAddr(addr sdk.ValAddress) string

func (*ChainClient) NewClientState added in v0.1.3

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

func (*ChainClient) NewStream

NewStream implements the grpc ClientConn.NewStream method

func (*ChainClient) PrepareFactory

func (cc *ChainClient) PrepareFactory(txf tx.Factory) (tx.Factory, error)

func (*ChainClient) PrintObject

func (cc *ChainClient) PrintObject(res interface{}) error

func (*ChainClient) PrintTxResponse

func (cc *ChainClient) PrintTxResponse(res *sdk.TxResponse) error

TODO: actually do something different here have a couple of levels of verbosity

func (*ChainClient) ProviderConfig added in v0.1.3

func (cc *ChainClient) ProviderConfig() provider.ProviderConfig

func (*ChainClient) QueryABCI

func (cc *ChainClient) QueryABCI(req abci.RequestQuery) (abci.ResponseQuery, error)

func (*ChainClient) QueryAccount

func (cc *ChainClient) QueryAccount(address sdk.AccAddress) (authtypes.AccountI, error)

func (*ChainClient) QueryBalance

func (cc *ChainClient) QueryBalance(keyName string) (sdk.Coins, error)

QueryBalance returns the amount of coins in the relayer account

func (*ChainClient) QueryBalanceWithAddress

func (cc *ChainClient) 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 (*ChainClient) QueryBalanceWithDenomTraces added in v0.1.3

func (cc *ChainClient) QueryBalanceWithDenomTraces(ctx context.Context, address sdk.AccAddress, pageReq *query.PageRequest) (sdk.Coins, error)

QueryBalanceWithDenomTraces is a helper function for query balance

func (*ChainClient) QueryChannel added in v0.1.3

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

QueryChannel returns the channel associated with a channelID

func (*ChainClient) QueryChannelClient added in v0.1.3

func (cc *ChainClient) QueryChannelClient(height int64, channelid, portid string) (*clienttypes.IdentifiedClientState, error)

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

func (*ChainClient) QueryChannels added in v0.1.3

func (cc *ChainClient) QueryChannels() ([]*chantypes.IdentifiedChannel, error)

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

func (*ChainClient) QueryClientConsensusState added in v0.1.3

func (cc *ChainClient) 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 (*ChainClient) QueryClientState added in v0.1.3

func (cc *ChainClient) 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 (*ChainClient) QueryClientStateResponse added in v0.1.3

func (cc *ChainClient) QueryClientStateResponse(height int64, srcClientId string) (*clienttypes.QueryClientStateResponse, error)

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

func (*ChainClient) QueryClients added in v0.1.3

func (cc *ChainClient) QueryClients() (clienttypes.IdentifiedClientStates, error)

QueryClients queries all the clients! TODO add pagination support

func (*ChainClient) QueryConnection added in v0.1.3

func (cc *ChainClient) QueryConnection(height int64, connectionid string) (*conntypes.QueryConnectionResponse, error)

QueryConnection returns the remote end of a given connection

func (*ChainClient) QueryConnectionChannels added in v0.1.3

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

QueryConnectionChannels queries the channels associated with a connection

func (*ChainClient) QueryConnections added in v0.1.3

func (cc *ChainClient) QueryConnections() (conns []*conntypes.IdentifiedConnection, err error)

QueryConnections gets any connections on a chain TODO add pagination support

func (*ChainClient) QueryConnectionsUsingClient added in v0.1.3

func (cc *ChainClient) QueryConnectionsUsingClient(height int64, clientid string) (*conntypes.QueryConnectionsResponse, error)

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

func (*ChainClient) QueryConsensusState added in v0.1.3

func (cc *ChainClient) 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 (*ChainClient) QueryConsensusStateABCI added in v0.1.3

func (cc *ChainClient) QueryConsensusStateABCI(clientID string, height ibcexported.Height) (*clienttypes.QueryConsensusStateResponse, error)

func (*ChainClient) QueryDelegatorValidators

func (cc *ChainClient) QueryDelegatorValidators(ctx context.Context, address sdk.AccAddress) ([]string, error)

func (*ChainClient) QueryDenomTrace added in v0.1.3

func (cc *ChainClient) QueryDenomTrace(denom string) (*transfertypes.DenomTrace, error)

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

func (*ChainClient) QueryDenomTraces

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

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

func (*ChainClient) QueryDenomsMetadata added in v0.1.3

func (cc *ChainClient) QueryDenomsMetadata(ctx context.Context, pageReq *query.PageRequest) (*bankTypes.QueryDenomsMetadataResponse, error)

func (*ChainClient) QueryDistributionCommission

func (cc *ChainClient) QueryDistributionCommission(ctx context.Context, address sdk.ValAddress) (sdk.DecCoins, error)

func (*ChainClient) QueryDistributionCommunityPool

func (cc *ChainClient) QueryDistributionCommunityPool(ctx context.Context) (sdk.DecCoins, error)

func (*ChainClient) QueryDistributionParams

func (cc *ChainClient) QueryDistributionParams(ctx context.Context) (*distTypes.Params, error)

func (*ChainClient) QueryDistributionRewards

func (cc *ChainClient) QueryDistributionRewards(ctx context.Context, delegatorAddress sdk.AccAddress, validatorAddress sdk.ValAddress) (sdk.DecCoins, error)

func (*ChainClient) QueryDistributionSlashes

func (cc *ChainClient) QueryDistributionSlashes(ctx context.Context, validatorAddress sdk.ValAddress, startHeight, endHeight uint64, pageReq *querytypes.PageRequest) (*distTypes.QueryValidatorSlashesResponse, error)

QueryDistributionSlashes returns all slashes of a validator, optionally pass the start and end height

func (*ChainClient) QueryDistributionValidatorRewards

func (cc *ChainClient) QueryDistributionValidatorRewards(ctx context.Context, validatorAddress sdk.ValAddress) (sdk.DecCoins, error)

QueryDistributionValidatorRewards returns all the validator distribution rewards from a given height

func (*ChainClient) QueryHeaderAtHeight added in v0.1.3

func (cc *ChainClient) QueryHeaderAtHeight(height int64) (ibcexported.Header, error)

QueryHeaderAtHeight returns the header at a given height

func (*ChainClient) QueryLatestHeight

func (cc *ChainClient) QueryLatestHeight() (int64, error)

func (*ChainClient) QueryNextSeqRecv added in v0.1.3

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

QueryNextSeqRecv returns the next seqRecv for a configured channel

func (*ChainClient) QueryPacketAcknowledgement added in v0.1.3

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

QueryPacketAcknowledgement returns the packet ack proof at a given height

func (*ChainClient) QueryPacketAcknowledgements added in v0.1.3

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

QueryPacketAcknowledgements returns an array of packet acks TODO add pagination support

func (*ChainClient) QueryPacketCommitment added in v0.1.3

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

QueryPacketCommitment returns the packet commitment proof at a given height

func (*ChainClient) QueryPacketCommitments added in v0.1.3

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

QueryPacketCommitments returns an array of packet commitments TODO add pagination support

func (*ChainClient) QueryPacketReceipt added in v0.1.3

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

QueryPacketReceipt returns the packet receipt proof at a given height

func (*ChainClient) QueryStakingParams added in v0.1.3

func (cc *ChainClient) QueryStakingParams(ctx context.Context) (*stakingtypes.Params, error)

func (*ChainClient) QueryTendermintProof added in v0.1.3

func (cc *ChainClient) QueryTendermintProof(height int64, key []byte) ([]byte, []byte, clienttypes.Height, error)

QueryTendermintProof performs an ABCI query with the given key and returns the value of the query, the proto encoded merkle proof, and the height of the Tendermint block containing the state root. The desired tendermint height to perform the query should be set in the client context. The query will be performed at one below this height (at the IAVL version) in order to obtain the correct merkle proof. Proof queries at height less than or equal to 2 are not supported. Queries with a client context height of 0 will perform a query at the lastest state available. Issue: https://github.com/cosmos/cosmos-sdk/issues/6567

func (*ChainClient) QueryTotalSupply added in v0.1.3

func (cc *ChainClient) QueryTotalSupply(ctx context.Context, pageReq *query.PageRequest) (*bankTypes.QueryTotalSupplyResponse, error)

QueryTotalSupply returns the total supply of coins on a chain

func (*ChainClient) QueryTx added in v0.1.3

func (cc *ChainClient) QueryTx(hashHex string) (*ctypes.ResultTx, error)

QueryTx takes a transaction hash and returns the transaction

func (*ChainClient) QueryTxs added in v0.1.3

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

QueryTxs returns an array of transactions given a tag

func (*ChainClient) QueryUnbondingPeriod added in v0.1.3

func (cc *ChainClient) QueryUnbondingPeriod() (time.Duration, error)

QueryUnbondingPeriod returns the unbonding period of the chain

func (*ChainClient) QueryUnreceivedAcknowledgements added in v0.1.3

func (cc *ChainClient) QueryUnreceivedAcknowledgements(height uint64, channelid, portid string, seqs []uint64) ([]uint64, error)

QueryUnreceivedAcknowledgements returns a list of unrelayed packet acks

func (*ChainClient) QueryUnreceivedPackets added in v0.1.3

func (cc *ChainClient) QueryUnreceivedPackets(height uint64, channelid, portid string, seqs []uint64) ([]uint64, error)

QueryUnreceivedPackets returns a list of unrelayed packet commitments

func (*ChainClient) QueryUpgradeProof added in v0.1.3

func (cc *ChainClient) 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 (*ChainClient) QueryUpgradedClient added in v0.1.3

func (cc *ChainClient) QueryUpgradedClient(height int64) (*clienttypes.QueryClientStateResponse, error)

QueryUpgradedClient returns upgraded client info

func (*ChainClient) QueryUpgradedConsState added in v0.1.3

func (cc *ChainClient) QueryUpgradedConsState(height int64) (*clienttypes.QueryConsensusStateResponse, error)

QueryUpgradedConsState returns upgraded consensus state and height of client

func (*ChainClient) RelayPacketFromSequence added in v0.1.3

func (cc *ChainClient) 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 (*ChainClient) RestoreKey

func (cc *ChainClient) RestoreKey(name, mnemonic string) (address string, err error)

func (*ChainClient) RunGRPCQuery

func (cc *ChainClient) RunGRPCQuery(ctx context.Context, method string, req interface{}, md metadata.MD) (abci.ResponseQuery, metadata.MD, error)

RunGRPCQuery runs a gRPC query from the clientCtx, given all necessary arguments for the gRPC method, and returns the ABCI response. It is used to factorize code between client (Invoke) and server (RegisterGRPCServer) gRPC handlers.

func (*ChainClient) SendMessage added in v0.1.3

func (*ChainClient) SendMessages added in v0.1.3

func (cc *ChainClient) SendMessages(msgs []provider.RelayerMessage) (*provider.RelayerTxResponse, bool, error)

func (*ChainClient) SendMsg

func (cc *ChainClient) SendMsg(ctx context.Context, msg sdk.Msg) (*sdk.TxResponse, error)

func (*ChainClient) SendMsgs

func (cc *ChainClient) SendMsgs(ctx context.Context, msgs []sdk.Msg) (*sdk.TxResponse, error)

SendMsgs wraps the msgs in a StdTx, signs and sends it. An error is returned if there was an issue sending the transaction. A successfully sent, but failed transaction will not return an error. If a transaction is successfully sent, the result of the execution of that transaction will be logged. A boolean indicating if a transaction was successfully sent and executed successfully is returned.

func (*ChainClient) SetSDKContext

func (cc *ChainClient) SetSDKContext() func()

SetSDKConfig sets the SDK config to the proper bech32 prefixes Don't use this unless you know what you're doing. if lens is successful, this can be eliminated TODO: :dagger: :knife: :chainsaw: remove this function

func (*ChainClient) ShowAddress

func (cc *ChainClient) ShowAddress(name string) (address string, err error)

func (*ChainClient) SubmitMisbehavior added in v0.1.3

func (cc *ChainClient) SubmitMisbehavior() (provider.RelayerMessage, error)

func (*ChainClient) Timeout added in v0.1.3

func (cc *ChainClient) Timeout() string

func (*ChainClient) TrustingPeriod added in v0.1.3

func (cc *ChainClient) TrustingPeriod() (time.Duration, error)

func (*ChainClient) TxFactory

func (cc *ChainClient) TxFactory() tx.Factory

func (*ChainClient) TxServiceBroadcast

func (cc *ChainClient) TxServiceBroadcast(ctx context.Context, req *tx.BroadcastTxRequest) (*tx.BroadcastTxResponse, error)

TxServiceBroadcast is a helper function to broadcast a Tx with the correct gRPC types from the tx service. Calls `clientCtx.BroadcastTx` under the hood.

func (*ChainClient) Type added in v0.1.3

func (cc *ChainClient) Type() string

func (*ChainClient) UpdateClient added in v0.1.3

func (cc *ChainClient) UpdateClient(srcClientId string, dstHeader ibcexported.Header) (provider.RelayerMessage, error)

func (*ChainClient) WaitForNBlocks added in v0.1.3

func (cc *ChainClient) WaitForNBlocks(n int64) error

WaitForNBlocks blocks until the next block on a given chain

type ChainClientConfig

type ChainClientConfig struct {
	Key            string                  `json:"key" yaml:"key"`
	ChainID        string                  `json:"chain-id" yaml:"chain-id"`
	RPCAddr        string                  `json:"rpc-addr" yaml:"rpc-addr"`
	GRPCAddr       string                  `json:"grpc-addr" yaml:"grpc-addr"`
	AccountPrefix  string                  `json:"account-prefix" yaml:"account-prefix"`
	KeyringBackend string                  `json:"keyring-backend" yaml:"keyring-backend"`
	GasAdjustment  float64                 `json:"gas-adjustment" yaml:"gas-adjustment"`
	GasPrices      string                  `json:"gas-prices" yaml:"gas-prices"`
	KeyDirectory   string                  `json:"key-directory" yaml:"key-directory"`
	Debug          bool                    `json:"debug" yaml:"debug"`
	Timeout        string                  `json:"timeout" yaml:"timeout"`
	OutputFormat   string                  `json:"output-format" yaml:"output-format"`
	SignModeStr    string                  `json:"sign-mode" yaml:"sign-mode"`
	Modules        []module.AppModuleBasic `json:"-" yaml:"-"`
}

func GetCosmosHubConfig

func GetCosmosHubConfig(keyHome string, debug bool) *ChainClientConfig

func GetOsmosisConfig

func GetOsmosisConfig(keyHome string, debug bool) *ChainClientConfig

func (*ChainClientConfig) NewProvider added in v0.1.3

func (ccc *ChainClientConfig) NewProvider(homepath string, debug bool) (provider.ChainProvider, error)

func (*ChainClientConfig) SignMode

func (ccc *ChainClientConfig) SignMode() signing.SignMode

func (*ChainClientConfig) Validate

func (ccc *ChainClientConfig) Validate() error

type Codec

type Codec struct {
	InterfaceRegistry types.InterfaceRegistry
	Marshaler         codec.Codec
	TxConfig          client.TxConfig
	Amino             *codec.LegacyAmino
}

func MakeCodec

func MakeCodec(moduleBasics []module.AppModuleBasic) Codec

func MakeCodecConfig

func MakeCodecConfig() Codec

type CosmosMessage added in v0.1.3

type CosmosMessage struct {
	Msg sdk.Msg
}

func (CosmosMessage) MsgBytes added in v0.1.3

func (cm CosmosMessage) MsgBytes() ([]byte, error)

func (CosmosMessage) Type added in v0.1.3

func (cm CosmosMessage) Type() string

type KeyOutput

type KeyOutput struct {
	Mnemonic string `json:"mnemonic" yaml:"mnemonic"`
	Address  string `json:"address" yaml:"address"`
}

KeyOutput contains mnemonic and address of key

Jump to

Keyboard shortcuts

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