Skip to content
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

resolve missing provider error in ethrDid.setAttribute #135

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

humuhimi
Copy link

@humuhimi humuhimi commented Jan 4, 2025

Description of Changes

In the EthrDID class constructor, when the following code executes:

if (conf.privateKey && typeof txSigner === 'undefined') {
    txSigner = new Wallet(conf.privateKey);
}

it causes an error if no provider is set. The issue occurs in node_modules\ethers\src.ts\providers\abstract-signer.ts at:

function checkProvider(signer: AbstractSigner, operation: string): Provider {
    if (signer.provider) { return signer.provider; }
    assert(false, "missing provider", "UNSUPPORTED_OPERATION", { operation });
}

Error Message:

Error: missing provider (operation="sendTransaction", code=UNSUPPORTED_OPERATION, version=abstract-signer/5.5.0)
reason: 'missing provider',
code: 'UNSUPPORTED_OPERATION',
operation: 'sendTransaction'

Fix:

The issue was resolved by modifying the txSigner initialization to include the provider:

txSigner = new Wallet(conf.privateKey, conf.provider || conf.web3?.currentProvider);

Related Issue

#81

This ensures a valid provider is passed, preventing the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant