Skip to content

Commit 428d1ff

Browse files
committed
[doc] English documentation
1 parent 0023588 commit 428d1ff

File tree

2 files changed

+68
-2
lines changed

2 files changed

+68
-2
lines changed

README.md

Lines changed: 59 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,63 @@
55
[![codecov](https://codecov.io/gh/nanmu42/etherscan-api/branch/master/graph/badge.svg)](https://codecov.io/gh/nanmu42/etherscan-api)
66
[![GoDoc](https://godoc.org/github.com/nanmu42/etherscan-api?status.svg)](https://godoc.org/github.com/nanmu42/etherscan-api)
77

8-
Go bindings to the Etherscan.io API
8+
Go bindings to the Etherscan.io API, with nearly Full implementation(accounts, transactions, tokens, contracts, blocks, stats), full network support(Mainnet, Ropsten, Kovan, Rinkby, Tobalaba), and only depending on standard library. :wink:
99

10-
Under development now. :)
10+
![etherscan-api-go](https://user-images.githubusercontent.com/8143068/43701511-04762080-9989-11e8-8731-8504924da4e1.png)
11+
12+
# Usage
13+
14+
Create a API instance and off you go. :rocket:
15+
16+
```go
17+
import (
18+
"github.com/nanmu42/etherscan-api"
19+
"fmt"
20+
)
21+
22+
func main() {
23+
// create a API client for specified ethereum net
24+
// there are many pre-defined network in package
25+
client := etherscan.New(etherscan.Mainnet, "[your API key]")
26+
27+
// (optional) add hooks, e.g. for rate limit
28+
client.BeforeRequest = func(module, action string, param map[string]interface{}) error {
29+
// ...
30+
}
31+
client.AfterRequest = func(module, action string, param map[string]interface{}, outcome interface{}, requestErr error) {
32+
// ...
33+
}
34+
35+
// check account balance
36+
balance, err := client.AccountBalance("0x281055afc982d96fab65b3a49cac8b878184cb16")
37+
if err != nil {
38+
panic(err)
39+
}
40+
// balance in wei, in *big.Int type
41+
fmt.Println(balance.Int())
42+
43+
// check token balance
44+
tokenBalance, err := client.TokenBalance("contractAddress", "holderAddress")
45+
46+
// check ERC20 transactions from/to a specified address
47+
transfers, err := client.ERC20Transfers("contractAddress", "address", startBlock, endBlock, page, offset)
48+
}
49+
```
50+
51+
You may find full method list at [GoDoc](https://godoc.org/github.com/nanmu42/etherscan-api).
52+
53+
# Etherscan API Key
54+
55+
You may apply for an API key on [etherscan](https://etherscan.io/apis).
56+
57+
> The Etherscan Ethereum Developer APIs are provided as a community service and without warranty, so please just use what you need and no more. They support both GET/POST requests and a rate limit of 5 requests/sec (exceed and you will be blocked).
58+
59+
# Paperwork Things
60+
61+
I am not from Etherscan and I just find their service really useful, so I implement this. :smile:
62+
63+
# License
64+
65+
Use of this work is governed by a MIT License.
66+
67+
You may find a license copy in project root.

doc.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Package etherscan provides Go bindings to the Etherscan.io API.
2+
//
3+
// The implementation is with nearly Full implementation
4+
// (accounts, transactions, tokens, contracts, blocks, stats),
5+
// full network support(Mainnet, Ropsten, Kovan, Rinkby, Tobalaba),
6+
// and only depending on standard library.
7+
//
8+
// Example can be found at https://github.com/nanmu42/etherscan-api
9+
package etherscan

0 commit comments

Comments
 (0)