LiquidityPoolEffectResponse.fromJson constructor

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

Implementation

factory LiquidityPoolEffectResponse.fromJson(Map<String, dynamic> json) {
  int feebp = json['fee_bp'] == null
      ? throw Exception("fee_bp is null in horizon response")
      : json['fee_bp']!;

  return LiquidityPoolEffectResponse(
      poolId: json['id'],
      fee: feebp,
      type: json['type'],
      totalTrustlines: json['total_trustlines'],
      totalShares: json['total_shares'],
      reserves: json['reserves'] != null
          ? List<ReserveResponse>.from(json['reserves']
              .map((e) => e == null ? null : ReserveResponse.fromJson(e)))
          : throw Exception("reserves is null in horizon response"));
}