Skip to content

Commit

Permalink
json tags
Browse files Browse the repository at this point in the history
  • Loading branch information
david-littlefarmer committed Nov 19, 2024
1 parent b966ac1 commit 3e5bddf
Showing 1 changed file with 53 additions and 59 deletions.
112 changes: 53 additions & 59 deletions networks/networks.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,74 +7,68 @@ import (
type Networks map[string]*Network

type Network struct {
ID uint64 `toml:"id"`
Name string `toml:"name"`
Title string `toml:"title"`
Type NetworkType `toml:"type"`

LogoURL string `toml:"logoUrl"`

ENSAddress string `toml:"ensAddress"`

AuthChain bool `toml:"authChain"`
Deprecated bool `toml:"deprecated"`
Disabled bool `toml:"disabled"`

NodeURL string `toml:"nodeUrl"`
IndexerURL string `toml:"indexerUrl"`
RelayerURL string `toml:"relayerUrl"`

InternalNodeURL string `toml:"internalNodeUrl"`
InternalIndexerURL string `toml:"internalIndexerUrl"`
InternalRelayerURL string `toml:"internalRelayerUrl"`

WSEnabled bool `toml:"wsEnabled"`
WSURL string `toml:"wsUrl"`

BlockExplorer *BlockExplorerConfig `toml:"blockExplorer"`

NativeToken *Currency `toml:"nativeToken"`
Currencies []*Currency `toml:"currencies"`

NodeGateway *NodeGatewayNetwork `toml:"nodeGateway"`
}

type Currency struct {
ContractAddress *string `toml:"contractAddress"`
Name string `toml:"name"`
Symbol string `toml:"symbol"`
Decimals uint64 `toml:"decimals"`
ImageURL string `toml:"imageUrl"`
Native bool `toml:"native"`
Default bool `toml:"default"`
Group CurrencyGroup `toml:"group"`
ID uint64 `toml:"id" json:"id,omitempty"`
Name string `toml:"name" json:"name,omitempty"`
Title string `toml:"title" json:"title,omitempty"`
Type NetworkType `toml:"type" json:"type,omitempty"`
LogoURL string `toml:"logoUrl" json:"logo_url,omitempty"`
ENSAddress string `toml:"ensAddress" json:"ens_address,omitempty"`
AuthChain bool `toml:"authChain" json:"auth_chain,omitempty"`
Deprecated bool `toml:"deprecated" json:"deprecated,omitempty"`
Disabled bool `toml:"disabled" json:"disabled,omitempty"`
WSEnabled bool `toml:"wsEnabled" json:"ws_enabled,omitempty"`
WSURL string `toml:"wsUrl" json:"wsurl,omitempty"`

BlockExplorer *BlockExplorerConfig `toml:"blockExplorer" json:"block_explorer,omitempty"`
NodeGateway *NodeGatewayNetwork `toml:"nodeGateway" json:"node_gateway,omitempty"`

NodeURL string `toml:"nodeUrl" json:"node_url,omitempty"`
IndexerURL string `toml:"indexerUrl" json:"indexer_url,omitempty"`
RelayerURL string `toml:"relayerUrl" json:"relayer_url,omitempty"`
InternalNodeURL string `toml:"internalNodeUrl" json:"-"`
InternalIndexerURL string `toml:"internalIndexerUrl" json:"-"`
InternalRelayerURL string `toml:"internalRelayerUrl" json:"-"`

NativeToken *Currency `toml:"nativeToken" json:"native_token,omitempty"`
Currencies []*Currency `toml:"currencies" json:"currencies,omitempty"`
}

type BlockExplorerConfig struct {
Name string `toml:"name"`
RootURL string `toml:"rootUrl"`
AddressURL string `toml:"addressUrl"`
TxnHashURL string `toml:"txnHashUrl"`
Name string `toml:"name" json:"name,omitempty"`
RootURL string `toml:"rootUrl" json:"root_url,omitempty"`
AddressURL string `toml:"addressUrl" json:"address_url,omitempty"`
TxnHashURL string `toml:"txnHashUrl" json:"txn_hash_url,omitempty"`
}

type NodeGatewayNetwork struct {
Endpoints []*NodeGatewayEndpoint `toml:"endpoints"`
Finality uint64 `toml:"finality"`
MonitorDisabled bool `toml:"monitorDisabled"`
MonitorPollInterval string `toml:"monitorPollInterval"`
MonitorBlockRetention uint64 `toml:"monitorBlockRetention"`
AlertsOff bool `toml:"alertsOff"`
Important bool `toml:"important"`
Endpoints []*NodeGatewayEndpoint `toml:"endpoints" json:"endpoints,omitempty"`
Finality uint64 `toml:"finality" json:"finality,omitempty"`
MonitorDisabled bool `toml:"monitorDisabled" json:"monitor_disabled,omitempty"`
MonitorPollInterval string `toml:"monitorPollInterval" json:"monitor_poll_interval,omitempty"`
MonitorBlockRetention uint64 `toml:"monitorBlockRetention" json:"monitor_block_retention,omitempty"`
AlertsOff bool `toml:"alertsOff" json:"alerts_off,omitempty"`
Important bool `toml:"important" json:"important,omitempty"`
}

type NodeGatewayEndpoint struct {
Label string `toml:"label"`
Priority int `toml:"priority"`
URL string `toml:"url"`
WSURL string `toml:"wsurl"`
SkipMethods []string `toml:"skipMethods"`
AuxMethodNs []string `toml:"auxMethodNs"`
Disabled bool `toml:"disabled"`
Label string `toml:"label" json:"label,omitempty"`
Priority int `toml:"priority" json:"priority,omitempty"`
URL string `toml:"url" json:"url,omitempty"`
WSURL string `toml:"wsurl" json:"wsurl,omitempty"`
SkipMethods []string `toml:"skipMethods" json:"skip_methods,omitempty"`
AuxMethodNs []string `toml:"auxMethodNs" json:"aux_method_ns,omitempty"`
Disabled bool `toml:"disabled" json:"disabled,omitempty"`
}

type Currency struct {
ContractAddress *string `toml:"contractAddress" json:"contract_address,omitempty"`
Name string `toml:"name" json:"name,omitempty"`
Symbol string `toml:"symbol" json:"symbol,omitempty"`
Decimals uint64 `toml:"decimals" json:"decimals,omitempty"`
ImageURL string `toml:"imageUrl" json:"image_url,omitempty"`
Native bool `toml:"native" json:"native,omitempty"`
Default bool `toml:"default" json:"default,omitempty"`
Group CurrencyGroup `toml:"group" json:"group,omitempty"`
}

type NetworkType uint8
Expand Down

0 comments on commit 3e5bddf

Please sign in to comment.