-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ERROR] "Missing provider" when calling ethrDid.setAttribute #81
Comments
Thank you for such a detailed report! I'm unable to verify right now, but it seems like you stumbled upon a bug. I think there might be an internal mismatch happening |
Hi, thank you for the answer! Web3HttpProvider: same procedure same errorI observed that the same error rises even if I use the const Web3HttpProvider = require('web3-providers-http')
const web3Url = config["localhost"]+":"+config["port"]
const web3Provider = new Web3HttpProvider(web3Url)
const ethrsprovider = new ethers.providers.Web3Provider(web3Provider)
const identifier = `did:ethr:${config["chainId"]}:0x1234...`
const aliceDid = await new EthrDID({
identifier: identifier,
registry: registryAddress, // registry contract deployed to ganache
provider: ethrsprovider,
chainNameOrId: config["chainId"], // ganache network id
privateKey: myPrivateKey,
})
await aliceDid.setAttribute('did/pub/Ed25519/veriKey/base64', "...") // <== !!! rises "missing provider error" !!! Web3HttpProvider: providing signer fixesHowever, providing the //
// [same code as above]
//
const didJwt = require("did-jwt")
const signer = didJwt.ES256KSigner(myPrivateKey, true)
const aliceDid = await new EthrDID({
identifier: identifier,
registry: registryAddress, // registry contract deployed to ganache
provider: ethrsprovider,
chainNameOrId: config["chainId"], // ganache network id
// privateKey: myPrivateKey,
signer: signer // new
})
await aliceDid.setAttribute('did/pub/Ed25519/veriKey/base64', "...") // <== works as intended InfuraProvider: providing signer gives another errorAlbeit this works for import { EthrDID } from "ethr-did";
import { InfuraProvider } from "@ethersproject/providers";
import { ES256KSigner } from "did-jwt";
const infuraProjectId = "abcde"
const myRopstenAddress = "0x..."
const pk = "123456789" // Private key of the address above
const signer = ES256KSigner(pk, true)
async function foo() {
const chainNameOrId = "ropsten"
const infura = new InfuraProvider("ropsten", infuraProjectId)
const ethrDid = new EthrDID({identifier: "did:ethr:ropsten:"+myRopstenAddress, signer: signer, provider: infura, chainNameOrId})
await ethrDid.setAttribute('did/svc/HubService', 'https://hubs.uport.me', 3600) // <== !!! rises "API provider does not support signing" !!!
}
// Execute
foo() Error details: https://gist.github.com/0Alic/717224c842031a17d9f9f86a5ce700f0 Hope I am not doing mistakes. |
@0Alic I've been trying to debug the missing provider error based on your very detailed reports (thank you for that!) There is a fix for the missing provider error, but it leads me to a new, even weirder error which is still blocking me (something about not detecting the network, similar to this). You are on the right track with your last 2 examples.
import { Wallet } from '@ethersproject/wallet'
/// ...
const txSigner = new Wallet(privateKey, infura)
const ethrDid = new EthrDID({identifier: "did:ethr:ropsten:"+myRopstenAddress, signer: signer, txSigner: txSigner, provider: infura, chainNameOrId}) |
Here is a sample that works for me: import { EthrDID } from "ethr-did";
import { InfuraProvider } from "@ethersproject/providers";
import { Wallet } from "@ethersproject/wallet"
const infuraProjectId = "...."
const { privateKey, address } = EthrDID.createKeyPair()
async function foo() {
const chainNameOrId = 3 // or "ropsten"
const provider = new InfuraProvider(3 /* or "ropsten"*/, infuraProjectId)
const txSigner = new Wallet(privateKey, provider)
const ethrDid = new EthrDID({
identifier: address,
txSigner,
provider,
chainNameOrId,
})
// throws INSUFFICIENT_FUNDS which means the transaction attempt is made
await ethrDid.setAttribute('did/svc/HubService', 'https://hubs.uport.me', 3600, 123456)
}
// Execute
foo() |
This seems to have no recent activity so I will assume it was solved. |
@mirceanis I tried your last given code with the dummy account address and private key, it shows insufficient funds but yes the attempt was made. The console just kind of hangs there. |
@mirceanis I also tried to check whether there was any transaction on etherscan for my ethereum address, but got nothing. |
@mirceanis I've figured out that if I do the same transaction on the front end using meta mask, I have to adjust the gas fee to make the transaction successful. Please how to set the gas Price in the setAttribute function, I checked this closed issue , here you've told how to set the gas Price and gas Limit but now the function doesn't support the gas Price parameter it accepts only gasLimit Parameter . |
@Touseef-md you can use the In the sample code from above, this would look like this: // ...
await ethrDid.setAttribute('did/svc/HubService', 'https://hubs.uport.me', 3600, 123456, {
gasLimit: 100000, // this overrides the `gasLimit` specified as a direct parameter 123456
gasPrice: 1000000000 // 1 gwei
}) See about call overrides and Transaction request to get an idea about what you can override. |
was this ever resolved, if yes can anyone share the solution again for reference. I am still getting the |
I'm getting the same error ( |
There is probably something wrong with the new "multi-network" setup. I was able to solve my issue, by using old config format: simonas-notcat/veramo-ethr@83b8feb#diff-bfe5fcdcbcc5b806d61f26909a1ef6cc3b98d63016e6243c3f0326ec4d28be73 |
I got the same error in goerli. node -v
|
Hello, I just approached this library and I have this issue that I cannot solve. Sorry if I am missing a very basic step.
Current Behavior
I create a ethrDid object using the ethrs InfuraProvider as explained here. I provide the private key of one of my Ropsten addresses.
If I call ethrDid.setAttribute() (or any other transaction) I get the error "Missing provider".
Expected Behavior
Execute the ethrDid.setAttribute() function.
Failure Information
reason: 'missing provider',
code: 'UNSUPPORTED_OPERATION',
operation: 'sendTransaction'
(more details below)
Steps to Reproduce
Environment Details
"@ethersproject/providers": "^5.5.0",
"@types/node": "^17.0.2",
"did-jwt": "^5.11.1",
"did-resolver": "^3.1.3",
"ethr-did": "^2.1.5",
"ethr-did-registry": "^0.0.3",
"ethr-did-resolver": "^5.0.2",
"ts-node": "^10.4.0",
"typescript": "^4.5.4",
Failure Logs/Screenshots
https://gist.github.com/0Alic/feb5b04fc05e76bf358c8d81114b228c
Thank you in advance.
The text was updated successfully, but these errors were encountered: