InfoResponse.fromJson constructor

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

Implementation

factory InfoResponse.fromJson(Map<String, dynamic> json) {
  Map<String, dynamic>? depositDynamic =
      json['deposit'] == null ? null : json['deposit'];

  Map<String, DepositAsset> depositMap = {};
  if (depositDynamic != null) {
    depositDynamic.forEach((key, value) {
      depositMap[key] = DepositAsset.fromJson(value);
    });
  }

  Map<String, dynamic>? depositExchangeDynamic =
      json['deposit-exchange'] == null ? null : json['deposit-exchange'];

  Map<String, DepositExchangeAsset> depositExchangeMap = {};
  if (depositExchangeDynamic != null) {
    depositExchangeDynamic.forEach((key, value) {
      depositExchangeMap[key] = DepositExchangeAsset.fromJson(value);
    });
  }

  Map<String, dynamic>? withdrawDynamic =
      json['withdraw'] == null ? null : json['withdraw'];

  Map<String, WithdrawAsset> withdrawMap = {};
  if (withdrawDynamic != null) {
    withdrawDynamic.forEach((key, value) {
      withdrawMap[key] = WithdrawAsset.fromJson(value);
    });
  }

  Map<String, dynamic>? withdrawExchangeDynamic =
      json['withdraw-exchange'] == null ? null : json['withdraw-exchange'];

  Map<String, WithdrawExchangeAsset> withdrawExchangeMap = {};
  if (withdrawExchangeDynamic != null) {
    withdrawExchangeDynamic.forEach((key, value) {
      withdrawExchangeMap[key] = WithdrawExchangeAsset.fromJson(value);
    });
  }

  return InfoResponse(
      depositMap,
      depositExchangeMap,
      withdrawMap,
      withdrawExchangeMap,
      json['fee'] == null ? null : AnchorFeeInfo.fromJson(json['fee']),
      json['transactions'] == null
          ? null
          : AnchorTransactionsInfo.fromJson(json['transactions']),
      json['transaction'] == null
          ? null
          : AnchorTransactionInfo.fromJson(json['transaction']),
      json['features'] == null
          ? null
          : AnchorFeatureFlags.fromJson(json['features']));
}