invoiceStateToMap static method

Map<String, dynamic> invoiceStateToMap(
  1. InvoiceState state
)

Every field of state, in the form restoreStateFromMap reads.

Implementation

static Map<String, dynamic> invoiceStateToMap(InvoiceState state) => {
      'type': state.typeName,
      'invoiceId': state.invoiceId,
      'isCreated': state.isCreated,
      'walletId': state.walletId,
      'addresses': List<String>.from(state.addresses),
      'amount': state.amount.toString(),
      if (state.outputs != null) 'outputs': [for (final o in state.outputs!) o.toMap()],
      'description': state.description,
      'status': state.status.name,
      'createdAt': state.createdAt.toIso8601String(),
      'expiresAt': state.expiresAt?.toIso8601String(),
      'paidAt': state.paidAt?.toIso8601String(),
      'paymentTxid': state.paymentTxid,
      'amountReceived': state.amountReceived?.toString(),
      'metadata': _detachedCopy(state.metadata),
      'version': state.version,
      'lastModified': state.lastModified.toIso8601String(),
    };