Skip to content

Commit a2cb094

Browse files
committed
feat: visibility of the network in the client
1 parent c44a816 commit a2cb094

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

client.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ type Client struct {
3838
AfterRequest func(module, action string, param map[string]interface{}, outcome interface{}, requestErr error)
3939
}
4040

41+
func (c *Client) GetNetwork() Network {
42+
return c.network
43+
}
44+
4145
// New initialize a new etherscan API client
4246
// please use pre-defined network value
4347
func New(network Network, APIKey string) *Client {

network.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ var (
3232

3333
// Network is ethereum network type (mainnet, ropsten, etc)
3434
type Network struct {
35-
Name string
36-
Type string
37-
BaseURL string
35+
Name string // Name of the network or chain
36+
Type string // Type of the network, either main or test
37+
baseURL string // baseURL for the API client
3838
}
3939

40-
// Domain returns the subdomain of etherscan API via n provided.
40+
// Domain returns the subdomain of etherscan API via n provided.
4141
func (n Network) Domain() (sub string) {
42-
return n.BaseURL
42+
return n.baseURL
4343
}

0 commit comments

Comments
 (0)