From 090ef7324037a47e3885106c875c4e809aa7494c Mon Sep 17 00:00:00 2001 From: Dan Kanefsky Date: Mon, 13 Nov 2023 10:44:09 -0800 Subject: [PATCH] unbonding period info --- relayer/client.go | 2 ++ relayer/query.go | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/relayer/client.go b/relayer/client.go index 763bfa60b..c570959bf 100644 --- a/relayer/client.go +++ b/relayer/client.go @@ -532,6 +532,7 @@ type ClientStateInfo struct { ChainID string TrustingPeriod time.Duration LatestHeight ibcexported.Height + UnbondingTime time.Duration } func ClientInfoFromClientState(clientState *codectypes.Any) (ClientStateInfo, error) { @@ -546,6 +547,7 @@ func ClientInfoFromClientState(clientState *codectypes.Any) (ClientStateInfo, er ChainID: t.ChainId, TrustingPeriod: t.TrustingPeriod, LatestHeight: t.LatestHeight, + UnbondingTime: t.UnbondingPeriod, }, nil default: return ClientStateInfo{}, fmt.Errorf("unhandled client state type: (%T)", clientState) diff --git a/relayer/query.go b/relayer/query.go index fa59dba14..087705526 100644 --- a/relayer/query.go +++ b/relayer/query.go @@ -316,8 +316,9 @@ func SPrintClientExpiration(chain *Chain, expiration time.Time, clientInfo Clien TIME: %s (%s) LAST UPDATE HEIGHT: %d TRUSTING PERIOD: %s + UNBONDING PERIOD: %s `, - chain.ClientID(), chain.ChainID(), status, expirationFormatted, remainingTime.Round(time.Second), clientInfo.LatestHeight.GetRevisionHeight(), clientInfo.TrustingPeriod.String()) + chain.ClientID(), chain.ChainID(), status, expirationFormatted, remainingTime.Round(time.Second), clientInfo.LatestHeight.GetRevisionHeight(), clientInfo.TrustingPeriod.String(), clientInfo.UnbondingTime.Round(time.Second)) return legacyOutput @@ -342,6 +343,7 @@ func SPrintClientExpirationJson(chain *Chain, expiration time.Time, clientInfo C "TIME": fmt.Sprintf("%s (%s)", expirationFormatted, remainingTime.Round(time.Second)), "LAST UPDATE HEIGHT": strconv.FormatUint(clientInfo.LatestHeight.GetRevisionHeight(), 10), "TRUSTING PERIOD": clientInfo.TrustingPeriod.String(), + "UNBONDING PERIOD": fmt.Sprint(clientInfo.UnbondingTime.Round(time.Second)), } jsonOutput, err := json.Marshal(data)