From 0c7f5e3970b7c61a841948295f08a8b6b0d2591b Mon Sep 17 00:00:00 2001 From: Ez3kiel Date: Wed, 18 Oct 2023 18:58:58 +0200 Subject: [PATCH] feat: new RPC methods (getPeers, getAccountHistory, getAccountAssets) --- CHANGELOG.md | 20 +- .../asset/asset.freezed.dart | 9 - .../block/block.freezed.dart | 39 -- lib/src/data_transfer_objects/dtos.dart | 9 + .../get_account_assets_params.dart | 17 + .../get_account_assets_params.freezed.dart | 168 ++++++++ .../get_account_assets_params.g.dart | 21 + .../get_account_assets_result.dart | 17 + .../get_account_assets_result.freezed.dart | 171 ++++++++ .../get_account_assets_result.g.dart | 22 + .../get_account_history/burn_history.dart | 17 + .../burn_history.freezed.dart | 160 +++++++ .../get_account_history/burn_history.g.dart | 19 + .../get_account_history_params.dart | 21 + .../get_account_history_params.freezed.dart | 274 ++++++++++++ .../get_account_history_params.g.dart | 29 ++ .../get_account_history_result.dart | 25 ++ .../get_account_history_result.freezed.dart | 395 +++++++++++++++++ .../get_account_history_result.g.dart | 41 ++ .../get_account_history/incoming_history.dart | 17 + .../incoming_history.freezed.dart | 162 +++++++ .../incoming_history.g.dart | 21 + .../get_account_history/mining_history.dart | 17 + .../mining_history.freezed.dart | 161 +++++++ .../get_account_history/mining_history.g.dart | 19 + .../get_account_history/outgoing_history.dart | 17 + .../outgoing_history.freezed.dart | 162 +++++++ .../outgoing_history.g.dart | 21 + .../get_assets/get_assets_params.freezed.dart | 7 - .../data_transfer_objects/get_peers/peer.dart | 25 ++ .../get_peers/peer.freezed.dart | 401 ++++++++++++++++++ .../get_peers/peer.g.dart | 36 ++ lib/src/repositories/daemon_constants.dart | 9 + .../daemon_rpc_methods_extension.dart | 32 ++ pubspec.yaml | 2 +- 35 files changed, 2523 insertions(+), 60 deletions(-) create mode 100644 lib/src/data_transfer_objects/get_account_assets/get_account_assets_params.dart create mode 100644 lib/src/data_transfer_objects/get_account_assets/get_account_assets_params.freezed.dart create mode 100644 lib/src/data_transfer_objects/get_account_assets/get_account_assets_params.g.dart create mode 100644 lib/src/data_transfer_objects/get_account_assets/get_account_assets_result.dart create mode 100644 lib/src/data_transfer_objects/get_account_assets/get_account_assets_result.freezed.dart create mode 100644 lib/src/data_transfer_objects/get_account_assets/get_account_assets_result.g.dart create mode 100644 lib/src/data_transfer_objects/get_account_history/burn_history.dart create mode 100644 lib/src/data_transfer_objects/get_account_history/burn_history.freezed.dart create mode 100644 lib/src/data_transfer_objects/get_account_history/burn_history.g.dart create mode 100644 lib/src/data_transfer_objects/get_account_history/get_account_history_params.dart create mode 100644 lib/src/data_transfer_objects/get_account_history/get_account_history_params.freezed.dart create mode 100644 lib/src/data_transfer_objects/get_account_history/get_account_history_params.g.dart create mode 100644 lib/src/data_transfer_objects/get_account_history/get_account_history_result.dart create mode 100644 lib/src/data_transfer_objects/get_account_history/get_account_history_result.freezed.dart create mode 100644 lib/src/data_transfer_objects/get_account_history/get_account_history_result.g.dart create mode 100644 lib/src/data_transfer_objects/get_account_history/incoming_history.dart create mode 100644 lib/src/data_transfer_objects/get_account_history/incoming_history.freezed.dart create mode 100644 lib/src/data_transfer_objects/get_account_history/incoming_history.g.dart create mode 100644 lib/src/data_transfer_objects/get_account_history/mining_history.dart create mode 100644 lib/src/data_transfer_objects/get_account_history/mining_history.freezed.dart create mode 100644 lib/src/data_transfer_objects/get_account_history/mining_history.g.dart create mode 100644 lib/src/data_transfer_objects/get_account_history/outgoing_history.dart create mode 100644 lib/src/data_transfer_objects/get_account_history/outgoing_history.freezed.dart create mode 100644 lib/src/data_transfer_objects/get_account_history/outgoing_history.g.dart create mode 100644 lib/src/data_transfer_objects/get_peers/peer.dart create mode 100644 lib/src/data_transfer_objects/get_peers/peer.freezed.dart create mode 100644 lib/src/data_transfer_objects/get_peers/peer.g.dart diff --git a/CHANGELOG.md b/CHANGELOG.md index ea6dbb1..24029cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,23 @@ +## 0.9.0 + +Daemon API upgrade : + +- new getPeers RPC method. +- new getAccountHistory RPC method. +- new getAccountAssets RPC method. + ## 0.8.0 -- feat: getAsset RPC method. -- feat: countAccounts RPC method. +Daemon API upgrade : + +- new getAsset RPC method. +- new countAccounts RPC method. ## 0.7.0 -- feat: getAccounts RPC method. +Daemon API upgrade : + +- new getAccounts RPC method. ## 0.6.0 @@ -16,7 +28,7 @@ Daemon API upgrade : ## 0.5.0 -- feat: getBlocksRangeByTopoHeight and getBlocksRangeByHeight RPC methods. +- new getBlocksRangeByTopoHeight and getBlocksRangeByHeight RPC methods. ## 0.4.7 diff --git a/lib/src/data_transfer_objects/asset/asset.freezed.dart b/lib/src/data_transfer_objects/asset/asset.freezed.dart index 5158487..d5eeccc 100644 --- a/lib/src/data_transfer_objects/asset/asset.freezed.dart +++ b/lib/src/data_transfer_objects/asset/asset.freezed.dart @@ -22,15 +22,12 @@ Asset _$AssetFromJson(Map json) { mixin _$Asset { @JsonKey(name: 'asset') String get asset => throw _privateConstructorUsedError; - @JsonKey(name: 'topoheight') int get topoheight => throw _privateConstructorUsedError; - @JsonKey(name: 'decimals') int get decimals => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) $AssetCopyWith get copyWith => throw _privateConstructorUsedError; } @@ -39,7 +36,6 @@ mixin _$Asset { abstract class $AssetCopyWith<$Res> { factory $AssetCopyWith(Asset value, $Res Function(Asset) then) = _$AssetCopyWithImpl<$Res, Asset>; - @useResult $Res call( {@JsonKey(name: 'asset') String asset, @@ -54,7 +50,6 @@ class _$AssetCopyWithImpl<$Res, $Val extends Asset> // ignore: unused_field final $Val _value; - // ignore: unused_field final $Res Function($Val) _then; @@ -87,7 +82,6 @@ abstract class _$$AssetImplCopyWith<$Res> implements $AssetCopyWith<$Res> { factory _$$AssetImplCopyWith( _$AssetImpl value, $Res Function(_$AssetImpl) then) = __$$AssetImplCopyWithImpl<$Res>; - @override @useResult $Res call( @@ -195,15 +189,12 @@ abstract class _Asset implements Asset { @override @JsonKey(name: 'asset') String get asset; - @override @JsonKey(name: 'topoheight') int get topoheight; - @override @JsonKey(name: 'decimals') int get decimals; - @override @JsonKey(ignore: true) _$$AssetImplCopyWith<_$AssetImpl> get copyWith => diff --git a/lib/src/data_transfer_objects/block/block.freezed.dart b/lib/src/data_transfer_objects/block/block.freezed.dart index 4514571..9223c0f 100644 --- a/lib/src/data_transfer_objects/block/block.freezed.dart +++ b/lib/src/data_transfer_objects/block/block.freezed.dart @@ -22,57 +22,41 @@ Block _$BlockFromJson(Map json) { mixin _$Block { @JsonKey(name: 'block_type') String get blockType => throw _privateConstructorUsedError; - @JsonKey(name: 'cumulative_difficulty') int get cumulativeDifficulty => throw _privateConstructorUsedError; - @JsonKey(name: 'difficulty') int get difficulty => throw _privateConstructorUsedError; - @JsonKey(name: 'extra_nonce') String get extraNonce => throw _privateConstructorUsedError; - @JsonKey(name: 'hash') String get hash => throw _privateConstructorUsedError; - @JsonKey(name: 'height') int get height => throw _privateConstructorUsedError; - @JsonKey(name: 'miner') String get miner => throw _privateConstructorUsedError; - @JsonKey(name: 'nonce') int get nonce => throw _privateConstructorUsedError; - @JsonKey(name: 'reward') int? get reward => throw _privateConstructorUsedError; - @JsonKey(name: 'supply') int? get supply => throw _privateConstructorUsedError; // TODO convert timestamp to DateTime @JsonKey(name: 'timestamp') int get timestamp => throw _privateConstructorUsedError; - @JsonKey(name: 'tips') List get tips => throw _privateConstructorUsedError; - @JsonKey(name: 'topoheight') int? get topoHeight => throw _privateConstructorUsedError; - @JsonKey(name: 'total_size_in_bytes') int get totalSizeInBytes => throw _privateConstructorUsedError; - @JsonKey(name: 'total_fees') int? get totalFees => throw _privateConstructorUsedError; - @JsonKey(name: 'txs_hashes') List get txsHashes => throw _privateConstructorUsedError; - @JsonKey(name: 'version') int get version => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) $BlockCopyWith get copyWith => throw _privateConstructorUsedError; } @@ -81,7 +65,6 @@ mixin _$Block { abstract class $BlockCopyWith<$Res> { factory $BlockCopyWith(Block value, $Res Function(Block) then) = _$BlockCopyWithImpl<$Res, Block>; - @useResult $Res call( {@JsonKey(name: 'block_type') String blockType, @@ -110,7 +93,6 @@ class _$BlockCopyWithImpl<$Res, $Val extends Block> // ignore: unused_field final $Val _value; - // ignore: unused_field final $Res Function($Val) _then; @@ -213,7 +195,6 @@ abstract class _$$BlockImplCopyWith<$Res> implements $BlockCopyWith<$Res> { factory _$$BlockImplCopyWith( _$BlockImpl value, $Res Function(_$BlockImpl) then) = __$$BlockImplCopyWithImpl<$Res>; - @override @useResult $Res call( @@ -396,13 +377,11 @@ class _$BlockImpl implements _Block { @override @JsonKey(name: 'supply') final int? supply; - // TODO convert timestamp to DateTime @override @JsonKey(name: 'timestamp') final int timestamp; final List _tips; - @override @JsonKey(name: 'tips') List get tips { @@ -421,7 +400,6 @@ class _$BlockImpl implements _Block { @JsonKey(name: 'total_fees') final int? totalFees; final List _txsHashes; - @override @JsonKey(name: 'txs_hashes') List get txsHashes { @@ -534,71 +512,54 @@ abstract class _Block implements Block { @override @JsonKey(name: 'block_type') String get blockType; - @override @JsonKey(name: 'cumulative_difficulty') int get cumulativeDifficulty; - @override @JsonKey(name: 'difficulty') int get difficulty; - @override @JsonKey(name: 'extra_nonce') String get extraNonce; - @override @JsonKey(name: 'hash') String get hash; - @override @JsonKey(name: 'height') int get height; - @override @JsonKey(name: 'miner') String get miner; - @override @JsonKey(name: 'nonce') int get nonce; - @override @JsonKey(name: 'reward') int? get reward; - @override @JsonKey(name: 'supply') int? get supply; - @override // TODO convert timestamp to DateTime @JsonKey(name: 'timestamp') int get timestamp; - @override @JsonKey(name: 'tips') List get tips; - @override @JsonKey(name: 'topoheight') int? get topoHeight; - @override @JsonKey(name: 'total_size_in_bytes') int get totalSizeInBytes; - @override @JsonKey(name: 'total_fees') int? get totalFees; - @override @JsonKey(name: 'txs_hashes') List get txsHashes; - @override @JsonKey(name: 'version') int get version; - @override @JsonKey(ignore: true) _$$BlockImplCopyWith<_$BlockImpl> get copyWith => diff --git a/lib/src/data_transfer_objects/dtos.dart b/lib/src/data_transfer_objects/dtos.dart index 3143e4b..abe17ec 100644 --- a/lib/src/data_transfer_objects/dtos.dart +++ b/lib/src/data_transfer_objects/dtos.dart @@ -1,6 +1,14 @@ export 'asset/asset.dart'; export 'block/block.dart'; export 'block_ordered_event/block_ordered_event.dart'; +export 'get_account_assets/get_account_assets_params.dart'; +export 'get_account_assets/get_account_assets_result.dart'; +export 'get_account_history/burn_history.dart'; +export 'get_account_history/get_account_history_params.dart'; +export 'get_account_history/get_account_history_result.dart'; +export 'get_account_history/incoming_history.dart'; +export 'get_account_history/mining_history.dart'; +export 'get_account_history/outgoing_history.dart'; export 'get_accounts/get_accounts_params.dart'; export 'get_accounts/get_accounts_result.dart'; export 'get_asset/get_asset_params.dart'; @@ -17,6 +25,7 @@ export 'get_info/network.dart'; export 'get_last_balance/get_last_balance_params.dart'; export 'get_last_balance/get_last_balance_result.dart'; export 'get_nonce/get_nonce_params.dart'; +export 'get_peers/peer.dart'; export 'get_range/get_height_range_params.dart'; export 'get_range/get_topoheight_range_params.dart'; export 'get_top_block/get_top_block_params.dart'; diff --git a/lib/src/data_transfer_objects/get_account_assets/get_account_assets_params.dart b/lib/src/data_transfer_objects/get_account_assets/get_account_assets_params.dart new file mode 100644 index 0000000..c0a9d81 --- /dev/null +++ b/lib/src/data_transfer_objects/get_account_assets/get_account_assets_params.dart @@ -0,0 +1,17 @@ +// ignore_for_file: public_member_api_docs, invalid_annotation_target + +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'get_account_assets_params.freezed.dart'; + +part 'get_account_assets_params.g.dart'; + +@freezed +class GetAccountAssetsParams with _$GetAccountAssetsParams { + const factory GetAccountAssetsParams({ + @JsonKey(name: 'address') required String address, + }) = _GetAccountAssetsParams; + + factory GetAccountAssetsParams.fromJson(Map json) => + _$GetAccountAssetsParamsFromJson(json); +} diff --git a/lib/src/data_transfer_objects/get_account_assets/get_account_assets_params.freezed.dart b/lib/src/data_transfer_objects/get_account_assets/get_account_assets_params.freezed.dart new file mode 100644 index 0000000..b062a17 --- /dev/null +++ b/lib/src/data_transfer_objects/get_account_assets/get_account_assets_params.freezed.dart @@ -0,0 +1,168 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'get_account_assets_params.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +GetAccountAssetsParams _$GetAccountAssetsParamsFromJson( + Map json) { + return _GetAccountAssetsParams.fromJson(json); +} + +/// @nodoc +mixin _$GetAccountAssetsParams { + @JsonKey(name: 'address') + String get address => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + + @JsonKey(ignore: true) + $GetAccountAssetsParamsCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $GetAccountAssetsParamsCopyWith<$Res> { + factory $GetAccountAssetsParamsCopyWith(GetAccountAssetsParams value, + $Res Function(GetAccountAssetsParams) then) = + _$GetAccountAssetsParamsCopyWithImpl<$Res, GetAccountAssetsParams>; + + @useResult + $Res call({@JsonKey(name: 'address') String address}); +} + +/// @nodoc +class _$GetAccountAssetsParamsCopyWithImpl<$Res, + $Val extends GetAccountAssetsParams> + implements $GetAccountAssetsParamsCopyWith<$Res> { + _$GetAccountAssetsParamsCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? address = null, + }) { + return _then(_value.copyWith( + address: null == address + ? _value.address + : address // ignore: cast_nullable_to_non_nullable + as String, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$GetAccountAssetsParamsImplCopyWith<$Res> + implements $GetAccountAssetsParamsCopyWith<$Res> { + factory _$$GetAccountAssetsParamsImplCopyWith( + _$GetAccountAssetsParamsImpl value, + $Res Function(_$GetAccountAssetsParamsImpl) then) = + __$$GetAccountAssetsParamsImplCopyWithImpl<$Res>; + + @override + @useResult + $Res call({@JsonKey(name: 'address') String address}); +} + +/// @nodoc +class __$$GetAccountAssetsParamsImplCopyWithImpl<$Res> + extends _$GetAccountAssetsParamsCopyWithImpl<$Res, + _$GetAccountAssetsParamsImpl> + implements _$$GetAccountAssetsParamsImplCopyWith<$Res> { + __$$GetAccountAssetsParamsImplCopyWithImpl( + _$GetAccountAssetsParamsImpl _value, + $Res Function(_$GetAccountAssetsParamsImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? address = null, + }) { + return _then(_$GetAccountAssetsParamsImpl( + address: null == address + ? _value.address + : address // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$GetAccountAssetsParamsImpl implements _GetAccountAssetsParams { + const _$GetAccountAssetsParamsImpl( + {@JsonKey(name: 'address') required this.address}); + + factory _$GetAccountAssetsParamsImpl.fromJson(Map json) => + _$$GetAccountAssetsParamsImplFromJson(json); + + @override + @JsonKey(name: 'address') + final String address; + + @override + String toString() { + return 'GetAccountAssetsParams(address: $address)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$GetAccountAssetsParamsImpl && + (identical(other.address, address) || other.address == address)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, address); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$GetAccountAssetsParamsImplCopyWith<_$GetAccountAssetsParamsImpl> + get copyWith => __$$GetAccountAssetsParamsImplCopyWithImpl< + _$GetAccountAssetsParamsImpl>(this, _$identity); + + @override + Map toJson() { + return _$$GetAccountAssetsParamsImplToJson( + this, + ); + } +} + +abstract class _GetAccountAssetsParams implements GetAccountAssetsParams { + const factory _GetAccountAssetsParams( + {@JsonKey(name: 'address') required final String address}) = + _$GetAccountAssetsParamsImpl; + + factory _GetAccountAssetsParams.fromJson(Map json) = + _$GetAccountAssetsParamsImpl.fromJson; + + @override + @JsonKey(name: 'address') + String get address; + + @override + @JsonKey(ignore: true) + _$$GetAccountAssetsParamsImplCopyWith<_$GetAccountAssetsParamsImpl> + get copyWith => throw _privateConstructorUsedError; +} diff --git a/lib/src/data_transfer_objects/get_account_assets/get_account_assets_params.g.dart b/lib/src/data_transfer_objects/get_account_assets/get_account_assets_params.g.dart new file mode 100644 index 0000000..632c54f --- /dev/null +++ b/lib/src/data_transfer_objects/get_account_assets/get_account_assets_params.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +// ignore_for_file: package_api_docs, non_constant_identifier_names + +part of 'get_account_assets_params.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$GetAccountAssetsParamsImpl _$$GetAccountAssetsParamsImplFromJson( + Map json) => + _$GetAccountAssetsParamsImpl( + address: json['address'] as String, + ); + +Map _$$GetAccountAssetsParamsImplToJson( + _$GetAccountAssetsParamsImpl instance) => + { + 'address': instance.address, + }; diff --git a/lib/src/data_transfer_objects/get_account_assets/get_account_assets_result.dart b/lib/src/data_transfer_objects/get_account_assets/get_account_assets_result.dart new file mode 100644 index 0000000..52a017a --- /dev/null +++ b/lib/src/data_transfer_objects/get_account_assets/get_account_assets_result.dart @@ -0,0 +1,17 @@ +// ignore_for_file: public_member_api_docs, invalid_annotation_target + +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'get_account_assets_result.freezed.dart'; + +part 'get_account_assets_result.g.dart'; + +@freezed +class GetAccountAssetsResult with _$GetAccountAssetsResult { + const factory GetAccountAssetsResult({ + required List assets, + }) = _GetAccountAssetsResult; + + factory GetAccountAssetsResult.fromJson(Map json) => + _$GetAccountAssetsResultFromJson(json); +} diff --git a/lib/src/data_transfer_objects/get_account_assets/get_account_assets_result.freezed.dart b/lib/src/data_transfer_objects/get_account_assets/get_account_assets_result.freezed.dart new file mode 100644 index 0000000..127d28e --- /dev/null +++ b/lib/src/data_transfer_objects/get_account_assets/get_account_assets_result.freezed.dart @@ -0,0 +1,171 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'get_account_assets_result.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +GetAccountAssetsResult _$GetAccountAssetsResultFromJson( + Map json) { + return _GetAccountAssetsResult.fromJson(json); +} + +/// @nodoc +mixin _$GetAccountAssetsResult { + List get assets => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + + @JsonKey(ignore: true) + $GetAccountAssetsResultCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $GetAccountAssetsResultCopyWith<$Res> { + factory $GetAccountAssetsResultCopyWith(GetAccountAssetsResult value, + $Res Function(GetAccountAssetsResult) then) = + _$GetAccountAssetsResultCopyWithImpl<$Res, GetAccountAssetsResult>; + + @useResult + $Res call({List assets}); +} + +/// @nodoc +class _$GetAccountAssetsResultCopyWithImpl<$Res, + $Val extends GetAccountAssetsResult> + implements $GetAccountAssetsResultCopyWith<$Res> { + _$GetAccountAssetsResultCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? assets = null, + }) { + return _then(_value.copyWith( + assets: null == assets + ? _value.assets + : assets // ignore: cast_nullable_to_non_nullable + as List, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$GetAccountAssetsResultImplCopyWith<$Res> + implements $GetAccountAssetsResultCopyWith<$Res> { + factory _$$GetAccountAssetsResultImplCopyWith( + _$GetAccountAssetsResultImpl value, + $Res Function(_$GetAccountAssetsResultImpl) then) = + __$$GetAccountAssetsResultImplCopyWithImpl<$Res>; + + @override + @useResult + $Res call({List assets}); +} + +/// @nodoc +class __$$GetAccountAssetsResultImplCopyWithImpl<$Res> + extends _$GetAccountAssetsResultCopyWithImpl<$Res, + _$GetAccountAssetsResultImpl> + implements _$$GetAccountAssetsResultImplCopyWith<$Res> { + __$$GetAccountAssetsResultImplCopyWithImpl( + _$GetAccountAssetsResultImpl _value, + $Res Function(_$GetAccountAssetsResultImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? assets = null, + }) { + return _then(_$GetAccountAssetsResultImpl( + assets: null == assets + ? _value._assets + : assets // ignore: cast_nullable_to_non_nullable + as List, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$GetAccountAssetsResultImpl implements _GetAccountAssetsResult { + const _$GetAccountAssetsResultImpl({required final List assets}) + : _assets = assets; + + factory _$GetAccountAssetsResultImpl.fromJson(Map json) => + _$$GetAccountAssetsResultImplFromJson(json); + + final List _assets; + + @override + List get assets { + if (_assets is EqualUnmodifiableListView) return _assets; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_assets); + } + + @override + String toString() { + return 'GetAccountAssetsResult(assets: $assets)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$GetAccountAssetsResultImpl && + const DeepCollectionEquality().equals(other._assets, _assets)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => + Object.hash(runtimeType, const DeepCollectionEquality().hash(_assets)); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$GetAccountAssetsResultImplCopyWith<_$GetAccountAssetsResultImpl> + get copyWith => __$$GetAccountAssetsResultImplCopyWithImpl< + _$GetAccountAssetsResultImpl>(this, _$identity); + + @override + Map toJson() { + return _$$GetAccountAssetsResultImplToJson( + this, + ); + } +} + +abstract class _GetAccountAssetsResult implements GetAccountAssetsResult { + const factory _GetAccountAssetsResult({required final List assets}) = + _$GetAccountAssetsResultImpl; + + factory _GetAccountAssetsResult.fromJson(Map json) = + _$GetAccountAssetsResultImpl.fromJson; + + @override + List get assets; + + @override + @JsonKey(ignore: true) + _$$GetAccountAssetsResultImplCopyWith<_$GetAccountAssetsResultImpl> + get copyWith => throw _privateConstructorUsedError; +} diff --git a/lib/src/data_transfer_objects/get_account_assets/get_account_assets_result.g.dart b/lib/src/data_transfer_objects/get_account_assets/get_account_assets_result.g.dart new file mode 100644 index 0000000..cd9bdde --- /dev/null +++ b/lib/src/data_transfer_objects/get_account_assets/get_account_assets_result.g.dart @@ -0,0 +1,22 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +// ignore_for_file: package_api_docs, non_constant_identifier_names + +part of 'get_account_assets_result.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$GetAccountAssetsResultImpl _$$GetAccountAssetsResultImplFromJson( + Map json) => + _$GetAccountAssetsResultImpl( + assets: + (json['assets'] as List).map((e) => e as String).toList(), + ); + +Map _$$GetAccountAssetsResultImplToJson( + _$GetAccountAssetsResultImpl instance) => + { + 'assets': instance.assets, + }; diff --git a/lib/src/data_transfer_objects/get_account_history/burn_history.dart b/lib/src/data_transfer_objects/get_account_history/burn_history.dart new file mode 100644 index 0000000..53d86de --- /dev/null +++ b/lib/src/data_transfer_objects/get_account_history/burn_history.dart @@ -0,0 +1,17 @@ +// ignore_for_file: public_member_api_docs, invalid_annotation_target + +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'burn_history.freezed.dart'; + +part 'burn_history.g.dart'; + +@freezed +class BurnHistory with _$BurnHistory { + const factory BurnHistory({ + @JsonKey(name: 'amount') required int amount, + }) = _BurnHistory; + + factory BurnHistory.fromJson(Map json) => + _$BurnHistoryFromJson(json); +} diff --git a/lib/src/data_transfer_objects/get_account_history/burn_history.freezed.dart b/lib/src/data_transfer_objects/get_account_history/burn_history.freezed.dart new file mode 100644 index 0000000..5869c64 --- /dev/null +++ b/lib/src/data_transfer_objects/get_account_history/burn_history.freezed.dart @@ -0,0 +1,160 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'burn_history.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +BurnHistory _$BurnHistoryFromJson(Map json) { + return _BurnHistory.fromJson(json); +} + +/// @nodoc +mixin _$BurnHistory { + @JsonKey(name: 'amount') + int get amount => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + + @JsonKey(ignore: true) + $BurnHistoryCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $BurnHistoryCopyWith<$Res> { + factory $BurnHistoryCopyWith( + BurnHistory value, $Res Function(BurnHistory) then) = + _$BurnHistoryCopyWithImpl<$Res, BurnHistory>; + + @useResult + $Res call({@JsonKey(name: 'amount') int amount}); +} + +/// @nodoc +class _$BurnHistoryCopyWithImpl<$Res, $Val extends BurnHistory> + implements $BurnHistoryCopyWith<$Res> { + _$BurnHistoryCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? amount = null, + }) { + return _then(_value.copyWith( + amount: null == amount + ? _value.amount + : amount // ignore: cast_nullable_to_non_nullable + as int, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$BurnHistoryImplCopyWith<$Res> + implements $BurnHistoryCopyWith<$Res> { + factory _$$BurnHistoryImplCopyWith( + _$BurnHistoryImpl value, $Res Function(_$BurnHistoryImpl) then) = + __$$BurnHistoryImplCopyWithImpl<$Res>; + + @override + @useResult + $Res call({@JsonKey(name: 'amount') int amount}); +} + +/// @nodoc +class __$$BurnHistoryImplCopyWithImpl<$Res> + extends _$BurnHistoryCopyWithImpl<$Res, _$BurnHistoryImpl> + implements _$$BurnHistoryImplCopyWith<$Res> { + __$$BurnHistoryImplCopyWithImpl( + _$BurnHistoryImpl _value, $Res Function(_$BurnHistoryImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? amount = null, + }) { + return _then(_$BurnHistoryImpl( + amount: null == amount + ? _value.amount + : amount // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$BurnHistoryImpl implements _BurnHistory { + const _$BurnHistoryImpl({@JsonKey(name: 'amount') required this.amount}); + + factory _$BurnHistoryImpl.fromJson(Map json) => + _$$BurnHistoryImplFromJson(json); + + @override + @JsonKey(name: 'amount') + final int amount; + + @override + String toString() { + return 'BurnHistory(amount: $amount)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$BurnHistoryImpl && + (identical(other.amount, amount) || other.amount == amount)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, amount); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$BurnHistoryImplCopyWith<_$BurnHistoryImpl> get copyWith => + __$$BurnHistoryImplCopyWithImpl<_$BurnHistoryImpl>(this, _$identity); + + @override + Map toJson() { + return _$$BurnHistoryImplToJson( + this, + ); + } +} + +abstract class _BurnHistory implements BurnHistory { + const factory _BurnHistory( + {@JsonKey(name: 'amount') required final int amount}) = _$BurnHistoryImpl; + + factory _BurnHistory.fromJson(Map json) = + _$BurnHistoryImpl.fromJson; + + @override + @JsonKey(name: 'amount') + int get amount; + + @override + @JsonKey(ignore: true) + _$$BurnHistoryImplCopyWith<_$BurnHistoryImpl> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/lib/src/data_transfer_objects/get_account_history/burn_history.g.dart b/lib/src/data_transfer_objects/get_account_history/burn_history.g.dart new file mode 100644 index 0000000..113cf89 --- /dev/null +++ b/lib/src/data_transfer_objects/get_account_history/burn_history.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +// ignore_for_file: package_api_docs, non_constant_identifier_names + +part of 'burn_history.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$BurnHistoryImpl _$$BurnHistoryImplFromJson(Map json) => + _$BurnHistoryImpl( + amount: json['amount'] as int, + ); + +Map _$$BurnHistoryImplToJson(_$BurnHistoryImpl instance) => + { + 'amount': instance.amount, + }; diff --git a/lib/src/data_transfer_objects/get_account_history/get_account_history_params.dart b/lib/src/data_transfer_objects/get_account_history/get_account_history_params.dart new file mode 100644 index 0000000..d00090a --- /dev/null +++ b/lib/src/data_transfer_objects/get_account_history/get_account_history_params.dart @@ -0,0 +1,21 @@ +// ignore_for_file: public_member_api_docs, invalid_annotation_target + +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'get_account_history_params.freezed.dart'; + +part 'get_account_history_params.g.dart'; + +@freezed +class GetAccountHistoryParams with _$GetAccountHistoryParams { + const factory GetAccountHistoryParams({ + @JsonKey(name: 'address') required String address, + @JsonKey(name: 'hash') String? hash, + @JsonKey(name: 'topoheight') int? topoheight, + @JsonKey(name: 'minimum_topoheight') int? minimumTopoheight, + @JsonKey(name: 'maximum_topoheight') int? maximumTopoheight, + }) = _GetAccountHistoryParams; + + factory GetAccountHistoryParams.fromJson(Map json) => + _$GetAccountHistoryParamsFromJson(json); +} diff --git a/lib/src/data_transfer_objects/get_account_history/get_account_history_params.freezed.dart b/lib/src/data_transfer_objects/get_account_history/get_account_history_params.freezed.dart new file mode 100644 index 0000000..01012c2 --- /dev/null +++ b/lib/src/data_transfer_objects/get_account_history/get_account_history_params.freezed.dart @@ -0,0 +1,274 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'get_account_history_params.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +GetAccountHistoryParams _$GetAccountHistoryParamsFromJson( + Map json) { + return _GetAccountHistoryParams.fromJson(json); +} + +/// @nodoc +mixin _$GetAccountHistoryParams { + @JsonKey(name: 'address') + String get address => throw _privateConstructorUsedError; + + @JsonKey(name: 'hash') + String? get hash => throw _privateConstructorUsedError; + + @JsonKey(name: 'topoheight') + int? get topoheight => throw _privateConstructorUsedError; + + @JsonKey(name: 'minimum_topoheight') + int? get minimumTopoheight => throw _privateConstructorUsedError; + + @JsonKey(name: 'maximum_topoheight') + int? get maximumTopoheight => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + + @JsonKey(ignore: true) + $GetAccountHistoryParamsCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $GetAccountHistoryParamsCopyWith<$Res> { + factory $GetAccountHistoryParamsCopyWith(GetAccountHistoryParams value, + $Res Function(GetAccountHistoryParams) then) = + _$GetAccountHistoryParamsCopyWithImpl<$Res, GetAccountHistoryParams>; + + @useResult + $Res call( + {@JsonKey(name: 'address') String address, + @JsonKey(name: 'hash') String? hash, + @JsonKey(name: 'topoheight') int? topoheight, + @JsonKey(name: 'minimum_topoheight') int? minimumTopoheight, + @JsonKey(name: 'maximum_topoheight') int? maximumTopoheight}); +} + +/// @nodoc +class _$GetAccountHistoryParamsCopyWithImpl<$Res, + $Val extends GetAccountHistoryParams> + implements $GetAccountHistoryParamsCopyWith<$Res> { + _$GetAccountHistoryParamsCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? address = null, + Object? hash = freezed, + Object? topoheight = freezed, + Object? minimumTopoheight = freezed, + Object? maximumTopoheight = freezed, + }) { + return _then(_value.copyWith( + address: null == address + ? _value.address + : address // ignore: cast_nullable_to_non_nullable + as String, + hash: freezed == hash + ? _value.hash + : hash // ignore: cast_nullable_to_non_nullable + as String?, + topoheight: freezed == topoheight + ? _value.topoheight + : topoheight // ignore: cast_nullable_to_non_nullable + as int?, + minimumTopoheight: freezed == minimumTopoheight + ? _value.minimumTopoheight + : minimumTopoheight // ignore: cast_nullable_to_non_nullable + as int?, + maximumTopoheight: freezed == maximumTopoheight + ? _value.maximumTopoheight + : maximumTopoheight // ignore: cast_nullable_to_non_nullable + as int?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$GetAccountHistoryParamsImplCopyWith<$Res> + implements $GetAccountHistoryParamsCopyWith<$Res> { + factory _$$GetAccountHistoryParamsImplCopyWith( + _$GetAccountHistoryParamsImpl value, + $Res Function(_$GetAccountHistoryParamsImpl) then) = + __$$GetAccountHistoryParamsImplCopyWithImpl<$Res>; + + @override + @useResult + $Res call( + {@JsonKey(name: 'address') String address, + @JsonKey(name: 'hash') String? hash, + @JsonKey(name: 'topoheight') int? topoheight, + @JsonKey(name: 'minimum_topoheight') int? minimumTopoheight, + @JsonKey(name: 'maximum_topoheight') int? maximumTopoheight}); +} + +/// @nodoc +class __$$GetAccountHistoryParamsImplCopyWithImpl<$Res> + extends _$GetAccountHistoryParamsCopyWithImpl<$Res, + _$GetAccountHistoryParamsImpl> + implements _$$GetAccountHistoryParamsImplCopyWith<$Res> { + __$$GetAccountHistoryParamsImplCopyWithImpl( + _$GetAccountHistoryParamsImpl _value, + $Res Function(_$GetAccountHistoryParamsImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? address = null, + Object? hash = freezed, + Object? topoheight = freezed, + Object? minimumTopoheight = freezed, + Object? maximumTopoheight = freezed, + }) { + return _then(_$GetAccountHistoryParamsImpl( + address: null == address + ? _value.address + : address // ignore: cast_nullable_to_non_nullable + as String, + hash: freezed == hash + ? _value.hash + : hash // ignore: cast_nullable_to_non_nullable + as String?, + topoheight: freezed == topoheight + ? _value.topoheight + : topoheight // ignore: cast_nullable_to_non_nullable + as int?, + minimumTopoheight: freezed == minimumTopoheight + ? _value.minimumTopoheight + : minimumTopoheight // ignore: cast_nullable_to_non_nullable + as int?, + maximumTopoheight: freezed == maximumTopoheight + ? _value.maximumTopoheight + : maximumTopoheight // ignore: cast_nullable_to_non_nullable + as int?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$GetAccountHistoryParamsImpl implements _GetAccountHistoryParams { + const _$GetAccountHistoryParamsImpl( + {@JsonKey(name: 'address') required this.address, + @JsonKey(name: 'hash') this.hash, + @JsonKey(name: 'topoheight') this.topoheight, + @JsonKey(name: 'minimum_topoheight') this.minimumTopoheight, + @JsonKey(name: 'maximum_topoheight') this.maximumTopoheight}); + + factory _$GetAccountHistoryParamsImpl.fromJson(Map json) => + _$$GetAccountHistoryParamsImplFromJson(json); + + @override + @JsonKey(name: 'address') + final String address; + @override + @JsonKey(name: 'hash') + final String? hash; + @override + @JsonKey(name: 'topoheight') + final int? topoheight; + @override + @JsonKey(name: 'minimum_topoheight') + final int? minimumTopoheight; + @override + @JsonKey(name: 'maximum_topoheight') + final int? maximumTopoheight; + + @override + String toString() { + return 'GetAccountHistoryParams(address: $address, hash: $hash, topoheight: $topoheight, minimumTopoheight: $minimumTopoheight, maximumTopoheight: $maximumTopoheight)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$GetAccountHistoryParamsImpl && + (identical(other.address, address) || other.address == address) && + (identical(other.hash, hash) || other.hash == hash) && + (identical(other.topoheight, topoheight) || + other.topoheight == topoheight) && + (identical(other.minimumTopoheight, minimumTopoheight) || + other.minimumTopoheight == minimumTopoheight) && + (identical(other.maximumTopoheight, maximumTopoheight) || + other.maximumTopoheight == maximumTopoheight)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, address, hash, topoheight, + minimumTopoheight, maximumTopoheight); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$GetAccountHistoryParamsImplCopyWith<_$GetAccountHistoryParamsImpl> + get copyWith => __$$GetAccountHistoryParamsImplCopyWithImpl< + _$GetAccountHistoryParamsImpl>(this, _$identity); + + @override + Map toJson() { + return _$$GetAccountHistoryParamsImplToJson( + this, + ); + } +} + +abstract class _GetAccountHistoryParams implements GetAccountHistoryParams { + const factory _GetAccountHistoryParams( + {@JsonKey(name: 'address') required final String address, + @JsonKey(name: 'hash') final String? hash, + @JsonKey(name: 'topoheight') final int? topoheight, + @JsonKey(name: 'minimum_topoheight') final int? minimumTopoheight, + @JsonKey(name: 'maximum_topoheight') final int? maximumTopoheight}) = + _$GetAccountHistoryParamsImpl; + + factory _GetAccountHistoryParams.fromJson(Map json) = + _$GetAccountHistoryParamsImpl.fromJson; + + @override + @JsonKey(name: 'address') + String get address; + + @override + @JsonKey(name: 'hash') + String? get hash; + + @override + @JsonKey(name: 'topoheight') + int? get topoheight; + + @override + @JsonKey(name: 'minimum_topoheight') + int? get minimumTopoheight; + + @override + @JsonKey(name: 'maximum_topoheight') + int? get maximumTopoheight; + + @override + @JsonKey(ignore: true) + _$$GetAccountHistoryParamsImplCopyWith<_$GetAccountHistoryParamsImpl> + get copyWith => throw _privateConstructorUsedError; +} diff --git a/lib/src/data_transfer_objects/get_account_history/get_account_history_params.g.dart b/lib/src/data_transfer_objects/get_account_history/get_account_history_params.g.dart new file mode 100644 index 0000000..64a0f30 --- /dev/null +++ b/lib/src/data_transfer_objects/get_account_history/get_account_history_params.g.dart @@ -0,0 +1,29 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +// ignore_for_file: package_api_docs, non_constant_identifier_names + +part of 'get_account_history_params.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$GetAccountHistoryParamsImpl _$$GetAccountHistoryParamsImplFromJson( + Map json) => + _$GetAccountHistoryParamsImpl( + address: json['address'] as String, + hash: json['hash'] as String?, + topoheight: json['topoheight'] as int?, + minimumTopoheight: json['minimum_topoheight'] as int?, + maximumTopoheight: json['maximum_topoheight'] as int?, + ); + +Map _$$GetAccountHistoryParamsImplToJson( + _$GetAccountHistoryParamsImpl instance) => + { + 'address': instance.address, + 'hash': instance.hash, + 'topoheight': instance.topoheight, + 'minimum_topoheight': instance.minimumTopoheight, + 'maximum_topoheight': instance.maximumTopoheight, + }; diff --git a/lib/src/data_transfer_objects/get_account_history/get_account_history_result.dart b/lib/src/data_transfer_objects/get_account_history/get_account_history_result.dart new file mode 100644 index 0000000..ce12419 --- /dev/null +++ b/lib/src/data_transfer_objects/get_account_history/get_account_history_result.dart @@ -0,0 +1,25 @@ +// ignore_for_file: public_member_api_docs, invalid_annotation_target + +import 'package:freezed_annotation/freezed_annotation.dart'; + +import 'package:xelis_dart_sdk/xelis_dart_sdk.dart'; + +part 'get_account_history_result.freezed.dart'; + +part 'get_account_history_result.g.dart'; + +@freezed +class GetAccountHistoryResult with _$GetAccountHistoryResult { + const factory GetAccountHistoryResult({ + @JsonKey(name: 'topoheight') required int topoheight, + @JsonKey(name: 'hash') required String hash, + @JsonKey(name: 'block_timestamp') required int blockTimestamp, + @JsonKey(name: 'burn') BurnHistory? burnHistory, + @JsonKey(name: 'mining') MiningHistory? miningHistory, + @JsonKey(name: 'outgoing') OutgoingHistory? outgoingHistory, + @JsonKey(name: 'incoming') IncomingHistory? incomingHistory, + }) = _GetAccountHistoryResult; + + factory GetAccountHistoryResult.fromJson(Map json) => + _$GetAccountHistoryResultFromJson(json); +} diff --git a/lib/src/data_transfer_objects/get_account_history/get_account_history_result.freezed.dart b/lib/src/data_transfer_objects/get_account_history/get_account_history_result.freezed.dart new file mode 100644 index 0000000..f3d6be8 --- /dev/null +++ b/lib/src/data_transfer_objects/get_account_history/get_account_history_result.freezed.dart @@ -0,0 +1,395 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'get_account_history_result.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +GetAccountHistoryResult _$GetAccountHistoryResultFromJson( + Map json) { + return _GetAccountHistoryResult.fromJson(json); +} + +/// @nodoc +mixin _$GetAccountHistoryResult { + @JsonKey(name: 'topoheight') + int get topoheight => throw _privateConstructorUsedError; + + @JsonKey(name: 'hash') + String get hash => throw _privateConstructorUsedError; + + @JsonKey(name: 'block_timestamp') + int get blockTimestamp => throw _privateConstructorUsedError; + + @JsonKey(name: 'burn') + BurnHistory? get burnHistory => throw _privateConstructorUsedError; + + @JsonKey(name: 'mining') + MiningHistory? get miningHistory => throw _privateConstructorUsedError; + + @JsonKey(name: 'outgoing') + OutgoingHistory? get outgoingHistory => throw _privateConstructorUsedError; + + @JsonKey(name: 'incoming') + IncomingHistory? get incomingHistory => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + + @JsonKey(ignore: true) + $GetAccountHistoryResultCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $GetAccountHistoryResultCopyWith<$Res> { + factory $GetAccountHistoryResultCopyWith(GetAccountHistoryResult value, + $Res Function(GetAccountHistoryResult) then) = + _$GetAccountHistoryResultCopyWithImpl<$Res, GetAccountHistoryResult>; + + @useResult + $Res call( + {@JsonKey(name: 'topoheight') int topoheight, + @JsonKey(name: 'hash') String hash, + @JsonKey(name: 'block_timestamp') int blockTimestamp, + @JsonKey(name: 'burn') BurnHistory? burnHistory, + @JsonKey(name: 'mining') MiningHistory? miningHistory, + @JsonKey(name: 'outgoing') OutgoingHistory? outgoingHistory, + @JsonKey(name: 'incoming') IncomingHistory? incomingHistory}); + + $BurnHistoryCopyWith<$Res>? get burnHistory; + + $MiningHistoryCopyWith<$Res>? get miningHistory; + + $OutgoingHistoryCopyWith<$Res>? get outgoingHistory; + + $IncomingHistoryCopyWith<$Res>? get incomingHistory; +} + +/// @nodoc +class _$GetAccountHistoryResultCopyWithImpl<$Res, + $Val extends GetAccountHistoryResult> + implements $GetAccountHistoryResultCopyWith<$Res> { + _$GetAccountHistoryResultCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? topoheight = null, + Object? hash = null, + Object? blockTimestamp = null, + Object? burnHistory = freezed, + Object? miningHistory = freezed, + Object? outgoingHistory = freezed, + Object? incomingHistory = freezed, + }) { + return _then(_value.copyWith( + topoheight: null == topoheight + ? _value.topoheight + : topoheight // ignore: cast_nullable_to_non_nullable + as int, + hash: null == hash + ? _value.hash + : hash // ignore: cast_nullable_to_non_nullable + as String, + blockTimestamp: null == blockTimestamp + ? _value.blockTimestamp + : blockTimestamp // ignore: cast_nullable_to_non_nullable + as int, + burnHistory: freezed == burnHistory + ? _value.burnHistory + : burnHistory // ignore: cast_nullable_to_non_nullable + as BurnHistory?, + miningHistory: freezed == miningHistory + ? _value.miningHistory + : miningHistory // ignore: cast_nullable_to_non_nullable + as MiningHistory?, + outgoingHistory: freezed == outgoingHistory + ? _value.outgoingHistory + : outgoingHistory // ignore: cast_nullable_to_non_nullable + as OutgoingHistory?, + incomingHistory: freezed == incomingHistory + ? _value.incomingHistory + : incomingHistory // ignore: cast_nullable_to_non_nullable + as IncomingHistory?, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $BurnHistoryCopyWith<$Res>? get burnHistory { + if (_value.burnHistory == null) { + return null; + } + + return $BurnHistoryCopyWith<$Res>(_value.burnHistory!, (value) { + return _then(_value.copyWith(burnHistory: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $MiningHistoryCopyWith<$Res>? get miningHistory { + if (_value.miningHistory == null) { + return null; + } + + return $MiningHistoryCopyWith<$Res>(_value.miningHistory!, (value) { + return _then(_value.copyWith(miningHistory: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $OutgoingHistoryCopyWith<$Res>? get outgoingHistory { + if (_value.outgoingHistory == null) { + return null; + } + + return $OutgoingHistoryCopyWith<$Res>(_value.outgoingHistory!, (value) { + return _then(_value.copyWith(outgoingHistory: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $IncomingHistoryCopyWith<$Res>? get incomingHistory { + if (_value.incomingHistory == null) { + return null; + } + + return $IncomingHistoryCopyWith<$Res>(_value.incomingHistory!, (value) { + return _then(_value.copyWith(incomingHistory: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$GetAccountHistoryResultImplCopyWith<$Res> + implements $GetAccountHistoryResultCopyWith<$Res> { + factory _$$GetAccountHistoryResultImplCopyWith( + _$GetAccountHistoryResultImpl value, + $Res Function(_$GetAccountHistoryResultImpl) then) = + __$$GetAccountHistoryResultImplCopyWithImpl<$Res>; + + @override + @useResult + $Res call( + {@JsonKey(name: 'topoheight') int topoheight, + @JsonKey(name: 'hash') String hash, + @JsonKey(name: 'block_timestamp') int blockTimestamp, + @JsonKey(name: 'burn') BurnHistory? burnHistory, + @JsonKey(name: 'mining') MiningHistory? miningHistory, + @JsonKey(name: 'outgoing') OutgoingHistory? outgoingHistory, + @JsonKey(name: 'incoming') IncomingHistory? incomingHistory}); + + @override + $BurnHistoryCopyWith<$Res>? get burnHistory; + + @override + $MiningHistoryCopyWith<$Res>? get miningHistory; + + @override + $OutgoingHistoryCopyWith<$Res>? get outgoingHistory; + + @override + $IncomingHistoryCopyWith<$Res>? get incomingHistory; +} + +/// @nodoc +class __$$GetAccountHistoryResultImplCopyWithImpl<$Res> + extends _$GetAccountHistoryResultCopyWithImpl<$Res, + _$GetAccountHistoryResultImpl> + implements _$$GetAccountHistoryResultImplCopyWith<$Res> { + __$$GetAccountHistoryResultImplCopyWithImpl( + _$GetAccountHistoryResultImpl _value, + $Res Function(_$GetAccountHistoryResultImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? topoheight = null, + Object? hash = null, + Object? blockTimestamp = null, + Object? burnHistory = freezed, + Object? miningHistory = freezed, + Object? outgoingHistory = freezed, + Object? incomingHistory = freezed, + }) { + return _then(_$GetAccountHistoryResultImpl( + topoheight: null == topoheight + ? _value.topoheight + : topoheight // ignore: cast_nullable_to_non_nullable + as int, + hash: null == hash + ? _value.hash + : hash // ignore: cast_nullable_to_non_nullable + as String, + blockTimestamp: null == blockTimestamp + ? _value.blockTimestamp + : blockTimestamp // ignore: cast_nullable_to_non_nullable + as int, + burnHistory: freezed == burnHistory + ? _value.burnHistory + : burnHistory // ignore: cast_nullable_to_non_nullable + as BurnHistory?, + miningHistory: freezed == miningHistory + ? _value.miningHistory + : miningHistory // ignore: cast_nullable_to_non_nullable + as MiningHistory?, + outgoingHistory: freezed == outgoingHistory + ? _value.outgoingHistory + : outgoingHistory // ignore: cast_nullable_to_non_nullable + as OutgoingHistory?, + incomingHistory: freezed == incomingHistory + ? _value.incomingHistory + : incomingHistory // ignore: cast_nullable_to_non_nullable + as IncomingHistory?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$GetAccountHistoryResultImpl implements _GetAccountHistoryResult { + const _$GetAccountHistoryResultImpl( + {@JsonKey(name: 'topoheight') required this.topoheight, + @JsonKey(name: 'hash') required this.hash, + @JsonKey(name: 'block_timestamp') required this.blockTimestamp, + @JsonKey(name: 'burn') this.burnHistory, + @JsonKey(name: 'mining') this.miningHistory, + @JsonKey(name: 'outgoing') this.outgoingHistory, + @JsonKey(name: 'incoming') this.incomingHistory}); + + factory _$GetAccountHistoryResultImpl.fromJson(Map json) => + _$$GetAccountHistoryResultImplFromJson(json); + + @override + @JsonKey(name: 'topoheight') + final int topoheight; + @override + @JsonKey(name: 'hash') + final String hash; + @override + @JsonKey(name: 'block_timestamp') + final int blockTimestamp; + @override + @JsonKey(name: 'burn') + final BurnHistory? burnHistory; + @override + @JsonKey(name: 'mining') + final MiningHistory? miningHistory; + @override + @JsonKey(name: 'outgoing') + final OutgoingHistory? outgoingHistory; + @override + @JsonKey(name: 'incoming') + final IncomingHistory? incomingHistory; + + @override + String toString() { + return 'GetAccountHistoryResult(topoheight: $topoheight, hash: $hash, blockTimestamp: $blockTimestamp, burnHistory: $burnHistory, miningHistory: $miningHistory, outgoingHistory: $outgoingHistory, incomingHistory: $incomingHistory)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$GetAccountHistoryResultImpl && + (identical(other.topoheight, topoheight) || + other.topoheight == topoheight) && + (identical(other.hash, hash) || other.hash == hash) && + (identical(other.blockTimestamp, blockTimestamp) || + other.blockTimestamp == blockTimestamp) && + (identical(other.burnHistory, burnHistory) || + other.burnHistory == burnHistory) && + (identical(other.miningHistory, miningHistory) || + other.miningHistory == miningHistory) && + (identical(other.outgoingHistory, outgoingHistory) || + other.outgoingHistory == outgoingHistory) && + (identical(other.incomingHistory, incomingHistory) || + other.incomingHistory == incomingHistory)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, topoheight, hash, blockTimestamp, + burnHistory, miningHistory, outgoingHistory, incomingHistory); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$GetAccountHistoryResultImplCopyWith<_$GetAccountHistoryResultImpl> + get copyWith => __$$GetAccountHistoryResultImplCopyWithImpl< + _$GetAccountHistoryResultImpl>(this, _$identity); + + @override + Map toJson() { + return _$$GetAccountHistoryResultImplToJson( + this, + ); + } +} + +abstract class _GetAccountHistoryResult implements GetAccountHistoryResult { + const factory _GetAccountHistoryResult( + {@JsonKey(name: 'topoheight') required final int topoheight, + @JsonKey(name: 'hash') required final String hash, + @JsonKey(name: 'block_timestamp') required final int blockTimestamp, + @JsonKey(name: 'burn') final BurnHistory? burnHistory, + @JsonKey(name: 'mining') final MiningHistory? miningHistory, + @JsonKey(name: 'outgoing') final OutgoingHistory? outgoingHistory, + @JsonKey(name: 'incoming') final IncomingHistory? incomingHistory}) = + _$GetAccountHistoryResultImpl; + + factory _GetAccountHistoryResult.fromJson(Map json) = + _$GetAccountHistoryResultImpl.fromJson; + + @override + @JsonKey(name: 'topoheight') + int get topoheight; + + @override + @JsonKey(name: 'hash') + String get hash; + + @override + @JsonKey(name: 'block_timestamp') + int get blockTimestamp; + + @override + @JsonKey(name: 'burn') + BurnHistory? get burnHistory; + + @override + @JsonKey(name: 'mining') + MiningHistory? get miningHistory; + + @override + @JsonKey(name: 'outgoing') + OutgoingHistory? get outgoingHistory; + + @override + @JsonKey(name: 'incoming') + IncomingHistory? get incomingHistory; + + @override + @JsonKey(ignore: true) + _$$GetAccountHistoryResultImplCopyWith<_$GetAccountHistoryResultImpl> + get copyWith => throw _privateConstructorUsedError; +} diff --git a/lib/src/data_transfer_objects/get_account_history/get_account_history_result.g.dart b/lib/src/data_transfer_objects/get_account_history/get_account_history_result.g.dart new file mode 100644 index 0000000..dfab39f --- /dev/null +++ b/lib/src/data_transfer_objects/get_account_history/get_account_history_result.g.dart @@ -0,0 +1,41 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +// ignore_for_file: package_api_docs, non_constant_identifier_names + +part of 'get_account_history_result.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$GetAccountHistoryResultImpl _$$GetAccountHistoryResultImplFromJson( + Map json) => + _$GetAccountHistoryResultImpl( + topoheight: json['topoheight'] as int, + hash: json['hash'] as String, + blockTimestamp: json['block_timestamp'] as int, + burnHistory: json['burn'] == null + ? null + : BurnHistory.fromJson(json['burn'] as Map), + miningHistory: json['mining'] == null + ? null + : MiningHistory.fromJson(json['mining'] as Map), + outgoingHistory: json['outgoing'] == null + ? null + : OutgoingHistory.fromJson(json['outgoing'] as Map), + incomingHistory: json['incoming'] == null + ? null + : IncomingHistory.fromJson(json['incoming'] as Map), + ); + +Map _$$GetAccountHistoryResultImplToJson( + _$GetAccountHistoryResultImpl instance) => + { + 'topoheight': instance.topoheight, + 'hash': instance.hash, + 'block_timestamp': instance.blockTimestamp, + 'burn': instance.burnHistory, + 'mining': instance.miningHistory, + 'outgoing': instance.outgoingHistory, + 'incoming': instance.incomingHistory, + }; diff --git a/lib/src/data_transfer_objects/get_account_history/incoming_history.dart b/lib/src/data_transfer_objects/get_account_history/incoming_history.dart new file mode 100644 index 0000000..222a634 --- /dev/null +++ b/lib/src/data_transfer_objects/get_account_history/incoming_history.dart @@ -0,0 +1,17 @@ +// ignore_for_file: public_member_api_docs, invalid_annotation_target + +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'incoming_history.freezed.dart'; + +part 'incoming_history.g.dart'; + +@freezed +class IncomingHistory with _$IncomingHistory { + const factory IncomingHistory({ + @JsonKey(name: 'amount') required int amount, + }) = _IncomingHistory; + + factory IncomingHistory.fromJson(Map json) => + _$IncomingHistoryFromJson(json); +} diff --git a/lib/src/data_transfer_objects/get_account_history/incoming_history.freezed.dart b/lib/src/data_transfer_objects/get_account_history/incoming_history.freezed.dart new file mode 100644 index 0000000..883a41a --- /dev/null +++ b/lib/src/data_transfer_objects/get_account_history/incoming_history.freezed.dart @@ -0,0 +1,162 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'incoming_history.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +IncomingHistory _$IncomingHistoryFromJson(Map json) { + return _IncomingHistory.fromJson(json); +} + +/// @nodoc +mixin _$IncomingHistory { + @JsonKey(name: 'amount') + int get amount => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + + @JsonKey(ignore: true) + $IncomingHistoryCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $IncomingHistoryCopyWith<$Res> { + factory $IncomingHistoryCopyWith( + IncomingHistory value, $Res Function(IncomingHistory) then) = + _$IncomingHistoryCopyWithImpl<$Res, IncomingHistory>; + + @useResult + $Res call({@JsonKey(name: 'amount') int amount}); +} + +/// @nodoc +class _$IncomingHistoryCopyWithImpl<$Res, $Val extends IncomingHistory> + implements $IncomingHistoryCopyWith<$Res> { + _$IncomingHistoryCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? amount = null, + }) { + return _then(_value.copyWith( + amount: null == amount + ? _value.amount + : amount // ignore: cast_nullable_to_non_nullable + as int, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$IncomingHistoryImplCopyWith<$Res> + implements $IncomingHistoryCopyWith<$Res> { + factory _$$IncomingHistoryImplCopyWith(_$IncomingHistoryImpl value, + $Res Function(_$IncomingHistoryImpl) then) = + __$$IncomingHistoryImplCopyWithImpl<$Res>; + + @override + @useResult + $Res call({@JsonKey(name: 'amount') int amount}); +} + +/// @nodoc +class __$$IncomingHistoryImplCopyWithImpl<$Res> + extends _$IncomingHistoryCopyWithImpl<$Res, _$IncomingHistoryImpl> + implements _$$IncomingHistoryImplCopyWith<$Res> { + __$$IncomingHistoryImplCopyWithImpl( + _$IncomingHistoryImpl _value, $Res Function(_$IncomingHistoryImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? amount = null, + }) { + return _then(_$IncomingHistoryImpl( + amount: null == amount + ? _value.amount + : amount // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$IncomingHistoryImpl implements _IncomingHistory { + const _$IncomingHistoryImpl({@JsonKey(name: 'amount') required this.amount}); + + factory _$IncomingHistoryImpl.fromJson(Map json) => + _$$IncomingHistoryImplFromJson(json); + + @override + @JsonKey(name: 'amount') + final int amount; + + @override + String toString() { + return 'IncomingHistory(amount: $amount)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$IncomingHistoryImpl && + (identical(other.amount, amount) || other.amount == amount)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, amount); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$IncomingHistoryImplCopyWith<_$IncomingHistoryImpl> get copyWith => + __$$IncomingHistoryImplCopyWithImpl<_$IncomingHistoryImpl>( + this, _$identity); + + @override + Map toJson() { + return _$$IncomingHistoryImplToJson( + this, + ); + } +} + +abstract class _IncomingHistory implements IncomingHistory { + const factory _IncomingHistory( + {@JsonKey(name: 'amount') required final int amount}) = + _$IncomingHistoryImpl; + + factory _IncomingHistory.fromJson(Map json) = + _$IncomingHistoryImpl.fromJson; + + @override + @JsonKey(name: 'amount') + int get amount; + + @override + @JsonKey(ignore: true) + _$$IncomingHistoryImplCopyWith<_$IncomingHistoryImpl> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/lib/src/data_transfer_objects/get_account_history/incoming_history.g.dart b/lib/src/data_transfer_objects/get_account_history/incoming_history.g.dart new file mode 100644 index 0000000..dabc94f --- /dev/null +++ b/lib/src/data_transfer_objects/get_account_history/incoming_history.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +// ignore_for_file: package_api_docs, non_constant_identifier_names + +part of 'incoming_history.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$IncomingHistoryImpl _$$IncomingHistoryImplFromJson( + Map json) => + _$IncomingHistoryImpl( + amount: json['amount'] as int, + ); + +Map _$$IncomingHistoryImplToJson( + _$IncomingHistoryImpl instance) => + { + 'amount': instance.amount, + }; diff --git a/lib/src/data_transfer_objects/get_account_history/mining_history.dart b/lib/src/data_transfer_objects/get_account_history/mining_history.dart new file mode 100644 index 0000000..871e609 --- /dev/null +++ b/lib/src/data_transfer_objects/get_account_history/mining_history.dart @@ -0,0 +1,17 @@ +// ignore_for_file: public_member_api_docs, invalid_annotation_target + +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'mining_history.freezed.dart'; + +part 'mining_history.g.dart'; + +@freezed +class MiningHistory with _$MiningHistory { + const factory MiningHistory({ + @JsonKey(name: 'reward') required int reward, + }) = _MiningHistory; + + factory MiningHistory.fromJson(Map json) => + _$MiningHistoryFromJson(json); +} diff --git a/lib/src/data_transfer_objects/get_account_history/mining_history.freezed.dart b/lib/src/data_transfer_objects/get_account_history/mining_history.freezed.dart new file mode 100644 index 0000000..e2eca64 --- /dev/null +++ b/lib/src/data_transfer_objects/get_account_history/mining_history.freezed.dart @@ -0,0 +1,161 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'mining_history.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +MiningHistory _$MiningHistoryFromJson(Map json) { + return _MiningHistory.fromJson(json); +} + +/// @nodoc +mixin _$MiningHistory { + @JsonKey(name: 'reward') + int get reward => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + + @JsonKey(ignore: true) + $MiningHistoryCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $MiningHistoryCopyWith<$Res> { + factory $MiningHistoryCopyWith( + MiningHistory value, $Res Function(MiningHistory) then) = + _$MiningHistoryCopyWithImpl<$Res, MiningHistory>; + + @useResult + $Res call({@JsonKey(name: 'reward') int reward}); +} + +/// @nodoc +class _$MiningHistoryCopyWithImpl<$Res, $Val extends MiningHistory> + implements $MiningHistoryCopyWith<$Res> { + _$MiningHistoryCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? reward = null, + }) { + return _then(_value.copyWith( + reward: null == reward + ? _value.reward + : reward // ignore: cast_nullable_to_non_nullable + as int, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$MiningHistoryImplCopyWith<$Res> + implements $MiningHistoryCopyWith<$Res> { + factory _$$MiningHistoryImplCopyWith( + _$MiningHistoryImpl value, $Res Function(_$MiningHistoryImpl) then) = + __$$MiningHistoryImplCopyWithImpl<$Res>; + + @override + @useResult + $Res call({@JsonKey(name: 'reward') int reward}); +} + +/// @nodoc +class __$$MiningHistoryImplCopyWithImpl<$Res> + extends _$MiningHistoryCopyWithImpl<$Res, _$MiningHistoryImpl> + implements _$$MiningHistoryImplCopyWith<$Res> { + __$$MiningHistoryImplCopyWithImpl( + _$MiningHistoryImpl _value, $Res Function(_$MiningHistoryImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? reward = null, + }) { + return _then(_$MiningHistoryImpl( + reward: null == reward + ? _value.reward + : reward // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$MiningHistoryImpl implements _MiningHistory { + const _$MiningHistoryImpl({@JsonKey(name: 'reward') required this.reward}); + + factory _$MiningHistoryImpl.fromJson(Map json) => + _$$MiningHistoryImplFromJson(json); + + @override + @JsonKey(name: 'reward') + final int reward; + + @override + String toString() { + return 'MiningHistory(reward: $reward)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$MiningHistoryImpl && + (identical(other.reward, reward) || other.reward == reward)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, reward); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$MiningHistoryImplCopyWith<_$MiningHistoryImpl> get copyWith => + __$$MiningHistoryImplCopyWithImpl<_$MiningHistoryImpl>(this, _$identity); + + @override + Map toJson() { + return _$$MiningHistoryImplToJson( + this, + ); + } +} + +abstract class _MiningHistory implements MiningHistory { + const factory _MiningHistory( + {@JsonKey(name: 'reward') required final int reward}) = + _$MiningHistoryImpl; + + factory _MiningHistory.fromJson(Map json) = + _$MiningHistoryImpl.fromJson; + + @override + @JsonKey(name: 'reward') + int get reward; + + @override + @JsonKey(ignore: true) + _$$MiningHistoryImplCopyWith<_$MiningHistoryImpl> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/lib/src/data_transfer_objects/get_account_history/mining_history.g.dart b/lib/src/data_transfer_objects/get_account_history/mining_history.g.dart new file mode 100644 index 0000000..10cd792 --- /dev/null +++ b/lib/src/data_transfer_objects/get_account_history/mining_history.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +// ignore_for_file: package_api_docs, non_constant_identifier_names + +part of 'mining_history.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$MiningHistoryImpl _$$MiningHistoryImplFromJson(Map json) => + _$MiningHistoryImpl( + reward: json['reward'] as int, + ); + +Map _$$MiningHistoryImplToJson(_$MiningHistoryImpl instance) => + { + 'reward': instance.reward, + }; diff --git a/lib/src/data_transfer_objects/get_account_history/outgoing_history.dart b/lib/src/data_transfer_objects/get_account_history/outgoing_history.dart new file mode 100644 index 0000000..598eb29 --- /dev/null +++ b/lib/src/data_transfer_objects/get_account_history/outgoing_history.dart @@ -0,0 +1,17 @@ +// ignore_for_file: public_member_api_docs, invalid_annotation_target + +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'outgoing_history.freezed.dart'; + +part 'outgoing_history.g.dart'; + +@freezed +class OutgoingHistory with _$OutgoingHistory { + const factory OutgoingHistory({ + @JsonKey(name: 'amount') required int amount, + }) = _OutgoingHistory; + + factory OutgoingHistory.fromJson(Map json) => + _$OutgoingHistoryFromJson(json); +} diff --git a/lib/src/data_transfer_objects/get_account_history/outgoing_history.freezed.dart b/lib/src/data_transfer_objects/get_account_history/outgoing_history.freezed.dart new file mode 100644 index 0000000..481b489 --- /dev/null +++ b/lib/src/data_transfer_objects/get_account_history/outgoing_history.freezed.dart @@ -0,0 +1,162 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'outgoing_history.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +OutgoingHistory _$OutgoingHistoryFromJson(Map json) { + return _OutgoingHistory.fromJson(json); +} + +/// @nodoc +mixin _$OutgoingHistory { + @JsonKey(name: 'amount') + int get amount => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + + @JsonKey(ignore: true) + $OutgoingHistoryCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $OutgoingHistoryCopyWith<$Res> { + factory $OutgoingHistoryCopyWith( + OutgoingHistory value, $Res Function(OutgoingHistory) then) = + _$OutgoingHistoryCopyWithImpl<$Res, OutgoingHistory>; + + @useResult + $Res call({@JsonKey(name: 'amount') int amount}); +} + +/// @nodoc +class _$OutgoingHistoryCopyWithImpl<$Res, $Val extends OutgoingHistory> + implements $OutgoingHistoryCopyWith<$Res> { + _$OutgoingHistoryCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? amount = null, + }) { + return _then(_value.copyWith( + amount: null == amount + ? _value.amount + : amount // ignore: cast_nullable_to_non_nullable + as int, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$OutgoingHistoryImplCopyWith<$Res> + implements $OutgoingHistoryCopyWith<$Res> { + factory _$$OutgoingHistoryImplCopyWith(_$OutgoingHistoryImpl value, + $Res Function(_$OutgoingHistoryImpl) then) = + __$$OutgoingHistoryImplCopyWithImpl<$Res>; + + @override + @useResult + $Res call({@JsonKey(name: 'amount') int amount}); +} + +/// @nodoc +class __$$OutgoingHistoryImplCopyWithImpl<$Res> + extends _$OutgoingHistoryCopyWithImpl<$Res, _$OutgoingHistoryImpl> + implements _$$OutgoingHistoryImplCopyWith<$Res> { + __$$OutgoingHistoryImplCopyWithImpl( + _$OutgoingHistoryImpl _value, $Res Function(_$OutgoingHistoryImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? amount = null, + }) { + return _then(_$OutgoingHistoryImpl( + amount: null == amount + ? _value.amount + : amount // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$OutgoingHistoryImpl implements _OutgoingHistory { + const _$OutgoingHistoryImpl({@JsonKey(name: 'amount') required this.amount}); + + factory _$OutgoingHistoryImpl.fromJson(Map json) => + _$$OutgoingHistoryImplFromJson(json); + + @override + @JsonKey(name: 'amount') + final int amount; + + @override + String toString() { + return 'OutgoingHistory(amount: $amount)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$OutgoingHistoryImpl && + (identical(other.amount, amount) || other.amount == amount)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, amount); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$OutgoingHistoryImplCopyWith<_$OutgoingHistoryImpl> get copyWith => + __$$OutgoingHistoryImplCopyWithImpl<_$OutgoingHistoryImpl>( + this, _$identity); + + @override + Map toJson() { + return _$$OutgoingHistoryImplToJson( + this, + ); + } +} + +abstract class _OutgoingHistory implements OutgoingHistory { + const factory _OutgoingHistory( + {@JsonKey(name: 'amount') required final int amount}) = + _$OutgoingHistoryImpl; + + factory _OutgoingHistory.fromJson(Map json) = + _$OutgoingHistoryImpl.fromJson; + + @override + @JsonKey(name: 'amount') + int get amount; + + @override + @JsonKey(ignore: true) + _$$OutgoingHistoryImplCopyWith<_$OutgoingHistoryImpl> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/lib/src/data_transfer_objects/get_account_history/outgoing_history.g.dart b/lib/src/data_transfer_objects/get_account_history/outgoing_history.g.dart new file mode 100644 index 0000000..fff02a4 --- /dev/null +++ b/lib/src/data_transfer_objects/get_account_history/outgoing_history.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +// ignore_for_file: package_api_docs, non_constant_identifier_names + +part of 'outgoing_history.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$OutgoingHistoryImpl _$$OutgoingHistoryImplFromJson( + Map json) => + _$OutgoingHistoryImpl( + amount: json['amount'] as int, + ); + +Map _$$OutgoingHistoryImplToJson( + _$OutgoingHistoryImpl instance) => + { + 'amount': instance.amount, + }; diff --git a/lib/src/data_transfer_objects/get_assets/get_assets_params.freezed.dart b/lib/src/data_transfer_objects/get_assets/get_assets_params.freezed.dart index 3147a17..080f958 100644 --- a/lib/src/data_transfer_objects/get_assets/get_assets_params.freezed.dart +++ b/lib/src/data_transfer_objects/get_assets/get_assets_params.freezed.dart @@ -22,12 +22,10 @@ GetAssetsParams _$GetAssetsParamsFromJson(Map json) { mixin _$GetAssetsParams { @JsonKey(name: 'skip') int? get skip => throw _privateConstructorUsedError; - @JsonKey(name: 'maximum') int? get maximum => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) $GetAssetsParamsCopyWith get copyWith => throw _privateConstructorUsedError; @@ -38,7 +36,6 @@ abstract class $GetAssetsParamsCopyWith<$Res> { factory $GetAssetsParamsCopyWith( GetAssetsParams value, $Res Function(GetAssetsParams) then) = _$GetAssetsParamsCopyWithImpl<$Res, GetAssetsParams>; - @useResult $Res call( {@JsonKey(name: 'skip') int? skip, @@ -52,7 +49,6 @@ class _$GetAssetsParamsCopyWithImpl<$Res, $Val extends GetAssetsParams> // ignore: unused_field final $Val _value; - // ignore: unused_field final $Res Function($Val) _then; @@ -81,7 +77,6 @@ abstract class _$$GetAssetsParamsImplCopyWith<$Res> factory _$$GetAssetsParamsImplCopyWith(_$GetAssetsParamsImpl value, $Res Function(_$GetAssetsParamsImpl) then) = __$$GetAssetsParamsImplCopyWithImpl<$Res>; - @override @useResult $Res call( @@ -177,11 +172,9 @@ abstract class _GetAssetsParams implements GetAssetsParams { @override @JsonKey(name: 'skip') int? get skip; - @override @JsonKey(name: 'maximum') int? get maximum; - @override @JsonKey(ignore: true) _$$GetAssetsParamsImplCopyWith<_$GetAssetsParamsImpl> get copyWith => diff --git a/lib/src/data_transfer_objects/get_peers/peer.dart b/lib/src/data_transfer_objects/get_peers/peer.dart new file mode 100644 index 0000000..6c05d94 --- /dev/null +++ b/lib/src/data_transfer_objects/get_peers/peer.dart @@ -0,0 +1,25 @@ +// ignore_for_file: public_member_api_docs, invalid_annotation_target, always_put_required_named_parameters_first + +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'peer.freezed.dart'; + +part 'peer.g.dart'; + +@freezed +class Peer with _$Peer { + const factory Peer({ + @JsonKey(name: 'addr') required String address, + @JsonKey(name: 'cumulative_difficulty') required int cumulativeDifficulty, + @JsonKey(name: 'height') required int height, + @JsonKey(name: 'id') required int id, + @JsonKey(name: 'last_ping') required int lastPing, + @JsonKey(name: 'pruned_topoheight') required int prunedTopoHeight, + @JsonKey(name: 'tag') String? tag, + @JsonKey(name: 'top_block_hash') required String topBlockHash, + @JsonKey(name: 'topoheight') required int topoheight, + @JsonKey(name: 'version') required String version, + }) = _Peer; + + factory Peer.fromJson(Map json) => _$PeerFromJson(json); +} diff --git a/lib/src/data_transfer_objects/get_peers/peer.freezed.dart b/lib/src/data_transfer_objects/get_peers/peer.freezed.dart new file mode 100644 index 0000000..18ebdb8 --- /dev/null +++ b/lib/src/data_transfer_objects/get_peers/peer.freezed.dart @@ -0,0 +1,401 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'peer.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +Peer _$PeerFromJson(Map json) { + return _Peer.fromJson(json); +} + +/// @nodoc +mixin _$Peer { + @JsonKey(name: 'addr') + String get address => throw _privateConstructorUsedError; + + @JsonKey(name: 'cumulative_difficulty') + int get cumulativeDifficulty => throw _privateConstructorUsedError; + + @JsonKey(name: 'height') + int get height => throw _privateConstructorUsedError; + + @JsonKey(name: 'id') + int get id => throw _privateConstructorUsedError; + + @JsonKey(name: 'last_ping') + int get lastPing => throw _privateConstructorUsedError; + + @JsonKey(name: 'pruned_topoheight') + int get prunedTopoHeight => throw _privateConstructorUsedError; + + @JsonKey(name: 'tag') + String? get tag => throw _privateConstructorUsedError; + + @JsonKey(name: 'top_block_hash') + String get topBlockHash => throw _privateConstructorUsedError; + + @JsonKey(name: 'topoheight') + int get topoheight => throw _privateConstructorUsedError; + + @JsonKey(name: 'version') + String get version => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + + @JsonKey(ignore: true) + $PeerCopyWith get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $PeerCopyWith<$Res> { + factory $PeerCopyWith(Peer value, $Res Function(Peer) then) = + _$PeerCopyWithImpl<$Res, Peer>; + + @useResult + $Res call( + {@JsonKey(name: 'addr') String address, + @JsonKey(name: 'cumulative_difficulty') int cumulativeDifficulty, + @JsonKey(name: 'height') int height, + @JsonKey(name: 'id') int id, + @JsonKey(name: 'last_ping') int lastPing, + @JsonKey(name: 'pruned_topoheight') int prunedTopoHeight, + @JsonKey(name: 'tag') String? tag, + @JsonKey(name: 'top_block_hash') String topBlockHash, + @JsonKey(name: 'topoheight') int topoheight, + @JsonKey(name: 'version') String version}); +} + +/// @nodoc +class _$PeerCopyWithImpl<$Res, $Val extends Peer> + implements $PeerCopyWith<$Res> { + _$PeerCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? address = null, + Object? cumulativeDifficulty = null, + Object? height = null, + Object? id = null, + Object? lastPing = null, + Object? prunedTopoHeight = null, + Object? tag = freezed, + Object? topBlockHash = null, + Object? topoheight = null, + Object? version = null, + }) { + return _then(_value.copyWith( + address: null == address + ? _value.address + : address // ignore: cast_nullable_to_non_nullable + as String, + cumulativeDifficulty: null == cumulativeDifficulty + ? _value.cumulativeDifficulty + : cumulativeDifficulty // ignore: cast_nullable_to_non_nullable + as int, + height: null == height + ? _value.height + : height // ignore: cast_nullable_to_non_nullable + as int, + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + lastPing: null == lastPing + ? _value.lastPing + : lastPing // ignore: cast_nullable_to_non_nullable + as int, + prunedTopoHeight: null == prunedTopoHeight + ? _value.prunedTopoHeight + : prunedTopoHeight // ignore: cast_nullable_to_non_nullable + as int, + tag: freezed == tag + ? _value.tag + : tag // ignore: cast_nullable_to_non_nullable + as String?, + topBlockHash: null == topBlockHash + ? _value.topBlockHash + : topBlockHash // ignore: cast_nullable_to_non_nullable + as String, + topoheight: null == topoheight + ? _value.topoheight + : topoheight // ignore: cast_nullable_to_non_nullable + as int, + version: null == version + ? _value.version + : version // ignore: cast_nullable_to_non_nullable + as String, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$PeerImplCopyWith<$Res> implements $PeerCopyWith<$Res> { + factory _$$PeerImplCopyWith( + _$PeerImpl value, $Res Function(_$PeerImpl) then) = + __$$PeerImplCopyWithImpl<$Res>; + + @override + @useResult + $Res call( + {@JsonKey(name: 'addr') String address, + @JsonKey(name: 'cumulative_difficulty') int cumulativeDifficulty, + @JsonKey(name: 'height') int height, + @JsonKey(name: 'id') int id, + @JsonKey(name: 'last_ping') int lastPing, + @JsonKey(name: 'pruned_topoheight') int prunedTopoHeight, + @JsonKey(name: 'tag') String? tag, + @JsonKey(name: 'top_block_hash') String topBlockHash, + @JsonKey(name: 'topoheight') int topoheight, + @JsonKey(name: 'version') String version}); +} + +/// @nodoc +class __$$PeerImplCopyWithImpl<$Res> + extends _$PeerCopyWithImpl<$Res, _$PeerImpl> + implements _$$PeerImplCopyWith<$Res> { + __$$PeerImplCopyWithImpl(_$PeerImpl _value, $Res Function(_$PeerImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? address = null, + Object? cumulativeDifficulty = null, + Object? height = null, + Object? id = null, + Object? lastPing = null, + Object? prunedTopoHeight = null, + Object? tag = freezed, + Object? topBlockHash = null, + Object? topoheight = null, + Object? version = null, + }) { + return _then(_$PeerImpl( + address: null == address + ? _value.address + : address // ignore: cast_nullable_to_non_nullable + as String, + cumulativeDifficulty: null == cumulativeDifficulty + ? _value.cumulativeDifficulty + : cumulativeDifficulty // ignore: cast_nullable_to_non_nullable + as int, + height: null == height + ? _value.height + : height // ignore: cast_nullable_to_non_nullable + as int, + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as int, + lastPing: null == lastPing + ? _value.lastPing + : lastPing // ignore: cast_nullable_to_non_nullable + as int, + prunedTopoHeight: null == prunedTopoHeight + ? _value.prunedTopoHeight + : prunedTopoHeight // ignore: cast_nullable_to_non_nullable + as int, + tag: freezed == tag + ? _value.tag + : tag // ignore: cast_nullable_to_non_nullable + as String?, + topBlockHash: null == topBlockHash + ? _value.topBlockHash + : topBlockHash // ignore: cast_nullable_to_non_nullable + as String, + topoheight: null == topoheight + ? _value.topoheight + : topoheight // ignore: cast_nullable_to_non_nullable + as int, + version: null == version + ? _value.version + : version // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$PeerImpl implements _Peer { + const _$PeerImpl( + {@JsonKey(name: 'addr') required this.address, + @JsonKey(name: 'cumulative_difficulty') + required this.cumulativeDifficulty, + @JsonKey(name: 'height') required this.height, + @JsonKey(name: 'id') required this.id, + @JsonKey(name: 'last_ping') required this.lastPing, + @JsonKey(name: 'pruned_topoheight') required this.prunedTopoHeight, + @JsonKey(name: 'tag') this.tag, + @JsonKey(name: 'top_block_hash') required this.topBlockHash, + @JsonKey(name: 'topoheight') required this.topoheight, + @JsonKey(name: 'version') required this.version}); + + factory _$PeerImpl.fromJson(Map json) => + _$$PeerImplFromJson(json); + + @override + @JsonKey(name: 'addr') + final String address; + @override + @JsonKey(name: 'cumulative_difficulty') + final int cumulativeDifficulty; + @override + @JsonKey(name: 'height') + final int height; + @override + @JsonKey(name: 'id') + final int id; + @override + @JsonKey(name: 'last_ping') + final int lastPing; + @override + @JsonKey(name: 'pruned_topoheight') + final int prunedTopoHeight; + @override + @JsonKey(name: 'tag') + final String? tag; + @override + @JsonKey(name: 'top_block_hash') + final String topBlockHash; + @override + @JsonKey(name: 'topoheight') + final int topoheight; + @override + @JsonKey(name: 'version') + final String version; + + @override + String toString() { + return 'Peer(address: $address, cumulativeDifficulty: $cumulativeDifficulty, height: $height, id: $id, lastPing: $lastPing, prunedTopoHeight: $prunedTopoHeight, tag: $tag, topBlockHash: $topBlockHash, topoheight: $topoheight, version: $version)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$PeerImpl && + (identical(other.address, address) || other.address == address) && + (identical(other.cumulativeDifficulty, cumulativeDifficulty) || + other.cumulativeDifficulty == cumulativeDifficulty) && + (identical(other.height, height) || other.height == height) && + (identical(other.id, id) || other.id == id) && + (identical(other.lastPing, lastPing) || + other.lastPing == lastPing) && + (identical(other.prunedTopoHeight, prunedTopoHeight) || + other.prunedTopoHeight == prunedTopoHeight) && + (identical(other.tag, tag) || other.tag == tag) && + (identical(other.topBlockHash, topBlockHash) || + other.topBlockHash == topBlockHash) && + (identical(other.topoheight, topoheight) || + other.topoheight == topoheight) && + (identical(other.version, version) || other.version == version)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash( + runtimeType, + address, + cumulativeDifficulty, + height, + id, + lastPing, + prunedTopoHeight, + tag, + topBlockHash, + topoheight, + version); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$PeerImplCopyWith<_$PeerImpl> get copyWith => + __$$PeerImplCopyWithImpl<_$PeerImpl>(this, _$identity); + + @override + Map toJson() { + return _$$PeerImplToJson( + this, + ); + } +} + +abstract class _Peer implements Peer { + const factory _Peer( + {@JsonKey(name: 'addr') required final String address, + @JsonKey(name: 'cumulative_difficulty') + required final int cumulativeDifficulty, + @JsonKey(name: 'height') required final int height, + @JsonKey(name: 'id') required final int id, + @JsonKey(name: 'last_ping') required final int lastPing, + @JsonKey(name: 'pruned_topoheight') required final int prunedTopoHeight, + @JsonKey(name: 'tag') final String? tag, + @JsonKey(name: 'top_block_hash') required final String topBlockHash, + @JsonKey(name: 'topoheight') required final int topoheight, + @JsonKey(name: 'version') required final String version}) = _$PeerImpl; + + factory _Peer.fromJson(Map json) = _$PeerImpl.fromJson; + + @override + @JsonKey(name: 'addr') + String get address; + + @override + @JsonKey(name: 'cumulative_difficulty') + int get cumulativeDifficulty; + + @override + @JsonKey(name: 'height') + int get height; + + @override + @JsonKey(name: 'id') + int get id; + + @override + @JsonKey(name: 'last_ping') + int get lastPing; + + @override + @JsonKey(name: 'pruned_topoheight') + int get prunedTopoHeight; + + @override + @JsonKey(name: 'tag') + String? get tag; + + @override + @JsonKey(name: 'top_block_hash') + String get topBlockHash; + + @override + @JsonKey(name: 'topoheight') + int get topoheight; + + @override + @JsonKey(name: 'version') + String get version; + + @override + @JsonKey(ignore: true) + _$$PeerImplCopyWith<_$PeerImpl> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/lib/src/data_transfer_objects/get_peers/peer.g.dart b/lib/src/data_transfer_objects/get_peers/peer.g.dart new file mode 100644 index 0000000..c5beeec --- /dev/null +++ b/lib/src/data_transfer_objects/get_peers/peer.g.dart @@ -0,0 +1,36 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +// ignore_for_file: package_api_docs, non_constant_identifier_names + +part of 'peer.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$PeerImpl _$$PeerImplFromJson(Map json) => _$PeerImpl( + address: json['addr'] as String, + cumulativeDifficulty: json['cumulative_difficulty'] as int, + height: json['height'] as int, + id: json['id'] as int, + lastPing: json['last_ping'] as int, + prunedTopoHeight: json['pruned_topoheight'] as int, + tag: json['tag'] as String?, + topBlockHash: json['top_block_hash'] as String, + topoheight: json['topoheight'] as int, + version: json['version'] as String, + ); + +Map _$$PeerImplToJson(_$PeerImpl instance) => + { + 'addr': instance.address, + 'cumulative_difficulty': instance.cumulativeDifficulty, + 'height': instance.height, + 'id': instance.id, + 'last_ping': instance.lastPing, + 'pruned_topoheight': instance.prunedTopoHeight, + 'tag': instance.tag, + 'top_block_hash': instance.topBlockHash, + 'topoheight': instance.topoheight, + 'version': instance.version, + }; diff --git a/lib/src/repositories/daemon_constants.dart b/lib/src/repositories/daemon_constants.dart index 7d71714..d750556 100644 --- a/lib/src/repositories/daemon_constants.dart +++ b/lib/src/repositories/daemon_constants.dart @@ -95,6 +95,15 @@ enum DaemonMethod { /// Counts the number of accounts saved on disk countAccounts('count_accounts'), + /// Retrieve all peers connected + getPeers('get_peers'), + + /// Fetch up to 20 history events for an account on a specific asset + getAccountHistory('get_account_history'), + + /// Retrieve all assets for an account + getAccountAssets('get_account_assets'), + // EVENTS METHODS /// Subscribe to an event. diff --git a/lib/src/repositories/daemon_rpc_methods_extension.dart b/lib/src/repositories/daemon_rpc_methods_extension.dart index a7f29da..76aaeb1 100644 --- a/lib/src/repositories/daemon_rpc_methods_extension.dart +++ b/lib/src/repositories/daemon_rpc_methods_extension.dart @@ -287,4 +287,36 @@ extension DaemonRpcMethodsExtension on DaemonClientRepository { final result = await sendRequest(DaemonMethod.countAccounts); return result as int; } + + /// Retrieve all peers connected + Future> getPeers() async { + final result = await sendRequest(DaemonMethod.getPeers); + return (result as List) + .map((e) => Peer.fromJson(e as Map)) + .toList(); + } + + /// Fetch up to 20 history events for an account on a specific asset + Future getAccountHistory( + GetAccountHistoryParams getAccountHistoryParams, + ) async { + final result = await sendRequest( + DaemonMethod.getAccountHistory, + getAccountHistoryParams.toJson(), + ); + return GetAccountHistoryResult.fromJson(result as Map); + } + + /// Retrieve all assets for an account + Future getAccountAssets( + GetAccountAssetsParams getAccountAssetsParams, + ) async { + final result = await sendRequest( + DaemonMethod.getAccountAssets, + getAccountAssetsParams.toJson(), + ); + return GetAccountAssetsResult( + assets: (result as List).map((e) => e as String).toList(), + ); + } } diff --git a/pubspec.yaml b/pubspec.yaml index 089a514..d50248f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -19,5 +19,5 @@ dev_dependencies: build_runner: ^2.4.6 freezed: ^2.4.5 json_serializable: ^6.7.1 - lints: ^2.1.1 + lints: ^3.0.0 test: ^1.24.8