Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
lst.forEach(async (a) => {
try {
const url = await accounts.getMetadataURL(a)
console.log(a, 'has url', url)
let metadata: IdentityMetadataWrapper
if (url == '') metadata = IdentityMetadataWrapper.fromEmpty(a)
else metadata = await IdentityMetadataWrapper.fetchFromURL(url)
processClaims(kit, a, metadata)
} catch (err) {
console.error('Bad address', a, err.toString())
}
})
}
async function makeMetadata(testnet: string, address: string, index: number) {
const attestationServiceClaim = createAttestationServiceURLClaim(
getAttestationServiceUrl(testnet, index)
)
const nameClaim = createNameClaim(`Validator ${index} on ${testnet}: ${address}`)
const fileName = `validator-${testnet}-${address}-metadata.json`
const filePath = `/tmp/${fileName}`
const metadata = IdentityMetadataWrapper.fromEmpty()
metadata.addClaim(nameClaim)
metadata.addClaim(attestationServiceClaim)
writeFileSync(filePath, metadata.toString())
await uploadFileToGoogleStorage(
filePath,
CLABS_VALIDATOR_METADATA_BUCKET,
`${testnet}/${fileName}`,
false,
'application/json'
)
}
async run() {
const { args } = this.parse(CreateMetadata)
const metadata = new IdentityMetadataWrapper(IdentityMetadataWrapper.fromEmpty())
writeFileSync(args.file, metadata.toString())
}
}