StakeAccount.fromJson constructor

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

Implementation

factory StakeAccount.fromJson(Map<String, dynamic> json) {
  final key = json["stakeAccount"]["key"];
  final Map<String, dynamic> value = json["stakeAccount"]["value"] ?? {};
  switch (key) {
    case "Uninitialized":
      return uninitialized;
    case "RewardsPool":
      return rewardsPool;
    case "Initialized":
      return StakeAccount.initialized(
          meta: StakeMeta.fromJson(value["meta"]));
    default:
      return StakeAccount.stake(
          meta: StakeMeta.fromJson(value["meta"]),
          stake: StakeStake.fromJson(value["stake"]),
          stakeFlags: value["stakeFlags"]);
  }
}