fromJson static method

GiftOnChainPurchaseOfferTransaction? fromJson(
  1. Map<String, dynamic>? json
)

Implementation

static GiftOnChainPurchaseOfferTransaction? fromJson(
    Map<String, dynamic>? json) {
  if (json == null) {
    return null;
  }

  return GiftOnChainPurchaseOfferTransaction(
    offerAddress: (json['offer_address'] as String?) ?? '',
    expirationDate: (json['expiration_date'] as int?) ?? 0,
    message:
        TonWalletMessage.fromJson(json['message'] as Map<String, dynamic>?)!,
    gaslessMessage: TonWalletMessage.fromJson(
        json['gasless_message'] as Map<String, dynamic>?),
    rentBudgetAmount: (json['rent_budget_amount'] is int
            ? json['rent_budget_amount'] as int
            : int.tryParse(json['rent_budget_amount']?.toString() ?? '')) ??
        0,
    executionAllowanceAmount: (json['execution_allowance_amount'] is int
            ? json['execution_allowance_amount'] as int
            : int.tryParse(
                json['execution_allowance_amount']?.toString() ?? '')) ??
        0,
    forwardAmount: (json['forward_amount'] is int
            ? json['forward_amount'] as int
            : int.tryParse(json['forward_amount']?.toString() ?? '')) ??
        0,
    fineAmount: (json['fine_amount'] is int
            ? json['fine_amount'] as int
            : int.tryParse(json['fine_amount']?.toString() ?? '')) ??
        0,
  );
}