From 4c8d29ce46efa29c6649ade244854bd3482ae065 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 19 Feb 2021 10:54:26 +0300 Subject: [PATCH] [#398] morph/client: Add method to read magic number Implement `Client.MagicNumber` method that returns magic number of the network to which the underlying RPC node client is connected. Network magic value is received via `GetNetwork` method. Signed-off-by: Leonard Lyubich --- pkg/morph/client/client.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/morph/client/client.go b/pkg/morph/client/client.go index 6b9622ce..44f43325 100644 --- a/pkg/morph/client/client.go +++ b/pkg/morph/client/client.go @@ -166,3 +166,9 @@ func toStackParameter(value interface{}) (sc.Parameter, error) { return result, nil } + +// MagicNumber returns the magic number of the network +// to which the underlying RPC node client is connected. +func (c *Client) MagicNumber() uint64 { + return uint64(c.client.GetNetwork()) +}