add possible 2d topic arrays fixes #175

This commit is contained in:
Fabian Vogelsteller 2015-04-21 20:46:14 +02:00
parent a5c1bcc6e4
commit c8f42262cc
9 changed files with 28 additions and 12 deletions

7
dist/web3-light.js vendored
View File

@ -1134,6 +1134,9 @@ var fromDecimal = function (value) {
var toHex = function (val) { var toHex = function (val) {
/*jshint maxcomplexity:7 */ /*jshint maxcomplexity:7 */
if(val === null || typeof val === 'undefined')
return val;
if (isBoolean(val)) if (isBoolean(val))
return fromDecimal(+val); return fromDecimal(+val);
@ -2320,7 +2323,9 @@ var getOptions = function (options) {
// make sure topics, get converted to hex // make sure topics, get converted to hex
options.topics = options.topics || []; options.topics = options.topics || [];
options.topics = options.topics.map(function(topic){ options.topics = options.topics.map(function(topic){
return utils.toHex(topic); return (utils.isArray(topic))
? topic.map(utils.toHex)
: utils.toHex(topic);
}); });
// lazy load // lazy load

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

7
dist/web3.js vendored
View File

@ -1134,6 +1134,9 @@ var fromDecimal = function (value) {
var toHex = function (val) { var toHex = function (val) {
/*jshint maxcomplexity:7 */ /*jshint maxcomplexity:7 */
if(val === null || typeof val === 'undefined')
return val;
if (isBoolean(val)) if (isBoolean(val))
return fromDecimal(+val); return fromDecimal(+val);
@ -2320,7 +2323,9 @@ var getOptions = function (options) {
// make sure topics, get converted to hex // make sure topics, get converted to hex
options.topics = options.topics || []; options.topics = options.topics || [];
options.topics = options.topics.map(function(topic){ options.topics = options.topics.map(function(topic){
return utils.toHex(topic); return (utils.isArray(topic))
? topic.map(utils.toHex)
: utils.toHex(topic);
}); });
// lazy load // lazy load

6
dist/web3.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/web3.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -198,6 +198,9 @@ var fromDecimal = function (value) {
var toHex = function (val) { var toHex = function (val) {
/*jshint maxcomplexity:7 */ /*jshint maxcomplexity:7 */
if(val === null || typeof val === 'undefined')
return val;
if (isBoolean(val)) if (isBoolean(val))
return fromDecimal(+val); return fromDecimal(+val);

View File

@ -42,7 +42,9 @@ var getOptions = function (options) {
// make sure topics, get converted to hex // make sure topics, get converted to hex
options.topics = options.topics || []; options.topics = options.topics || [];
options.topics = options.topics.map(function(topic){ options.topics = options.topics.map(function(topic){
return utils.toHex(topic); return (utils.isArray(topic))
? topic.map(utils.toHex)
: utils.toHex(topic);
}); });
// lazy load // lazy load

View File

@ -4,6 +4,7 @@ var BigNumber = require('bignumber.js');
var assert = chai.assert; var assert = chai.assert;
var tests = [ var tests = [
{ value: null, expected: null },
{ value: 1, expected: '0x1' }, { value: 1, expected: '0x1' },
{ value: '1', expected: '0x1' }, { value: '1', expected: '0x1' },
{ value: '0x1', expected: '0x1'}, { value: '0x1', expected: '0x1'},