Documentation ¶
Index ¶
Constants ¶
const ( DestinationUtxo = "UTXO" DestinationAccount = "Account" BlackHoleAddr = "0000-0000-0000-0000-0000" )
const JsonRPCVersion = "2.0"
const (
NamespaceSeparator = "."
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BatchRequest ¶
type BatchRequestParams ¶
type BatchRequestParams struct { RequestParams Result any //response type }
type BlockIdOrHash ¶
BlockIdOrHash block id or block hash must be only choose one
type FileType ¶
type FileType struct { Name string `json:"name"` //file name Type string `json:"type"` //data type if exist Value string `json:"value"` //if file name is null, save result to value }
func NewFileType ¶
type ID ¶
type ID struct { // At most one of Num or Str may be nonzero. If both are zero // valued, then IsNum specifies which field's value is to be used // as the ID. Num uint64 Str string // IsString controls whether the Num or Str field's value should be // used as the ID, when both are zero valued. It must always be // set to true if the request ID is a string. IsString bool }
ID represents a JSON-RPC 2.0 request ID, which may be either a string or number (or null, which is unsupported).
func (ID) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (*ID) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type ListForm ¶
type ListForm struct { Name string `json:"name"` //table name PaginatorForm RowForm }
type PaginatorForm ¶
type Param ¶
type Param json.RawMessage
Params is an ARRAY of json.RawMessages. This is because *Ethereum* RPCs always use arrays is their input parameter; this differs from the official JSONRPC spec, which allows parameters of any type. But, this assumption makes handling Params in our Ethereum API use-cases *so* much easier.
func (Param) MarshalJSON ¶
MarshalJSON returns m as the JSON encoding of m.
func (*Param) UnmarshalJSON ¶
UnmarshalJSON sets *m to a copy of data.
type Params ¶
type Params []Param
func MakeParams ¶
MakeParams generates JSONRPC parameters from its inputs, and should be used for complex dynamic data which may fail to marshal, in which case the error is propagated to the caller.
Examples:
params, err := jsonrpc.MakeParams(someComplexObject, "string", true)
func MustParams ¶
MakeParams can be used to generate JSONRPC Params field from well-known data, which should not fail.
Examples:
request.Params = jsonrpc.MustParams("latest", true)
func (Params) UnmarshalInto ¶
UnmarshalInto will decode Params into the passed in values, which must be pointer receivers. The type of the passed in value is used to Unmarshal the data. UnmarshalInto will fail if the parameters cannot be converted to the passed-in types.
Example:
var blockNum string var fullBlock bool err := request.Params.UnmarshalInto(&blockNum, &fullBlock)
IMPORTANT: While Go will compile with non-pointer receivers, the Unmarshal attempt will *always* fail with an error.
func (Params) UnmarshalSingleParam ¶
UnmarshalSingleParam can be used in the (rare) case where only one of the Request.Params is needed. For example we use this in Smart Routing to extract the blockNum value from RPCs without decoding the entire Params array.
Example:
err := request.Params.UnmarshalSingleParam(pos, &blockNum)
type Request ¶
type Request struct { JSONRPC string `json:"jsonrpc"` Method string `json:"method"` ID ID `json:"id"` Params Params `json:"params"` }
func (Request) MarshalJSON ¶
func (*Request) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type RequestParams ¶
type WordsLenType ¶
type WordsLenType int
const ( WordsLenTwelve WordsLenType = 12 WordsLenFifteen WordsLenType = 15 WordsLenEighteen WordsLenType = 18 WordsTwentyOne WordsLenType = 21 WordsLenTwentyTwo WordsLenType = 24 )
func (*WordsLenType) GetBitSize ¶
func (w *WordsLenType) GetBitSize() int