solana

package
v0.2.13 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2020 License: GPL-3.0 Imports: 12 Imported by: 2

Documentation

Index

Constants

View Source
const DefaultClientRPCURL = "http://localhost:8899"

Variables

This section is empty.

Functions

func SendRawPost

func SendRawPost(data []byte, url string) (*http.Response, error)

SendRawPost sends a raw bytes as a POST request to the URL specified

func SendRequest

func SendRequest(request Request, url string) (*http.Response, error)

SendRequest sends the JSON-2.0 request to the target url and returns the response and any error.

func SendRequestWithRetry

func SendRequestWithRetry(request Request, url string, timeoutInSecs int, retries int) (response *http.Response, err error)

SendRequestWithRetry calls SendRequest but with configurable retry logic

Types

type AccountContext

type AccountContext struct {
	Slot int `json:"slot"`
}

type AccountValue

type AccountValue struct {
	Data       string `json:"data"`
	Executable bool   `json:"executable"`
	Lamports   int    `json:"lamports"`
	Owner      string `json:"owner"`
	RentEpoch  int    `json:"rentEpoch"`
}

type AddressDecoder

type AddressDecoder struct{}

func NewAddressDecoder

func NewAddressDecoder() AddressDecoder

func (AddressDecoder) DecodeAddress

func (AddressDecoder) DecodeAddress(encoded pack.String) (pack.Bytes, error)

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(opts ClientOptions) *Client

func (*Client) CallContract

func (client *Client) CallContract(ctx context.Context, contract address.Address, input pack.Bytes) (output pack.Bytes, err error)

type ClientOptions

type ClientOptions struct {
	Logger *zap.Logger
	RPCURL string
}

func DefaultClientOptions

func DefaultClientOptions() ClientOptions

type Error

type Error struct {
	Code    int              `json:"code"`
	Message string           `json:"message"`
	Data    *json.RawMessage `json:"data"`
}

Error defines a JSON-RPC 2.0 error object. See https://www.jsonrpc.org/specification for more information.

type Request

type Request struct {
	Version string          `json:"jsonrpc"`
	ID      interface{}     `json:"id"`
	Method  string          `json:"method"`
	Params  json.RawMessage `json:"params,omitempty"`
}

Request defines a JSON-RPC 2.0 request object. See https://www.jsonrpc.org/specification for more information. A Request should not be explicitly created, but instead unmarshaled from JSON.

type Response

type Response struct {
	Version string           `json:"jsonrpc"`
	ID      interface{}      `json:"id"`
	Result  *json.RawMessage `json:"result,omitempty"`
	Error   *Error           `json:"error,omitempty"`
}

Response defines a JSON-RPC 2.0 response object. See https://www.jsonrpc.org/specification for more information. A Response is usually marshaled into bytes and returned in response to a Request.

func SendData

func SendData(method string, data []byte, url string) (Response, error)

SendData sends data to method via jsonrpc

func SendDataWithRetry

func SendDataWithRetry(method string, data []byte, url string) (Response, error)

SendDataWithRetry is the same as SendData but will retry if sending the request failed

type ResponseGetAccountInfo

type ResponseGetAccountInfo struct {
	Context AccountContext `json:"context"`
	Value   AccountValue   `json:"value"`
}

Jump to

Keyboard shortcuts

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