import 'package:stackwallet/dto/ordinals/inscription_link.dart'; import 'package:stackwallet/dto/ordinals/ordinals_response.dart'; class AddressResponse extends OrdinalsResponse { final AddressLinks links; final String address; final List inscriptions; AddressResponse({ required this.links, required this.address, required this.inscriptions, }); factory AddressResponse.fromJson(OrdinalsResponse json) { final data = json.data as Map; final inscriptionsJson = data['inscriptions'] as List; final inscriptions = inscriptionsJson .map((inscriptionJson) => InscriptionLink.fromJson(inscriptionJson as Map)) .toList(); return AddressResponse( links: AddressLinks.fromJson(data['_links'] as Map), address: data['address'] as String, inscriptions: inscriptions, ); } } class AddressLinks { final AddressLink? self; AddressLinks({ this.self, }); factory AddressLinks.fromJson(Map json) { return AddressLinks( self: json['self'] != null ? AddressLink.fromJson(json['self'] as Map) : null, ); } } class AddressLink { final String href; AddressLink({required this.href}); factory AddressLink.fromJson(Map json) { return AddressLink(href: json['href'] as String); } }