File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 88package etherscan
99
1010import (
11+ "fmt"
12+ "os"
1113 "testing"
1214 "time"
1315)
1416
17+ const apiKeyEnvName = "ETHERSCAN_API_KEY"
18+
1519var (
1620 // api test client for many test cases
1721 api * Client
1822 // bucket default rate limiter
1923 bucket * Bucket
24+ // apiKey etherscan API key
25+ apiKey string
2026)
2127
2228func init () {
29+ apiKey = os .Getenv (apiKeyEnvName )
30+ if apiKey == "" {
31+ panic (fmt .Sprintf ("API key is empty, set env variable %q with a valid API key to proceed." , apiKeyEnvName ))
32+ }
2333 bucket = NewBucket (200 * time .Millisecond )
2434
25- api = New (Mainnet , "etherscan-api-e2e-test" )
35+ api = New (Mainnet , apiKey )
2636 api .Verbose = true
2737 api .BeforeRequest = func (module string , action string , param map [string ]interface {}) error {
2838 bucket .Take ()
You can’t perform that action at this time.
0 commit comments