From 809003d97f3a8e6e0a6cea3406812fea780cae8d Mon Sep 17 00:00:00 2001 From: cd10012 Date: Mon, 30 Mar 2020 23:51:47 -0400 Subject: [PATCH] Resolving ENS address on submission --- injector.js | 10 +++++++++- server.js | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/injector.js b/injector.js index 2af6d5868..328f4f4c6 100644 --- a/injector.js +++ b/injector.js @@ -31,6 +31,11 @@ let getBytecode = async function(web3, address) { return await web3.eth.getCode(address) }; +let resolveAddress = async function (web3, address) { + console.log("Resolving ENS address at " + address + "to ethereum account...") + return await web3.eth.ens.getAddress(address) +} + let cborDecode = function(bytecode) { let cborLength = bytecode[bytecode.length - 2] * 0x100 + bytecode[bytecode.length - 1] @@ -163,8 +168,11 @@ let storeData = function(repository, chain, address, compilationResult, sources) } } -exports.inject = async function(repository, chain, address, files) { +exports.inject = async function(repository, chain, address, isENS, files) { if (address) { + if (isENS) { + address = resolveAddress(address) + } address = Web3.utils.toChecksumAddress(address) } let metadata = findMetadataFile(files) diff --git a/server.js b/server.js index e5be546e8..58da55efe 100644 --- a/server.js +++ b/server.js @@ -40,6 +40,7 @@ app.post('/', (req, res) => { repository, req.body.chain, req.body.address, + req.body.isENS, files ).then(result => { res.status(200).send({ result })