2020-01-14 12:02:38 +00:00
|
|
|
package response
|
2018-03-05 08:53:09 +00:00
|
|
|
|
2019-02-19 11:47:25 +00:00
|
|
|
import (
|
2020-01-14 12:02:38 +00:00
|
|
|
"encoding/json"
|
|
|
|
|
|
|
|
"github.com/CityOfZion/neo-go/pkg/rpc/request"
|
2020-01-13 15:20:30 +00:00
|
|
|
"github.com/CityOfZion/neo-go/pkg/rpc/response/result"
|
2019-02-19 11:47:25 +00:00
|
|
|
"github.com/CityOfZion/neo-go/pkg/vm"
|
|
|
|
)
|
2019-01-22 12:14:40 +00:00
|
|
|
|
2018-03-05 08:53:09 +00:00
|
|
|
// InvokeResult represents the outcome of a script that is
|
|
|
|
// executed by the NEO VM.
|
|
|
|
type InvokeResult struct {
|
2019-02-19 11:47:25 +00:00
|
|
|
State vm.State `json:"state"`
|
|
|
|
GasConsumed string `json:"gas_consumed"`
|
|
|
|
Script string `json:"script"`
|
2020-01-14 12:02:38 +00:00
|
|
|
Stack []request.StackParam
|
2018-03-05 08:53:09 +00:00
|
|
|
}
|
|
|
|
|
2020-01-14 12:02:38 +00:00
|
|
|
// Header is a generic JSON-RPC 2.0 response header (ID and JSON-RPC version).
|
|
|
|
type Header struct {
|
|
|
|
ID json.RawMessage `json:"id"`
|
|
|
|
JSONRPC string `json:"jsonrpc"`
|
2018-03-05 08:53:09 +00:00
|
|
|
}
|
|
|
|
|
2020-01-14 12:02:38 +00:00
|
|
|
// HeaderAndError adds an Error (that can be empty) to the Header, it's used
|
|
|
|
// to construct type-specific responses.
|
|
|
|
type HeaderAndError struct {
|
|
|
|
Header
|
|
|
|
Error *Error `json:"error,omitempty"`
|
2018-03-05 08:53:09 +00:00
|
|
|
}
|
|
|
|
|
2020-01-14 12:02:38 +00:00
|
|
|
// Raw represents a standard raw JSON-RPC 2.0
|
|
|
|
// response: http://www.jsonrpc.org/specification#response_object.
|
|
|
|
type Raw struct {
|
|
|
|
HeaderAndError
|
2020-02-20 18:08:22 +00:00
|
|
|
Result json.RawMessage `json:"result,omitempty"`
|
2018-03-05 08:53:09 +00:00
|
|
|
}
|
2019-01-22 12:14:40 +00:00
|
|
|
|
2020-01-14 12:02:38 +00:00
|
|
|
// GetTxOut represents result of `gettxout` RPC call.
|
|
|
|
type GetTxOut struct {
|
|
|
|
HeaderAndError
|
|
|
|
Result *result.TransactionOutput
|
2019-01-22 12:14:40 +00:00
|
|
|
}
|
|
|
|
|
2020-01-14 12:02:38 +00:00
|
|
|
// GetRawTx represents verbose output of `getrawtransaction` RPC call.
|
|
|
|
type GetRawTx struct {
|
|
|
|
HeaderAndError
|
2020-02-20 16:29:21 +00:00
|
|
|
Result *result.TransactionOutputRaw `json:"result"`
|
2020-02-06 12:02:03 +00:00
|
|
|
}
|