diff --git a/gateway/emulator.go b/gateway/emulator.go index 64c7322d..e7d2ca92 100644 --- a/gateway/emulator.go +++ b/gateway/emulator.go @@ -335,6 +335,10 @@ func (g *EmulatorGateway) GetLatestProtocolStateSnapshot(ctx context.Context) ([ return snapshot, nil } +func (g *EmulatorGateway) GetNodeVersionInfo(context.Context) (*flow.NodeVersionInfo, error) { + return &flow.NodeVersionInfo{}, nil +} + // SecureConnection placeholder func to complete gateway interface implementation func (g *EmulatorGateway) SecureConnection() bool { return false diff --git a/gateway/gateway.go b/gateway/gateway.go index 412941d8..6257cd8e 100644 --- a/gateway/gateway.go +++ b/gateway/gateway.go @@ -49,6 +49,7 @@ type Gateway interface { GetEvents(context.Context, string, uint64, uint64) ([]flow.BlockEvents, error) GetCollection(context.Context, flow.Identifier) (*flow.Collection, error) GetLatestProtocolStateSnapshot(context.Context) ([]byte, error) + GetNodeVersionInfo(context.Context) (*flow.NodeVersionInfo, error) Ping() error WaitServer(context.Context) error SecureConnection() bool diff --git a/gateway/grpc.go b/gateway/grpc.go index 3266dbc1..7a1b2699 100644 --- a/gateway/grpc.go +++ b/gateway/grpc.go @@ -284,6 +284,11 @@ func (g *GrpcGateway) GetLatestProtocolStateSnapshot(ctx context.Context) ([]byt return g.client.GetLatestProtocolStateSnapshot(ctx) } +// GetNodeVersionInfo returns version information for the access node. +func (g *GrpcGateway) GetNodeVersionInfo(ctx context.Context) (*flow.NodeVersionInfo, error) { + return g.client.GetNodeVersionInfo(ctx) +} + // Ping is used to check if the access node is alive and healthy. func (g *GrpcGateway) Ping() error { ctx := context.Background() diff --git a/gateway/mocks/Gateway.go b/gateway/mocks/Gateway.go index a8311189..5c24695e 100644 --- a/gateway/mocks/Gateway.go +++ b/gateway/mocks/Gateway.go @@ -347,6 +347,36 @@ func (_m *Gateway) GetLatestProtocolStateSnapshot(_a0 context.Context) ([]byte, return r0, r1 } +// GetNodeVersionInfo provides a mock function with given fields: _a0 +func (_m *Gateway) GetNodeVersionInfo(_a0 context.Context) (*flow.NodeVersionInfo, error) { + ret := _m.Called(_a0) + + if len(ret) == 0 { + panic("no return value specified for GetNodeVersionInfo") + } + + var r0 *flow.NodeVersionInfo + var r1 error + if rf, ok := ret.Get(0).(func(context.Context) (*flow.NodeVersionInfo, error)); ok { + return rf(_a0) + } + if rf, ok := ret.Get(0).(func(context.Context) *flow.NodeVersionInfo); ok { + r0 = rf(_a0) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*flow.NodeVersionInfo) + } + } + + if rf, ok := ret.Get(1).(func(context.Context) error); ok { + r1 = rf(_a0) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // GetSystemTransaction provides a mock function with given fields: ctx, blockID func (_m *Gateway) GetSystemTransaction(ctx context.Context, blockID flow.Identifier) (*flow.Transaction, error) { ret := _m.Called(ctx, blockID) diff --git a/gateway/mocks/gateway_mock.go b/gateway/mocks/gateway_mock.go index 29e26f7e..b3dd2521 100644 --- a/gateway/mocks/gateway_mock.go +++ b/gateway/mocks/gateway_mock.go @@ -44,6 +44,7 @@ const ( GetSystemTransactionResultFunc = "GetSystemTransactionResult" GetSystemTransactionWithIDFunc = "GetSystemTransactionWithID" GetSystemTransactionResultWithIDFunc = "GetSystemTransactionResultWithID" + GetNodeVersionInfoFunc = "GetNodeVersionInfo" ) type TestGateway struct { @@ -66,6 +67,7 @@ type TestGateway struct { GetSystemTransactionWithID *mock.Call GetSystemTransactionResultWithID *mock.Call GetLatestProtocolStateSnapshot *mock.Call + GetNodeVersionInfo *mock.Call Ping *mock.Call SecureConnection *mock.Call } @@ -145,6 +147,7 @@ func DefaultMockGateway() *TestGateway { mock.AnythingOfType("flow.Identifier"), mock.AnythingOfType("flow.Identifier"), ), + GetNodeVersionInfo: m.On(GetNodeVersionInfoFunc, ctxMock), } // default return values @@ -181,6 +184,7 @@ func DefaultMockGateway() *TestGateway { t.GetSystemTransactionResult.Return(tests.NewTransactionResult(nil), nil) t.GetSystemTransactionWithID.Return(tests.NewTransaction(), nil) t.GetSystemTransactionResultWithID.Return(tests.NewTransactionResult(nil), nil) + t.GetNodeVersionInfo.Return((*flow.NodeVersionInfo)(nil), nil) return t }