Skip to content

Commit d2e3c5d

Browse files
committed
add README example
1 parent 794ef38 commit d2e3c5d

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,36 @@
11
# etherscan-go
22
etherscan.io API client in Go
3+
4+
```go
5+
// main.go
6+
7+
package main
8+
9+
import (
10+
"fmt"
11+
"log"
12+
13+
"github.com/gravityblast/etherscan"
14+
)
15+
16+
func checkErr(err error) {
17+
if err != nil {
18+
log.Fatal(err)
19+
}
20+
}
21+
22+
func main() {
23+
c, err := etherscan.NewClient(etherscan.Mainnet, "YOUR_API_KEY")
24+
checkErr(err)
25+
26+
resp, err := c.Account("0x0000000000000000000000000000000000000000")
27+
checkErr(err)
28+
29+
fmt.Printf("%+v\n", resp)
30+
}
31+
```
32+
33+
```bash
34+
go run main.go
35+
&{Status:1 Message:OK Result:+7641879211751631214533}
36+
```

0 commit comments

Comments
 (0)