We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 84c69b5 commit 42ada40Copy full SHA for 42ada40
setup_e2e_test.go
@@ -8,21 +8,31 @@
8
package etherscan
9
10
import (
11
+ "fmt"
12
+ "os"
13
"testing"
14
"time"
15
)
16
17
+const apiKeyEnvName = "ETHERSCAN_API_KEY"
18
+
19
var (
20
// api test client for many test cases
21
api *Client
22
// bucket default rate limiter
23
bucket *Bucket
24
+ // apiKey etherscan API key
25
+ apiKey string
26
27
28
func 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
+ }
33
bucket = NewBucket(200 * time.Millisecond)
34
- api = New(Mainnet, "etherscan-api-e2e-test")
35
+ api = New(Mainnet, apiKey)
36
api.Verbose = true
37
api.BeforeRequest = func(module string, action string, param map[string]interface{}) error {
38
bucket.Take()
0 commit comments