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

Add the ability to specify the parity host #23

Merged
merged 3 commits into from Jun 29, 2018
Merged

Conversation

SeekTheError
Copy link
Contributor

Wrote this PR so I could use cobalt as a full-blown deployer programmatically.

@SeekTheError SeekTheError requested a review from mirek June 27, 2018 11:55
@mirek
Copy link
Contributor

mirek commented Jun 27, 2018

You can use it already by providing Object as provider:

const Web3 = require('web3')
const makeWeb3 = require('@appliedblockchain/cobalt/web3')
const web3 = makeWeb3({
  provider: new Web3.providers.WebsocketProvider('ws://localhost:8546')
})

@SeekTheError SeekTheError changed the title Add ability to specify the parity host Add the ability to specify the parity host Jun 27, 2018
@mirek
Copy link
Contributor

mirek commented Jun 27, 2018

But yes, it should be smart/convenient to recognize ws://, wss://, http://, https://, ipc:// (file:?)...

@SeekTheError
Copy link
Contributor Author

@mirek Didn't realize you could pass a provider object...
Anyway I added support for ipc:// urls so I guess it's good enough now? Just let me know.

@mirek
Copy link
Contributor

mirek commented Jun 29, 2018

I think we shouldn't introduce new "host" attribute, just use provider for those values:
if it's ganache string -> start ganache, otherwise pass it directly as is to new Web3(provider) (wss?, https? cases should be handled correctly by web3 itself, same with provider objects)
^wss? -> ws provider
^https? -> http provider
otherwise pass it as is to allow for setting up provider somewhere else.

parity case should be removed.

If you do it we can merge otherwise I should have some time soon to look at it.

@SeekTheError
Copy link
Contributor Author

@mirek Done, I left a special case for ipc since the autodetect fails for ipc:// like urls

@mirek mirek merged commit e394cf2 into master Jun 29, 2018
@mirek mirek deleted the specify-parity-host branch June 29, 2018 14:35
@mirek
Copy link
Contributor

mirek commented Jun 29, 2018

Thanks, feel free to do:

npm version minor
git push
git push --tags

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

Successfully merging this pull request may close these issues.

None yet

2 participants