GetBalanceResponse.deserialize constructor

GetBalanceResponse.deserialize(
  1. Map<String, dynamic> input
)

Implementation

factory GetBalanceResponse.deserialize(Map<String, dynamic> input) {
  if (!input.containsKey('result')) {
    throw Exception('Invalid input');
  }

  Map<String, dynamic> result = input['result'] as Map<String, dynamic>;

  return GetBalanceResponse(
    resultType: input['result_type'] as String,
    balanceMsats: result['balance'] as int,
    maxAmount: result['max_amount'] ?? null,
    budgetRenewal: result['budget_renewal'] ?? null,
  );
}