getblock

package module
v0.0.0-...-b706568 Latest Latest
Warning

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

Go to latest
Published: May 3, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

README

JSON-RPC client for getblock.io.

Install

go get github.com/ofen/getblock-go

Example

package main

import (
    "context"
    "fmt"

    "github.com/ofen/getblock-go/eth"
)

func main() {
    ctx := context.Background()

    client := eth.New("your-api-token")
    head, err := client.BlockNumber(ctx)
    if err != nil {
        panic(err)
    }

    fmt.Println(head)
}

Documentation

https://getblock.io/docs/

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Client jsonrpc.RPCClient
}

Client is common JSON-RPC client.

func New

func New(token string, endpoint string) *Client

New creates Client.

func (*Client) Call

func (c *Client) Call(ctx context.Context, method string, params ...interface{}) (*jsonrpc.RPCResponse, error)

Call sends request to JSON-RPC endpoint. Repeats request on 5xx error up to 5 times.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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