diff --git a/ethproviders/config.go b/ethproviders/config.go index 8c647fb7..6f96a3c5 100644 --- a/ethproviders/config.go +++ b/ethproviders/config.go @@ -5,11 +5,15 @@ import "strings" type Config map[string]NetworkConfig type NetworkConfig struct { - ID uint64 `toml:"id" json:"id"` - URL string `toml:"url" json:"url"` - AuthChain bool `toml:"auth_chain" json:"authChain"` - Testnet bool `toml:"testnet" json:"testnet"` - Disabled bool `toml:"disabled" json:"disabled"` + ID uint64 `toml:"id" json:"id"` + URL string `toml:"url" json:"url"` + + WSEnabled bool `toml:"ws_enabled" json:"wsEnabled"` + WSURL string `toml:"ws_url" json:"wsUrl"` + + AuthChain bool `toml:"auth_chain" json:"authChain"` + Testnet bool `toml:"testnet" json:"testnet"` + Disabled bool `toml:"disabled" json:"disabled"` } func (n Config) GetByID(id uint64) (NetworkConfig, bool) { diff --git a/ethrpc/ethrpc.go b/ethrpc/ethrpc.go index 762fe673..83f8efa3 100644 --- a/ethrpc/ethrpc.go +++ b/ethrpc/ethrpc.go @@ -24,7 +24,7 @@ import ( type Provider struct { log logger.Logger nodeURL string - nodeWSSURL string + nodeWSURL string httpClient httpClient br breaker.Breaker jwtToken string // optional @@ -420,7 +420,7 @@ func (p *Provider) SubscribeFilterLogs(ctx context.Context, query ethereum.Filte } if p.gethRPC == nil { var err error - p.gethRPC, err = rpc.Dial(p.nodeWSSURL) + p.gethRPC, err = rpc.Dial(p.nodeWSURL) if err != nil { return nil, fmt.Errorf("ethrpc: SubscribeFilterLogs failed: %w", err) } @@ -436,7 +436,7 @@ func (p *Provider) SubscribeNewHeads(ctx context.Context, ch chan<- *types.Heade } if p.gethRPC == nil { var err error - p.gethRPC, err = rpc.Dial(p.nodeWSSURL) + p.gethRPC, err = rpc.Dial(p.nodeWSURL) if err != nil { return nil, fmt.Errorf("ethrpc: SubscribeNewHeads failed: %w", err) } @@ -477,5 +477,5 @@ func (p *Provider) contractQuery(ctx context.Context, contractAddress string, in // ... func (p *Provider) IsStreamingEnabled() bool { - return p.nodeWSSURL != "" + return p.nodeWSURL != "" } diff --git a/ethrpc/option.go b/ethrpc/option.go index 59d73d3e..cac05465 100644 --- a/ethrpc/option.go +++ b/ethrpc/option.go @@ -15,7 +15,7 @@ type httpClient interface { func WithStreaming(nodeWebsocketURL string) Option { return func(p *Provider) { - p.nodeWSSURL = nodeWebsocketURL + p.nodeWSURL = nodeWebsocketURL } }