client: add GetStoragePrice for native policy contract

This commit is contained in:
Roman Khimov 2021-03-16 22:50:14 +03:00
parent 025330f132
commit 42674e46ac
2 changed files with 20 additions and 0 deletions

View file

@ -25,6 +25,14 @@ func (c *Client) GetExecFeeFactor() (int64, error) {
return c.invokeNativePolicyMethod("getExecFeeFactor")
}
// GetStoragePrice invokes `getStoragePrice` method on a native Policy contract.
func (c *Client) GetStoragePrice() (int64, error) {
if !c.initDone {
return 0, errNetworkNotInitialized
}
return c.invokeNativePolicyMethod("getStoragePrice")
}
// GetMaxNotValidBeforeDelta invokes `getMaxNotValidBeforeDelta` method on a native Notary contract.
func (c *Client) GetMaxNotValidBeforeDelta() (int64, error) {
notaryHash, err := c.GetNativeContractHash(nativenames.Notary)

View file

@ -428,6 +428,18 @@ var rpcClientTestCases = map[string][]rpcClientTestCase{
},
},
},
"getStoragePrice": {
{
name: "positive",
invoke: func(c *Client) (interface{}, error) {
return c.GetStoragePrice()
},
serverResponse: `{"id":1,"jsonrpc":"2.0","result":{"state":"HALT","gasconsumed":"2007390","script":"EMAMDWdldEZlZVBlckJ5dGUMFJphpG7sl7iTBtfOgfFbRiCR0AkyQWJ9W1I=","stack":[{"type":"Integer","value":"100000"}],"tx":null}}`,
result: func(c *Client) interface{} {
return int64(100000)
},
},
},
"getMaxNotValidBeforeDelta": {
{
name: "positive",