getters.gno
4.05 Kb · 100 lines
1package core
2
3import (
4 "gno.land/p/onbloc/ibc/union/lightclient"
5 "gno.land/p/onbloc/ibc/union/types"
6)
7
8// GetStatus returns the client's status, or an error when the client is missing.
9func GetStatus(clientId types.ClientId) (types.Status, error) {
10 return mustGetImpl().GetStatus(clientId)
11}
12
13// GetLightClient returns the live light client instance for a client, or
14// (nil, false) when the client is missing.
15func GetLightClient(clientId types.ClientId) (lightclient.Interface, bool) {
16 return mustGetImpl().GetLightClient(clientId)
17}
18
19// GetClientType returns the registered client type for a client, or an error
20// when the client is missing.
21func GetClientType(clientId types.ClientId) (types.ClientType, error) {
22 return mustGetImpl().GetClientType(clientId)
23}
24
25// GetClientImpl returns the impl identifier for a client (best-effort: type), or
26// an error when the client is missing.
27func GetClientImpl(clientId types.ClientId) (string, error) {
28 return mustGetImpl().GetClientImpl(clientId)
29}
30
31// GetRegisteredClientType reports whether a client type is registered (best-effort).
32func GetRegisteredClientType(clientType types.ClientType) bool {
33 return mustGetImpl().GetRegisteredClientType(clientType)
34}
35
36// GetClientState returns the mirrored client state bytes, or an error when the
37// client state is missing.
38func GetClientState(clientId types.ClientId) ([]byte, error) {
39 return mustGetImpl().GetClientStateBytes(clientId)
40}
41
42// GetConsensusState returns the consensus state bytes at a height, or an error
43// when no consensus state is stored at that height.
44func GetConsensusState(clientId types.ClientId, height types.Height) ([]byte, error) {
45 return mustGetImpl().GetConsensusStateBytes(clientId, height)
46}
47
48// GetLatestHeight returns the light client's latest height, or an error when the
49// client is missing.
50func GetLatestHeight(clientId types.ClientId) (uint64, error) {
51 return mustGetImpl().GetLatestHeight(clientId)
52}
53
54// GetTimestampAtHeight returns the consensus timestamp recorded at a height, or
55// an error when the client is missing or has no consensus state at that height.
56func GetTimestampAtHeight(clientId types.ClientId, height uint64) (types.Timestamp, error) {
57 return mustGetImpl().GetTimestampAtHeight(clientId, height)
58}
59
60// GetConnection returns the typed connection record, or an error when the
61// connection is missing.
62func GetConnection(connectionId types.ConnectionId) (types.Connection, error) {
63 return mustGetImpl().GetConnection(connectionId)
64}
65
66// GetBatchPackets returns the batch packet commitment for a batch hash, or an
67// error when no batch packet commitment is stored for that hash.
68func GetBatchPackets(batchHash types.H256) (types.H256, error) {
69 return mustGetImpl().GetBatchPacketsCommitment(batchHash)
70}
71
72// GetBatchReceipts returns the batch receipt commitment for a batch hash, or an
73// error when no batch receipt commitment is stored for that hash.
74func GetBatchReceipts(batchHash types.H256) (types.H256, error) {
75 return mustGetImpl().GetBatchReceiptsCommitment(batchHash)
76}
77
78// GetCommittedMembershipProof returns the committed membership proof value for
79// the client/height/path key.
80func GetCommittedMembershipProof(clientId types.ClientId, proofHeight uint64, path []byte) (types.H256, error) {
81 return mustGetImpl().GetCommittedMembershipProofCommitment(clientId, proofHeight, path)
82}
83
84// GetCommittedNonMembershipProof reports whether a non-membership proof
85// commitment is stored for the key.
86func GetCommittedNonMembershipProof(clientId types.ClientId, proofHeight uint64, path []byte) bool {
87 return mustGetImpl().GetCommittedNonMembershipProof(clientId, proofHeight, path)
88}
89
90// GetChannels returns all stored channel records.
91func GetChannels() ([]types.Channel, error) {
92 return mustGetImpl().GetChannels()
93}
94
95// GetChannel returns the stored channel record for channelId.
96// Apps need this to look up the counterparty channel id when constructing packets to send via
97// BatchSend (the core no longer auto-derives it from a sender-side helper).
98func GetChannel(channelId types.ChannelId) (types.Channel, error) {
99 return mustGetImpl().GetChannel(channelId)
100}