VestingPoolInfo.fromJson constructor

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

Implementation

factory VestingPoolInfo.fromJson(Map<String, dynamic> json) {
  return VestingPoolInfo(
    name: json.valueAsString<String?>('name', acceptCamelCase: true),
    vestingType: json.valueAsString<String?>(
      'vesting_type',
      acceptCamelCase: true,
    ),
    lockStart: json.valueTo<google_protobuf_timestamp.Timestamp?, String>(
      key: 'lock_start',
      parse: (v) => google_protobuf_timestamp.Timestamp.fromRfc3339(v),
      acceptCamelCase: true,
    ),
    lockEnd: json.valueTo<google_protobuf_timestamp.Timestamp?, String>(
      key: 'lock_end',
      parse: (v) => google_protobuf_timestamp.Timestamp.fromRfc3339(v),
      acceptCamelCase: true,
    ),
    withdrawable: json.valueAsString<String?>(
      'withdrawable',
      acceptCamelCase: true,
    ),
    initiallyLocked: json
        .valueTo<cosmos_base_v1beta1_coin.Coin?, Map<String, dynamic>>(
          key: 'initially_locked',
          parse: (v) => cosmos_base_v1beta1_coin.Coin.fromJson(v),
          acceptCamelCase: true,
        ),
    currentlyLocked: json.valueAsString<String?>(
      'currently_locked',
      acceptCamelCase: true,
    ),
    sentAmount: json.valueAsString<String?>(
      'sent_amount',
      acceptCamelCase: true,
    ),
    reservations:
        (json.valueEnsureAsList<dynamic>(
              'reservations',
              acceptCamelCase: true,
            ))
            .map(
              (e) => JsonParser.valueTo<
                chain4energy_c4echain_cfevesting_account_vesting_pool.VestingPoolReservation,
                Map<String, dynamic>
              >(
                value: e,
                parse:
                    (v) =>
                        chain4energy_c4echain_cfevesting_account_vesting_pool
                            .VestingPoolReservation.fromJson(v),
              ),
            )
            .toList(),
  );
}