Facing Web3Provider error #1515
-
Failed to initialize Request Network: TypeError: Cannot read properties of undefined (reading 'Web3Provider') async initialize() {
} |
Beta Was this translation helpful? Give feedback.
Answered by
aimensahnoun
Dec 7, 2024
Replies: 1 comment
-
@SamsShow, you need to use the provider that you got from others when creating a new Example: const ethersProvider = new ethers.providers.Web3Provider(walletProvider);
const web3SignatureProvider = new Web3SignatureProvider(
ethersProvider!.provider
); In your case it would be const provider = new ethers.providers.Web3Provider(window.ethereum);
await provider.send("eth_requestAccounts", []);
const signer = provider.getSigner();
// Fixed here
this.signatureProvider = new Web3SignatureProvider(provider.provider);
this.requestClient = new RequestNetwork({
nodeConnectionConfig: {
baseURL: 'https://sepolia.gateway.request.network/',
},
signatureProvider: this.signatureProvider,
});
return this.requestClient;
} catch (error) {
console.error('Failed to initialize Request Network:', error);
throw error;
} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
MantisClone
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@SamsShow, you need to use the provider that you got from others when creating a new
Web3SignatureProvider
, not thewindow. ethereum
directly.Example:
In your case it would be