Skip to content

Commit 3e5bddf

Browse files
json tags
1 parent b966ac1 commit 3e5bddf

File tree

1 file changed

+53
-59
lines changed

1 file changed

+53
-59
lines changed

networks/networks.go

Lines changed: 53 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -7,74 +7,68 @@ import (
77
type Networks map[string]*Network
88

99
type Network struct {
10-
ID uint64 `toml:"id"`
11-
Name string `toml:"name"`
12-
Title string `toml:"title"`
13-
Type NetworkType `toml:"type"`
14-
15-
LogoURL string `toml:"logoUrl"`
16-
17-
ENSAddress string `toml:"ensAddress"`
18-
19-
AuthChain bool `toml:"authChain"`
20-
Deprecated bool `toml:"deprecated"`
21-
Disabled bool `toml:"disabled"`
22-
23-
NodeURL string `toml:"nodeUrl"`
24-
IndexerURL string `toml:"indexerUrl"`
25-
RelayerURL string `toml:"relayerUrl"`
26-
27-
InternalNodeURL string `toml:"internalNodeUrl"`
28-
InternalIndexerURL string `toml:"internalIndexerUrl"`
29-
InternalRelayerURL string `toml:"internalRelayerUrl"`
30-
31-
WSEnabled bool `toml:"wsEnabled"`
32-
WSURL string `toml:"wsUrl"`
33-
34-
BlockExplorer *BlockExplorerConfig `toml:"blockExplorer"`
35-
36-
NativeToken *Currency `toml:"nativeToken"`
37-
Currencies []*Currency `toml:"currencies"`
38-
39-
NodeGateway *NodeGatewayNetwork `toml:"nodeGateway"`
40-
}
41-
42-
type Currency struct {
43-
ContractAddress *string `toml:"contractAddress"`
44-
Name string `toml:"name"`
45-
Symbol string `toml:"symbol"`
46-
Decimals uint64 `toml:"decimals"`
47-
ImageURL string `toml:"imageUrl"`
48-
Native bool `toml:"native"`
49-
Default bool `toml:"default"`
50-
Group CurrencyGroup `toml:"group"`
10+
ID uint64 `toml:"id" json:"id,omitempty"`
11+
Name string `toml:"name" json:"name,omitempty"`
12+
Title string `toml:"title" json:"title,omitempty"`
13+
Type NetworkType `toml:"type" json:"type,omitempty"`
14+
LogoURL string `toml:"logoUrl" json:"logo_url,omitempty"`
15+
ENSAddress string `toml:"ensAddress" json:"ens_address,omitempty"`
16+
AuthChain bool `toml:"authChain" json:"auth_chain,omitempty"`
17+
Deprecated bool `toml:"deprecated" json:"deprecated,omitempty"`
18+
Disabled bool `toml:"disabled" json:"disabled,omitempty"`
19+
WSEnabled bool `toml:"wsEnabled" json:"ws_enabled,omitempty"`
20+
WSURL string `toml:"wsUrl" json:"wsurl,omitempty"`
21+
22+
BlockExplorer *BlockExplorerConfig `toml:"blockExplorer" json:"block_explorer,omitempty"`
23+
NodeGateway *NodeGatewayNetwork `toml:"nodeGateway" json:"node_gateway,omitempty"`
24+
25+
NodeURL string `toml:"nodeUrl" json:"node_url,omitempty"`
26+
IndexerURL string `toml:"indexerUrl" json:"indexer_url,omitempty"`
27+
RelayerURL string `toml:"relayerUrl" json:"relayer_url,omitempty"`
28+
InternalNodeURL string `toml:"internalNodeUrl" json:"-"`
29+
InternalIndexerURL string `toml:"internalIndexerUrl" json:"-"`
30+
InternalRelayerURL string `toml:"internalRelayerUrl" json:"-"`
31+
32+
NativeToken *Currency `toml:"nativeToken" json:"native_token,omitempty"`
33+
Currencies []*Currency `toml:"currencies" json:"currencies,omitempty"`
5134
}
5235

5336
type BlockExplorerConfig struct {
54-
Name string `toml:"name"`
55-
RootURL string `toml:"rootUrl"`
56-
AddressURL string `toml:"addressUrl"`
57-
TxnHashURL string `toml:"txnHashUrl"`
37+
Name string `toml:"name" json:"name,omitempty"`
38+
RootURL string `toml:"rootUrl" json:"root_url,omitempty"`
39+
AddressURL string `toml:"addressUrl" json:"address_url,omitempty"`
40+
TxnHashURL string `toml:"txnHashUrl" json:"txn_hash_url,omitempty"`
5841
}
5942

6043
type NodeGatewayNetwork struct {
61-
Endpoints []*NodeGatewayEndpoint `toml:"endpoints"`
62-
Finality uint64 `toml:"finality"`
63-
MonitorDisabled bool `toml:"monitorDisabled"`
64-
MonitorPollInterval string `toml:"monitorPollInterval"`
65-
MonitorBlockRetention uint64 `toml:"monitorBlockRetention"`
66-
AlertsOff bool `toml:"alertsOff"`
67-
Important bool `toml:"important"`
44+
Endpoints []*NodeGatewayEndpoint `toml:"endpoints" json:"endpoints,omitempty"`
45+
Finality uint64 `toml:"finality" json:"finality,omitempty"`
46+
MonitorDisabled bool `toml:"monitorDisabled" json:"monitor_disabled,omitempty"`
47+
MonitorPollInterval string `toml:"monitorPollInterval" json:"monitor_poll_interval,omitempty"`
48+
MonitorBlockRetention uint64 `toml:"monitorBlockRetention" json:"monitor_block_retention,omitempty"`
49+
AlertsOff bool `toml:"alertsOff" json:"alerts_off,omitempty"`
50+
Important bool `toml:"important" json:"important,omitempty"`
6851
}
6952

7053
type NodeGatewayEndpoint struct {
71-
Label string `toml:"label"`
72-
Priority int `toml:"priority"`
73-
URL string `toml:"url"`
74-
WSURL string `toml:"wsurl"`
75-
SkipMethods []string `toml:"skipMethods"`
76-
AuxMethodNs []string `toml:"auxMethodNs"`
77-
Disabled bool `toml:"disabled"`
54+
Label string `toml:"label" json:"label,omitempty"`
55+
Priority int `toml:"priority" json:"priority,omitempty"`
56+
URL string `toml:"url" json:"url,omitempty"`
57+
WSURL string `toml:"wsurl" json:"wsurl,omitempty"`
58+
SkipMethods []string `toml:"skipMethods" json:"skip_methods,omitempty"`
59+
AuxMethodNs []string `toml:"auxMethodNs" json:"aux_method_ns,omitempty"`
60+
Disabled bool `toml:"disabled" json:"disabled,omitempty"`
61+
}
62+
63+
type Currency struct {
64+
ContractAddress *string `toml:"contractAddress" json:"contract_address,omitempty"`
65+
Name string `toml:"name" json:"name,omitempty"`
66+
Symbol string `toml:"symbol" json:"symbol,omitempty"`
67+
Decimals uint64 `toml:"decimals" json:"decimals,omitempty"`
68+
ImageURL string `toml:"imageUrl" json:"image_url,omitempty"`
69+
Native bool `toml:"native" json:"native,omitempty"`
70+
Default bool `toml:"default" json:"default,omitempty"`
71+
Group CurrencyGroup `toml:"group" json:"group,omitempty"`
7872
}
7973

8074
type NetworkType uint8

0 commit comments

Comments
 (0)