dev
dart 30 lines 989 Bytes
Raw
1 import 'package:cake_wallet/anypay/any_pay_payment_instruction_output.dart';
2
3 class AnyPayPaymentInstruction {
4 AnyPayPaymentInstruction(
5 {required this.type,
6 required this.requiredFeeRate,
7 required this.txKey,
8 required this.txHash,
9 required this.outputs});
10
11 factory AnyPayPaymentInstruction.fromMap(Map<String, dynamic> obj) {
12 final outputs = (obj['outputs'] as List<dynamic>)
13 .map((dynamic out) => AnyPayPaymentInstructionOutput.fromMap(out as Map<String, dynamic>))
14 .toList();
15 return AnyPayPaymentInstruction(
16 type: obj['type'] as String,
17 requiredFeeRate: obj['requiredFeeRate'] as int,
18 txKey: obj['tx_key'] as bool? ?? false,
19 txHash: obj['tx_hash'] as bool? ?? false,
20 outputs: outputs);
21 }
22
23 static const transactionType = 'transaction';
24
25 final String type;
26 final int requiredFeeRate;
27 final bool txKey;
28 final bool txHash;
29 final List<AnyPayPaymentInstructionOutput> outputs;
30 }