From 45c4bc58de93935951218cf35f9fe8c689e53790 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 4 Sep 2019 11:43:51 +0200 Subject: [PATCH] fix checksum address --- remix-simulator/src/methods/accounts.js | 2 +- remix-simulator/src/methods/transactions.js | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/remix-simulator/src/methods/accounts.js b/remix-simulator/src/methods/accounts.js index b0563c7c57..176cd129c4 100644 --- a/remix-simulator/src/methods/accounts.js +++ b/remix-simulator/src/methods/accounts.js @@ -45,7 +45,7 @@ Accounts.prototype.methods = function () { } Accounts.prototype.eth_accounts = function (payload, cb) { - return cb(null, this.accountsList.map((x) => x.address)) + return cb(null, this.accountsList.map((x) => ethJSUtil.toChecksumAddress(x.address))) } Accounts.prototype.eth_getBalance = function (payload, cb) { diff --git a/remix-simulator/src/methods/transactions.js b/remix-simulator/src/methods/transactions.js index 75e82a20d1..b861fc4b3d 100644 --- a/remix-simulator/src/methods/transactions.js +++ b/remix-simulator/src/methods/transactions.js @@ -26,6 +26,10 @@ Transactions.prototype.methods = function () { } Transactions.prototype.eth_sendTransaction = function (payload, cb) { + // from might be lowercased address (web3) + if (payload.params && payload.params.length > 0 && payload.params[0].from) { + payload.params[0].from = ethJSUtil.toChecksumAddress(payload.params[0].from) + } processTx(this.accounts, payload, false, cb) } @@ -70,6 +74,10 @@ Transactions.prototype.eth_getCode = function (payload, cb) { } Transactions.prototype.eth_call = function (payload, cb) { + // from might be lowercased address (web3) + if (payload.params && payload.params.length > 0 && payload.params[0].from) { + payload.params[0].from = ethJSUtil.toChecksumAddress(payload.params[0].from) + } processTx(this.accounts, payload, true, cb) }