diff --git a/pkg/rpc/client/native.go b/pkg/rpc/client/native.go index 4d81138e0..54eb5de5e 100644 --- a/pkg/rpc/client/native.go +++ b/pkg/rpc/client/native.go @@ -25,3 +25,12 @@ func (c *Client) GetNNSPrice() (int64, error) { } return c.invokeNativeGetMethod(nnsHash, "getPrice") } + +// GetGasPerBlock invokes `getGasPerBlock` method on a native NEO contract. +func (c *Client) GetGasPerBlock() (int64, error) { + neoHash, err := c.GetNativeContractHash(nativenames.Neo) + if err != nil { + return 0, fmt.Errorf("failed to get native NEO hash: %w", err) + } + return c.invokeNativeGetMethod(neoHash, "getGasPerBlock") +} diff --git a/pkg/rpc/client/rpc_test.go b/pkg/rpc/client/rpc_test.go index ef8be0ac6..43eceec4d 100644 --- a/pkg/rpc/client/rpc_test.go +++ b/pkg/rpc/client/rpc_test.go @@ -464,6 +464,18 @@ var rpcClientTestCases = map[string][]rpcClientTestCase{ }, }, }, + "getGasPerBlock": { + { + name: "positive", + invoke: func(c *Client) (interface{}, error) { + return c.GetGasPerBlock() + }, + serverResponse: `{"id":1,"jsonrpc":"2.0","result":{"state":"HALT","gasconsumed":"2007390","script":"EMAMDWdldEZlZVBlckJ5dGUMFJphpG7sl7iTBtfOgfFbRiCR0AkyQWJ9W1I=","stack":[{"type":"Integer","value":"500000000"}],"tx":null}}`, + result: func(c *Client) interface{} { + return int64(500000000) + }, + }, + }, "getMaxNotValidBeforeDelta": { { name: "positive",