Skip to content

Commit

Permalink
Converted to node module
Browse files Browse the repository at this point in the history
Converted to npm package
Added brower
Added browserify with minification
Updated Readme
  • Loading branch information
cubedro committed Nov 5, 2014
1 parent 3e174a0 commit 4be4db5
Show file tree
Hide file tree
Showing 24 changed files with 1,785 additions and 653 deletions.
5 changes: 5 additions & 0 deletions .bowerrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"directory": "example/js/",
"cwd": "./",
"analytics": false
}
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@
*/**/.DS_Store
ethereum/ethereum
ethereal/ethereal

example/js
node_modules
bower_components
npm-debug.log
50 changes: 50 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"predef": [
"console",
"require",
"equal",
"test",
"testBoth",
"testWithDefault",
"raises",
"deepEqual",
"start",
"stop",
"ok",
"strictEqual",
"module",
"expect",
"reject",
"impl"
],

"esnext": true,
"proto": true,
"node" : true,
"browser" : true,
"browserify" : true,

"boss" : true,
"curly": false,
"debug": true,
"devel": true,
"eqeqeq": true,
"evil": true,
"forin": false,
"immed": false,
"laxbreak": false,
"newcap": true,
"noarg": true,
"noempty": false,
"nonew": false,
"nomen": false,
"onevar": false,
"plusplus": false,
"regexp": false,
"undef": true,
"sub": true,
"strict": false,
"white": false,
"shadow": true,
"eqnull": true
}
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
language: node_js
node_js:
- "0.10"
# before_script:
# - npm install
# - gulp build
14 changes: 14 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
This file is part of ethereum.js.

ethereum.js is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

ethereum.js is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.
52 changes: 50 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,57 @@
# Ethereum JavaScript API

This is the Ethereum compatible JavaScript API using `Promise`s
which implements the [Generic JSON RPC](https://github.com/ethereum/wiki/wiki/Generic-JSON-RPC) spec.
which implements the [Generic JSON RPC](https://github.com/ethereum/wiki/wiki/Generic-JSON-RPC) spec. It's available on npm as a node module and also for bower and component as an embeddable js

For an example see `index.html`.
### Installation

## Node.js

npm install ethereum.js

## For browser
Bower

bower install ethereum.js

Component

component install ethereum/ethereum.js

* Include `ethereum.min.js` in your html file.
* Include [es6-promise](https://github.com/jakearchibald/es6-promise) or another ES6-Shim if your browser doesn't support ECMAScript 6.

### Usage
Require the library:

var web3 = require('web3');

Set a provider (QtProvider, WebSocketProvider, HttpRpcProvider)

var web3.setProvider(new web3.providers.WebSocketProvider('ws://localhost:40404/eth'));

There you go, now you can use it:

```
web3.eth.coinbase.then(function(result){
console.log(result);
return web3.eth.balanceAt(result);
}).then(function(balance){
console.log(web3.toDecimal(balance));
}).catch(function(err){
console.log(err);
});
```


For another example see `example/index.html`.

### Building

* `gulp build`


### Testing

**Please note this repo is in it's early stage.**

Expand Down
47 changes: 47 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"name": "ethereum.js",
"namespace": "ethereum",
"version": "0.0.1",
"description": "Ethereum Compatible JavaScript API",
"main": "dist/ethereum.js",
"dependencies": {
"es6-promise": "#master"
},
"repository": {
"type": "git",
"url": "https://github.com/ethereum/ethereum.js.git"
},
"bugs": {
"url": "https://github.com/ethereum/ethereum.js/issues"
},
"keywords": [
"ethereum",
"javascript",
"API"
],
"authors": [
{
"name": "Marek Kotewicz",
"email": "[email protected]",
"homepage": "https://github.com/debris"
},
{
"name": "Marian Oancea",
"email": "[email protected]",
"homepage": "https://github.com/cubedro"
}
],
"license": "LGPL-3.0",
"ignore": [
"example",
"lib",
"node_modules",
"package.json",
".editorconfig",
".gitignore",
".jshintrc",
".travis.yml",
"*.js",
"**/*.txt"
]
}
Loading

0 comments on commit 4be4db5

Please sign in to comment.