etherscan

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

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

Go to latest
Published: Feb 20, 2019 License: MIT Imports: 5 Imported by: 0

README

etherscan-go

etherscan.io API client in Go

// main.go

package main

import (
	"fmt"
	"log"

	"github.com/gravityblast/etherscan"
)

func checkErr(err error) {
	if err != nil {
		log.Fatal(err)
	}
}

func main() {
	c, err := etherscan.NewClient(etherscan.Mainnet, "YOUR_API_KEY")
	checkErr(err)

	resp, err := c.Account("0x0000000000000000000000000000000000000000")
	checkErr(err)

	fmt.Printf("%+v\n", resp)
}
go run main.go
&{Status:1 Message:OK Result:+7641879211751631214533}

Documentation

Index

Constants

View Source
const (
	Mainnet = 1
	Rinkeby = 3
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountResponse

type AccountResponse struct {
	Status  string  `json:"status"`
	Message string  `json:"message"`
	Result  *BigInt `json:"result"`
}

type BigInt

type BigInt struct {
	big.Int
}

func (*BigInt) UnmarshalJSON

func (bigint *BigInt) UnmarshalJSON(b []byte) error

type Client

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

func NewClient

func NewClient(networkID NetworkID, apiKey string) (*Client, error)

func (*Client) Account

func (c *Client) Account(address string) (*AccountResponse, error)

type NetworkID

type NetworkID = int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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