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