Browse Source

Merge commit 'e9ebbb67c4289d15b5f3dff6ca9a31025b6b0a04' into web3.js-v3.1

cl-refactor
Marek Kotewicz 10 years ago
parent
commit
73e2797da6
  1. 2
      libjsqrc/ethereumjs/bower.json
  2. 37
      libjsqrc/ethereumjs/dist/web3-light.js
  3. 8
      libjsqrc/ethereumjs/dist/web3-light.js.map
  4. 4
      libjsqrc/ethereumjs/dist/web3-light.min.js
  5. 37
      libjsqrc/ethereumjs/dist/web3.js
  6. 8
      libjsqrc/ethereumjs/dist/web3.js.map
  7. 4
      libjsqrc/ethereumjs/dist/web3.min.js
  8. 9
      libjsqrc/ethereumjs/lib/solidity/coder.js
  9. 26
      libjsqrc/ethereumjs/lib/solidity/formatters.js
  10. 2
      libjsqrc/ethereumjs/lib/version.json
  11. 2
      libjsqrc/ethereumjs/package.js
  12. 2
      libjsqrc/ethereumjs/package.json
  13. 9
      libjsqrc/ethereumjs/test/coder.decodeParam.js
  14. 9
      libjsqrc/ethereumjs/test/coder.encodeParam.js

2
libjsqrc/ethereumjs/bower.json

@ -1,7 +1,7 @@
{
"name": "web3",
"namespace": "ethereum",
"version": "0.3.1",
"version": "0.3.2",
"description": "Ethereum Compatible JavaScript API",
"main": [
"./dist/web3.js",

37
libjsqrc/ethereumjs/dist/web3-light.js

@ -433,8 +433,15 @@ var coder = new SolidityCoder([
}),
new SolidityType({
name: 'bytes',
match: 'prefix',
match: 'strict',
mode: 'bytes',
inputFormatter: f.formatInputDynamicBytes,
outputFormatter: f.formatOutputDynamicBytes
}),
new SolidityType({
name: 'bytes',
match: 'prefix',
mode: 'value',
inputFormatter: f.formatInputBytes,
outputFormatter: f.formatOutputBytes
}),
@ -510,6 +517,18 @@ var formatInputInt = function (value) {
* @returns {SolidityParam}
*/
var formatInputBytes = function (value) {
var result = utils.fromAscii(value, c.ETH_PADDING).substr(2);
return new SolidityParam(result);
};
/**
* Formats input value to byte representation of string
*
* @method formatInputDynamicBytes
* @param {String}
* @returns {SolidityParam}
*/
var formatInputDynamicBytes = function (value) {
var result = utils.fromAscii(value, c.ETH_PADDING).substr(2);
return new SolidityParam('', formatInputInt(value.length).value, result);
};
@ -620,6 +639,18 @@ var formatOutputBool = function (param) {
* @returns {String} ascii string
*/
var formatOutputBytes = function (param) {
// length might also be important!
return utils.toAscii(param.value);
};
/**
* Should be used to format output string
*
* @method formatOutputDynamicBytes
* @param {SolidityParam} left-aligned hex representation of string
* @returns {String} ascii string
*/
var formatOutputDynamicBytes = function (param) {
// length might also be important!
return utils.toAscii(param.suffix);
};
@ -639,6 +670,7 @@ var formatOutputAddress = function (param) {
module.exports = {
formatInputInt: formatInputInt,
formatInputBytes: formatInputBytes,
formatInputDynamicBytes: formatInputDynamicBytes,
formatInputBool: formatInputBool,
formatInputReal: formatInputReal,
formatOutputInt: formatOutputInt,
@ -647,6 +679,7 @@ module.exports = {
formatOutputUReal: formatOutputUReal,
formatOutputBool: formatOutputBool,
formatOutputBytes: formatOutputBytes,
formatOutputDynamicBytes: formatOutputDynamicBytes,
formatOutputAddress: formatOutputAddress
};
@ -1361,7 +1394,7 @@ module.exports = {
},{"bignumber.js":"bignumber.js"}],9:[function(require,module,exports){
module.exports={
"version": "0.3.1"
"version": "0.3.2"
}
},{}],10:[function(require,module,exports){

8
libjsqrc/ethereumjs/dist/web3-light.js.map

File diff suppressed because one or more lines are too long

4
libjsqrc/ethereumjs/dist/web3-light.min.js

File diff suppressed because one or more lines are too long

37
libjsqrc/ethereumjs/dist/web3.js

@ -433,8 +433,15 @@ var coder = new SolidityCoder([
}),
new SolidityType({
name: 'bytes',
match: 'prefix',
match: 'strict',
mode: 'bytes',
inputFormatter: f.formatInputDynamicBytes,
outputFormatter: f.formatOutputDynamicBytes
}),
new SolidityType({
name: 'bytes',
match: 'prefix',
mode: 'value',
inputFormatter: f.formatInputBytes,
outputFormatter: f.formatOutputBytes
}),
@ -510,6 +517,18 @@ var formatInputInt = function (value) {
* @returns {SolidityParam}
*/
var formatInputBytes = function (value) {
var result = utils.fromAscii(value, c.ETH_PADDING).substr(2);
return new SolidityParam(result);
};
/**
* Formats input value to byte representation of string
*
* @method formatInputDynamicBytes
* @param {String}
* @returns {SolidityParam}
*/
var formatInputDynamicBytes = function (value) {
var result = utils.fromAscii(value, c.ETH_PADDING).substr(2);
return new SolidityParam('', formatInputInt(value.length).value, result);
};
@ -620,6 +639,18 @@ var formatOutputBool = function (param) {
* @returns {String} ascii string
*/
var formatOutputBytes = function (param) {
// length might also be important!
return utils.toAscii(param.value);
};
/**
* Should be used to format output string
*
* @method formatOutputDynamicBytes
* @param {SolidityParam} left-aligned hex representation of string
* @returns {String} ascii string
*/
var formatOutputDynamicBytes = function (param) {
// length might also be important!
return utils.toAscii(param.suffix);
};
@ -639,6 +670,7 @@ var formatOutputAddress = function (param) {
module.exports = {
formatInputInt: formatInputInt,
formatInputBytes: formatInputBytes,
formatInputDynamicBytes: formatInputDynamicBytes,
formatInputBool: formatInputBool,
formatInputReal: formatInputReal,
formatOutputInt: formatOutputInt,
@ -647,6 +679,7 @@ module.exports = {
formatOutputUReal: formatOutputUReal,
formatOutputBool: formatOutputBool,
formatOutputBytes: formatOutputBytes,
formatOutputDynamicBytes: formatOutputDynamicBytes,
formatOutputAddress: formatOutputAddress
};
@ -1361,7 +1394,7 @@ module.exports = {
},{"bignumber.js":"bignumber.js"}],9:[function(require,module,exports){
module.exports={
"version": "0.3.1"
"version": "0.3.2"
}
},{}],10:[function(require,module,exports){

8
libjsqrc/ethereumjs/dist/web3.js.map

File diff suppressed because one or more lines are too long

4
libjsqrc/ethereumjs/dist/web3.min.js

File diff suppressed because one or more lines are too long

9
libjsqrc/ethereumjs/lib/solidity/coder.js

@ -297,8 +297,15 @@ var coder = new SolidityCoder([
}),
new SolidityType({
name: 'bytes',
match: 'prefix',
match: 'strict',
mode: 'bytes',
inputFormatter: f.formatInputDynamicBytes,
outputFormatter: f.formatOutputDynamicBytes
}),
new SolidityType({
name: 'bytes',
match: 'prefix',
mode: 'value',
inputFormatter: f.formatInputBytes,
outputFormatter: f.formatOutputBytes
}),

26
libjsqrc/ethereumjs/lib/solidity/formatters.js

@ -50,6 +50,18 @@ var formatInputInt = function (value) {
* @returns {SolidityParam}
*/
var formatInputBytes = function (value) {
var result = utils.fromAscii(value, c.ETH_PADDING).substr(2);
return new SolidityParam(result);
};
/**
* Formats input value to byte representation of string
*
* @method formatInputDynamicBytes
* @param {String}
* @returns {SolidityParam}
*/
var formatInputDynamicBytes = function (value) {
var result = utils.fromAscii(value, c.ETH_PADDING).substr(2);
return new SolidityParam('', formatInputInt(value.length).value, result);
};
@ -160,6 +172,18 @@ var formatOutputBool = function (param) {
* @returns {String} ascii string
*/
var formatOutputBytes = function (param) {
// length might also be important!
return utils.toAscii(param.value);
};
/**
* Should be used to format output string
*
* @method formatOutputDynamicBytes
* @param {SolidityParam} left-aligned hex representation of string
* @returns {String} ascii string
*/
var formatOutputDynamicBytes = function (param) {
// length might also be important!
return utils.toAscii(param.suffix);
};
@ -179,6 +203,7 @@ var formatOutputAddress = function (param) {
module.exports = {
formatInputInt: formatInputInt,
formatInputBytes: formatInputBytes,
formatInputDynamicBytes: formatInputDynamicBytes,
formatInputBool: formatInputBool,
formatInputReal: formatInputReal,
formatOutputInt: formatOutputInt,
@ -187,6 +212,7 @@ module.exports = {
formatOutputUReal: formatOutputUReal,
formatOutputBool: formatOutputBool,
formatOutputBytes: formatOutputBytes,
formatOutputDynamicBytes: formatOutputDynamicBytes,
formatOutputAddress: formatOutputAddress
};

2
libjsqrc/ethereumjs/lib/version.json

@ -1,3 +1,3 @@
{
"version": "0.3.1"
"version": "0.3.2"
}

2
libjsqrc/ethereumjs/package.js

@ -1,7 +1,7 @@
/* jshint ignore:start */
Package.describe({
name: 'ethereum:web3',
version: '0.3.1',
version: '0.3.2',
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.

2
libjsqrc/ethereumjs/package.json

@ -1,7 +1,7 @@
{
"name": "web3",
"namespace": "ethereum",
"version": "0.3.1",
"version": "0.3.2",
"description": "Ethereum JavaScript API, middleware to talk to a ethereum node over RPC",
"main": "./index.js",
"directories": {

9
libjsqrc/ethereumjs/test/coder.decodeParam.js

@ -3,9 +3,12 @@ var assert = chai.assert;
var coder = require('../lib/solidity/coder');
var tests = [
{ type: 'int', value: '0000000000000000000000000000000000000000000000000000000000000001', expected: 1},
{ type: 'int', value: '0000000000000000000000000000000000000000000000000000000000000010', expected: 16},
{ type: 'int', value: 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', expected: -1}
{ type: 'int', value: '0000000000000000000000000000000000000000000000000000000000000001', expected: 1},
{ type: 'int', value: '0000000000000000000000000000000000000000000000000000000000000010', expected: 16},
{ type: 'int', value: 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', expected: -1},
{ type: 'bytes32', value: '6761766f66796f726b0000000000000000000000000000000000000000000000', expected: 'gavofyork'},
{ type: 'bytes', value: '0000000000000000000000000000000000000000000000000000000000000009' +
'6761766f66796f726b0000000000000000000000000000000000000000000000', expected: 'gavofyork'}
];
describe('lib/solidity/coder', function () {

9
libjsqrc/ethereumjs/test/coder.encodeParam.js

@ -3,9 +3,12 @@ var assert = chai.assert;
var coder = require('../lib/solidity/coder');
var tests = [
{ type: 'int', value: 1, expected: '0000000000000000000000000000000000000000000000000000000000000001'},
{ type: 'int', value: 16, expected: '0000000000000000000000000000000000000000000000000000000000000010'},
{ type: 'int', value: -1, expected: 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'}
{ type: 'int', value: 1, expected: '0000000000000000000000000000000000000000000000000000000000000001'},
{ type: 'int', value: 16, expected: '0000000000000000000000000000000000000000000000000000000000000010'},
{ type: 'int', value: -1, expected: 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'},
{ type: 'bytes32', value: 'gavofyork', expected: '6761766f66796f726b0000000000000000000000000000000000000000000000'},
{ type: 'bytes', value: 'gavofyork', expected: '0000000000000000000000000000000000000000000000000000000000000009' +
'6761766f66796f726b0000000000000000000000000000000000000000000000'}
];
describe('lib/solidity/coder', function () {

Loading…
Cancel
Save