client: add GetOraclePrice for oracle price
This commit is contained in:
parent
42674e46ac
commit
f308a9995d
2 changed files with 30 additions and 0 deletions
18
pkg/rpc/client/native.go
Normal file
18
pkg/rpc/client/native.go
Normal file
|
@ -0,0 +1,18 @@
|
|||
package client
|
||||
|
||||
// Various non-policy things from native contracs.
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/native/nativenames"
|
||||
)
|
||||
|
||||
// GetOraclePrice invokes `getPrice` method on a native Oracle contract.
|
||||
func (c *Client) GetOraclePrice() (int64, error) {
|
||||
oracleHash, err := c.GetNativeContractHash(nativenames.Notary)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("failed to get native Oracle hash: %w", err)
|
||||
}
|
||||
return c.invokeNativeGetMethod(oracleHash, "getPrice")
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue