Skip to content

Commit 3f2f8dd

Browse files
committed
[doc] add Chinese README
1 parent 115a5d2 commit 3f2f8dd

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
[![Go Report Card](https://goreportcard.com/badge/github.com/nanmu42/etherscan-api)](https://goreportcard.com/report/github.com/nanmu42/etherscan-api)
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)
7+
[中文文档](https://github.com/nanmu42/etherscan-api/blob/master/README_ZH.md)
78

89
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:
910

README_ZH.md

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# etherscan-api
2+
3+
[![Build Status](https://travis-ci.org/nanmu42/etherscan-api.svg?branch=master)](https://travis-ci.org/nanmu42/etherscan-api)
4+
[![Go Report Card](https://goreportcard.com/badge/github.com/nanmu42/etherscan-api)](https://goreportcard.com/report/github.com/nanmu42/etherscan-api)
5+
[![codecov](https://codecov.io/gh/nanmu42/etherscan-api/branch/master/graph/badge.svg)](https://codecov.io/gh/nanmu42/etherscan-api)
6+
[![GoDoc](https://godoc.org/github.com/nanmu42/etherscan-api?status.svg)](https://godoc.org/github.com/nanmu42/etherscan-api)
7+
[English Readme](https://github.com/nanmu42/etherscan-api/blob/master/README.md)
8+
9+
Etherscan.io的Golang实现,
10+
支持几乎所有功能(accounts, transactions, tokens, contracts, blocks, stats),
11+
所有公共网络(Mainnet, Ropsten, Kovan, Rinkby, Tobalaba)。
12+
本项目只依赖于官方库。 :wink:
13+
14+
# Usage
15+
16+
填入网络选项和API Key即可开始使用。 :rocket:
17+
18+
```go
19+
import (
20+
"github.com/nanmu42/etherscan-api"
21+
"fmt"
22+
)
23+
24+
func main() {
25+
// 创建连接指定网络的客户端
26+
client := etherscan.New(etherscan.Mainnet, "[your API key]")
27+
28+
// (可选)按需注册钩子函数,例如用于速率控制
29+
client.BeforeRequest = func(module, action string, param map[string]interface{}) error {
30+
// ...
31+
}
32+
client.AfterRequest = func(module, action string, param map[string]interface{}, outcome interface{}, requestErr error) {
33+
// ...
34+
}
35+
36+
// 查询账户以太坊余额
37+
balance, err := client.AccountBalance("0x281055afc982d96fab65b3a49cac8b878184cb16")
38+
if err != nil {
39+
panic(err)
40+
}
41+
// 余额以 *big.Int 的类型呈现,单位为 wei
42+
fmt.Println(balance.Int())
43+
44+
// 查询token余额
45+
tokenBalance, err := client.TokenBalance("contractAddress", "holderAddress")
46+
47+
// 查询出入指定地址的ERC20转账列表
48+
transfers, err := client.ERC20Transfers("contractAddress", "address", startBlock, endBlock, page, offset)
49+
}
50+
```
51+
52+
客户端方法列表可在[GoDoc](https://godoc.org/github.com/nanmu42/etherscan-api)查询。
53+
54+
# Etherscan API Key
55+
56+
API Key可以在[etherscan](https://etherscan.io/apis)申请。
57+
58+
Etherscan的API服务是一个公开的社区无偿服务,请避免滥用。
59+
API的调用速率不能高于5次/秒,否则会遭到封禁。
60+
61+
# 利益声明
62+
63+
我和Etherscan没有任何联系。我仅仅是觉得他们的服务很棒,而自己又恰好需要这样一个库。 :smile:
64+
65+
# 许可证
66+
67+
MIT
68+
69+
请自由享受开源,欢迎贡献开源。

0 commit comments

Comments
 (0)