Documentation
¶
Index ¶
- Variables
- func CreateMnemonic() (string, error)
- func MustGetHeight(h ibcexported.Height) uint64
- func RegisterInterfaces(registry codectypes.InterfaceRegistry)
- type Chain
- func (c *Chain) CLIContext(height int64) sdkCtx.Context
- func (c *Chain) ChainID() string
- func (c *Chain) ClientID() string
- func (c *Chain) ClientType() string
- func (c *Chain) Config() ChainConfig
- func (srcChain *Chain) CreateTrustedHeader(dstChain core.ChainI, srcHeader core.HeaderI) (core.HeaderI, error)
- func (c *Chain) DeleteLightDB() error
- func (c *Chain) ErrCantSetPath(err error) error
- func (c *Chain) ForceInitLight() error
- func (c *Chain) GetAddress() (sdk.AccAddress, error)
- func (c *Chain) GetLatestLightHeader() (*tmclient.Header, error)
- func (c *Chain) GetLatestLightHeight() (int64, error)
- func (c *Chain) GetLightSignedHeaderAtHeight(height int64) (*tmclient.Header, error)
- func (c *Chain) GetTrustingPeriod() time.Duration
- func (c *Chain) Init(homePath string, timeout time.Duration, debug bool) error
- func (c *Chain) Key() string
- func (c *Chain) KeyExists(name string) bool
- func (c *Chain) LightClient(db dbm.DB) (*light.Client, error)
- func (c *Chain) LightClientWithTrust(db dbm.DB, to light.TrustOptions) (*light.Client, error)
- func (c *Chain) LightClientWithoutTrust(db dbm.DB) (*light.Client, error)
- func (c *Chain) LightHTTP() lightp.Provider
- func (c *Chain) Log(s string)
- func (c *Chain) LogFailedTx(res *sdk.TxResponse, err error, msgs []sdk.Msg)
- func (c *Chain) LogSuccessTx(res *sdk.TxResponse, msgs []sdk.Msg)
- func (dst *Chain) MakeMsgCreateClient(clientID string, dstHeader core.HeaderI, signer sdk.AccAddress) (sdk.Msg, error)
- func (c *Chain) Marshaler() codec.Marshaler
- func (c *Chain) MustGetAddress() sdk.AccAddress
- func (c *Chain) NewLightDB() (db *dbm.GoLevelDB, df func(), err error)
- func (c *Chain) Path() *core.PathEnd
- func (c *Chain) Print(toPrint proto.Message, text, indent bool) error
- func (c *Chain) QueryBalance(addr sdk.AccAddress) (sdk.Coins, error)
- func (c *Chain) QueryChannel(height int64, prove bool) (chanRes *chantypes.QueryChannelResponse, err error)
- func (c *Chain) QueryClientConsensusState(height int64, dstClientConsHeight ibcexported.Height, _ bool) (*clienttypes.QueryConsensusStateResponse, error)
- func (c *Chain) QueryClientState(height int64, _ bool) (*clienttypes.QueryClientStateResponse, error)
- func (c *Chain) QueryConnection(height int64, prove bool) (*conntypes.QueryConnectionResponse, error)
- func (c *Chain) QueryConsensusParams() (*abci.ConsensusParams, error)
- func (c *Chain) QueryDenomTraces(offset, limit uint64, height int64) (*transfertypes.QueryDenomTracesResponse, error)
- func (c *Chain) QueryHeaderAtHeight(height int64) (*tmclient.Header, error)
- func (c *Chain) QueryHistoricalInfo(height clienttypes.Height) (*stakingtypes.QueryHistoricalInfoResponse, error)
- func (c *Chain) QueryLatestHeader() (out core.HeaderI, err error)
- func (c *Chain) QueryLatestHeight() (int64, error)
- func (src *Chain) QueryPacket(height int64, seq uint64) (*chantypes.Packet, error)
- func (dst *Chain) QueryPacketAcknowledgement(height int64, sequence uint64) ([]byte, error)
- func (c *Chain) QueryPacketAcknowledgementCommitment(height int64, seq uint64) (ackRes *chantypes.QueryPacketAcknowledgementResponse, err error)
- func (c *Chain) QueryPacketAcknowledgements(offset, limit, height uint64) (comRes *chantypes.QueryPacketAcknowledgementsResponse, err error)
- func (c *Chain) QueryPacketCommitment(height int64, seq uint64) (comRes *chantypes.QueryPacketCommitmentResponse, err error)
- func (c *Chain) QueryPacketCommitments(offset, limit, height uint64) (comRes *chantypes.QueryPacketCommitmentsResponse, err error)
- func (c *Chain) QueryPacketReciept(height int64, seq uint64) (recRes *chantypes.QueryPacketReceiptResponse, err error)
- func (c *Chain) QueryTxs(height uint64, page, limit int, events []string) ([]*ctypes.ResultTx, error)
- func (c *Chain) QueryUnbondingPeriod() (time.Duration, error)
- func (c *Chain) QueryUnrecievedAcknowledgements(height uint64, seqs []uint64) ([]uint64, error)
- func (c *Chain) QueryUnrecievedPackets(height uint64, seqs []uint64) ([]uint64, error)
- func (c *Chain) QueryValsetAtHeight(height clienttypes.Height) (*tmproto.ValidatorSet, error)
- func (c *Chain) Send(msgs []sdk.Msg) bool
- func (c *Chain) SendMsgs(msgs []sdk.Msg) ([]byte, error)
- func (c *Chain) SetPath(p *core.PathEnd) error
- func (c *Chain) StartEventListener(dst core.ChainI, strategy core.StrategyI)
- func (c *Chain) TrustOptions(height int64, hash []byte) light.TrustOptions
- func (c *Chain) TxFactory(height int64) tx.Factory
- func (c Chain) Update(key, value string) (core.ChainConfigI, error)
- func (c *Chain) UpdateLightWithHeader() (core.HeaderI, error)
- func (c *Chain) UseSDKContext() func()
- func (c *Chain) ValidateTxResult(resTx *ctypes.ResultTx) (err error)
- func (c *Chain) VerifyProof(queryPath string, resp abci.ResponseQuery) error
- type ChainConfig
- func (*ChainConfig) Descriptor() ([]byte, []int)
- func (c ChainConfig) GetChain() core.ChainI
- func (m *ChainConfig) Marshal() (dAtA []byte, err error)
- func (m *ChainConfig) MarshalTo(dAtA []byte) (int, error)
- func (m *ChainConfig) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*ChainConfig) ProtoMessage()
- func (m *ChainConfig) Reset()
- func (m *ChainConfig) Size() (n int)
- func (m *ChainConfig) String() string
- func (m *ChainConfig) Unmarshal(dAtA []byte) error
- func (m *ChainConfig) XXX_DiscardUnknown()
- func (m *ChainConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *ChainConfig) XXX_Merge(src proto.Message)
- func (m *ChainConfig) XXX_Size() int
- func (m *ChainConfig) XXX_Unmarshal(b []byte) error
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidLengthConfig = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowConfig = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupConfig = fmt.Errorf("proto: unexpected end of group") )
var ErrLightNotInitialized = errors.New("light client is not initialized")
ErrLightNotInitialized returns the canonical error for a an uninitialized light client
Functions ¶
func MustGetHeight ¶
func MustGetHeight(h ibcexported.Height) uint64
MustGetHeight takes the height inteface and returns the actual height
func RegisterInterfaces ¶
func RegisterInterfaces(registry codectypes.InterfaceRegistry)
RegisterInterfaces register the ibc transfer module interfaces to protobuf Any.
Types ¶
type Chain ¶
type Chain struct { // TODO: make these private HomePath string `yaml:"-" json:"-"` PathEnd *core.PathEnd `yaml:"-" json:"-"` Keybase keys.Keyring `yaml:"-" json:"-"` Client rpcclient.Client `yaml:"-" json:"-"` Encoding params.EncodingConfig `yaml:"-" json:"-"` // contains filtered or unexported fields }
Chain represents the necessary data for connecting to and indentifying a chain and its counterparites
func (*Chain) CLIContext ¶
CLIContext returns an instance of client.Context derived from Chain
func (*Chain) ClientType ¶
func (*Chain) Config ¶
func (c *Chain) Config() ChainConfig
func (*Chain) CreateTrustedHeader ¶
func (*Chain) DeleteLightDB ¶
DeleteLightDB removes the light client database on disk, forcing re-initialization
func (*Chain) ErrCantSetPath ¶
ErrCantSetPath returns an error if the path doesn't set properly
func (*Chain) ForceInitLight ¶
ForceInitLight forces initialization of the light client from the configured node
func (*Chain) GetAddress ¶
func (c *Chain) GetAddress() (sdk.AccAddress, error)
GetAddress returns the sdk.AccAddress associated with the configred key
func (*Chain) GetLatestLightHeader ¶
GetLatestLightHeader returns the header to be used for client creation
func (*Chain) GetLatestLightHeight ¶
GetLatestLightHeight uses the CLI utilities to pull the latest height from a given chain
func (*Chain) GetLightSignedHeaderAtHeight ¶
GetLightSignedHeaderAtHeight returns a signed header at a particular height.
func (*Chain) GetTrustingPeriod ¶
GetTrustingPeriod returns the trusting period for the chain
func (*Chain) LightClient ¶
LightClient initializes the light client for a given chain from the trusted store in the database this should be call for all other light client usage
func (*Chain) LightClientWithTrust ¶
LightClientWithTrust takes a header from the chain and attempts to add that header to the light database.
func (*Chain) LightClientWithoutTrust ¶
LightClientWithoutTrust querys the latest header from the chain and initializes a new light client database using that header. This should only be called when first initializing the light client
func (*Chain) LogFailedTx ¶
LogFailedTx takes the transaction and the messages to create it and logs the appropriate data
func (*Chain) LogSuccessTx ¶
func (c *Chain) LogSuccessTx(res *sdk.TxResponse, msgs []sdk.Msg)
LogSuccessTx take the transaction and the messages to create it and logs the appropriate data
func (*Chain) MakeMsgCreateClient ¶
func (dst *Chain) MakeMsgCreateClient(clientID string, dstHeader core.HeaderI, signer sdk.AccAddress) (sdk.Msg, error)
MakeMsgCreateClient creates a Msg to this chain
func (*Chain) MustGetAddress ¶
func (c *Chain) MustGetAddress() sdk.AccAddress
MustGetAddress used for brevity
func (*Chain) NewLightDB ¶
NewLightDB returns a new instance of the lightclient database connection CONTRACT: must close the database connection when done with it (defer df())
func (*Chain) Print ¶
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 (*Chain) QueryBalance ¶
QueryBalance returns the amount of coins in the relayer account
func (*Chain) QueryChannel ¶
func (c *Chain) QueryChannel(height int64, prove bool) (chanRes *chantypes.QueryChannelResponse, err error)
QueryChannel returns the channel associated with a channelID
func (*Chain) QueryClientConsensusState ¶
func (c *Chain) QueryClientConsensusState( height int64, dstClientConsHeight ibcexported.Height, _ bool) (*clienttypes.QueryConsensusStateResponse, error)
QueryClientConsensusState retrevies the latest consensus state for a client in state at a given height
func (*Chain) QueryClientState ¶
func (c *Chain) QueryClientState(height int64, _ bool) (*clienttypes.QueryClientStateResponse, error)
QueryClientState retrevies the latest consensus state for a client in state at a given height
func (*Chain) QueryConnection ¶
func (c *Chain) QueryConnection(height int64, prove bool) (*conntypes.QueryConnectionResponse, error)
QueryConnection returns the remote end of a given connection
func (*Chain) QueryConsensusParams ¶
func (c *Chain) QueryConsensusParams() (*abci.ConsensusParams, error)
QueryConsensusParams returns the consensus params
func (*Chain) QueryDenomTraces ¶
func (c *Chain) QueryDenomTraces(offset, limit uint64, height int64) (*transfertypes.QueryDenomTracesResponse, error)
QueryDenomTraces returns all the denom traces from a given chain
func (*Chain) QueryHeaderAtHeight ¶
QueryHeaderAtHeight returns the header at a given height
func (*Chain) QueryHistoricalInfo ¶
func (c *Chain) QueryHistoricalInfo(height clienttypes.Height) (*stakingtypes.QueryHistoricalInfoResponse, error)
QueryHistoricalInfo returns historical header data
func (*Chain) QueryLatestHeader ¶
QueryLatestHeader returns the latest header from the chain
func (*Chain) QueryLatestHeight ¶
QueryLatestHeight queries the chain for the latest height and returns it
func (*Chain) QueryPacket ¶
func (*Chain) QueryPacketAcknowledgement ¶
func (*Chain) QueryPacketAcknowledgementCommitment ¶
func (c *Chain) QueryPacketAcknowledgementCommitment(height int64, seq uint64) (ackRes *chantypes.QueryPacketAcknowledgementResponse, err error)
QueryPacketAcknowledgementCommitment returns the packet ack proof at a given height
func (*Chain) QueryPacketAcknowledgements ¶
func (c *Chain) QueryPacketAcknowledgements(offset, limit, height uint64) (comRes *chantypes.QueryPacketAcknowledgementsResponse, err error)
QueryPacketAcknowledgements returns an array of packet acks
func (*Chain) QueryPacketCommitment ¶
func (c *Chain) QueryPacketCommitment( height int64, seq uint64) (comRes *chantypes.QueryPacketCommitmentResponse, err error)
QueryPacketCommitment returns the packet commitment proof at a given height
func (*Chain) QueryPacketCommitments ¶
func (c *Chain) QueryPacketCommitments( offset, limit, height uint64) (comRes *chantypes.QueryPacketCommitmentsResponse, err error)
QueryPacketCommitments returns an array of packet commitments
func (*Chain) QueryPacketReciept ¶
func (c *Chain) QueryPacketReciept(height int64, seq uint64) (recRes *chantypes.QueryPacketReceiptResponse, err error)
QueryPacketReciept returns the packet reciept proof at a given height
func (*Chain) QueryTxs ¶
func (c *Chain) QueryTxs(height uint64, page, limit int, events []string) ([]*ctypes.ResultTx, error)
QueryTxs returns an array of transactions given a tag
func (*Chain) QueryUnbondingPeriod ¶
QueryUnbondingPeriod returns the unbonding period of the chain
func (*Chain) QueryUnrecievedAcknowledgements ¶
QueryUnrecievedAcknowledgements returns a list of unrelayed packet acks
func (*Chain) QueryUnrecievedPackets ¶
QueryUnrecievedPackets returns a list of unrelayed packet commitments
func (*Chain) QueryValsetAtHeight ¶
func (c *Chain) QueryValsetAtHeight(height clienttypes.Height) (*tmproto.ValidatorSet, error)
QueryValsetAtHeight returns the validator set at a given height
func (*Chain) StartEventListener ¶
func (*Chain) TrustOptions ¶
func (c *Chain) TrustOptions(height int64, hash []byte) light.TrustOptions
TrustOptions returns light.TrustOptions given a height and hash
func (Chain) Update ¶
func (c Chain) Update(key, value string) (core.ChainConfigI, error)
Update returns a new chain with updated values
func (*Chain) UpdateLightWithHeader ¶
UpdateLightWithHeader calls client.Update and then .
func (*Chain) UseSDKContext ¶
func (c *Chain) 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 (*Chain) ValidateTxResult ¶
ValidateTxResult takes a transaction and validates the proof against a stored root of trust
func (*Chain) VerifyProof ¶
func (c *Chain) VerifyProof(queryPath string, resp abci.ResponseQuery) error
VerifyProof performs response proof verification.
type ChainConfig ¶
type ChainConfig struct { Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` ChainId string `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` RpcAddr string `protobuf:"bytes,3,opt,name=rpc_addr,json=rpcAddr,proto3" json:"rpc_addr,omitempty"` AccountPrefix string `protobuf:"bytes,4,opt,name=account_prefix,json=accountPrefix,proto3" json:"account_prefix,omitempty"` GasAdjustment float64 `protobuf:"fixed64,5,opt,name=gas_adjustment,json=gasAdjustment,proto3" json:"gas_adjustment,omitempty"` GasPrices string `protobuf:"bytes,6,opt,name=gas_prices,json=gasPrices,proto3" json:"gas_prices,omitempty"` TrustingPeriod string `protobuf:"bytes,7,opt,name=trusting_period,json=trustingPeriod,proto3" json:"trusting_period,omitempty"` }
func (*ChainConfig) Descriptor ¶
func (*ChainConfig) Descriptor() ([]byte, []int)
func (ChainConfig) GetChain ¶
func (c ChainConfig) GetChain() core.ChainI
func (*ChainConfig) Marshal ¶
func (m *ChainConfig) Marshal() (dAtA []byte, err error)
func (*ChainConfig) MarshalToSizedBuffer ¶
func (m *ChainConfig) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*ChainConfig) ProtoMessage ¶
func (*ChainConfig) ProtoMessage()
func (*ChainConfig) Reset ¶
func (m *ChainConfig) Reset()
func (*ChainConfig) Size ¶
func (m *ChainConfig) Size() (n int)
func (*ChainConfig) String ¶
func (m *ChainConfig) String() string
func (*ChainConfig) Unmarshal ¶
func (m *ChainConfig) Unmarshal(dAtA []byte) error
func (*ChainConfig) XXX_DiscardUnknown ¶
func (m *ChainConfig) XXX_DiscardUnknown()
func (*ChainConfig) XXX_Marshal ¶
func (m *ChainConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*ChainConfig) XXX_Merge ¶
func (m *ChainConfig) XXX_Merge(src proto.Message)
func (*ChainConfig) XXX_Size ¶
func (m *ChainConfig) XXX_Size() int
func (*ChainConfig) XXX_Unmarshal ¶
func (m *ChainConfig) XXX_Unmarshal(b []byte) error