Documentation ¶
Index ¶
- Constants
- func CreateFunctionInvocationScript(contract util.Uint160, method string, params Params) ([]byte, error)
- func ExpandArrayIntoScript(script *io.BinWriter, slice []Param) error
- type Batch
- type BlockFilter
- type ExecutionFilter
- type FuncParam
- type In
- type NotificationFilter
- type Param
- func (p *Param) GetArray() ([]Param, error)
- func (p *Param) GetBoolean() bool
- func (p *Param) GetBytesBase64() ([]byte, error)
- func (p *Param) GetBytesHex() ([]byte, error)
- func (p *Param) GetFuncParam() (FuncParam, error)
- func (p *Param) GetInt() (int, error)
- func (p Param) GetSignerWithWitness() (SignerWithWitness, error)
- func (p Param) GetSignersWithWitnesses() ([]transaction.Signer, []transaction.Witness, error)
- func (p *Param) GetString() (string, error)
- func (p *Param) GetUint160FromAddress() (util.Uint160, error)
- func (p *Param) GetUint160FromAddressOrHex() (util.Uint160, error)
- func (p *Param) GetUint160FromHex() (util.Uint160, error)
- func (p *Param) GetUint256() (util.Uint256, error)
- func (p Param) String() string
- func (p *Param) UnmarshalJSON(data []byte) error
- type Params
- type Raw
- type RawParams
- type Request
- type SignerWithWitness
- type TxFilter
Constants ¶
const ( StringT paramType NumberT BooleanT ArrayT FuncParamT BlockFilterT TxFilterT NotificationFilterT ExecutionFilterT SignerWithWitnessT )
These are parameter types accepted by RPC server.
const (
// JSONRPCVersion is the only JSON-RPC protocol version supported.
JSONRPCVersion = "2.0"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Batch ¶ added in v0.78.2
type Batch []In
Batch represents a standard JSON-RPC 2.0 batch: https://www.jsonrpc.org/specification#batch.
type BlockFilter ¶ added in v0.90.0
type BlockFilter struct {
Primary int `json:"primary"`
}
BlockFilter is a wrapper structure for block event filter. The only allowed filter is primary index.
type ExecutionFilter ¶ added in v0.75.0
type ExecutionFilter struct {
State string `json:"state"`
}
ExecutionFilter is a wrapper structure used for transaction execution events. It allows to choose failing or successful transactions based on their VM state.
type FuncParam ¶
type FuncParam struct { Type smartcontract.ParamType `json:"type"` Value Param `json:"value"` }
FuncParam represents a function argument parameter used in the invokefunction RPC method.
type In ¶
type In struct { JSONRPC string `json:"jsonrpc"` Method string `json:"method"` RawParams json.RawMessage `json:"params,omitempty"` RawID json.RawMessage `json:"id,omitempty"` }
In represents a standard JSON-RPC 2.0 request: http://www.jsonrpc.org/specification#request_object.
type NotificationFilter ¶ added in v0.75.0
type NotificationFilter struct { Contract *util.Uint160 `json:"contract,omitempty"` Name *string `json:"name,omitempty"` }
NotificationFilter is a wrapper structure representing filter used for notifications generated during transaction execution. Notifications can be filtered by contract hash and by name.
type Param ¶
type Param struct { Type paramType Value interface{} }
Param represents a param either passed to the server or to send to a server using the client.
func (*Param) GetBoolean ¶ added in v0.76.0
GetBoolean returns boolean value of the parameter.
func (*Param) GetBytesBase64 ¶ added in v0.90.0
GetBytesBase64 returns []byte value of the parameter if it is a base64-encoded string.
func (*Param) GetBytesHex ¶
GetBytesHex returns []byte value of the parameter if it is a hex-encoded string.
func (*Param) GetFuncParam ¶
GetFuncParam returns current parameter as a function call parameter.
func (Param) GetSignerWithWitness ¶ added in v0.92.0
func (p Param) GetSignerWithWitness() (SignerWithWitness, error)
GetSignerWithWitness returns SignerWithWitness value of the parameter.
func (Param) GetSignersWithWitnesses ¶ added in v0.92.0
func (p Param) GetSignersWithWitnesses() ([]transaction.Signer, []transaction.Witness, error)
GetSignersWithWitnesses returns a slice of SignerWithWitness with CalledByEntry scope from array of Uint160 or array of serialized transaction.Signer stored in the parameter.
func (*Param) GetUint160FromAddress ¶
GetUint160FromAddress returns Uint160 value of the parameter that was supplied as an address.
func (*Param) GetUint160FromAddressOrHex ¶ added in v0.76.1
GetUint160FromAddressOrHex returns Uint160 value of the parameter that was supplied either as raw hex or as an address.
func (*Param) GetUint160FromHex ¶
GetUint160FromHex returns Uint160 value of the parameter encoded in hex.
func (*Param) GetUint256 ¶
GetUint256 returns Uint256 value of the parameter.
func (*Param) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler interface.
type Params ¶
type Params []Param
Params represents the JSON-RPC params.
func (Params) ValueWithType ¶
ValueWithType returns the param struct at the given index if it exists and matches the given type.
type Raw ¶
type Raw struct { JSONRPC string `json:"jsonrpc"` Method string `json:"method"` RawParams []interface{} `json:"params"` ID int `json:"id"` }
Raw represents JSON-RPC request.
type RawParams ¶
type RawParams struct {
Values []interface{}
}
RawParams is just a slice of abstract values, used to represent parameters passed from client to server.
func NewRawParams ¶
func NewRawParams(vals ...interface{}) RawParams
NewRawParams creates RawParams from its parameters.
type Request ¶ added in v0.78.2
Request contains standard JSON-RPC 2.0 request and batch of requests: http://www.jsonrpc.org/specification. It's used in server to represent incoming queries.
func NewRequest ¶ added in v0.78.2
func NewRequest() *Request
NewRequest creates a new Request struct.
func (*Request) DecodeData ¶ added in v0.78.2
func (r *Request) DecodeData(data io.ReadCloser) error
DecodeData decodes the given reader into the the request struct.
func (Request) MarshalJSON ¶ added in v0.78.2
MarshalJSON implements json.Marshaler interface.
func (*Request) UnmarshalJSON ¶ added in v0.78.2
UnmarshalJSON implements json.Unmarshaler interface.
type SignerWithWitness ¶ added in v0.92.0
type SignerWithWitness struct { transaction.Signer transaction.Witness }
SignerWithWitness represents transaction's signer with the corresponding witness.
func (*SignerWithWitness) MarshalJSON ¶ added in v0.92.0
func (s *SignerWithWitness) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Unmarshaler interface.