etherscanAPI

package module
v0.0.0-...-1af6323 Latest Latest
Warning

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

Go to latest
Published: May 22, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

README

EtherscanAPI

Only just started but checked in because I am sharing code that needs it.

Raw cut checked in before coffee.

Documentation coming sometime.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EtherStrToWei

func EtherStrToWei(value string) (vInEther *big.Int, ok bool)

EtherStrToWei converts 1.0 to 1000000000000000000000

0.1 to  100000000000000000000

func GetABI

func GetABI(address string, chain string) (abi string, err error)

GetABI returns the public ABI

func GetOptimisation

func GetOptimisation(address string, chain string) (optimisation bool, err error)

GetOptimisation - find out if the code was optimised

func GetSWARM

func GetSWARM(address string, chain string) (swarm string, err error)

GetSWARM returns the swarm address

func GetSourceCode

func GetSourceCode(address string, chain string) (code string, err error)

GetSourceCode returns the code section

func GetVersion

func GetVersion(address string, chain string) (version string, err error)

GetVersion - return the version

Types

type API

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

API - the Etherscan API toolkit

func NewEtherscanAPI

func NewEtherscanAPI(key string) (newAPI *API)

NewEtherscanAPI - create an api object with the correct key

func (*API) AccountTransactions

func (a *API) AccountTransactions(action string, by string, val string, start string, end string, sort string) (tr TxListRec)

Really need to improve the way we call this.

func (*API) EstimateGas

func (a *API) EstimateGas(to string, value string) (res IntRec)

EstimateGas - run Tx locally and return amount of gas required

func (*API) EthCall

func (a *API) EthCall(to string, data string) (res StringRec)

func (*API) GasPrice

func (a *API) GasPrice() (res IntRec)

GasPrice - get optimal gas price

func (*API) GetCode

func (a *API) GetCode(address string) (res StringRec)

GetCode - get code at a particular address

func (*API) GetLogs

func (a *API) GetLogs(fromBlock string, toBlock string, address string, topics []string, operands []string) (ev EventRec)

GetLogs - scour event logs from start to stop

func (*API) InternalTransactionsByAddress

func (a *API) InternalTransactionsByAddress(addr string) (tr TxListRec)

func (*API) TransactionsByAddress

func (a *API) TransactionsByAddress(addr string) (tr TxListRec)

TransactionsByAddress : Get a list of 'Normal' Transactions By Address [Optional Parameters] startblock: starting blockNo to retrieve results, endblock: ending blockNo to retrieve results ([BETA] Returned 'isError' values: 0=No Error, 1=Got Error) (Returns up to a maximum of the last 10000 transactions only) http://api.etherscan.io/api?module=account&action=txlist&address=0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae&startblock=0&endblock=99999999&sort=asc&apikey=YourApiKeyToken (To get paginated results use page=<page number> and offset=<max records to return>) https://api.etherscan.io/api?module=account&action=txlist&address=0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae&startblock=0&endblock=99999999&page=1&offset=10&sort=asc&apikey=YourApiKeyToken

func (*API) TransactionsByAddressFromTo

func (a *API) TransactionsByAddressFromTo(addr string, from string, to string) (tr TxListRec)

TransactionsByAddressFromTo - return transactions in specified address range. empty string to use default

type EvListItem

type EvListItem struct {
	Address          string
	Topics           []string
	Data             string
	BlockNumber      string
	TimeStamp        string
	GasPrice         string
	GasUsed          string
	LogIndex         string
	TransactionHash  string
	TransactionIndex string
}

EvListItem - returned by an EventList

type EventRec

type EventRec struct {
	Status  string
	Message string
	Result  []EvListItem
}

EventRec -

type IntRec

type IntRec struct {
	Status  string
	Message string
	Result  *big.Int
}

IntRec - integer or nothing

type StringRec

type StringRec struct {
	Status  string
	Message string
	Result  string
}

StringRec - integer or nothing

type TxListItem

type TxListItem struct {
	BlockNumber       string `json:"blockNumber"`
	TimeStamp         string `json:"timeStamp"`
	Hash              string `json:"hash"`
	From              string `json:"from"`
	To                string `json:"to"`
	Value             string `json:"value"`
	Gas               string `json:"gas"`
	IsError           string `json:"isError"`
	GasUsed           string `json:"gasUsed"`
	CumulativeGasUsed string `json:"cumulativeGasUsed"`
	ContractAddress   string `json:"contractAddress"`
	Input             string `json:"input"`
}

type TxListRec

type TxListRec struct {
	Status  string
	Message string
	Result  []TxListItem
}

TxListRec - result from Transaction Calls

Status  - OK / NOTOK
Message - error if Status NOTOK
Result  - TxListItem

Jump to

Keyboard shortcuts

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