Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func New(network Network, APIKey string) *Client {
return NewCustomized(Customization{
Timeout: 30 * time.Second,
Key: APIKey,
BaseURL: fmt.Sprintf(`https://%s.etherscan.io/api?`, network.SubDomain()),
BaseURL: MapNetworkToURL[network],
})
}

Expand Down
28 changes: 0 additions & 28 deletions client_test.go

This file was deleted.

23 changes: 12 additions & 11 deletions network.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,20 @@ const (
//// Ethereum public networks

// Mainnet Ethereum mainnet for production
Mainnet Network = "api"
// Ropsten Testnet(POW)
Ropsten Network = "api-ropsten"
// Kovan Testnet(POA)
Kovan Network = "api-kovan"
// Rinkby Testnet(CLIQUE)
Rinkby Network = "api-rinkeby"
// Goerli Testnet(CLIQUE)
Goerli Network = "api-goerli"
// Tobalaba Testnet
Tobalaba Network = "api-tobalaba"
Mainnet Network = "ethereum"
Sepolia Network = "sepolia"

Polygon Network = "polygon"
PolygonAmoy Network = "amoy"
)

var MapNetworkToURL = map[Network]string{
Mainnet: "https://api.etherscan.io/api?",
Sepolia: "https://api-sepolia.etherscan.io/api?",
Polygon: "https://api.polygonscan.com/api?",
PolygonAmoy: "https://api-amoy.polygonscan.com/api?",
}

// Network is ethereum network type (mainnet, ropsten, etc)
type Network string

Expand Down