uport-project / ethr-did

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

I need help #82

Closed joeg9soft closed 2 years ago

joeg9soft commented 2 years ago

var provider = new ethers.providers.Web3Provider(new Web3.providers.HttpProvider('http://localhost:8545'),{ chainId: 123456, name: '0x1e240' })

var ethrdid = new EthrDID.EthrDID({ identifier:keypair.identifier, chainNameOrId: 0x1e240, registry: '0x4b0DA3a1a20fc121f586c014170E3a14Cf897011', provider: provider, txSigner: '0xD241B460BD7896b1bDe396a21E3C6248F3C58503', signer: didJWT.ES256KSigner(keypair.privateKey), alg: 'ES256K' })

ethrdid.setAttribute('testkey', 'test') .then(res => console.log('then',res)) .catch(err => console.log('catch',err))

i made EthrDID object and tried to setAttribute. So I got error

reason: 'cannot estimate gas; transaction may fail or may require manual gas limit',
code: 'UNPREDICTABLE_GAS_LIMIT',

And then tried this

let txOptions = { gasLimit: 10000000} or var bn = ethers.BigNumber.from(100000) let txOptions = { gasLimit: bn}

ethrdid.setAttribute('testkey', 'test', txOptions) .then(res => console.log('then',res)) .catch(err => console.log('catch',err))

reason: 'invalid BigNumber value', code: 'INVALID_ARGUMENT',

But both same error... please help me out of this...

joeg9soft commented 2 years ago

var ethrdid = new EthrDID.EthrDID({ rpcUrl: 'http://redcube.pw:8545', chainNameOrId: 123456, txSigner: provider.getSigner(), identifier: keypair.identifier, registry: '0x4b0DA3a1a20fc121f586c014170E3a14Cf897011'})

ethrdid.setAttribute('did/pub/Ed25519/veriKey/base64', 'Arl8MN52fwhM4wgBaO4pMFO6M7I11xFqMmPSnxRQk2tx',360, 500000)

360 is expiresIn 5000000 is gasLimit I resolved