Skip to content

Commit

Permalink
Add fields to Domain model according to Smart contract Struct
Browse files Browse the repository at this point in the history
  • Loading branch information
simonesestito committed Jan 4, 2024
1 parent d324b53 commit 762c05e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/model/domain.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ class Domain with _$Domain {
required String realAddress,
required DomainType type,
required String owner,
required int resoldTimes,
required int price,
}) = _Domain;

const Domain._();

bool get isForSale => price > 0;
}

enum DomainType {
Expand Down
14 changes: 14 additions & 0 deletions lib/repository/domain_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@ class DomainRepository {
'bafybeifx7yeb55armcsxwwitkymga5xf53dxiarykms3ygqic223w5sk3m',
type: DomainType.ipfs,
owner: '0x000000000000000000000000000000000000dead',
resoldTimes: 20,
price: 100,
),
Domain(
domainName: 'tor${DomainInputValidator.domainSuffix}',
realAddress:
'duckduckgogg42xjoc72x3sjasowoarfbgcmvfimaftt6twagswzczad.onion',
type: DomainType.tor,
owner: '0x000000000000000000000000000000000000dead',
resoldTimes: 20,
price: 0,
),
];

Expand All @@ -43,4 +47,14 @@ class DomainRepository {
await Future.delayed(const Duration(milliseconds: 100));
return List.unmodifiable(_mockDomains);
}

Future<List<Domain>> getAllDomains() async {
await Future.delayed(const Duration(milliseconds: 100));
return List.unmodifiable(_mockDomains);
}

Future<List<Domain>> getDomainsForSale() async {
await Future.delayed(const Duration(milliseconds: 100));
return List.unmodifiable(_mockDomains.sublist(0, 1));
}
}

0 comments on commit 762c05e

Please sign in to comment.