cake_wallet/cw_ethereum/lib/pending_ethereum_transaction.dart
OmarHatem 532488960b - Fix extracting Ethereum Private key from seeds
- Integrate signing/sending transaction with the send view model
2023-04-28 05:02:49 +03:00

35 lines
919 B
Dart

import 'dart:typed_data';
import 'package:cw_core/pending_transaction.dart';
import 'package:web3dart/crypto.dart';
import 'package:web3dart/web3dart.dart';
class PendingEthereumTransaction with PendingTransaction {
final Function sendTransaction;
final Uint8List signedTransaction;
final BigInt fee;
final String amount;
PendingEthereumTransaction({
required this.sendTransaction,
required this.signedTransaction,
required this.fee,
required this.amount,
});
@override
String get amountFormatted =>
EtherAmount.inWei(BigInt.parse(amount)).getValueInUnit(EtherUnit.ether).toString();
@override
Future<void> commit() async => sendTransaction();
@override
String get feeFormatted => EtherAmount.inWei(fee).getValueInUnit(EtherUnit.ether).toString();
@override
String get hex => bytesToHex(signedTransaction, include0x: true);
@override
String get id => '';
}