mirror of
https://github.com/status-im/web3.js.git
synced 2025-02-23 11:38:12 +00:00
Improvement on Readme.md (#944)
* HTTP Basic Auth, some cleanups There’s no need for additional dependency `btoa` as `XHR2` already has the support for Basic Auth. * remove redundant code * fix semicolons * Rewrite Basic Auth to support both sync and async calls. * semicolon consistency * Documentation for Basic Auth connection added. * Add Community and Other implementations to README * remove contributors
This commit is contained in:
parent
c3e6c3867f
commit
7df9c539c3
25
README.md
25
README.md
@ -64,7 +64,18 @@ console.log(web3); // {eth: .., shh: ...} // it's here!
|
||||
Set a provider (HttpProvider)
|
||||
|
||||
```js
|
||||
web3.setProvider(new web3.providers.HttpProvider('http://localhost:8545'));
|
||||
if (typeof web3 !== 'undefined') {
|
||||
web3 = new Web3(web3.currentProvider);
|
||||
} else {
|
||||
// set the provider you want from Web3.providers
|
||||
web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
|
||||
}
|
||||
```
|
||||
|
||||
Set a provider (HttpProvider using [HTTP Basic Authentication](https://en.wikipedia.org/wiki/Basic_access_authentication))
|
||||
|
||||
```js
|
||||
web3.setProvider(new web3.providers.HttpProvider('http://host.url', 0, BasicAuthUsername, BasicAuthPassword));
|
||||
```
|
||||
|
||||
There you go, now you can use it:
|
||||
@ -104,6 +115,17 @@ npm run-script build
|
||||
npm test
|
||||
```
|
||||
|
||||
### Community
|
||||
- [Gitter](https://gitter.im/ethereum/web3.js?source=orgpage)
|
||||
- [Forum](https://forum.ethereum.org/categories/ethereum-js)
|
||||
|
||||
|
||||
### Other implementations
|
||||
- Python [Web3.py](https://github.com/pipermerriam/web3.py)
|
||||
- Haskell [hs-web3](https://github.com/airalab/hs-web3)
|
||||
- Java [web3j](https://github.com/web3j/web3j)
|
||||
|
||||
|
||||
[npm-image]: https://badge.fury.io/js/web3.png
|
||||
[npm-url]: https://npmjs.org/package/web3
|
||||
[travis-image]: https://travis-ci.org/ethereum/web3.js.svg
|
||||
@ -116,4 +138,3 @@ npm test
|
||||
[coveralls-url]: https://coveralls.io/r/ethereum/web3.js?branch=master
|
||||
[waffle-image]: https://badge.waffle.io/ethereum/web3.js.svg?label=ready&title=Ready
|
||||
[waffle-url]: https://waffle.io/ethereum/web3.js
|
||||
|
||||
|
@ -10,4 +10,3 @@ console.log(coinbase);
|
||||
|
||||
var balance = web3.eth.getBalance(coinbase);
|
||||
console.log(balance.toString(10));
|
||||
|
||||
|
@ -84,5 +84,6 @@
|
||||
"url": "https://github.com/obscuren"
|
||||
}
|
||||
],
|
||||
|
||||
"license": "LGPL-3.0"
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user