chainInfo fix

This commit is contained in:
Tim
2024-07-11 14:22:51 -04:00
parent 0f3776b0df
commit 675f4b6bec

View File

@@ -15,7 +15,11 @@ const _chains = [
]
for (const chain of _chains) {
const path = `../contract/broadcast/Deploy.sol/${chain.id}/run-latest.json`;
fs.readdir('../contract/broadcast', (err, files) => {
if (err) throw err;
for (const deploymentClassDir of files) {
if (deploymentClassDir.startsWith('Deploy') && deploymentClassDir.endsWith('.sol')) {
const path = `${deploymentClassDir}/${chain.id}/run-latest.json`;
let deployment
try {
deployment = JSON.parse(fs.readFileSync(path, 'utf8')) //null synchronous is ok we only do this once on init
@@ -50,4 +54,8 @@ for (const chain of _chains) {
console.log('VaultFactory', chain.factory)
console.log('QueryHelper', chain.helper)
chainInfo[chain.id] = chain
}
}
});
}