diff --git a/pkg/morph/client/client.go b/pkg/morph/client/client.go index d9978b54..41742d7a 100644 --- a/pkg/morph/client/client.go +++ b/pkg/morph/client/client.go @@ -457,3 +457,20 @@ func (c *Client) BlockCount() (res uint32, err error) { return c.client.GetBlockCount() } + +// MsPerBlock returns MillisecondsPerBlock network parameter. +func (c *Client) MsPerBlock() (res int64, err error) { + if c.multiClient != nil { + return res, c.multiClient.iterateClients(func(c *Client) error { + res, err = c.MsPerBlock() + return err + }) + } + + v, err := c.client.GetVersion() + if err != nil { + return 0, fmt.Errorf("getVersion: %w", err) + } + + return int64(v.Protocol.MillisecondsPerBlock), nil +}