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
Unable to sign messages using EthereumPrivateKeyProvider.
I'm trying to get Provider (which can sign and send transaction) from private key using @web3auth/ethereum-provider package, but I'm able to get provider but getting error while signing the message using that private key.
To Reproduce
`import { EthereumPrivateKeyProvider } from "@web3auth/ethereum-provider";
import type { SafeEventEmitterProvider } from "@web3auth/base";
const signEthMessage = async (provider: SafeEventEmitterProvider): Promise => {
const web3 = new Web3(provider as any);
const accounts = await web3.eth.getAccounts();
// hex message
const message = "0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad";
const signature = await web3.eth.sign(message, accounts[0]);
return signature;
};
Unable to sign messages using EthereumPrivateKeyProvider.
I'm trying to get Provider (which can sign and send transaction) from private key using
@web3auth/ethereum-provider
package, but I'm able to get provider but getting error while signing the message using that private key.To Reproduce
`import { EthereumPrivateKeyProvider } from "@web3auth/ethereum-provider";
import type { SafeEventEmitterProvider } from "@web3auth/base";
const signEthMessage = async (provider: SafeEventEmitterProvider): Promise => {
const web3 = new Web3(provider as any);
const accounts = await web3.eth.getAccounts();
// hex message
const message = "0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad";
const signature = await web3.eth.sign(message, accounts[0]);
return signature;
};
(async () => {
const provider = await EthereumPrivateKeyProvider.getProviderInstance({
chainConfig: {
rpcTarget: "https://polygon-rpc.com",
chainId: "0x89", // hex chain id
networkName: "matic",
ticker: "matic",
tickerName: "matic",
},
privKey: "4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318",
});
const signedMessage = await signEthMessage(provider);
})();`
Steps to reproduce the behavior:
Expected behavior
it should sign message using private key.
Screenshots
If applicable, add screenshots to help explain your problem.
Screenshots of console logs are welcome
Device Info (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: