Skip to content

Commit

Permalink
Resolving ENS address on submission
Browse files Browse the repository at this point in the history
  • Loading branch information
corydickson committed Mar 31, 2020
1 parent 0c5c9e8 commit 809003d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion injector.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
Expand Down

0 comments on commit 809003d

Please sign in to comment.