Skip to content

Commit

Permalink
Fix precision
Browse files Browse the repository at this point in the history
  • Loading branch information
jair-rosa-cb committed Jan 8, 2025
1 parent f254b63 commit 9e0c8e3
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 16 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ dist-ssr
# dotenv environment variable files
.env
.env.*
!.env.example
!.env.example
.env*.local
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@
"typescript": "~5.6.2",
"typescript-eslint": "^8.11.0",
"vite": "^5.4.10"
}
},
"packageManager": "[email protected]+sha512.cce0f9de9c5a7c95bef944169cc5dfe8741abfb145078c0d508b868056848a87c81e626246cb60967cbd7fd29a6c062ef73ff840d96b3c86c40ac92cf4a813ee"
}
33 changes: 19 additions & 14 deletions src/GetHistory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,13 @@ export default function GetHistory(): React.JSX.Element {
limit,
walletAddress: wAddress,
network,
}).then((res) => res.data),
})
.then((res) => res.data)
.catch((e) => {
console.log('Axios error:', e);
}),
onError: (error: AxiosError) => {
console.log('onError:', error);
const errorMessage = (error.response?.data as string) || 'An error happened while fetching';
toast.error(errorMessage)
}
Expand Down Expand Up @@ -105,39 +110,39 @@ export default function GetHistory(): React.JSX.Element {
</thead>
<tbody>
{data.map((item: HistoryResponseItem, i: number) => {
const amount = Number(item.model.content.token_transfers[0].value) / 1000000;
const transferType = item.model.content.token_transfers[0].token_transfer_type;
const amount = Number(item?.model?.content?.value) / 1000000000000000000;
const transferType = item.model?.content?.token_transfers?.[0]?.token_transfer_type || '';
return (
<tr key={i}>
<td>{i+1}</td>
<td className={styles.clickable}>
<a target="_blank" href={item.model.transaction_link}>
{reduceStr(item.model.transaction_hash)}
<a target="_blank" href={item.model?.transaction_link}>
{reduceStr(item.model?.transaction_hash)}
</a>
</td>
<td
className={styles.clickable}
onClick={() => copyToClipboard(item.model.from_address_id)}
onClick={() => copyToClipboard(item.model?.from_address_id)}
>
{reduceStr(item.model.from_address_id)}
{reduceStr(item.model?.from_address_id)}
</td>
<td
className={styles.clickable}
onClick={() => copyToClipboard(item.model.to_address_id)}
onClick={() => copyToClipboard(item.model?.to_address_id)}
>
{reduceStr(item.model.to_address_id)}
{reduceStr(item.model?.to_address_id)}
</td>
<td>{item.model.network_id}</td>
<td>{item.model?.network_id}</td>
<td>{amount}</td>
<td>{transferType}</td>
<td
className={styles.clickable}
onClick={() => copyToClipboard(item.model.block_hash)}
onClick={() => copyToClipboard(item.model?.block_hash)}
>
{reduceStr(item.model.block_hash)}
{reduceStr(item.model?.block_hash)}
</td>
<td>{item.model.block_height}</td>
<td>{item.model.content.block_timestamp}</td>
<td>{item.model?.block_height}</td>
<td>{item.model?.content?.block_timestamp}</td>
</tr>
);
})}
Expand Down

0 comments on commit 9e0c8e3

Please sign in to comment.