dev
dart 130 lines 3.5 KB
Raw
1 class SolanaNFTAssetModel {
2 String? address;
3 String? mint;
4 String? standard;
5 String? name;
6 String? symbol;
7 String? description;
8 String? imageOriginalUrl;
9 String? externalUrl;
10 String? metadataOriginalUrl;
11 String? totalSupply;
12 Metaplex? metaplex;
13 Collection? collection;
14 Contract? contract;
15
16 SolanaNFTAssetModel({
17 this.address,
18 this.mint,
19 this.standard,
20 this.name,
21 this.symbol,
22 this.description,
23 this.imageOriginalUrl,
24 this.externalUrl,
25 this.metadataOriginalUrl,
26 this.totalSupply,
27 this.metaplex,
28 this.collection,
29 this.contract,
30 });
31
32 factory SolanaNFTAssetModel.fromJson(Map<String, dynamic> json) {
33 return SolanaNFTAssetModel(
34 address: json['address'] as String?,
35 mint: json['mint'] as String?,
36 standard: json['standard'] as String?,
37 name: json['name'] as String?,
38 symbol: json['symbol'] as String?,
39 description: json['description'] as String?,
40 imageOriginalUrl: json['imageOriginalUrl'] as String?,
41 externalUrl: json['externalUrl'] as String?,
42 metadataOriginalUrl: json['metadataOriginalUrl'] as String?,
43 totalSupply: json['totalSupply'] as String?,
44 metaplex: json['metaplex'] != null
45 ? Metaplex.fromJson(json['metaplex'] as Map<String, dynamic>)
46 : null,
47 collection: json['collection'] != null
48 ? Collection.fromJson(json['collection'] as Map<String, dynamic>)
49 : null,
50 contract: json['contract'] != null
51 ? Contract.fromJson(json['contract'] as Map<String, dynamic>)
52 : null,
53 );
54 }
55 }
56
57 class Metaplex {
58 String? metadataUri;
59 String? updateAuthority;
60 int? sellerFeeBasisPoints;
61 int? primarySaleHappened;
62 bool? isMutable;
63 bool? masterEdition;
64
65 Metaplex(
66 {this.metadataUri,
67 this.updateAuthority,
68 this.sellerFeeBasisPoints,
69 this.primarySaleHappened,
70 this.isMutable,
71 this.masterEdition});
72
73 factory Metaplex.fromJson(Map<String, dynamic> json) {
74 return Metaplex(
75 metadataUri: json['metadataUri'] as String?,
76 updateAuthority: json['updateAuthority'] as String?,
77 sellerFeeBasisPoints: json['sellerFeeBasisPoints'] as int?,
78 primarySaleHappened: json['primarySaleHappened'] as int?,
79 isMutable: json['isMutable'] as bool?,
80 masterEdition: json['masterEdition'] as bool?,
81 );
82 }
83 }
84
85 class Collection {
86 String? collectionAddress;
87 String? name;
88 String? description;
89 String? imageOriginalUrl;
90 String? externalUrl;
91 String? metaplexMint;
92 int? sellerFeeBasisPoints;
93
94 Collection(
95 {this.collectionAddress,
96 this.name,
97 this.description,
98 this.imageOriginalUrl,
99 this.externalUrl,
100 this.metaplexMint,
101 this.sellerFeeBasisPoints});
102
103 factory Collection.fromJson(Map<String, dynamic> json) {
104 return Collection(
105 collectionAddress: json['collectionAddress'] as String?,
106 name: json['name'] as String?,
107 description: json['description'] as String?,
108 imageOriginalUrl: json['imageOriginalUrl'] as String?,
109 externalUrl: json['externalUrl'] as String?,
110 metaplexMint: json['metaplexMint'] as String?,
111 sellerFeeBasisPoints: json['sellerFeeBasisPoints'] as int?,
112 );
113 }
114 }
115
116 class Contract {
117 String? type;
118 String? name;
119 String? symbol;
120
121 Contract({this.type, this.name, this.symbol});
122
123 factory Contract.fromJson(Map<String, dynamic> json) {
124 return Contract(
125 type: json['type'] as String?,
126 name: json['name'] as String?,
127 symbol: json['symbol'] as String?,
128 );
129 }
130 }