dev
dart 46 lines 954 Bytes
Raw
1 import 'package:cw_core/amount/money.dart';
2 import 'package:cw_core/pending_transaction.dart';
3
4 class PendingSolanaTransaction with PendingTransaction {
5 final String serializedTransaction;
6 final String destinationAddress;
7 final Function sendTransaction;
8 String? _sig;
9
10 PendingSolanaTransaction({
11 required this.fee,
12 required this.amount,
13 required this.serializedTransaction,
14 required this.destinationAddress,
15 required this.sendTransaction,
16 this.additionalCost,
17 });
18
19 @override
20 final Money amount;
21
22 @override
23 final Money fee;
24
25 @override
26 final Money? additionalCost;
27
28 @override
29 String get amountFormatted => amount.toString();
30
31 @override
32 Future<void> commit() async {
33 _sig = await sendTransaction();
34 }
35
36 @override
37 String get hex => serializedTransaction;
38
39 @override
40 String get id => _sig ?? '';
41
42 @override
43 Future<Map<String, String>> commitUR() {
44 throw UnimplementedError();
45 }
46 }