Skip to content

Commit

Permalink
unbonding period info
Browse files Browse the repository at this point in the history
  • Loading branch information
boojamya committed Nov 13, 2023
1 parent 27cf122 commit 090ef73
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions relayer/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion relayer/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
Expand Down

0 comments on commit 090ef73

Please sign in to comment.