hashgraph / hashgraph/did-sdk-js

CREATE did transaction throws timeout error

Open
#71 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
43
Forks
21
PR merge metrics
No merged PRs in 30d

Description

### Description

This is the error:
```
Error subscribing to topic 0.0.34026405 during attempt 0. Waiting 250 ms before next attempt: Topic 0.0.34026405 does not exist
/home/nicola/hdid/node_modules/@hashgraph/did-sdk-js/dist/identity/hcs/message-transaction.js:49
throw new Error(err.message);
^

Error: timeout exceeded
at HcsDidTransaction.handleError (/home/nicola/hdid/node_modules/@hashgraph/did-sdk-js/dist/identity/hcs/message-transaction.js:49:19)
at HcsDidTransaction. (/home/nicola/hdid/node_modules/@hashgraph/did-sdk-js/dist/identity/hcs/message-transaction.js:161:22)
at Generator.throw ()
at rejected (/home/nicola/hdid/node_modules/@hashgraph/did-sdk-js/dist/identity/hcs/message-transaction.js:6:65)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
```

This is the code that allows to reproduce the issue:

```
const { Client, AccountId, PrivateKey, Hbar } = require('@hashgraph/sdk')
const { HcsIdentityNetworkBuilder, DidMethodOperation } = require('@hashgraph/did-sdk-js')

require('dotenv').config()

async function main () {
console.log(process.env.HCLI_MIRROR_PROVIDER)

const client = Client
.forName(process.env.HCLI_NETWORK)
.setOperator(AccountId.fromString(process.env.HCLI_PAYER), PrivateKey.fromString(process.env.HCLI_PAYERPRIVKEY))
.setMirrorNetwork(process.env.HCLI_MIRROR_PROVIDER)

const identityNetwork = await new HcsIdentityNetworkBuilder()
.setNetwork(process.env.HCLI_NETWORK)
.setAppnetName('MyIdentityAppnet')
.addAppnetDidServer('https://appnet-did-server-url:port/path-to-did-api')
.setPublicKey(PrivateKey.fromString(process.env.HCLI_PAYERPRIVKEY).publicKey)
.setMaxTransactionFee(new Hbar(2))
.setDidTopicMemo('MyIdentityAppnet DID topic')
.setVCTopicMemo('MyIdentityAppnet VC topic')
.execute(client)

console.log(identityNetwork)

const did = identityNetwork.generateDid(true)

console.log(did)

const didRootKey = did.getPrivateDidRootKey()

console.log(didRootKey)

const didDocument = did.generateDidDocument()

console.log(didDocument)

await identityNetwork.createDidTransaction(DidMethodOperation.CREATE)
.setDidDocument(JSON.stringify(didDocument))
.signMessage(doc => didRootKey.sign(doc))
.buildAndSignTransaction(tx => tx.setMaxTransactionFee(new Hbar(2)))
.onMessageConfirmed(msg => {
console.log(msg)
})
.execute(client)
}

main()
```

The format of the .env file is:
```
HCLI_PAYER=0.0.xxx
HCLI_PAYERPRIVKEY=yyyyyyyyyyy
HCLI_NETWORK=testnet
HCLI_MIRROR_PROVIDER=hcs.testnet.mirrornode.hedera.com:5600
```

### Steps to reproduce

1. Run the script with the .env file set

### Additional context

_No response_

### Hedera network

testnet

### Version

current testnet version

### Operating system

Linux

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.