import 'package:stackwallet/dto/ordinals/ordinals_response.dart'; class InscriptionResponse extends OrdinalsResponse { late final Links links; late final String address; late final int contentLength; late final String contentType; late final int genesisFee; late final int genesisHeight; late final String genesisTransaction; late final String location; late final int number; late final int offset; late final String output; late final String? sat; // Make sure to update the type to allow null late final String timestamp; InscriptionResponse({ required this.links, required this.address, required this.contentLength, required this.contentType, required this.genesisFee, required this.genesisHeight, required this.genesisTransaction, required this.location, required this.number, required this.offset, required this.output, required this.sat, required this.timestamp, }); factory InscriptionResponse.fromJson(OrdinalsResponse json) { final data = json.data as Map; return InscriptionResponse( links: Links.fromJson(data['_links'] as Map), address: data['address'] as String, contentLength: data['content_length'] as int, contentType: data['content_type'] as String, genesisFee: data['genesis_fee'] as int, genesisHeight: data['genesis_height'] as int, genesisTransaction: data['genesis_transaction'] as String, location: data['location'] as String, number: data['number'] as int, offset: data['offset'] as int, output: data['output'] as String, sat: data['sat'] as String?, timestamp: data['timestamp'] as String, ); } } class Links { late final Link content; late final Link genesisTransaction; late final Link next; late final Link output; late final Link prev; late final Link preview; late final Link? sat; // Make sure to update the type to allow null late final Link self; Links({ required this.content, required this.genesisTransaction, required this.next, required this.output, required this.prev, required this.preview, this.sat, required this.self, }); factory Links.fromJson(Map json) { return Links( content: Link.fromJson(json['content'] as Map), genesisTransaction: Link.fromJson(json['genesis_transaction'] as Map), next: Link.fromJson(json['next'] as Map), output: Link.fromJson(json['output'] as Map), prev: Link.fromJson(json['prev'] as Map), preview: Link.fromJson(json['preview'] as Map), sat: json['sat'] != null ? Link.fromJson(json['sat'] as Map) : null, self: Link.fromJson(json['self'] as Map), ); } } class Link { late final String href; Link({required this.href}); factory Link.fromJson(Map json) { return Link(href: json['href'] as String); } }