目前我正在使用 https://pub.dev/packages/web3dart 发送交易包,需要 metaMask 钱包私钥。我怎样才能得到私钥
transactionForAddProduct({String? functionName, var params, Web3Client? web3client}) async {
try {
DeployedContract _contract = await loadContract();
final sendFunction = contract.function(functionName!);
Transaction transaction = Transaction.callContract(
from: EthereumAddress.fromHex("walletAddress"),
contract: _contract,
function: _sendFunction,
parameters: params,
);
var transactionValue = web3client!.sendTransaction(
EthPrivateKey.fromHex("privateKey"),
transaction,
chainId: 80001,
fetchChainIdFromNetworkId: false,
);
print("=====> transaction is ${transactionValue}");
} catch (exception) {
print("=======> exception is ${exception.toString()}");
}
}