mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-11-01 07:04:08 +01:00
52 lines
1.1 KiB
Dart
52 lines
1.1 KiB
Dart
import 'package:cw_core/pending_transaction.dart';
|
|
|
|
class PendingSolanaTransaction with PendingTransaction {
|
|
final double amount;
|
|
final String serializedTransaction;
|
|
final String destinationAddress;
|
|
final Function sendTransaction;
|
|
final double fee;
|
|
String? _sig;
|
|
|
|
PendingSolanaTransaction({
|
|
required this.fee,
|
|
required this.amount,
|
|
required this.serializedTransaction,
|
|
required this.destinationAddress,
|
|
required this.sendTransaction,
|
|
});
|
|
|
|
@override
|
|
String get amountFormatted {
|
|
String stringifiedAmount = amount.toString();
|
|
|
|
if (stringifiedAmount.toString().length >= 6) {
|
|
stringifiedAmount = stringifiedAmount.substring(0, 6);
|
|
}
|
|
|
|
return stringifiedAmount;
|
|
}
|
|
|
|
@override
|
|
Future<void> commit() async {
|
|
_sig = await sendTransaction();
|
|
}
|
|
|
|
@override
|
|
String get feeFormatted => "$feeFormattedValue SOL";
|
|
|
|
@override
|
|
String get feeFormattedValue => fee.toString();
|
|
|
|
@override
|
|
String get hex => serializedTransaction;
|
|
|
|
@override
|
|
String get id => _sig ?? '';
|
|
|
|
@override
|
|
Future<Map<String, String>> commitUR() {
|
|
throw UnimplementedError();
|
|
}
|
|
}
|