diff --git a/pkg/rpc/client/rpc.go b/pkg/rpc/client/rpc.go index e51078fbf..bb0655f9d 100644 --- a/pkg/rpc/client/rpc.go +++ b/pkg/rpc/client/rpc.go @@ -34,12 +34,12 @@ var errNetworkNotInitialized = errors.New("RPC client network is not initialized func (c *Client) CalculateNetworkFee(tx *transaction.Transaction) (int64, error) { var ( params = request.NewRawParams(tx.Bytes()) - resp int64 + resp = new(result.NetworkFee) ) - if err := c.performRequest("calculatenetworkfee", params, &resp); err != nil { + if err := c.performRequest("calculatenetworkfee", params, resp); err != nil { return 0, err } - return resp, nil + return resp.Value, nil } // GetApplicationLog returns the contract log based on the specified txid. diff --git a/pkg/rpc/response/result/netfee.go b/pkg/rpc/response/result/netfee.go new file mode 100644 index 000000000..c3606f735 --- /dev/null +++ b/pkg/rpc/response/result/netfee.go @@ -0,0 +1,6 @@ +package result + +// NetworkFee represents a result of calculatenetworkfee RPC call. +type NetworkFee struct { + Value int64 `json:"networkfee,string"` +} diff --git a/pkg/rpc/server/server.go b/pkg/rpc/server/server.go index 3a62b3e6d..206621a1f 100644 --- a/pkg/rpc/server/server.go +++ b/pkg/rpc/server/server.go @@ -630,7 +630,7 @@ func (s *Server) calculateNetworkFee(reqParams request.Params) (interface{}, *re } fee := s.chain.GetPolicer().FeePerByte() netFee += int64(size) * fee - return netFee, nil + return result.NetworkFee{Value: netFee}, nil } // getApplicationLog returns the contract log based on the specified txid or blockid.