mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-25 04:57:17 +00:00
removed promise dependency, updated readme, fixed node.js version of lib
This commit is contained in:
parent
5b701962dc
commit
da4c2d530d
15
README.md
15
README.md
@ -1,6 +1,6 @@
|
||||
# Ethereum JavaScript API
|
||||
|
||||
This is the Ethereum compatible JavaScript API using `Promise`s
|
||||
This is the Ethereum compatible [JavaScript API](https://github.com/ethereum/wiki/wiki/JavaScript-API)
|
||||
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
|
||||
|
||||
[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![dependency status][dep-image]][dep-url] [![dev dependency status][dep-dev-image]][dep-dev-url]
|
||||
@ -23,7 +23,7 @@ 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.
|
||||
* Include [bignumber.js](https://github.com/MikeMcl/bignumber.js/)
|
||||
|
||||
## Usage
|
||||
Require the library:
|
||||
@ -37,14 +37,8 @@ Set a provider (QtProvider, WebSocketProvider, HttpRpcProvider)
|
||||
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);
|
||||
});
|
||||
var coinbase = web3.eth.coinbase;
|
||||
var balance = web3.eth.balanceAt(coinbase);
|
||||
```
|
||||
|
||||
|
||||
@ -99,3 +93,4 @@ ethereum -ws -loglevel=4
|
||||
[dep-url]: https://david-dm.org/ethereum/ethereum.js
|
||||
[dep-dev-image]: https://david-dm.org/ethereum/ethereum.js/dev-status.svg
|
||||
[dep-dev-url]: https://david-dm.org/ethereum/ethereum.js#info=devDependencies
|
||||
|
||||
|
@ -1,11 +1,10 @@
|
||||
{
|
||||
"name": "ethereum.js",
|
||||
"namespace": "ethereum",
|
||||
"version": "0.0.9",
|
||||
"version": "0.0.10",
|
||||
"description": "Ethereum Compatible JavaScript API",
|
||||
"main": ["./dist/ethereum.js", "./dist/ethereum.min.js"],
|
||||
"dependencies": {
|
||||
"es6-promise": "#master",
|
||||
"bignumber.js": ">=2.0.0"
|
||||
},
|
||||
"repository": {
|
||||
|
4
dist/ethereum.js
vendored
4
dist/ethereum.js
vendored
@ -622,6 +622,10 @@ module.exports = Filter;
|
||||
* @date 2014
|
||||
*/
|
||||
|
||||
if ("build" !== 'build') {/*
|
||||
var XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest; // jshint ignore:line
|
||||
*/}
|
||||
|
||||
var HttpSyncProvider = function (host) {
|
||||
this.handlers = [];
|
||||
this.host = host || 'http://localhost:8080';
|
||||
|
4
dist/ethereum.js.map
vendored
4
dist/ethereum.js.map
vendored
File diff suppressed because one or more lines are too long
@ -2,7 +2,6 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<script type="text/javascript" src="js/es6-promise/promise.min.js"></script>
|
||||
<script type="text/javascript" src="js/bignumber.js/bignumber.min.js"></script>
|
||||
<script type="text/javascript" src="../dist/ethereum.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
@ -2,7 +2,6 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<script type="text/javascript" src="js/es6-promise/promise.min.js"></script>
|
||||
<script type="text/javascript" src="js/bignumber.js/bignumber.min.js"></script>
|
||||
<script type="text/javascript" src="../dist/ethereum.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
@ -1,16 +1,12 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
require('es6-promise').polyfill();
|
||||
|
||||
var web3 = require("../index.js");
|
||||
|
||||
web3.setProvider(new web3.providers.HttpRpcProvider('http://localhost:8080'));
|
||||
web3.setProvider(new web3.providers.HttpSyncProvider('http://localhost:8080'));
|
||||
|
||||
var coinbase = web3.eth.coinbase;
|
||||
console.log(coinbase);
|
||||
|
||||
var balance = web3.eth.balanceAt(coinbase);
|
||||
console.log(balance);
|
||||
|
||||
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);
|
||||
});
|
@ -21,6 +21,10 @@
|
||||
* @date 2014
|
||||
*/
|
||||
|
||||
if (process.env.NODE_ENV !== 'build') {
|
||||
var XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest; // jshint ignore:line
|
||||
}
|
||||
|
||||
var HttpSyncProvider = function (host) {
|
||||
this.handlers = [];
|
||||
this.host = host || 'http://localhost:8080';
|
||||
|
@ -1,14 +1,13 @@
|
||||
{
|
||||
"name": "ethereum.js",
|
||||
"namespace": "ethereum",
|
||||
"version": "0.0.9",
|
||||
"version": "0.0.10",
|
||||
"description": "Ethereum Compatible JavaScript API",
|
||||
"main": "./index.js",
|
||||
"directories": {
|
||||
"lib": "./lib"
|
||||
},
|
||||
"dependencies": {
|
||||
"es6-promise": "*",
|
||||
"ws": "*",
|
||||
"xmlhttprequest": "*",
|
||||
"bignumber.js": ">=2.0.0"
|
||||
|
@ -1,4 +1,3 @@
|
||||
require('es6-promise').polyfill();
|
||||
|
||||
var assert = require('assert');
|
||||
var web3 = require('../index.js');
|
||||
|
@ -1,5 +1,3 @@
|
||||
require('es6-promise').polyfill();
|
||||
|
||||
var assert = require('assert');
|
||||
var web3 = require('../index.js');
|
||||
var u = require('./utils.js');
|
||||
|
@ -1,5 +1,3 @@
|
||||
require('es6-promise').polyfill();
|
||||
|
||||
var assert = require('assert');
|
||||
var web3 = require('../index.js');
|
||||
var u = require('./utils.js');
|
||||
|
@ -1,5 +1,3 @@
|
||||
require('es6-promise').polyfill();
|
||||
|
||||
var assert = require('assert');
|
||||
var web3 = require('../index.js');
|
||||
var u = require('./utils.js');
|
||||
|
Loading…
Reference in New Issue
Block a user