Skip to content

Commit

Permalink
generate index.js exports
Browse files Browse the repository at this point in the history
  • Loading branch information
mikec committed Dec 18, 2021
1 parent 8d249d4 commit 25633bf
Show file tree
Hide file tree
Showing 3 changed files with 291 additions and 1 deletion.
24 changes: 24 additions & 0 deletions generateExports.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const fs = require('fs')
const constants = require('./constants')

const contracts = [
['./artifacts/contracts/Account/Account.sol/Account.json', constants.ACCOUNT],
['./artifacts/contracts/Account/AccountFactory.sol/AccountFactory.json', constants.ACCOUNT_FACTORY],
['./artifacts/contracts/Batched/DeployAndCall.sol/DeployAndCall.json', constants.DEPLOY_AND_CALL],
['./artifacts/contracts/Deployers/SaltedDeployer.sol/SaltedDeployer.json', constants.SALTED_DEPLOYER]
]

function generateInterface () {
let contractsJSON = {}
for (let i in contracts) {
const [path, address] = contracts[i]
const { contractName, abi, bytecode, deployedBytecode } = require(path)
contractsJSON[contractName] = { address, abi, bytecode, deployedBytecode }
}
console.log('Writing index.js file...')
fs.writeFileSync('./index.js', `module.exports = ${JSON.stringify(contractsJSON, null, 2)}\n`)
console.log('done')
console.log()
}

generateInterface()
Loading

0 comments on commit 25633bf

Please sign in to comment.