From 64c13f4e1a5ae7688e9d2a173842c355512ad70e Mon Sep 17 00:00:00 2001 From: Antoine Toulme Date: Thu, 12 Jul 2018 10:44:38 +0200 Subject: [PATCH] Move to web3 1.0 --- lib/txutils.js | 8 ++------ package.json | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/txutils.js b/lib/txutils.js index 1e921cd7..cd9e6437 100644 --- a/lib/txutils.js +++ b/lib/txutils.js @@ -1,7 +1,5 @@ var Transaction = require('ethereumjs-tx'); -var coder = require('web3/lib/solidity/coder'); -// When updating to web3 1.0.0, replace by -// var coder = require('web3-eth-abi'); +var coder = require('web3-eth-abi'); var rlp = require('rlp'); var CryptoJS = require('crypto-js'); @@ -32,9 +30,7 @@ function _encodeFunctionTxData (functionName, types, args) { var fullName = functionName + '(' + types.join() + ')'; var signature = CryptoJS.SHA3(fullName, { outputLength: 256 }).toString(CryptoJS.enc.Hex).slice(0, 8); - var dataHex = '0x' + signature + coder.encodeParams(types, args); -// When updating to web3 1.0.0, replace by -// var dataHex = coder.encodeFunctionSignature(fullName) + coder.encodeParameters(types, args).replace('0x','') + var dataHex = coder.encodeFunctionSignature(fullName) + coder.encodeParameters(types, args).replace('0x','') return dataHex; } diff --git a/package.json b/package.json index f64ae2fd..43b69665 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "rlp": "^2.0.0", "scrypt-async": "^1.2.0", "tweetnacl": "0.13.2", - "web3": "0.20.2" + "web3": "1.0.0-beta.34" }, "devDependencies": { "async": "^1.4.2",