Skip to content

Commit ce07c55

Browse files
committed
Add polygon, remove legacy chains
1 parent abc8e81 commit ce07c55

File tree

3 files changed

+13
-42
lines changed

3 files changed

+13
-42
lines changed

client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func New(network Network, APIKey string) *Client {
4343
return NewCustomized(Customization{
4444
Timeout: 30 * time.Second,
4545
Key: APIKey,
46-
BaseURL: fmt.Sprintf(`https://%s.etherscan.io/api?`, network.SubDomain()),
46+
BaseURL: MapNetworkToURL[network],
4747
})
4848
}
4949

client_test.go

Lines changed: 0 additions & 28 deletions
This file was deleted.

network.go

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,20 @@ const (
1111
//// Ethereum public networks
1212

1313
// Mainnet Ethereum mainnet for production
14-
Mainnet Network = "api"
15-
// Ropsten Testnet(POW)
16-
Ropsten Network = "api-ropsten"
17-
// Kovan Testnet(POA)
18-
Kovan Network = "api-kovan"
19-
// Rinkby Testnet(CLIQUE)
20-
Rinkby Network = "api-rinkeby"
21-
// Goerli Testnet(CLIQUE)
22-
Goerli Network = "api-goerli"
23-
// Tobalaba Testnet
24-
Tobalaba Network = "api-tobalaba"
25-
// Sepolia Testnet
26-
Sepolia Network = "api-sepolia"
14+
Mainnet Network = "ethereum"
15+
Sepolia Network = "sepolia"
16+
17+
Polygon Network = "polygon"
18+
PolygonAmoy Network = "amoy"
2719
)
2820

21+
var MapNetworkToURL = map[Network]string{
22+
Mainnet: "https://api.etherscan.io/api?",
23+
Sepolia: "https://api-sepolia.etherscan.io/api?",
24+
Polygon: "https://api.polygonscan.com/api?",
25+
PolygonAmoy: "https://api-amoy.polygonscan.com/api?",
26+
}
27+
2928
// Network is ethereum network type (mainnet, ropsten, etc)
3029
type Network string
3130

0 commit comments

Comments
 (0)