You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I finally managed to find some time to work on this. As discussed in 748, I was able to find a method by which an error message with the blockchain address to fund is delivered when an attempt to add a service to a did:ethr fails.
const returnBlockchainId = async (did:string) => {
//resolves the newly created DID to find the blockchain address
const resolve = await agent.resolveDid({didUrl:did})
const document = resolve.didDocument?.verificationMethod
const blockchainId = document? document[0].blockchainAccountId:""
return blockchainId
}
async function tryToUpdate (options:IDIDManagerAddServiceArgs) {
try {
const result = await agent.didManagerAddService(options)
console.log("Success!")
return result
}
catch(err){
if (err instanceof Error) {
if (err.message.includes("insufficient funds for intrinsic transaction cost"))
{
const address = await returnBlockchainId(options.did)
console.log("insufficient funds on address:" + address)
} else{
console.log(err)
}
}
}
}
async function getAndUpdate() {
const rinkebyAlice = await agent.didManagerGetOrCreate({alias:"testRinkeby"})
tryToUpdate({
did: rinkebyAlice.did,
service: {
id: 'localhost-useless-endpoint',
type: 'DIDComm',
serviceEndpoint: `http://localhost:1/foobar`,
description: 'endpoint ',
},
})
}
getAndUpdate().catch(console.log)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
I finally managed to find some time to work on this. As discussed in 748, I was able to find a method by which an error message with the blockchain address to fund is delivered when an attempt to add a service to a did:ethr fails.
Beta Was this translation helpful? Give feedback.
All reactions