How to use the @celo/contractkit/lib/identity.IdentityMetadataWrapper.fromFile 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 / cli / src / commands / account / show-metadata.ts View on Github external
async run() {
    const res = this.parse(ShowMetadata)
    const metadata = IdentityMetadataWrapper.fromFile(res.args.file)
    console.info(`Metadata at ${res.args.file} contains the following claims: \n`)
    displayMetadata(metadata)
  }
}
github celo-org / celo-monorepo / packages / cli / src / utils / identity.ts View on Github external
export const modifyMetadata = async (
  filePath: string,
  operation: (metadata: IdentityMetadataWrapper) => Promise
) => {
  const metadata = IdentityMetadataWrapper.fromFile(filePath)
  await operation(metadata)
  writeFileSync(filePath, metadata.toString())
}
github celo-org / celo-monorepo / packages / cli / src / utils / identity.ts View on Github external
protected readMetadata = () => {
    const { args } = this.parse(this.self)
    const filePath = args.file
    try {
      cli.action.start(`Read Metadata from ${filePath}`)
      const data = IdentityMetadataWrapper.fromFile(filePath)
      cli.action.stop()
      return data
    } catch (error) {
      cli.action.stop(`Error: ${error}`)
      throw error
    }
  }