client: add NNS price getter

This commit is contained in:
Roman Khimov 2021-03-16 22:59:04 +03:00
parent f308a9995d
commit 87d4939093
2 changed files with 21 additions and 0 deletions

View file

@ -16,3 +16,12 @@ func (c *Client) GetOraclePrice() (int64, error) {
}
return c.invokeNativeGetMethod(oracleHash, "getPrice")
}
// GetNNSPrice invokes `getPrice` method on a native NameService contract.
func (c *Client) GetNNSPrice() (int64, error) {
nnsHash, err := c.GetNativeContractHash(nativenames.NameService)
if err != nil {
return 0, fmt.Errorf("failed to get native NameService hash: %w", err)
}
return c.invokeNativeGetMethod(nnsHash, "getPrice")
}