Skip to content

Instantly share code, notes, and snippets.

@ferni
ferni / fix-web3-sha3.js
Created December 17, 2016 14:19
Fixes web3.sha3 leading '0x' compatibility issue between <= 0.15 and >= 0.16 versions
var Web3 = require('web3');
var web3 = new Web3();
function fixSha3(web3) {
var original = web3.sha3;
web3.sha3 = function() {
var result = original.apply(this, arguments);
if (result[1] !== 'x') {
return '0x' + result;
}
Verifying I am +ferni on my passcard. https://onename.com/ferni