From 7ffb7712812af0bd4ea1683433d9217801921dd4 Mon Sep 17 00:00:00 2001 From: noelyoo Date: Wed, 19 Sep 2018 22:29:11 +0900 Subject: [PATCH] Refactor buffer constructor --- src/universal-dapp.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/universal-dapp.js b/src/universal-dapp.js index 2982ede212..99cdc0ea6e 100644 --- a/src/universal-dapp.js +++ b/src/universal-dapp.js @@ -83,7 +83,7 @@ UniversalDApp.prototype.resetAPI = function (transactionContextAPI) { UniversalDApp.prototype.createVMAccount = function (privateKey, balance, cb) { this._addAccount(privateKey, balance) executionContext.vm().stateManager.cache.flush(function () {}) - privateKey = new Buffer(privateKey, 'hex') + privateKey = Buffer.from(privateKey, 'hex') cb(null, '0x' + ethJSUtil.privateToAddress(privateKey).toString('hex')) } @@ -118,7 +118,7 @@ UniversalDApp.prototype._addAccount = function (privateKey, balance) { } if (self.accounts) { - privateKey = new Buffer(privateKey, 'hex') + privateKey = Buffer.from(privateKey, 'hex') var address = ethJSUtil.privateToAddress(privateKey) // FIXME: we don't care about the callback, but we should still make this proper @@ -165,7 +165,7 @@ UniversalDApp.prototype.getBalance = function (address, cb) { return cb('No accounts?') } - executionContext.vm().stateManager.getAccountBalance(new Buffer(address, 'hex'), function (err, res) { + executionContext.vm().stateManager.getAccountBalance(Buffer.from(address, 'hex'), function (err, res) { if (err) { cb('Account not found') } else {