request

package
v0.98.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 13, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// JSONRPCVersion is the only JSON-RPC protocol version supported.
	JSONRPCVersion = "2.0"
)

Variables

This section is empty.

Functions

func CreateFunctionInvocationScript

func CreateFunctionInvocationScript(contract util.Uint160, method string, param *Param) ([]byte, error)

CreateFunctionInvocationScript creates a script to invoke given contract with given parameters.

func ExpandArrayIntoScript added in v0.94.0

func ExpandArrayIntoScript(script *io.BinWriter, slice []Param) error

ExpandArrayIntoScript pushes all FuncParam parameters from the given array into the given buffer in reverse order.

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 []Param         `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.

func NewIn

func NewIn() *In

NewIn creates a new In struct.

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 {
	json.RawMessage
	// contains filtered or unexported fields
}

Param represents a param either passed to the server or to send to a server using the client.

func (*Param) GetArray

func (p *Param) GetArray() ([]Param, error)

GetArray returns a slice of Params stored in the parameter.

func (*Param) GetBigInt added in v0.98.2

func (p *Param) GetBigInt() (*big.Int, error)

GetBigInt returns big-interer value of the parameter.

func (*Param) GetBoolean added in v0.76.0

func (p *Param) GetBoolean() (bool, error)

GetBoolean returns boolean value of the parameter or tries to cast parameter to a bool value.

func (*Param) GetBooleanStrict added in v0.98.0

func (p *Param) GetBooleanStrict() (bool, error)

GetBooleanStrict returns boolean value of the parameter.

func (*Param) GetBytesBase64 added in v0.90.0

func (p *Param) GetBytesBase64() ([]byte, error)

GetBytesBase64 returns []byte value of the parameter if it is a base64-encoded string.

func (*Param) GetBytesHex

func (p *Param) GetBytesHex() ([]byte, error)

GetBytesHex returns []byte value of the parameter if it is a hex-encoded string.

func (*Param) GetFuncParam

func (p *Param) GetFuncParam() (FuncParam, error)

GetFuncParam returns current parameter as a function call parameter.

func (*Param) GetInt

func (p *Param) GetInt() (int, error)

GetInt returns int value of the parameter or tries to cast parameter to an int value.

func (*Param) GetIntStrict added in v0.98.0

func (p *Param) GetIntStrict() (int, error)

GetIntStrict returns int value of the parameter if the parameter is integer.

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) GetString

func (p *Param) GetString() (string, error)

GetString returns string value of the parameter or tries to cast parameter to a string value.

func (*Param) GetStringStrict added in v0.98.0

func (p *Param) GetStringStrict() (string, error)

GetStringStrict returns string value of the parameter.

func (*Param) GetUint160FromAddress

func (p *Param) GetUint160FromAddress() (util.Uint160, error)

GetUint160FromAddress returns Uint160 value of the parameter that was supplied as an address.

func (*Param) GetUint160FromAddressOrHex added in v0.76.1

func (p *Param) GetUint160FromAddressOrHex() (util.Uint160, error)

GetUint160FromAddressOrHex returns Uint160 value of the parameter that was supplied either as raw hex or as an address.

func (*Param) GetUint160FromHex

func (p *Param) GetUint160FromHex() (util.Uint160, error)

GetUint160FromHex returns Uint160 value of the parameter encoded in hex.

func (*Param) GetUint256

func (p *Param) GetUint256() (util.Uint256, error)

GetUint256 returns Uint256 value of the parameter.

func (*Param) IsNull added in v0.98.0

func (p *Param) IsNull() bool

IsNull returns whether parameter represents JSON nil value.

func (Param) String

func (p Param) String() string

type Params

type Params []Param

Params represents the JSON-RPC params.

func (Params) String added in v0.92.0

func (p Params) String() string

func (Params) Value

func (p Params) Value(index int) *Param

Value returns the param struct for the given index if it exists.

type Raw

type Raw struct {
	JSONRPC   string        `json:"jsonrpc"`
	Method    string        `json:"method"`
	RawParams []interface{} `json:"params"`
	ID        uint64        `json:"id"`
}

Raw represents JSON-RPC request on the Client side.

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

type Request struct {
	In    *In
	Batch Batch
}

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

func (r Request) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (*Request) UnmarshalJSON added in v0.78.2

func (r *Request) UnmarshalJSON(data []byte) error

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.Marshaler interface.

type TxFilter added in v0.75.0

type TxFilter struct {
	Sender *util.Uint160 `json:"sender,omitempty"`
	Signer *util.Uint160 `json:"signer,omitempty"`
}

TxFilter is a wrapper structure for transaction event filter. It allows to filter transactions by senders and signers.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL