Skip to content

Commit

Permalink
refactor: rename Wansee models
Browse files Browse the repository at this point in the history
  • Loading branch information
reasje committed Nov 5, 2024
1 parent 3d0cc41 commit 0b549e5
Show file tree
Hide file tree
Showing 33 changed files with 231 additions and 224 deletions.
2 changes: 1 addition & 1 deletion logic/lib/src/domain/entities/entities.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export 'balance_data.dart';
export 'wannsee/wannsee_models.dart';
export 'moonchain/moonchain_models.dart';
export 'default_tokens/default_tokens.dart';
export 'default_ipfs_gateways/default_ipfs_gateways.dart';
export 'default_tweets/default_tweets.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,29 @@ import 'package:equatable/equatable.dart';

import 'item.dart';

class WannseeAddressTokensList extends Equatable {
const WannseeAddressTokensList({this.items, this.nextPageParams});
class MoonchainAddressTokensListResponse extends Equatable {

final List<Item>? items;
final dynamic nextPageParams;
/// `dart:convert`
///
/// Parses the string and returns the resulting Json object as [MoonchainAddressTokensListResponse].
factory MoonchainAddressTokensListResponse.fromJson(String data) {
return MoonchainAddressTokensListResponse.fromMap(
json.decode(data) as Map<String, dynamic>);
}

factory WannseeAddressTokensList.fromMap(Map<String, dynamic> data) {
return WannseeAddressTokensList(
factory MoonchainAddressTokensListResponse.fromMap(
Map<String, dynamic> data) {
return MoonchainAddressTokensListResponse(
items: (data['items'] as List<dynamic>?)
?.map((dynamic e) => Item.fromMap(e as Map<String, dynamic>))
.toList(),
nextPageParams: data['next_page_params'] as dynamic,
);
}
const MoonchainAddressTokensListResponse({this.items, this.nextPageParams});

final List<Item>? items;
final dynamic nextPageParams;

Map<String, dynamic> toMap() => <String, dynamic>{
'items': items?.map((e) => e.toMap()).toList(),
Expand All @@ -26,22 +35,14 @@ class WannseeAddressTokensList extends Equatable {

/// `dart:convert`
///
/// Parses the string and returns the resulting Json object as [WannseeAddressTokensList].
factory WannseeAddressTokensList.fromJson(String data) {
return WannseeAddressTokensList.fromMap(
json.decode(data) as Map<String, dynamic>);
}

/// `dart:convert`
///
/// Converts [WannseeAddressTokensList] to a JSON string.
/// Converts [MoonchainAddressTokensListResponse] to a JSON string.
String toJson() => json.encode(toMap());

WannseeAddressTokensList copyWith({
MoonchainAddressTokensListResponse copyWith({
List<Item>? items,
dynamic nextPageParams,
}) {
return WannseeAddressTokensList(
return MoonchainAddressTokensListResponse(
items: items ?? this.items,
nextPageParams: nextPageParams ?? this.nextPageParams,
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import 'package:equatable/equatable.dart';

class MoonchainBalanceEvenModel extends Equatable {

factory MoonchainBalanceEvenModel.fromJson(Map<String, dynamic> json,) {
return MoonchainBalanceEvenModel(balance: json['balance'] as String);
}

const MoonchainBalanceEvenModel({this.balance});
final String? balance;

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['balance'] = balance;
return data;
}

@override
List<Object?> get props => [balance];
}
8 changes: 8 additions & 0 deletions logic/lib/src/domain/entities/moonchain/moonchain_models.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export 'moonchain_transactions_model/moonchain_transactions_model.dart';
export 'moonchain_balance_event_model.dart';
export 'shared/shared.dart';
export 'moonchain_token_transfers_response_model/moonchain_token_transfer_response_model.dart';
export 'moonchain_tokens_balance_response_model/moonchain_tokens_balance_response_model.dart';
export 'moonchain_token_meta_data_response/moonchain_token_meta_data_response.dart';
export 'moonchain_address_tokens_list/moonchain_address_tokens_list_response.dart';
export 'moonchain_nft_collection_detail_response/moonchain_nft_collection_detail_response.dart';
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ import 'package:equatable/equatable.dart';

import 'item.dart';

class WannseeNftCollectionDetail extends Equatable {
class MoonchainNftCollectionDetailResponse extends Equatable {
final List<Item>? items;
final dynamic nextPageParams;

const WannseeNftCollectionDetail({this.items, this.nextPageParams});
const MoonchainNftCollectionDetailResponse({this.items, this.nextPageParams});

factory WannseeNftCollectionDetail.fromMap(Map<String, dynamic> data) {
return WannseeNftCollectionDetail(
factory MoonchainNftCollectionDetailResponse.fromMap(
Map<String, dynamic> data) {
return MoonchainNftCollectionDetailResponse(
items: (data['items'] as List<dynamic>?)
?.map((dynamic e) => Item.fromMap(e as Map<String, dynamic>))
.toList(),
Expand All @@ -26,22 +27,22 @@ class WannseeNftCollectionDetail extends Equatable {

/// `dart:convert`
///
/// Parses the string and returns the resulting Json object as [WannseeNftCollectionDetail].
factory WannseeNftCollectionDetail.fromJson(String data) {
return WannseeNftCollectionDetail.fromMap(
/// Parses the string and returns the resulting Json object as [MoonchainNftCollectionDetailResponse].
factory MoonchainNftCollectionDetailResponse.fromJson(String data) {
return MoonchainNftCollectionDetailResponse.fromMap(
json.decode(data) as Map<String, dynamic>);
}

/// `dart:convert`
///
/// Converts [WannseeNftCollectionDetail] to a JSON string.
/// Converts [MoonchainNftCollectionDetailResponse] to a JSON string.
String toJson() => json.encode(toMap());

WannseeNftCollectionDetail copyWith({
MoonchainNftCollectionDetailResponse copyWith({
List<Item>? items,
dynamic nextPageParams,
}) {
return WannseeNftCollectionDetail(
return MoonchainNftCollectionDetailResponse(
items: items ?? this.items,
nextPageParams: nextPageParams ?? this.nextPageParams,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import 'package:equatable/equatable.dart';

import 'attribute.dart';

class WannseeTokenMetaData extends Equatable {
const WannseeTokenMetaData({
class MoonchainTokenMetaDataResponse extends Equatable {
const MoonchainTokenMetaDataResponse({
this.image,
this.name,
this.externalLink,
Expand All @@ -21,8 +21,8 @@ class WannseeTokenMetaData extends Equatable {
final List<Attribute>? attributes;
final bool? isRealWorldNft;

factory WannseeTokenMetaData.fromMap(Map<String, dynamic> data) {
return WannseeTokenMetaData(
factory MoonchainTokenMetaDataResponse.fromMap(Map<String, dynamic> data) {
return MoonchainTokenMetaDataResponse(
image: data['image'] as String?,
name: data['name'] as String?,
externalLink: data['external_link'] as String?,
Expand All @@ -45,26 +45,26 @@ class WannseeTokenMetaData extends Equatable {

/// `dart:convert`
///
/// Parses the string and returns the resulting Json object as [WannseeTokenMetaData].
factory WannseeTokenMetaData.fromJson(String data) {
return WannseeTokenMetaData.fromMap(
/// Parses the string and returns the resulting Json object as [MoonchainTokenMetaDataResponse].
factory MoonchainTokenMetaDataResponse.fromJson(String data) {
return MoonchainTokenMetaDataResponse.fromMap(
json.decode(data) as Map<String, dynamic>);
}

/// `dart:convert`
///
/// Converts [WannseeTokenMetaData] to a JSON string.
/// Converts [MoonchainTokenMetaDataResponse] to a JSON string.
String toJson() => json.encode(toMap());

WannseeTokenMetaData copyWith({
MoonchainTokenMetaDataResponse copyWith({
String? image,
String? name,
String? externalLink,
String? description,
List<Attribute>? attributes,
bool? isRealWorldNft,
}) {
return WannseeTokenMetaData(
return MoonchainTokenMetaDataResponse(
image: image ?? this.image,
name: name ?? this.name,
externalLink: externalLink ?? this.externalLink,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,45 @@ import 'package:equatable/equatable.dart';

import '../shared/shared.dart';

class WannseeTokenTransfersModel extends Equatable {
final List<TokenTransfer>? items;
final dynamic nextPageParams;
class MoonchainTokenTransfersResponseModel extends Equatable {

const WannseeTokenTransfersModel({this.items, this.nextPageParams});
/// `dart:convert`
///
/// Parses the string and returns the resulting Json object as [MoonchainTokenTransfersResponseModel].
factory MoonchainTokenTransfersResponseModel.fromJson(String data) {
return MoonchainTokenTransfersResponseModel.fromMap(
json.decode(data) as Map<String, dynamic>);
}

factory WannseeTokenTransfersModel.fromMap(Map<String, dynamic> data) {
return WannseeTokenTransfersModel(
factory MoonchainTokenTransfersResponseModel.fromMap(
Map<String, dynamic> data) {
return MoonchainTokenTransfersResponseModel(
items: (data['items'] as List<dynamic>?)
?.map((dynamic e) => TokenTransfer.fromMap(e as Map<String, dynamic>))
.toList(),
nextPageParams: data['next_page_params'] as dynamic,
);
}

const MoonchainTokenTransfersResponseModel({this.items, this.nextPageParams});
final List<TokenTransfer>? items;
final dynamic nextPageParams;

Map<String, dynamic> toMap() => <String, dynamic>{
'items': items?.map((e) => e.toMap()).toList(),
'next_page_params': nextPageParams,
};

/// `dart:convert`
///
/// Parses the string and returns the resulting Json object as [WannseeTokenTransfersModel].
factory WannseeTokenTransfersModel.fromJson(String data) {
return WannseeTokenTransfersModel.fromMap(
json.decode(data) as Map<String, dynamic>);
}

/// `dart:convert`
///
/// Converts [WannseeTokenTransfersModel] to a JSON string.
/// Converts [MoonchainTokenTransfersResponseModel] to a JSON string.
String toJson() => json.encode(toMap());

WannseeTokenTransfersModel copyWith({
MoonchainTokenTransfersResponseModel copyWith({
List<TokenTransfer>? items,
dynamic nextPageParams,
}) {
return WannseeTokenTransfersModel(
return MoonchainTokenTransfersResponseModel(
items: items ?? this.items,
nextPageParams: nextPageParams ?? this.nextPageParams,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,44 @@ import 'package:equatable/equatable.dart';

import 'item.dart';

class WannseeTokensBalanceModel extends Equatable {
final List<TokenItem>? items;
final dynamic nextPageParams;
class MoonchainTokensBalanceResponseModel extends Equatable {

const WannseeTokensBalanceModel({this.items, this.nextPageParams});
/// `dart:convert`
///
/// Parses the string and returns the resulting Json object as [MoonchainTokensBalanceResponseModel].
factory MoonchainTokensBalanceResponseModel.fromJson(String data) {
return MoonchainTokensBalanceResponseModel.fromMap(
json.decode(data) as Map<String, dynamic>);
}

factory WannseeTokensBalanceModel.fromMap(Map<String, dynamic> data) {
return WannseeTokensBalanceModel(
factory MoonchainTokensBalanceResponseModel.fromMap(Map<String, dynamic> data) {
return MoonchainTokensBalanceResponseModel(
items: (data['items'] as List<dynamic>?)
?.map((dynamic e) => TokenItem.fromMap(e as Map<String, dynamic>))
.toList(),
nextPageParams: data['next_page_params'] as dynamic,
);
}

const MoonchainTokensBalanceResponseModel({this.items, this.nextPageParams});
final List<TokenItem>? items;
final dynamic nextPageParams;

Map<String, dynamic> toMap() => <String, dynamic>{
'items': items?.map((e) => e.toMap()).toList(),
'next_page_params': nextPageParams,
};

/// `dart:convert`
///
/// Parses the string and returns the resulting Json object as [WannseeTokensBalanceModel].
factory WannseeTokensBalanceModel.fromJson(String data) {
return WannseeTokensBalanceModel.fromMap(
json.decode(data) as Map<String, dynamic>);
}

/// `dart:convert`
///
/// Converts [WannseeTokensBalanceModel] to a JSON string.
/// Converts [MoonchainTokensBalanceResponseModel] to a JSON string.
String toJson() => json.encode(toMap());

WannseeTokensBalanceModel copyWith({
MoonchainTokensBalanceResponseModel copyWith({
List<TokenItem>? items,
dynamic nextPageParams,
}) {
return WannseeTokensBalanceModel(
return MoonchainTokensBalanceResponseModel(
items: items ?? this.items,
nextPageParams: nextPageParams ?? this.nextPageParams,
);
Expand Down
Loading

0 comments on commit 0b549e5

Please sign in to comment.