mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-23 03:38:35 +00:00
rpc: fix Client's GetOraclePrice
This commit is contained in:
parent
92282c70cb
commit
49e228ddf8
2 changed files with 16 additions and 1 deletions
|
@ -16,7 +16,7 @@ import (
|
||||||
|
|
||||||
// GetOraclePrice invokes `getPrice` method on a native Oracle contract.
|
// GetOraclePrice invokes `getPrice` method on a native Oracle contract.
|
||||||
func (c *Client) GetOraclePrice() (int64, error) {
|
func (c *Client) GetOraclePrice() (int64, error) {
|
||||||
oracleHash, err := c.GetNativeContractHash(nativenames.Notary)
|
oracleHash, err := c.GetNativeContractHash(nativenames.Oracle)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, fmt.Errorf("failed to get native Oracle hash: %w", err)
|
return 0, fmt.Errorf("failed to get native Oracle hash: %w", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -998,3 +998,18 @@ func TestClient_GetNotaryServiceFeePerKey(t *testing.T) {
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, defaultNotaryServiceFeePerKey, actual)
|
require.Equal(t, defaultNotaryServiceFeePerKey, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestClient_GetOraclePrice(t *testing.T) {
|
||||||
|
chain, rpcSrv, httpSrv := initServerWithInMemoryChain(t)
|
||||||
|
defer chain.Close()
|
||||||
|
defer func() { _ = rpcSrv.Shutdown() }()
|
||||||
|
|
||||||
|
c, err := client.New(context.Background(), httpSrv.URL, client.Options{})
|
||||||
|
require.NoError(t, err)
|
||||||
|
require.NoError(t, c.Init())
|
||||||
|
|
||||||
|
var defaultOracleRequestPrice int64 = 5000_0000
|
||||||
|
actual, err := c.GetOraclePrice()
|
||||||
|
require.NoError(t, err)
|
||||||
|
require.Equal(t, defaultOracleRequestPrice, actual)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue