Skip to content

Commit bc8217c

Browse files
committed
feat(transfer): show client latest trusted height on render page
The Transfer section listed each client by ID only, making it hard to tell which client is up-to-date when several track the same chain. Add a read-only core.ClientLatestHeight accessor and surface it next to each "send via" link.
1 parent 01bc43e commit bc8217c

3 files changed

Lines changed: 16 additions & 3 deletions

File tree

gno.land/r/aib/ibc/apps/transfer/filetests/z0bb_render_home_with_client_filetest.gno

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func main(cur realm) {
3636
//
3737
// Trigger an IBC transfer from your wallet. Pick the client of the destination chain:
3838
//
39-
// - [send via `07-tendermint-1`](/r/aib/main$help&func=Transfer&amount=&clientID=07-tendermint-1&denom=&memo=&receiver=&timeoutTimestamp=1234571490) ([client details](/r/aib/ibc/core:clients/07-tendermint-1))
39+
// - [send via `07-tendermint-1`](/r/aib/main$help&func=Transfer&amount=&clientID=07-tendermint-1&denom=&memo=&receiver=&timeoutTimestamp=1234571490) — trusted height `2/2` ([client details](/r/aib/ibc/core:clients/07-tendermint-1))
4040
//
4141
// ## Vouchers (0)
4242
//

gno.land/r/aib/ibc/apps/transfer/render.gno

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ func renderTransferLinks() string {
187187
out.WriteString("Trigger an IBC transfer from your wallet. Pick the client of the destination chain:\n\n")
188188
for _, clientID := range clientIDs {
189189
out.WriteString(ufmt.Sprintf(
190-
"- [send via `%s`](%s) ([client details](/r/aib/ibc/core:clients/%s))\n",
191-
clientID, newTransferLink(clientID, "", "").URL(), clientID,
190+
"- [send via `%s`](%s) — trusted height `%s` ([client details](/r/aib/ibc/core:clients/%s))\n",
191+
clientID, newTransferLink(clientID, "", "").URL(), core.ClientLatestHeight(clientID), clientID,
192192
))
193193
}
194194

gno.land/r/aib/ibc/core/client.gno

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,19 @@ func ClientIDs() []string {
5858
return ids
5959
}
6060

61+
// ClientLatestHeight returns the latest (highest) consensus height the given
62+
// client has been updated to, formatted as "<revision>/<height>". This is the
63+
// client's latest trusted height. Returns "" if the client is unknown.
64+
// Intended for read-only callers (UIs) that want to surface how up-to-date a
65+
// client is.
66+
func ClientLatestHeight(clientID string) string {
67+
c := store.getClient(clientID)
68+
if c == nil {
69+
return ""
70+
}
71+
return c.lightClient.LatestHeight().String()
72+
}
73+
6174
// RegisterCounterparty will register the IBC v2 counterparty info for the
6275
// given clientID. It must be called by the same relayer that called
6376
// CreateClient.

0 commit comments

Comments
 (0)