Comparing version 0.20.1 to 0.20.2
@@ -13,2 +13,1 @@ #!/usr/bin/env node | ||
console.log(balance.toString(10)); | ||
@@ -135,60 +135,43 @@ /* | ||
// TODO: refactor whole encoding! | ||
SolidityCoder.prototype.encodeWithOffset = function (type, solidityType, encoded, offset) { | ||
/* jshint maxcomplexity: 17 */ | ||
/* jshint maxdepth: 5 */ | ||
var self = this; | ||
if (solidityType.isDynamicArray(type)) { | ||
return (function () { | ||
// offset was already set | ||
var nestedName = solidityType.nestedName(type); | ||
var nestedStaticPartLength = solidityType.staticPartLength(nestedName); | ||
var result = encoded[0]; | ||
var encodingMode={dynamic:1,static:2,other:3}; | ||
(function () { | ||
var previousLength = 2; // in int | ||
if (solidityType.isDynamicArray(nestedName)) { | ||
for (var i = 1; i < encoded.length; i++) { | ||
previousLength += +(encoded[i - 1])[0] || 0; | ||
result += f.formatInputInt(offset + i * nestedStaticPartLength + previousLength * 32).encode(); | ||
} | ||
} | ||
})(); | ||
var mode=(solidityType.isDynamicArray(type)?encodingMode.dynamic:(solidityType.isStaticArray(type)?encodingMode.static:encodingMode.other)); | ||
// first element is length, skip it | ||
(function () { | ||
for (var i = 0; i < encoded.length - 1; i++) { | ||
var additionalOffset = result / 2; | ||
result += self.encodeWithOffset(nestedName, solidityType, encoded[i + 1], offset + additionalOffset); | ||
} | ||
})(); | ||
if(mode !== encodingMode.other){ | ||
var nestedName = solidityType.nestedName(type); | ||
var nestedStaticPartLength = solidityType.staticPartLength(nestedName); | ||
var result = (mode === encodingMode.dynamic ? encoded[0] : ''); | ||
return result; | ||
})(); | ||
if (solidityType.isDynamicArray(nestedName)) { | ||
var previousLength = (mode === encodingMode.dynamic ? 2 : 0); | ||
} else if (solidityType.isStaticArray(type)) { | ||
return (function () { | ||
var nestedName = solidityType.nestedName(type); | ||
var nestedStaticPartLength = solidityType.staticPartLength(nestedName); | ||
var result = ""; | ||
for (var i = 0; i < encoded.length; i++) { | ||
// calculate length of previous item | ||
if(mode === encodingMode.dynamic){ | ||
previousLength += +(encoded[i - 1])[0] || 0; | ||
} | ||
else if(mode === encodingMode.static){ | ||
previousLength += +(encoded[i - 1] || [])[0] || 0; | ||
} | ||
result += f.formatInputInt(offset + i * nestedStaticPartLength + previousLength * 32).encode(); | ||
} | ||
} | ||
if (solidityType.isDynamicArray(nestedName)) { | ||
(function () { | ||
var previousLength = 0; // in int | ||
for (var i = 0; i < encoded.length; i++) { | ||
// calculate length of previous item | ||
previousLength += +(encoded[i - 1] || [])[0] || 0; | ||
result += f.formatInputInt(offset + i * nestedStaticPartLength + previousLength * 32).encode(); | ||
} | ||
})(); | ||
var len= (mode === encodingMode.dynamic ? encoded.length-1 : encoded.length); | ||
for (var c = 0; c < len; c++) { | ||
var additionalOffset = result / 2; | ||
if(mode === encodingMode.dynamic){ | ||
result += self.encodeWithOffset(nestedName, solidityType, encoded[c + 1], offset + additionalOffset); | ||
} | ||
else if(mode === encodingMode.static){ | ||
result += self.encodeWithOffset(nestedName, solidityType, encoded[c], offset + additionalOffset); | ||
} | ||
} | ||
(function () { | ||
for (var i = 0; i < encoded.length; i++) { | ||
var additionalOffset = result / 2; | ||
result += self.encodeWithOffset(nestedName, solidityType, encoded[i], offset + additionalOffset); | ||
} | ||
})(); | ||
return result; | ||
})(); | ||
return result; | ||
} | ||
@@ -199,2 +182,3 @@ | ||
/** | ||
@@ -201,0 +185,0 @@ * Should be used to decode bytes to plain param |
@@ -526,3 +526,3 @@ /* | ||
var isObject = function (object) { | ||
return object !== null && !(object instanceof Array) && typeof object === 'object'; | ||
return object !== null && !(Array.isArray(object)) && typeof object === 'object'; | ||
}; | ||
@@ -549,3 +549,3 @@ | ||
var isArray = function (object) { | ||
return object instanceof Array; | ||
return Array.isArray(object); | ||
}; | ||
@@ -552,0 +552,0 @@ |
{ | ||
"version": "0.20.1" | ||
"version": "0.20.2" | ||
} |
@@ -1,3 +0,1 @@ | ||
'use strict' | ||
/* | ||
@@ -26,2 +24,5 @@ This file is part of web3.js. | ||
'use strict'; | ||
var utils = require('../utils/utils'); | ||
@@ -28,0 +29,0 @@ var config = require('../utils/config'); |
/* jshint ignore:start */ | ||
Package.describe({ | ||
name: 'ethereum:web3', | ||
version: '0.20.1', | ||
version: '0.20.2', | ||
summary: 'Ethereum JavaScript API, middleware to talk to a ethreum node over RPC', | ||
@@ -6,0 +6,0 @@ git: 'https://github.com/ethereum/ethereum.js', |
{ | ||
"name": "web3", | ||
"namespace": "ethereum", | ||
"version": "0.20.1", | ||
"version": "0.20.2", | ||
"description": "Ethereum JavaScript API, middleware to talk to a ethereum node over RPC", | ||
@@ -43,3 +43,3 @@ "main": "./index.js", | ||
"lint": "jshint *.js lib", | ||
"test": "mocha", | ||
"test": "mocha; jshint *.js lib", | ||
"test-coveralls": "istanbul cover _mocha -- -R spec && cat coverage/lcov.info | coveralls --verbose" | ||
@@ -88,3 +88,4 @@ }, | ||
], | ||
"license": "LGPL-3.0" | ||
} |
@@ -36,2 +36,8 @@ # Migration 0.13.0 -> 0.14.0 | ||
### Yarn | ||
```bash | ||
yarn add web3 | ||
``` | ||
### Meteor.js | ||
@@ -68,5 +74,16 @@ | ||
```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: | ||
@@ -109,2 +126,13 @@ | ||
### 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 | ||
@@ -122,2 +150,1 @@ [npm-url]: https://npmjs.org/package/web3 | ||
[waffle-url]: https://waffle.io/ethereum/web3.js | ||
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
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
NPM Shrinkwrap
Supply chain riskPackage contains a shrinkwrap file. This may allow the package to bypass normal install procedures.
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
3024011
157
32457
147
1
2