Comparing version 0.20.1 to 1.0.0-beta.1
{ | ||
"namespace": "ethereum", | ||
"name": "web3", | ||
"namespace": "ethereum", | ||
"version": "0.17.0-alpha", | ||
"description": "Ethereum Compatible JavaScript API", | ||
"version": "1.0.0-beta.1", | ||
"description": "Ethereum JavaScript API", | ||
"license": "LGPL-3.0", | ||
"main": [ | ||
"./dist/web3.js", | ||
"./dist/web3.min.js" | ||
], | ||
"moduleType": "global", | ||
"dependencies": { | ||
"bignumber.js": ">=2.0.0", | ||
"crypto-js": "~3.1.4" | ||
"bn.js": ">=4.11.6" | ||
}, | ||
@@ -23,27 +23,40 @@ "repository": { | ||
"keywords": [ | ||
"ethereum", | ||
"javascript", | ||
"Ethereum", | ||
"JavaScript", | ||
"RPC", | ||
"Swarm", | ||
"Whisper", | ||
"Smart Contracts", | ||
"API" | ||
], | ||
"authors": [ | ||
{ | ||
"name": "Marek Kotewicz", | ||
"email": "marek@ethdev.com", | ||
"homepage": "https://github.com/debris" | ||
}, | ||
{ | ||
"name": "Marian Oancea", | ||
"email": "marian@ethdev.com", | ||
"homepage": "https://github.com/cubedro" | ||
}, | ||
{ | ||
"name": "Fabian Vogelsteller", | ||
"email": "fabian@ethdev.com", | ||
"homepage": "https://github.com/frozeman" | ||
} | ||
{ | ||
"name": "Fabian Vogelsteller", | ||
"email": "fabian@ethereum.org", | ||
"homepage": "http://frozeman.de" | ||
}, | ||
{ | ||
"name": "Marek Kotewicz", | ||
"email": "marek@ethcore.io", | ||
"url": "https://github.com/debris" | ||
}, | ||
{ | ||
"name": "Marian Oancea", | ||
"url": "https://github.com/cubedro" | ||
}, | ||
{ | ||
"name": "Gav Wood", | ||
"email": "g@ethcore.io", | ||
"homepage": "http://gavwood.com" | ||
}, | ||
{ | ||
"name": "Jeffery Wilcke", | ||
"email": "jeffrey.wilcke@ethereum.org", | ||
"url": "https://github.com/obscuren" | ||
} | ||
], | ||
"license": "LGPL-3.0", | ||
"ignore": [ | ||
"example", | ||
"lib", | ||
"test", | ||
"packages", | ||
"src", | ||
"node_modules", | ||
@@ -50,0 +63,0 @@ "package.json", |
155
gulpfile.js
@@ -5,3 +5,3 @@ #!/usr/bin/env node | ||
var version = require('./lib/version.json'); | ||
var version = require('./lerna.json'); | ||
var path = require('path'); | ||
@@ -14,2 +14,3 @@ | ||
var uglify = require('gulp-uglify'); | ||
var babel = require('gulp-babel'); | ||
var rename = require('gulp-rename'); | ||
@@ -23,22 +24,93 @@ var source = require('vinyl-source-stream'); | ||
var DEST = path.join(__dirname, 'dist/'); | ||
var src = 'index'; | ||
var dst = 'web3'; | ||
var lightDst = 'web3-light'; | ||
var packages = [{ | ||
fileName: 'web3', | ||
expose: 'Web3', | ||
src: './src/index.js' | ||
},{ | ||
fileName: 'web3-utils', | ||
expose: 'Utils', | ||
src: './packages/web3-utils/src/index.js' | ||
},{ | ||
fileName: 'web3-eth', | ||
expose: 'Eth', | ||
src: './packages/web3-eth/src/index.js' | ||
},{ | ||
fileName: 'web3-eth-accounts', | ||
expose: 'Accounts', | ||
src: './packages/web3-eth-accounts/src/index.js' | ||
},{ | ||
fileName: 'web3-eth-contract', | ||
expose: 'Conract', | ||
src: './packages/web3-eth-contract/src/index.js' | ||
},{ | ||
fileName: 'web3-eth-personal', | ||
expose: 'Personal', | ||
src: './packages/web3-eth-personal/src/index.js' | ||
},{ | ||
fileName: 'web3-eth-iban', | ||
expose: 'EthIban', | ||
src: './packages/web3-eth-iban/src/index.js' | ||
},{ | ||
fileName: 'web3-eth-abi', | ||
expose: 'EthAbi', | ||
src: './packages/web3-eth-abi/src/index.js' | ||
},{ | ||
fileName: 'web3-net', | ||
expose: 'Net', | ||
src: './packages/web3-net/src/index.js' | ||
},{ | ||
fileName: 'web3-shh', | ||
expose: 'Shh', | ||
src: './packages/web3-shh/src/index.js' | ||
},{ | ||
fileName: 'web3-bzz', | ||
expose: 'Bzz', | ||
src: './packages/web3-bzz/src/index.js' | ||
},{ | ||
fileName: 'web3-core-requestManager', | ||
expose: 'RequestManager', | ||
src: './packages/web3-core-requestManager/src/index.js' | ||
},{ | ||
fileName: 'web3-providers-ipc', | ||
expose: 'Web3IpcProvider', | ||
src: './packages/web3-providers-ipc/src/index.js' | ||
},{ | ||
fileName: 'web3-providers-http', | ||
expose: 'Web3HttpProvider', | ||
src: './packages/web3-providers-http/src/index.js', | ||
ignore: ['xmlhttprequest'] | ||
},{ | ||
fileName: 'web3-providers-ws', | ||
expose: 'Web3WsProvider', | ||
src: './packages/web3-providers-ws/src/index.js' | ||
}]; | ||
var browserifyOptions = { | ||
debug: true, | ||
insert_global_vars: false, // jshint ignore:line | ||
detectGlobals: false, | ||
// standalone: 'Web3', | ||
derequire: true, | ||
insertGlobalVars: false, // jshint ignore:line | ||
detectGlobals: true, | ||
bundleExternal: true | ||
}; | ||
var ugliyOptions = { | ||
compress:{ | ||
dead_code : true, // jshint ignore:line | ||
drop_debugger : true, // jshint ignore:line | ||
global_defs : { // jshint ignore:line | ||
"DEBUG": false // matters for some libraries | ||
} | ||
} | ||
}; | ||
gulp.task('version', function(){ | ||
gulp.src(['./package.json']) | ||
.pipe(replace(/\"version\"\: \"([\.0-9]*)\"/, '"version": "'+ version.version + '"')) | ||
.pipe(replace(/\"version\"\: \"([\.0-9\-a-z]*)\"/, '"version": "'+ version.version + '"')) | ||
.pipe(gulp.dest('./')); | ||
gulp.src(['./bower.json']) | ||
.pipe(replace(/\"version\"\: \"([\.0-9]*)\"/, '"version": "'+ version.version + '"')) | ||
.pipe(replace(/\"version\"\: \"([\.0-9\-a-z]*)\"/, '"version": "'+ version.version + '"')) | ||
.pipe(gulp.dest('./')); | ||
gulp.src(['./package.js']) | ||
.pipe(replace(/version\: \'([\.0-9]*)\'/, "version: '"+ version.version + "'")) | ||
.pipe(replace(/version\: \'([\.0-9\-a-z]*)\'/, "version: '"+ version.version + "'")) | ||
.pipe(gulp.dest('./')); | ||
@@ -64,37 +136,44 @@ }); | ||
gulp.task('light', ['clean'], function () { | ||
return browserify(browserifyOptions) | ||
.require('./' + src + '.js', {expose: 'web3'}) | ||
.ignore('bignumber.js') | ||
.require('./lib/utils/browser-bn.js', {expose: 'bignumber.js'}) // fake bignumber.js | ||
.add('./' + src + '.js') | ||
.bundle() | ||
.pipe(exorcist(path.join( DEST, lightDst + '.js.map'))) | ||
.pipe(source(lightDst + '.js')) | ||
.pipe(gulp.dest( DEST )) | ||
.pipe(streamify(uglify())) | ||
.pipe(rename(lightDst + '.min.js')) | ||
.pipe(gulp.dest( DEST )); | ||
}); | ||
packages.forEach(function(pckg, i){ | ||
var prevPckg = (!i) ? 'clean' : packages[i-1].fileName; | ||
gulp.task('standalone', ['clean'], function () { | ||
return browserify(browserifyOptions) | ||
.require('./' + src + '.js', {expose: 'web3'}) | ||
.require('bignumber.js') // expose it to dapp users | ||
.add('./' + src + '.js') | ||
.ignore('crypto') | ||
.bundle() | ||
.pipe(exorcist(path.join( DEST, dst + '.js.map'))) | ||
.pipe(source(dst + '.js')) | ||
.pipe(gulp.dest( DEST )) | ||
.pipe(streamify(uglify())) | ||
.pipe(rename(dst + '.min.js')) | ||
.pipe(gulp.dest( DEST )); | ||
gulp.task(pckg.fileName, [prevPckg], function () { | ||
browserifyOptions.standalone = pckg.expose; | ||
var pipe = browserify(browserifyOptions) | ||
.require(pckg.src, {expose: pckg.expose}) | ||
.require('bn.js', {expose: 'BN'}) // expose it to dapp developers | ||
.add(pckg.src); | ||
if(pckg.ignore) { | ||
pckg.ignore.forEach(function (ignore) { | ||
pipe.ignore(ignore); | ||
}); | ||
} | ||
return pipe.bundle() | ||
.pipe(exorcist(path.join( DEST, pckg.fileName + '.js.map'))) | ||
.pipe(source(pckg.fileName + '.js')) | ||
.pipe(streamify(babel({ | ||
compact: false, | ||
presets: ['env'] | ||
}))) | ||
.pipe(gulp.dest( DEST )) | ||
.pipe(streamify(babel({ | ||
compact: true, | ||
presets: ['env'] | ||
}))) | ||
.pipe(streamify(uglify(ugliyOptions))) | ||
.on('error', function (err) { console.error(err); }) | ||
.pipe(rename(pckg.fileName + '.min.js')) | ||
.pipe(gulp.dest( DEST )); | ||
}); | ||
}); | ||
gulp.task('watch', function() { | ||
gulp.watch(['./lib/*.js'], ['lint', 'build']); | ||
gulp.watch(['./src/*.js'], ['lint', 'build']); | ||
}); | ||
gulp.task('default', ['version', 'lint', 'clean', 'light', 'standalone']); | ||
gulp.task('default', ['version', 'lint', 'clean', packages[packages.length-1].fileName]); | ||
/* jshint ignore:start */ | ||
Package.describe({ | ||
name: 'ethereum:web3', | ||
version: '0.20.1', | ||
summary: 'Ethereum JavaScript API, middleware to talk to a ethreum node over RPC', | ||
git: 'https://github.com/ethereum/ethereum.js', | ||
// By default, Meteor will default to using README.md for documentation. | ||
// To avoid submitting documentation, set this field to null. | ||
documentation: 'README.md' | ||
name: 'ethereum:web3', | ||
version: '1.0.0-beta.1', | ||
summary: 'Ethereum JavaScript API, middleware to talk to a ethreum node over RPC', | ||
git: 'https://github.com/ethereum/ethereum.js', | ||
// By default, Meteor will default to using README.md for documentation. | ||
// To avoid submitting documentation, set this field to null. | ||
documentation: 'README.md' | ||
}); | ||
Npm.depends({ | ||
"xmlhttprequest": "1.7.0" | ||
"xmlhttprequest": "1.7.0" | ||
}); | ||
@@ -18,17 +18,7 @@ | ||
Package.onUse(function(api) { | ||
api.versionsFrom('1.0.3.2'); | ||
api.versionsFrom('1.0.3.2'); | ||
// api.use('3stack:bignumber@2.0.0', 'client'); | ||
api.export(['Web3', 'BigNumber'], ['client', 'server']); | ||
api.addFiles('dist/web3.js', ['client', 'server']); | ||
api.addFiles('package-init.js', ['client', 'server']); | ||
api.addFiles('dist/web3.min.js', ['client', 'server']); | ||
}); | ||
// Package.onTest(function(api) { | ||
// api.use('tinytest'); | ||
// api.use('test'); | ||
// api.addFiles('test-tests.js'); | ||
// }); | ||
/* jshint ignore:end */ |
{ | ||
"name": "web3", | ||
"namespace": "ethereum", | ||
"version": "0.20.1", | ||
"description": "Ethereum JavaScript API, middleware to talk to a ethereum node over RPC", | ||
"main": "./index.js", | ||
"version": "1.0.0-beta.1", | ||
"description": "Ethereum JavaScript API", | ||
"license": "LGPL-3.0", | ||
"main": "./src/index.js", | ||
"directories": { | ||
"lib": "./lib" | ||
"lib": "./src", | ||
"doc": "./doc", | ||
"test": "./test" | ||
}, | ||
"dependencies": { | ||
"bignumber.js": "git+https://github.com/frozeman/bignumber.js-nolookahead.git", | ||
"crypto-js": "^3.1.4", | ||
"utf8": "^2.1.1", | ||
"xhr2": "*", | ||
"xmlhttprequest": "*" | ||
}, | ||
"browser": { | ||
"xmlhttprequest": "./lib/utils/browser-xhr.js" | ||
}, | ||
"devDependencies": { | ||
"bower": ">=1.4.1", | ||
"browserify": ">=10.0", | ||
"chai": "^3.0.0", | ||
"coveralls": "^2.11.2", | ||
"del": ">=2.0.2", | ||
"exorcist": "^0.4.0", | ||
"gulp": ">=3.9.0", | ||
"gulp-jshint": ">=1.5.0", | ||
"gulp-rename": ">=1.2.0", | ||
"gulp-replace": "^0.5.3", | ||
"gulp-streamify": "0.0.5", | ||
"gulp-uglify": ">=1.2.0", | ||
"istanbul": "^0.4.4", | ||
"jshint": ">=2.5.0", | ||
"mocha": ">=2.3.3", | ||
"sandboxed-module": "^2.0.2", | ||
"vinyl-source-stream": "^1.1.0" | ||
}, | ||
"scripts": { | ||
"build": "gulp", | ||
"watch": "gulp watch", | ||
"lint": "jshint *.js lib", | ||
"test": "mocha", | ||
"lint": "jshint *.js packages", | ||
"test": "mocha; jshint *.js packages", | ||
"test-coveralls": "istanbul cover _mocha -- -R spec && cat coverage/lcov.info | coveralls --verbose" | ||
@@ -52,24 +26,23 @@ }, | ||
"bugs": { | ||
"url": "https://github.com/ethereum/web3.js/issues" | ||
"url ": "https://github.com/ethereum/web3.js/issues" | ||
}, | ||
"keywords": [ | ||
"ethereum", | ||
"javascript", | ||
"Ethereum", | ||
"JavaScript", | ||
"API" | ||
], | ||
"author": "ethdev.com", | ||
"author": "ethereum.org", | ||
"authors": [ | ||
{ | ||
"name": "Fabian Vogelsteller", | ||
"email": "fabian@ethereum.org", | ||
"homepage": "http://frozeman.de" | ||
}, | ||
{ | ||
"name": "Marek Kotewicz", | ||
"email": "marek@ethdev.com", | ||
"email": "marek@ethcore.io", | ||
"url": "https://github.com/debris" | ||
}, | ||
{ | ||
"name": "Fabian Vogelsteller", | ||
"email": "fabian@ethdev.com", | ||
"homepage": "http://frozeman.de" | ||
}, | ||
{ | ||
"name": "Marian Oancea", | ||
"email": "marian@ethdev.com", | ||
"url": "https://github.com/cubedro" | ||
@@ -79,3 +52,3 @@ }, | ||
"name": "Gav Wood", | ||
"email": "g@ethdev.com", | ||
"email": "g@ethcore.io", | ||
"homepage": "http://gavwood.com" | ||
@@ -85,7 +58,35 @@ }, | ||
"name": "Jeffery Wilcke", | ||
"email": "jeff@ethdev.com", | ||
"email": "jeffrey.wilcke@ethereum.org", | ||
"url": "https://github.com/obscuren" | ||
} | ||
], | ||
"license": "LGPL-3.0" | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"babel-preset-env": "^1.6.0", | ||
"bignumber.js": "^4.0.0", | ||
"bn.js": "^4.11.6", | ||
"bower": ">=1.4.1", | ||
"browserify": "^14.4.0", | ||
"chai": "^3.0.0", | ||
"coveralls": "^2.11.2", | ||
"crypto-js": "^3.1.4", | ||
"del": ">=2.0.2", | ||
"ethereumjs-wallet": "^0.6.0", | ||
"ethjs-signer": "^0.1.1", | ||
"exorcist": "^0.4.0", | ||
"gulp": ">=3.9.0", | ||
"gulp-babel": "^6.1.2", | ||
"gulp-jshint": "^2.0.4", | ||
"gulp-rename": "^1.2.2", | ||
"gulp-replace": "^0.6.1", | ||
"gulp-streamify": "^1.0.2", | ||
"gulp-uglify": "^3.0.0", | ||
"istanbul": "^0.4.4", | ||
"jshint": ">=2.5.0", | ||
"lerna": "^2.0.0", | ||
"mocha": ">=2.3.3", | ||
"sandboxed-module": "^2.0.2", | ||
"underscore": "^1.8.3", | ||
"vinyl-source-stream": "^1.1.0" | ||
} | ||
} |
@@ -1,15 +0,7 @@ | ||
# Migration 0.13.0 -> 0.14.0 | ||
web3.js has moved from 0.x.x to 1.x.x. This is a major refactor, we will provide a guide on how to upgrade in the future. | ||
web3.js version 0.14.0 supports [multiple instances of web3](https://github.com/ethereum/web3.js/issues/297) object. | ||
To migrate to this version, please follow the guide: | ||
<img src="./web3js.jpg" width=200 /> | ||
```diff | ||
-var web3 = require('web3'); | ||
+var Web3 = require('web3'); | ||
+var web3 = new Web3(); | ||
``` | ||
# web3.js - Ethereum JavaScript API | ||
# Ethereum JavaScript API | ||
[![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) | ||
@@ -49,21 +41,24 @@ | ||
Component | ||
Or Include `dist/web3.min.js` in your html file. | ||
```bash | ||
component install ethereum/web3.js | ||
``` | ||
* Include `web3.min.js` in your html file. (not required for the meteor package) | ||
## Usage | ||
Use the `web3` object directly from global namespace: | ||
Use the `Web3` object directly from global namespace: | ||
```js | ||
console.log(web3); // {eth: .., shh: ...} // it's here! | ||
var web3 = new Web3('ws://localhost:8546'); | ||
console.log(Web3); | ||
> { | ||
eth: ... , | ||
shh: ... , | ||
utils: ..., | ||
... | ||
} | ||
``` | ||
Set a provider (HttpProvider) | ||
Additionally you can set a provider using `web3.setProvider()` (e.g. WebsocketProvider) | ||
```js | ||
web3.setProvider(new web3.providers.HttpProvider('http://localhost:8545')); | ||
web3.setProvider('ws://localhost:8546'); | ||
// or | ||
web3.setProvider(new Web3.providers.WebsocketProvider('ws://localhost:8546')); | ||
``` | ||
@@ -74,14 +69,16 @@ | ||
```js | ||
var coinbase = web3.eth.coinbase; | ||
var balance = web3.eth.getBalance(coinbase); | ||
web3.eth.getAccounts() | ||
.then(console.log); | ||
``` | ||
You can find more examples in [`example`](https://github.com/ethereum/web3.js/tree/master/example) directory. | ||
## Documentation | ||
Documentation can be found at [read the docs](http://web3js.readthedocs.io/en/1.0/) | ||
## Contribute! | ||
## Building | ||
### Requirements | ||
* Node.js | ||
* [Node.js](https://nodejs.org) | ||
* npm | ||
@@ -93,3 +90,2 @@ | ||
sudo apt-get install npm | ||
sudo apt-get install nodejs-legacy | ||
``` | ||
@@ -96,0 +92,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Git dependency
Supply chain riskContains a dependency which resolves to a remote git URL. Dependencies fetched from git URLs are not immutable can be used to inject untrusted code or reduce the likelihood of a reproducible install.
Found 1 instance in 1 package
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 2 instances in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
0
1
0
1
0
1
546636
26
82
6541
1
116
- Removedbignumber.js@git+https://github.com/frozeman/bignumber.js-nolookahead.git
- Removedcrypto-js@^3.1.4
- Removedutf8@^2.1.1
- Removedxhr2@*
- Removedxmlhttprequest@*
- Removedcrypto-js@3.3.0(transitive)
- Removedutf8@2.1.2(transitive)
- Removedxhr2@0.2.1(transitive)
- Removedxmlhttprequest@1.8.0(transitive)