Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move rpc url from config to parameter #51

Closed
konstantinzolotarev opened this issue Nov 10, 2018 · 4 comments
Closed

Move rpc url from config to parameter #51

konstantinzolotarev opened this issue Nov 10, 2018 · 4 comments

Comments

@konstantinzolotarev
Copy link

It makes more sense to configure RPC client using parameters (not in config)
Otherwise it's impossible to use it as real RPC client.

For example right now it's not possible to connect to 2 different EVMs at same time or reconfigure it without pain.

What do you think about something like this:

iex> config = %Ethereumex.Config{http_url: "https://localhost:8545"}
iex> Ethereumex.HttpClient.web3_client_version(config)
{:ok, "Parity//v1.7.2-beta-9f47909-20170918/x86_64-macos/rustc1.19.0"}
@hswick
Copy link
Collaborator

hswick commented Nov 11, 2018

Passing around the config variable every time feels a bit clunky.

However, enabling the ability to connect to multiple EVMs does seem useful. This is solved by web3.js by simply instantiating multiple web3 instances. The only analog would be to make multiple processes, however that becomes difficult with the statically named processes under the hood.

@konstantinzolotarev
Copy link
Author

Yep spawning new instance of rpc with custom parameters also will work.
Issue right now is that library is not usable anyhow except of connect to one JSONRPC.

@ayrat555
Copy link
Member

@konstantinzolotarev it's possible

Ethereumex.HttpClient.web3_client_version(url: "http://localhost:8545")

#37

@konstantinzolotarev
Copy link
Author

@ayrat555 Awesome ! Thank you !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants