How to use the @celo/contractkit/lib/identity.IdentityMetadataWrapper.fromEmpty function in @celo/contractkit

To help you get started, we’ve selected a few @celo/contractkit examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github celo-org / celo-monorepo / packages / leaderboard / src / board.ts View on Github external
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())
    }
  })
}
github celo-org / celo-monorepo / packages / celotool / src / cmds / deploy / initial / contracts.ts View on Github external
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'
  )
}
github celo-org / celo-monorepo / packages / cli / src / commands / identity / create-metadata.ts View on Github external
async run() {
    const { args } = this.parse(CreateMetadata)
    const metadata = new IdentityMetadataWrapper(IdentityMetadataWrapper.fromEmpty())
    writeFileSync(args.file, metadata.toString())
  }
}