Skip to content

Commit

Permalink
Merge pull request #2000 from ethereum/ethereumProvider
Browse files Browse the repository at this point in the history
EthereumProvider and the related refactoring
  • Loading branch information
nivida authored Jan 25, 2019
2 parents 9534855 + 3dd6251 commit 5998517
Show file tree
Hide file tree
Showing 730 changed files with 65,521 additions and 50,013 deletions.
5 changes: 0 additions & 5 deletions .bowerrc

This file was deleted.

11 changes: 11 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
node_modules
coverage
test
docs/_build
dist
package.js
rollup.config.js
jest.config.js
jest.preprocessor.js
W3cWebsocket.js
packages/**/rollup.config.js
62 changes: 62 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"parser": "babel-eslint",
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"node": true,
"jest/globals": true
},
"extends": [
"standard",
"plugin:unicorn/recommended",
"plugin:jest/recommended",
"prettier",
"prettier/standard",
"prettier/unicorn"
],
"parserOptions": {
"ecmaVersion": 2017,
"sourceType": "module"
},
"plugins": [
"prettier",
"standard",
"unicorn",
"jest"
],
"rules": {
"no-useless-constructor": 0,
"no-new": 0,
"standard/no-callback-literal": 0,
"unicorn/filename-case": [
"error",
{
"case": "pascalCase"
}
],
"prettier/prettier": "error",
"indent": [
"error",
4,
{
"SwitchCase": 1
}
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single",
{
"avoidEscape": true
}
],
"semi": [
"error",
"always"
]
}
}
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dist/
.DS_Store
*.swp
*/**/*un~
Expand All @@ -8,10 +9,9 @@ npm-debug.log
/coverage
/tmp
node_modules
bower_components
/bower
.idea/
.npm/
.vscode/
dist/
!./dist/web3.min.js
coverage/
lerna-debug.log
.eslintcache
2 changes: 0 additions & 2 deletions .jshintignore

This file was deleted.

19 changes: 0 additions & 19 deletions .jshintrc

This file was deleted.

10 changes: 0 additions & 10 deletions .npmignore

This file was deleted.

11 changes: 11 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"printWidth": 120,
"tabWidth": 4,
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": false,
"arrowParens": "always",
"proseWrap": "never"
}
8 changes: 5 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ node_js:
- "6"
- "7"
- "8"
- "9"
- "10"
- "11"
env:
- CXX=g++-4.8
addons:
Expand All @@ -20,9 +22,9 @@ before_script:
- sh -e /etc/init.d/xvfb start
install:
- npm install
- npm run bootstrap
script:
- npm run-script build
- npm run-script test-coveralls
- npm run travis
after_script:
- cd test/node && npm install && node app.js
- npm run coveralls

2 changes: 0 additions & 2 deletions .versions

This file was deleted.

8 changes: 4 additions & 4 deletions ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
Steps before creating an issue:
1. I've read the documentation.
2. I was looking for an solution on stackoverflow or something else.
3. I was looking for an identical issue.
1. I have read the documentation.
2. I was looking for an solution on stackoverflow or somewhere else.
3. I checked the issue list if an identical issue already exists.
-->

Expand All @@ -18,7 +18,7 @@ Steps before creating an issue:
2. [Second step]
3. [and so on...]

#### Logs
#### Error Logs

#### Versions
[NPM, Node, Web3.js, OS, device...]
12 changes: 7 additions & 5 deletions PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,20 @@ Fixes #(issue)

<!--- Please delete options that are not relevant. -->

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change

## Checklist:

- [ ] I have selected the correct base branch.
- [ ] I have performed a self-review of my own code.
- [ ] I have commented my code, particularly in hard-to-understand areas.
- [ ] I have made corresponding changes to the documentation.
- [ ] My changes generate no new warnings.
- [ ] My changes generate no warnings.
- [ ] I have updated or added types for all modules I've changed
- [ ] Any dependent changes have been merged and published in downstream modules.
- [ ] I ran ```npm run test``` with success and extended the tests if necessary.
- [ ] I ran ```npm run build``` and tested the resulting file from ```dist``` folder in a browser.
- [ ] I ran ```npm run build``` and tested it in the browser and with node.
- [ ] I ran ```npm run-script dtslint``` and tested that all my types are correct
- [ ] I have tested my code on the live network.
92 changes: 24 additions & 68 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
**PREVIEW RELEASE** This is a beta preview release with breaking changes! The current stable version is 0.20.0

<img src="https://github.com/ethereum/web3.js/raw/1.0/web3js.jpg" width=200 />
![Web3.js logo](assets/web3js.svg)

# web3.js - Ethereum JavaScript API

[![npm](https://img.shields.io/npm/dm/web3.svg)](https://www.npmjs.com/package/web3) [![Build Status][travis-image]][travis-url] [![Coverage Status][coveralls-image]][coveralls-url]
[![Join the chat at https://gitter.im/ethereum/web3.js](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/ethereum/web3.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

[![npm](https://img.shields.io/npm/dm/web3.svg)](https://www.npmjs.com/package/web3) [![Build Status][travis-image]][travis-url] [![dependency status][dep-image]][dep-url] [![dev dependency status][dep-dev-image]][dep-dev-url] [![Coverage Status][coveralls-image]][coveralls-url] [![Stories in Ready][waffle-image]][waffle-url]

This is the Ethereum [JavaScript API][docs]
which connects to the [Generic JSON RPC](https://github.com/ethereum/wiki/wiki/JSON-RPC) spec.


You need to run a local or remote Ethereum node to use this library.

Please read the [documentation][docs] for more.
Expand All @@ -30,33 +28,12 @@ npm install web3
yarn add web3
```

### Meteor

*Note*: works only in the Browser for now. (PR welcome).

```bash
meteor add ethereum:web3
```

### In the Browser

Use the prebuild ``dist/web3.min.js``, or
build using the [web3.js][repo] repository:

```bash
npm run-script build
```

Then include `dist/web3.js` in your html file.
This will expose `Web3` on the window object.

## Usage

```js
// in node.js
var Web3 = require('web3');
import Web3 from 'web3';

var web3 = new Web3('ws://localhost:8546');
const web3 = new Web3('ws://localhost:8546');
console.log(web3);
> {
eth: ... ,
Expand All @@ -83,78 +60,57 @@ web3.eth.getAccounts()

### Usage with TypeScript

Type definitions are maintained at [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped) by others. You can install them with
We do support types within the repo itself. Please open an issue here if you find any wrong types.

```bash
npm install --dev @types/web3.js
```

You might need to install type definitions for `bignumber.js` and `lodash` too.

And then use `web3.js` as follows:
You can use `web3.js` as follows:

```typescript
import Web3 = require("web3"); // Note the special syntax! Copy this line when in doubt!
import Web3 from 'web3';
const web3 = new Web3("ws://localhost:8546");
```

**Please note:** We do not support TypeScript ourselves. If you have any issue with TypeScript and `web3.js` do not create an issue here. Go over to DefinitelyTyped and do it there.

## Documentation

Documentation can be found at [read the docs][docs]


## Building
## Contributing

### Requirements

* [Node.js](https://nodejs.org)
* npm

### Commands
```bash
sudo apt-get update
sudo apt-get install nodejs
sudo apt-get install npm
```

### Building (gulp)
npm run clean // removes all the node_modules folders in all modules
npm run bootstrap // install all dependencies and symlinks the internal modules for all modules
npm run test // runs all tests
npm run build // runs rollup
npm run dev // runs rollup with a watcher

Build only the web3.js package

```bash
npm run-script build
```

Or build all sub packages as well

```bash
npm run-script build-all
```

This will put all the browser build files into the `dist` folder.


### Testing (mocha)

```bash
npm test
```

### Contributing

- All contributions have to go into develop, or the 1.0 branch
- All contributions have to go into develop (0.20.x), or the 1.0 branch
- Please follow the code style of the other files, we use 4 spaces as tabs.

### Support

![chrome](https://img.shields.io/badge/chrome-latest%202%20versions-green.svg)
![firefox](https://img.shields.io/badge/firefox-latest%202%20versions-green.svg)
![opera](https://img.shields.io/badge/opera-latest%202%20versions-green.svg)
![node](https://img.shields.io/badge/node->=6-green.svg)

### Community
- [Gitter](https://gitter.im/ethereum/web3.js?source=orgpage)
- [Forum](https://forum.ethereum.org/categories/ethereum-js)


### Similar libraries in other languages
- Python [Web3.py](https://github.com/pipermerriam/web3.py)
- Haskell [hs-web3](https://github.com/airalab/hs-web3) - Haskell [hs-web3](https://github.com/airalab/hs-web3)
- Java [web3j](https://github.com/web3j/web3j) - Java [web3j](https://github.com/web3j/web3j)
- Haskell [hs-web3](https://github.com/airalab/hs-web3)
- Java [web3j](https://github.com/web3j/web3j)
- Scala [web3j-scala](https://github.com/mslinn/web3j-scala)
- Purescript [purescript-web3](https://github.com/f-o-a-m/purescript-web3)
- PHP [web3.php](https://github.com/sc0Vu/web3.php)
Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes
Loading

0 comments on commit 5998517

Please sign in to comment.