diff --git a/CHANGELOG.md b/CHANGELOG.md index 3da3722..621bdc8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.7.0 + +- feat: getAccounts RPC method. + ## 0.6.0 Daemon API upgrade : diff --git a/README.md b/README.md index e9a7a01..7e31d8c 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ Software Development Kit in Dart for XELIS Blockchain. ## Features JSON-RPC Client to interact with daemon API: + - Call JSON-RPC methods. - Subscribe and listen to events. @@ -38,7 +39,7 @@ Future main() async { // You can also use the repository to listen to events. - // There are 5 different types of events, + // There are 7 different types of events, // you can add callbacks depending on the event. daemonRepository ..onNewBlock((block) { diff --git a/lib/src/data_transfer_objects/dtos.dart b/lib/src/data_transfer_objects/dtos.dart index e6d92ac..aa9c4f0 100644 --- a/lib/src/data_transfer_objects/dtos.dart +++ b/lib/src/data_transfer_objects/dtos.dart @@ -1,5 +1,7 @@ export 'block/block.dart'; export 'block_ordered_event/block_ordered_event.dart'; +export 'get_accounts/get_accounts_params.dart'; +export 'get_accounts/get_accounts_result.dart'; export 'get_balance/balance.dart'; export 'get_balance_at_topoheight/get_balance_at_topoheight_params.dart'; export 'get_block_at_topoheight/get_block_at_topoheight_params.dart'; diff --git a/lib/src/data_transfer_objects/get_accounts/get_accounts_params.dart b/lib/src/data_transfer_objects/get_accounts/get_accounts_params.dart new file mode 100644 index 0000000..b2fac0f --- /dev/null +++ b/lib/src/data_transfer_objects/get_accounts/get_accounts_params.dart @@ -0,0 +1,28 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'get_accounts_params.freezed.dart'; + +part 'get_accounts_params.g.dart'; + +/// @nodoc +@freezed +class GetAccountsParams with _$GetAccountsParams { + /// @nodoc + const factory GetAccountsParams({ + /// @nodoc + @JsonKey(name: 'skip') int? skip, + + /// @nodoc + @JsonKey(name: 'maximum') int? maximum, + + /// @nodoc + @JsonKey(name: 'minimum_topoheight') int? minTopoHeight, + + /// @nodoc + @JsonKey(name: 'maximum_topoheight') int? maxTopoHeight, + }) = _GetAccountsParams; + + /// @nodoc + factory GetAccountsParams.fromJson(Map json) => + _$GetAccountsParamsFromJson(json); +} diff --git a/lib/src/data_transfer_objects/get_accounts/get_accounts_params.freezed.dart b/lib/src/data_transfer_objects/get_accounts/get_accounts_params.freezed.dart new file mode 100644 index 0000000..58d5a75 --- /dev/null +++ b/lib/src/data_transfer_objects/get_accounts/get_accounts_params.freezed.dart @@ -0,0 +1,262 @@ +// 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_accounts_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'); + +GetAccountsParams _$GetAccountsParamsFromJson(Map json) { + return _GetAccountsParams.fromJson(json); +} + +/// @nodoc +mixin _$GetAccountsParams { + /// @nodoc + @JsonKey(name: 'skip') + int? get skip => throw _privateConstructorUsedError; + + /// @nodoc + @JsonKey(name: 'maximum') + int? get maximum => throw _privateConstructorUsedError; + + /// @nodoc + @JsonKey(name: 'minimum_topoheight') + int? get minTopoHeight => throw _privateConstructorUsedError; + + /// @nodoc + @JsonKey(name: 'maximum_topoheight') + int? get maxTopoHeight => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + + @JsonKey(ignore: true) + $GetAccountsParamsCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $GetAccountsParamsCopyWith<$Res> { + factory $GetAccountsParamsCopyWith( + GetAccountsParams value, $Res Function(GetAccountsParams) then) = + _$GetAccountsParamsCopyWithImpl<$Res, GetAccountsParams>; + + @useResult + $Res call( + {@JsonKey(name: 'skip') int? skip, + @JsonKey(name: 'maximum') int? maximum, + @JsonKey(name: 'minimum_topoheight') int? minTopoHeight, + @JsonKey(name: 'maximum_topoheight') int? maxTopoHeight}); +} + +/// @nodoc +class _$GetAccountsParamsCopyWithImpl<$Res, $Val extends GetAccountsParams> + implements $GetAccountsParamsCopyWith<$Res> { + _$GetAccountsParamsCopyWithImpl(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? skip = freezed, + Object? maximum = freezed, + Object? minTopoHeight = freezed, + Object? maxTopoHeight = freezed, + }) { + return _then(_value.copyWith( + skip: freezed == skip + ? _value.skip + : skip // ignore: cast_nullable_to_non_nullable + as int?, + maximum: freezed == maximum + ? _value.maximum + : maximum // ignore: cast_nullable_to_non_nullable + as int?, + minTopoHeight: freezed == minTopoHeight + ? _value.minTopoHeight + : minTopoHeight // ignore: cast_nullable_to_non_nullable + as int?, + maxTopoHeight: freezed == maxTopoHeight + ? _value.maxTopoHeight + : maxTopoHeight // ignore: cast_nullable_to_non_nullable + as int?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$GetAccountsParamsImplCopyWith<$Res> + implements $GetAccountsParamsCopyWith<$Res> { + factory _$$GetAccountsParamsImplCopyWith(_$GetAccountsParamsImpl value, + $Res Function(_$GetAccountsParamsImpl) then) = + __$$GetAccountsParamsImplCopyWithImpl<$Res>; + + @override + @useResult + $Res call( + {@JsonKey(name: 'skip') int? skip, + @JsonKey(name: 'maximum') int? maximum, + @JsonKey(name: 'minimum_topoheight') int? minTopoHeight, + @JsonKey(name: 'maximum_topoheight') int? maxTopoHeight}); +} + +/// @nodoc +class __$$GetAccountsParamsImplCopyWithImpl<$Res> + extends _$GetAccountsParamsCopyWithImpl<$Res, _$GetAccountsParamsImpl> + implements _$$GetAccountsParamsImplCopyWith<$Res> { + __$$GetAccountsParamsImplCopyWithImpl(_$GetAccountsParamsImpl _value, + $Res Function(_$GetAccountsParamsImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? skip = freezed, + Object? maximum = freezed, + Object? minTopoHeight = freezed, + Object? maxTopoHeight = freezed, + }) { + return _then(_$GetAccountsParamsImpl( + skip: freezed == skip + ? _value.skip + : skip // ignore: cast_nullable_to_non_nullable + as int?, + maximum: freezed == maximum + ? _value.maximum + : maximum // ignore: cast_nullable_to_non_nullable + as int?, + minTopoHeight: freezed == minTopoHeight + ? _value.minTopoHeight + : minTopoHeight // ignore: cast_nullable_to_non_nullable + as int?, + maxTopoHeight: freezed == maxTopoHeight + ? _value.maxTopoHeight + : maxTopoHeight // ignore: cast_nullable_to_non_nullable + as int?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$GetAccountsParamsImpl implements _GetAccountsParams { + const _$GetAccountsParamsImpl( + {@JsonKey(name: 'skip') this.skip, + @JsonKey(name: 'maximum') this.maximum, + @JsonKey(name: 'minimum_topoheight') this.minTopoHeight, + @JsonKey(name: 'maximum_topoheight') this.maxTopoHeight}); + + factory _$GetAccountsParamsImpl.fromJson(Map json) => + _$$GetAccountsParamsImplFromJson(json); + + /// @nodoc + @override + @JsonKey(name: 'skip') + final int? skip; + + /// @nodoc + @override + @JsonKey(name: 'maximum') + final int? maximum; + + /// @nodoc + @override + @JsonKey(name: 'minimum_topoheight') + final int? minTopoHeight; + + /// @nodoc + @override + @JsonKey(name: 'maximum_topoheight') + final int? maxTopoHeight; + + @override + String toString() { + return 'GetAccountsParams(skip: $skip, maximum: $maximum, minTopoHeight: $minTopoHeight, maxTopoHeight: $maxTopoHeight)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$GetAccountsParamsImpl && + (identical(other.skip, skip) || other.skip == skip) && + (identical(other.maximum, maximum) || other.maximum == maximum) && + (identical(other.minTopoHeight, minTopoHeight) || + other.minTopoHeight == minTopoHeight) && + (identical(other.maxTopoHeight, maxTopoHeight) || + other.maxTopoHeight == maxTopoHeight)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => + Object.hash(runtimeType, skip, maximum, minTopoHeight, maxTopoHeight); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$GetAccountsParamsImplCopyWith<_$GetAccountsParamsImpl> get copyWith => + __$$GetAccountsParamsImplCopyWithImpl<_$GetAccountsParamsImpl>( + this, _$identity); + + @override + Map toJson() { + return _$$GetAccountsParamsImplToJson( + this, + ); + } +} + +abstract class _GetAccountsParams implements GetAccountsParams { + const factory _GetAccountsParams( + {@JsonKey(name: 'skip') final int? skip, + @JsonKey(name: 'maximum') final int? maximum, + @JsonKey(name: 'minimum_topoheight') final int? minTopoHeight, + @JsonKey(name: 'maximum_topoheight') final int? maxTopoHeight}) = + _$GetAccountsParamsImpl; + + factory _GetAccountsParams.fromJson(Map json) = + _$GetAccountsParamsImpl.fromJson; + + @override + + /// @nodoc + @JsonKey(name: 'skip') + int? get skip; + + @override + + /// @nodoc + @JsonKey(name: 'maximum') + int? get maximum; + + @override + + /// @nodoc + @JsonKey(name: 'minimum_topoheight') + int? get minTopoHeight; + + @override + + /// @nodoc + @JsonKey(name: 'maximum_topoheight') + int? get maxTopoHeight; + + @override + @JsonKey(ignore: true) + _$$GetAccountsParamsImplCopyWith<_$GetAccountsParamsImpl> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/lib/src/data_transfer_objects/get_accounts/get_accounts_params.g.dart b/lib/src/data_transfer_objects/get_accounts/get_accounts_params.g.dart new file mode 100644 index 0000000..c617941 --- /dev/null +++ b/lib/src/data_transfer_objects/get_accounts/get_accounts_params.g.dart @@ -0,0 +1,27 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +// ignore_for_file: package_api_docs, non_constant_identifier_names + +part of 'get_accounts_params.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$GetAccountsParamsImpl _$$GetAccountsParamsImplFromJson( + Map json) => + _$GetAccountsParamsImpl( + skip: json['skip'] as int?, + maximum: json['maximum'] as int?, + minTopoHeight: json['minimum_topoheight'] as int?, + maxTopoHeight: json['maximum_topoheight'] as int?, + ); + +Map _$$GetAccountsParamsImplToJson( + _$GetAccountsParamsImpl instance) => + { + 'skip': instance.skip, + 'maximum': instance.maximum, + 'minimum_topoheight': instance.minTopoHeight, + 'maximum_topoheight': instance.maxTopoHeight, + }; diff --git a/lib/src/data_transfer_objects/get_accounts/get_accounts_result.dart b/lib/src/data_transfer_objects/get_accounts/get_accounts_result.dart new file mode 100644 index 0000000..6856c41 --- /dev/null +++ b/lib/src/data_transfer_objects/get_accounts/get_accounts_result.dart @@ -0,0 +1,13 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'get_accounts_result.freezed.dart'; + +/// @nodoc +@freezed +class GetAccountsResult with _$GetAccountsResult { + /// @nodoc + const factory GetAccountsResult({ + /// @nodoc + required List publicKeys, + }) = _GetAccountsResult; +} diff --git a/lib/src/data_transfer_objects/get_accounts/get_accounts_result.freezed.dart b/lib/src/data_transfer_objects/get_accounts/get_accounts_result.freezed.dart new file mode 100644 index 0000000..7b5cf59 --- /dev/null +++ b/lib/src/data_transfer_objects/get_accounts/get_accounts_result.freezed.dart @@ -0,0 +1,152 @@ +// 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_accounts_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'); + +/// @nodoc +mixin _$GetAccountsResult { + /// @nodoc + List get publicKeys => throw _privateConstructorUsedError; + + @JsonKey(ignore: true) + $GetAccountsResultCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $GetAccountsResultCopyWith<$Res> { + factory $GetAccountsResultCopyWith( + GetAccountsResult value, $Res Function(GetAccountsResult) then) = + _$GetAccountsResultCopyWithImpl<$Res, GetAccountsResult>; + + @useResult + $Res call({List publicKeys}); +} + +/// @nodoc +class _$GetAccountsResultCopyWithImpl<$Res, $Val extends GetAccountsResult> + implements $GetAccountsResultCopyWith<$Res> { + _$GetAccountsResultCopyWithImpl(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? publicKeys = null, + }) { + return _then(_value.copyWith( + publicKeys: null == publicKeys + ? _value.publicKeys + : publicKeys // ignore: cast_nullable_to_non_nullable + as List, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$GetAccountsResultImplCopyWith<$Res> + implements $GetAccountsResultCopyWith<$Res> { + factory _$$GetAccountsResultImplCopyWith(_$GetAccountsResultImpl value, + $Res Function(_$GetAccountsResultImpl) then) = + __$$GetAccountsResultImplCopyWithImpl<$Res>; + + @override + @useResult + $Res call({List publicKeys}); +} + +/// @nodoc +class __$$GetAccountsResultImplCopyWithImpl<$Res> + extends _$GetAccountsResultCopyWithImpl<$Res, _$GetAccountsResultImpl> + implements _$$GetAccountsResultImplCopyWith<$Res> { + __$$GetAccountsResultImplCopyWithImpl(_$GetAccountsResultImpl _value, + $Res Function(_$GetAccountsResultImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? publicKeys = null, + }) { + return _then(_$GetAccountsResultImpl( + publicKeys: null == publicKeys + ? _value._publicKeys + : publicKeys // ignore: cast_nullable_to_non_nullable + as List, + )); + } +} + +/// @nodoc + +class _$GetAccountsResultImpl implements _GetAccountsResult { + const _$GetAccountsResultImpl({required final List publicKeys}) + : _publicKeys = publicKeys; + + /// @nodoc + final List _publicKeys; + + /// @nodoc + @override + List get publicKeys { + if (_publicKeys is EqualUnmodifiableListView) return _publicKeys; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_publicKeys); + } + + @override + String toString() { + return 'GetAccountsResult(publicKeys: $publicKeys)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$GetAccountsResultImpl && + const DeepCollectionEquality() + .equals(other._publicKeys, _publicKeys)); + } + + @override + int get hashCode => Object.hash( + runtimeType, const DeepCollectionEquality().hash(_publicKeys)); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$GetAccountsResultImplCopyWith<_$GetAccountsResultImpl> get copyWith => + __$$GetAccountsResultImplCopyWithImpl<_$GetAccountsResultImpl>( + this, _$identity); +} + +abstract class _GetAccountsResult implements GetAccountsResult { + const factory _GetAccountsResult({required final List publicKeys}) = + _$GetAccountsResultImpl; + + @override + + /// @nodoc + List get publicKeys; + + @override + @JsonKey(ignore: true) + _$$GetAccountsResultImplCopyWith<_$GetAccountsResultImpl> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/lib/src/data_transfer_objects/get_block_template/get_block_template_params.freezed.dart b/lib/src/data_transfer_objects/get_block_template/get_block_template_params.freezed.dart index 0310157..6f52373 100644 --- a/lib/src/data_transfer_objects/get_block_template/get_block_template_params.freezed.dart +++ b/lib/src/data_transfer_objects/get_block_template/get_block_template_params.freezed.dart @@ -72,7 +72,6 @@ abstract class _$$GetBlockTemplateParamsImplCopyWith<$Res> _$GetBlockTemplateParamsImpl value, $Res Function(_$GetBlockTemplateParamsImpl) then) = __$$GetBlockTemplateParamsImplCopyWithImpl<$Res>; - @override @useResult $Res call({@JsonKey(name: 'address') String address}); @@ -161,7 +160,6 @@ abstract class _GetBlockTemplateParams implements GetBlockTemplateParams { /// @nodoc @JsonKey(name: 'address') String get address; - @override @JsonKey(ignore: true) _$$GetBlockTemplateParamsImplCopyWith<_$GetBlockTemplateParamsImpl> diff --git a/lib/src/data_transfer_objects/get_info/get_info_result.freezed.dart b/lib/src/data_transfer_objects/get_info/get_info_result.freezed.dart index 15cd1a2..181d0c2 100644 --- a/lib/src/data_transfer_objects/get_info/get_info_result.freezed.dart +++ b/lib/src/data_transfer_objects/get_info/get_info_result.freezed.dart @@ -84,6 +84,7 @@ abstract class $GetInfoResultCopyWith<$Res> { factory $GetInfoResultCopyWith( GetInfoResult value, $Res Function(GetInfoResult) then) = _$GetInfoResultCopyWithImpl<$Res, GetInfoResult>; + @useResult $Res call( {@JsonKey(name: 'average_block_time') int averageBlockTime, @@ -108,6 +109,7 @@ class _$GetInfoResultCopyWithImpl<$Res, $Val extends GetInfoResult> // ignore: unused_field final $Val _value; + // ignore: unused_field final $Res Function($Val) _then; @@ -493,31 +495,37 @@ abstract class _GetInfoResult implements GetInfoResult { /// @nodoc @JsonKey(name: 'height') int get height; + @override /// @nodoc @JsonKey(name: 'mempool_size') int get mempoolSize; + @override /// @nodoc @JsonKey(name: 'native_supply') int get nativeSupply; + @override /// @nodoc @JsonKey(name: 'network') Network get network; + @override /// @nodoc @JsonKey(name: 'stableheight') int get stableHeight; + @override /// @nodoc @JsonKey(name: 'top_hash') String get topHash; + @override /// @nodoc diff --git a/lib/src/data_transfer_objects/get_last_balance/get_last_balance_result.freezed.dart b/lib/src/data_transfer_objects/get_last_balance/get_last_balance_result.freezed.dart index f2d747b..7a82548 100644 --- a/lib/src/data_transfer_objects/get_last_balance/get_last_balance_result.freezed.dart +++ b/lib/src/data_transfer_objects/get_last_balance/get_last_balance_result.freezed.dart @@ -91,7 +91,6 @@ abstract class _$$GetLastBalanceResultImplCopyWith<$Res> factory _$$GetLastBalanceResultImplCopyWith(_$GetLastBalanceResultImpl value, $Res Function(_$GetLastBalanceResultImpl) then) = __$$GetLastBalanceResultImplCopyWithImpl<$Res>; - @override @useResult $Res call( @@ -198,13 +197,11 @@ abstract class _GetLastBalanceResult implements GetLastBalanceResult { /// @nodoc @JsonKey(name: 'balance') Balance get balance; - @override /// @nodoc @JsonKey(name: 'topoheight') int get topoHeight; - @override @JsonKey(ignore: true) _$$GetLastBalanceResultImplCopyWith<_$GetLastBalanceResultImpl> diff --git a/lib/src/data_transfer_objects/transaction/transaction.freezed.dart b/lib/src/data_transfer_objects/transaction/transaction.freezed.dart index 4ac3d2b..77b2ea2 100644 --- a/lib/src/data_transfer_objects/transaction/transaction.freezed.dart +++ b/lib/src/data_transfer_objects/transaction/transaction.freezed.dart @@ -170,7 +170,6 @@ abstract class _$$TransactionImplCopyWith<$Res> factory _$$TransactionImplCopyWith( _$TransactionImpl value, $Res Function(_$TransactionImpl) then) = __$$TransactionImplCopyWithImpl<$Res>; - @override @useResult $Res call( @@ -426,43 +425,36 @@ abstract class _Transaction implements Transaction { /// @nodoc @JsonKey(name: 'data') TransactionType get data; - @override /// @nodoc @JsonKey(name: 'fee') int get fee; - @override /// @nodoc @JsonKey(name: 'version') int get version; - @override /// @nodoc @JsonKey(name: 'in_mempool') bool get inMempool; - @override /// @nodoc @JsonKey(name: 'nonce') int get nonce; - @override /// @nodoc @JsonKey(name: 'owner') String get owner; - @override /// @nodoc @JsonKey(name: 'signature') String get signature; - @override @JsonKey(ignore: true) _$$TransactionImplCopyWith<_$TransactionImpl> get copyWith => diff --git a/lib/src/data_transfer_objects/transaction/transaction_type.freezed.dart b/lib/src/data_transfer_objects/transaction/transaction_type.freezed.dart index a5f74cb..3c7b69b 100644 --- a/lib/src/data_transfer_objects/transaction/transaction_type.freezed.dart +++ b/lib/src/data_transfer_objects/transaction/transaction_type.freezed.dart @@ -127,7 +127,6 @@ abstract class _$$TransactionTypeImplCopyWith<$Res> factory _$$TransactionTypeImplCopyWith(_$TransactionTypeImpl value, $Res Function(_$TransactionTypeImpl) then) = __$$TransactionTypeImplCopyWithImpl<$Res>; - @override @useResult $Res call( @@ -291,13 +290,11 @@ abstract class _TransactionType implements TransactionType { /// @nodoc @JsonKey(name: 'call_contract') CallContract? get callContract; - @override /// @nodoc @JsonKey(name: 'deploy_contract') String? get deployContract; - @override @JsonKey(ignore: true) _$$TransactionTypeImplCopyWith<_$TransactionTypeImpl> get copyWith => diff --git a/lib/src/repositories/daemon_constants.dart b/lib/src/repositories/daemon_constants.dart index ef570c5..01e024a 100644 --- a/lib/src/repositories/daemon_constants.dart +++ b/lib/src/repositories/daemon_constants.dart @@ -85,6 +85,10 @@ enum DaemonMethod { /// Retrieve a specific range of blocks (up to 20 maximum) based on height. getBlocksRangeByHeight('get_blocks_range_by_height'), + /// Retrieve all available accounts + /// (each account got at least one interaction on chain). + getAccounts('get_accounts'), + // 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 2fe65b4..feee53c 100644 --- a/lib/src/repositories/daemon_rpc_methods_extension.dart +++ b/lib/src/repositories/daemon_rpc_methods_extension.dart @@ -255,4 +255,18 @@ extension DaemonRpcMethodsExtension on DaemonClientRepository { .map((e) => Block.fromJson(e as Map)) .toList(); } + + /// Retrieve all available accounts + /// (each account got at least one interaction on chain). + Future getAccounts([ + GetAccountsParams? getAccountsParams, + ]) async { + final result = await sendRequest( + DaemonMethod.getAccounts, + getAccountsParams?.toJson() ?? const GetAccountsParams().toJson(), + ); + return GetAccountsResult( + publicKeys: (result as List).map((e) => e as String).toList(), + ); + } } diff --git a/pubspec.yaml b/pubspec.yaml index 41de316..d2295fe 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: xelis_dart_sdk description: Software Development Kit in Dart to build Apps for the Xelis Blockchain. -version: 0.6.0 +version: 0.7.0 repository: https://github.com/xelis-project/xelis-dart-jdk environment: