EffectResponse.fromJson constructor

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

Implementation

factory EffectResponse.fromJson(Map<String, dynamic> json) {
  int type = convertInt(json["type_i"]);
  switch (type) {
    // Account effects
    case 0:
      return AccountCreatedEffectResponse.fromJson(json);
    case 1:
      return AccountRemovedEffectResponse.fromJson(json);
    case 2:
      return AccountCreditedEffectResponse.fromJson(json);
    case 3:
      return AccountDebitedEffectResponse.fromJson(json);
    case 4:
      return AccountThresholdsUpdatedEffectResponse.fromJson(json);
    case 5:
      return AccountHomeDomainUpdatedEffectResponse.fromJson(json);
    case 6:
      return AccountFlagsUpdatedEffectResponse.fromJson(json);
    case 7:
      return AccountInflationDestinationUpdatedEffectResponse.fromJson(json);
    // Signer effects
    case 10:
      return SignerCreatedEffectResponse.fromJson(json);
    case 11:
      return SignerRemovedEffectResponse.fromJson(json);
    case 12:
      return SignerUpdatedEffectResponse.fromJson(json);
    // Trustline effects
    case 20:
      return TrustlineCreatedEffectResponse.fromJson(json);
    case 21:
      return TrustlineRemovedEffectResponse.fromJson(json);
    case 22:
      return TrustlineUpdatedEffectResponse.fromJson(json);
    case 23:
      return TrustlineAuthorizedEffectResponse.fromJson(json);
    case 24:
      return TrustlineDeauthorizedEffectResponse.fromJson(json);
    case 25:
      return TrustlineAuthorizedToMaintainLiabilitiesEffectResponse.fromJson(
          json);
    case 26:
      return TrustLineFlagsUpdatedEffectResponse.fromJson(json);
    // Trading effects
    case 30:
      return OfferCreatedEffectResponse.fromJson(json);
    case 31:
      return OfferRemovedEffectResponse.fromJson(json);
    case 32:
      return OfferUpdatedEffectResponse.fromJson(json);
    case 33:
      return TradeEffectResponse.fromJson(json);
    // Data effects
    case 40:
      return DataCreatedEffectResponse.fromJson(json);
    case 41:
      return DataRemovedEffectResponse.fromJson(json);
    case 42:
      return DataUpdatedEffectResponse.fromJson(json);
    // Bump Sequence effects
    case 43:
      return SequenceBumpedEffectResponse.fromJson(json);
    // Claimable Balance effects
    case 50:
      return ClaimableBalanceCreatedEffectResponse.fromJson(json);
    case 51:
      return ClaimableBalanceClaimantCreatedEffectResponse.fromJson(json);
    case 52:
      return ClaimableBalanceClaimedEffectResponse.fromJson(json);
    // Sponsorship
    case 60:
      return AccountSponsorshipCreatedEffectResponse.fromJson(json);
    case 61:
      return AccountSponsorshipUpdatedEffectResponse.fromJson(json);
    case 62:
      return AccountSponsorshipRemovedEffectResponse.fromJson(json);
    case 63:
      return TrustlineSponsorshipCreatedEffectResponse.fromJson(json);
    case 64:
      return TrustlineSponsorshipUpdatedEffectResponse.fromJson(json);
    case 65:
      return TrustlineSponsorshipRemovedEffectResponse.fromJson(json);
    case 66:
      return DataSponsorshipCreatedEffectResponse.fromJson(json);
    case 67:
      return DataSponsorshipUpdatedEffectResponse.fromJson(json);
    case 68:
      return DataSponsorshipRemovedEffectResponse.fromJson(json);
    case 69:
      return ClaimableBalanceSponsorshipCreatedEffectResponse.fromJson(json);
    case 70:
      return ClaimableBalanceSponsorshipUpdatedEffectResponse.fromJson(json);
    case 71:
      return ClaimableBalanceSponsorshipRemovedEffectResponse.fromJson(json);
    case 72:
      return SignerSponsorshipCreatedEffectResponse.fromJson(json);
    case 73:
      return SignerSponsorshipUpdatedEffectResponse.fromJson(json);
    case 74:
      return SignerSponsorshipRemovedEffectResponse.fromJson(json);
    // Clawback claimable balance
    case 80:
      return ClaimableBalanceClawedBackEffectResponse.fromJson(json);
    default:
      throw new Exception("Invalid operation type");
  }
}