sendTransaction method

Future<String> sendTransaction(
  1. String toAddress,
  2. String amount
)

Implementation

Future<String> sendTransaction(String toAddress, String amount) async {
  final transaction = Transaction(
    to: EthereumAddress.fromHex(toAddress),
    from: EthereumAddress.fromHex(account!),
    value: EtherAmount.fromUnitAndValue(
      EtherUnit.wei,
      BigInt.from(double.parse(amount) * pow(10, 18)),
    ),
  );
  var httpClient = Client();
  Credentials cred = CustomCredentials(walletConnect);
  var ethClient = Web3Client(apiUrl, httpClient);
  final txBytes = await ethClient.sendTransaction(cred, transaction);
  return txBytes;
}