Closed JAtoms closed 2 years ago
@JAtoms It is not possible to get the private keys. That defeats the purpose of WalletConnect. Please take a look at this thread: https://github.com/RootSoft/walletconnect-dart-sdk/issues/45#issuecomment-1157698146
Thanks, @RootSoft for the quick response. The use of the private key in Web3Dart actually made me file this issue. In Web3Dart I'd have to manually input the private key. Could there be another way around this, I am curious to learn. Below is the way it got stated in web3Dart docus.
var ethClient = Web3Client(apiUrl, httpClient);
var credentials = ethClient.credentialsFromPrivateKey("0x...");
await client.sendTransaction( credentials, Transaction( to: EthereumAddress.fromHex('0xC91...3706'), gasPrice: EtherAmount.inWei(BigInt.one), maxGas: 100000, value: EtherAmount.fromUnitAndValue(EtherUnit.ether, 1), ), );
@JAtoms
WalletConnect bridges between your dApp and wallet, so your private keys are not exposed outside the wallet.
Here's some example code:
final provider = EthereumWalletConnectProvider(connector);
final ethereum = Web3Client('https://ropsten.infura.io/', Client());
final sender = EthereumAddress.fromHex(session.accounts[0]);
final transaction = Transaction(
to: sender,
from: sender,
gasPrice: EtherAmount.inWei(BigInt.one),
maxGas: 100000,
value: EtherAmount.fromUnitAndValue(EtherUnit.finney, 1),
);
final credentials = WalletConnectEthereumCredentials(provider: provider);
// Send the transaction
final txBytes = await ethereum.sendTransaction(credentials, transaction);
walletconnect_qr_code_modal WalletConnectEthereumCredentials
Could it be possible to get private keys as well when connected to Metamask or Trust Wallet?
Secondly, Sending transactions is quite not clear. I'd like to send transactions together with an ABI function, how can that be done?