Skip to content

Commit

Permalink
feat: format nano custom types to improve UX/UI
Browse files Browse the repository at this point in the history
  • Loading branch information
pedroferreira1 committed Aug 26, 2024
1 parent b7fc33e commit 7c88bd6
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/components/tx/TxData.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ class TxData extends React.Component {
ncData.nc_blueprint_id,
ncData.nc_method,
ncData.nc_pubkey,
network,
ncData.nc_args
);
deserializer.parseAddress(network);
await deserializer.parseArguments();
this.setState({ ncDeserializer: deserializer, ncLoading: false });
};
Expand Down Expand Up @@ -767,10 +767,19 @@ class TxData extends React.Component {
};

const renderArgValue = arg => {
if (arg.type === 'bytes') {
const typeBytesOrigin = ['bytes', 'TxOutputScript', 'TokenUid', 'VertexId'];
if (typeBytesOrigin.includes(arg.type)) {
return arg.parsed.toString('hex');
}

if (arg.type === 'Timestamp') {
return dateFormatter.parseTimestamp(arg.parsed);
}

if (arg.type === 'Amount') {
return hathorLib.numberUtils.prettyValue(arg.parsed, this.props.decimalPlaces);
}

return arg.parsed;
};

Expand Down

0 comments on commit 7c88bd6

Please sign in to comment.