query

package
v6.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2026 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package query provides access to the RPC server

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Query

func Query[T any](chain string, method string, params Params) (*T, error)

Query returns a single result for given method and params.

func QueryBatch

func QueryBatch[T any](chain string, batchPayload []BatchPayload) (map[string]*T, error)

QueryBatch batches requests to the node. Returned values are stored in map, with the same keys as defined in `batchPayload` (this way we don't have to operate on array indices)

func QueryBatchWithHeaders

func QueryBatchWithHeaders[T any](chain string, headers map[string]string, batchPayload []BatchPayload) (map[string]*T, error)

func QueryUrl

func QueryUrl[T any](url string, method string, params Params) (*T, error)

QueryUrl is just like Query, but it does not resolve chain to RPC provider URL

func QueryWithHeaders

func QueryWithHeaders[T any](url string, headers map[string]string, method string, params Params) (*T, error)

QueryWithHeaders returns a single result for a given method and params.

Types

type BatchPayload

type BatchPayload struct {
	Key string
	*Payload
}

BatchPayload is a wrapper around Payload type that allows us to associate a name (Key) to given request.

type Params

type Params []interface{}

Params are used during calls to the RPC.

type Payload

type Payload struct {
	Headers map[string]string `json:"headers,omitempty"`
	Method  string            `json:"method"`
	Params  `json:"params"`
}

Payload is used to make calls to the RPC.

Jump to

Keyboard shortcuts

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