uport-project / ethr-did

Create ethr DIDs
Apache License 2.0
259 stars 53 forks source link

setAttribute - invalid argument 0: hex string has length 0, want 40 for common.Address #57

Closed HBashanaE closed 3 years ago

HBashanaE commented 3 years ago

I was trying to perform CRUD operations on a DID document. When I try to set attribute as it was in the documentation it throws an error Error: [ethjs-query] while formatting outputs from RPC '{"value":{"code":-32602,"message":"invalid argument 0: hex string has length 0, want 40 for common.Address"}}'

This is my code.

const EthrDID = require('ethr-did')
const registerResolver = require('ethr-did-resolver').default
const HttpProvider = require('ethjs-provider-http')

const { address, privateKey } = EthrDID.createKeyPair()
const provider = new HttpProvider('http://127.0.0.1:8545')

const ethrDid = new EthrDID({
    address,
    privateKey,
    provider
})

registerResolver({
    provider,
    registry: '0xdca7ef03e98e0dc2b855be647c39abe984fcf21b'
})
ethrDid.setAttribute('did/svc/HubService', 'https://hubs.uport.me', 10).then(console.log).catch(console.log)

dependencies: "did-jwt": "^4.8.0", "did-resolver": "^2.1.1", "ethjs-provider-http": "^0.1.6", "ethr-did": "^1.1.0", "ethr-did-resolver": "^0.2.0",

Desktop :

Thank you in advance.

uport-automation-bot commented 3 years ago

:tada: This issue has been resolved in version 2.0.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: