@@ -32,7 +32,12 @@ function NanoContractDetail() {
32
32
const context = useContext ( GlobalModalContext ) ;
33
33
const wallet = getGlobalWallet ( ) ;
34
34
35
- const { nanoContracts, blueprintsData, tokenMetadata, decimalPlaces } = useSelector ( ( state ) => {
35
+ const {
36
+ nanoContracts,
37
+ blueprintsData,
38
+ tokenMetadata,
39
+ decimalPlaces,
40
+ } = useSelector ( ( state ) => {
36
41
return {
37
42
nanoContracts : state . nanoContracts ,
38
43
blueprintsData : state . blueprintsData ,
@@ -170,12 +175,23 @@ function NanoContractDetail() {
170
175
return get ( blueprintInformation . attributes , field ) ;
171
176
}
172
177
173
- // Some fields should be better parsed, e.g., timestamp, address
174
- // however we don't have a simple and generic way to knowing it
175
- // this was discussed and we will have this in the future, so
176
- // for now we keep this UI and when we have this feature in the
177
- // hathor-core, we can improve the user UI
178
- return value === null ? ' - ' : value ;
178
+ if ( value == null ) {
179
+ // If value is null or undefined, we show empty string
180
+ return null ;
181
+ }
182
+
183
+ // Get type of value but removing possible optional mark (?) to format the value correctly
184
+ const type = blueprintInformation . attributes [ field ] . replace ( '?' , '' ) ;
185
+
186
+ if ( type === 'Timestamp' ) {
187
+ return hathorLib . dateUtils . parseTimestamp ( value ) ;
188
+ }
189
+
190
+ if ( type === 'Amount' ) {
191
+ return hathorLib . numberUtils . prettyValue ( value , decimalPlaces ) ;
192
+ }
193
+
194
+ return value ;
179
195
}
180
196
181
197
/**
0 commit comments