Skip to content
This repository has been archived by the owner on Feb 1, 2021. It is now read-only.

Endpoint and registry configuration #91

Merged
merged 10 commits into from
Apr 3, 2019

Conversation

mirceanis
Copy link
Contributor

@mirceanis mirceanis commented Apr 2, 2019

What's here

This changeset allows devs to configure the RPC endpoint and eventual registries they want to use.
This is useful for private nets and for properly configuring an infura project.
Any configuration should be done during app startup / sdk initialization.

There is a Networks registry that already has some defaults for the more popular public eth networks. Those can be overridden like so:

Networks.registerNetwork(Networks.mainnet.copy(rpcUrl = "http://127.0.0.1:8485"))

This will make the SDK try to use a localhost node to interact with the network.

Here's an example config for a private network:

val myNet = EthNetwork(
                name = "mynet",
                networkId = "0x6123",
                rpcUrl = "https://127.0.0.1:8545",
                //assuming this was deployed already to the private net
                ethrDidRegistry = "0x7efdca03e98e0dc2b855be647c39abe98421bfcf",
)
Networks.registerNetwork(myNet)
Uport.initialize(Configuration.setEthNetwork(myNet))

Networks can also be specified more granularly for individual classes but should only be used in isolation (see note below).
JWTTools accepts a preferredNetwork param
Configuration allows an ethNetwork to be set
EthrDIDResolver accepts a rpcUrl and a registry

Note

Throughout the codebase there is an assumption that the networks are configured at the start. Later changes to configuration will override the existing entries.

@mirceanis mirceanis requested a review from ugoamanoh April 2, 2019 13:51
@mirceanis mirceanis changed the title [wip] endpoint and registry configuration Endpoint and registry configuration Apr 2, 2019
@mirceanis mirceanis merged commit 8e8fae8 into develop Apr 3, 2019
@mirceanis mirceanis deleted the feature/163383730-endpoint-configuration branch May 20, 2019 10:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants