readd topic convertion, add fix

This commit is contained in:
Fabian Vogelsteller 2015-11-24 22:02:57 +01:00
parent 2c7db81ebc
commit 0563dba4ee
7 changed files with 35 additions and 32 deletions

15
dist/web3-light.js vendored
View File

@ -2010,7 +2010,7 @@ var toAscii = function(hex) {
}; };
/** /**
* Should be called to get hex representation (prefixed by 0x) of utf8 string * Should be called to get hex representation (prefixed by 0x) of utf8 a string
* *
* @method fromUtf8 * @method fromUtf8
* @param {String} string * @param {String} string
@ -3760,9 +3760,10 @@ var inputPostFormatter = function(post) {
} }
// format the following options // format the following options
// post.topics = post.topics.map(function(topic){ post.topics = post.topics.map(function(topic){
// return utils.fromUtf8(topic); // convert only if not hex
// }); return (topic.indexOf('0x') === 0) ? topic : utils.fromUtf8(topic);
});
return post; return post;
}; };
@ -3791,9 +3792,9 @@ var outputPostFormatter = function(post){
if (!post.topics) { if (!post.topics) {
post.topics = []; post.topics = [];
} }
// post.topics = post.topics.map(function(topic){ post.topics = post.topics.map(function(topic){
// return utils.toAscii(topic); return utils.toAscii(topic);
// }); });
return post; return post;
}; };

File diff suppressed because one or more lines are too long

15
dist/web3.js vendored
View File

@ -2010,7 +2010,7 @@ var toAscii = function(hex) {
}; };
/** /**
* Should be called to get hex representation (prefixed by 0x) of utf8 string * Should be called to get hex representation (prefixed by 0x) of utf8 a string
* *
* @method fromUtf8 * @method fromUtf8
* @param {String} string * @param {String} string
@ -3760,9 +3760,10 @@ var inputPostFormatter = function(post) {
} }
// format the following options // format the following options
// post.topics = post.topics.map(function(topic){ post.topics = post.topics.map(function(topic){
// return utils.fromUtf8(topic); // convert only if not hex
// }); return (topic.indexOf('0x') === 0) ? topic : utils.fromUtf8(topic);
});
return post; return post;
}; };
@ -3791,9 +3792,9 @@ var outputPostFormatter = function(post){
if (!post.topics) { if (!post.topics) {
post.topics = []; post.topics = [];
} }
// post.topics = post.topics.map(function(topic){ post.topics = post.topics.map(function(topic){
// return utils.toAscii(topic); return utils.toAscii(topic);
// }); });
return post; return post;
}; };

6
dist/web3.js.map vendored

File diff suppressed because one or more lines are too long

10
dist/web3.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -137,7 +137,7 @@ var toAscii = function(hex) {
}; };
/** /**
* Should be called to get hex representation (prefixed by 0x) of utf8 string * Should be called to get hex representation (prefixed by 0x) of utf8 a string
* *
* @method fromUtf8 * @method fromUtf8
* @param {String} string * @param {String} string

View File

@ -220,9 +220,10 @@ var inputPostFormatter = function(post) {
} }
// format the following options // format the following options
// post.topics = post.topics.map(function(topic){ post.topics = post.topics.map(function(topic){
// return utils.fromUtf8(topic); // convert only if not hex
// }); return (topic.indexOf('0x') === 0) ? topic : utils.fromUtf8(topic);
});
return post; return post;
}; };
@ -251,9 +252,9 @@ var outputPostFormatter = function(post){
if (!post.topics) { if (!post.topics) {
post.topics = []; post.topics = [];
} }
// post.topics = post.topics.map(function(topic){ post.topics = post.topics.map(function(topic){
// return utils.toAscii(topic); return utils.toAscii(topic);
// }); });
return post; return post;
}; };