[Explorer]: Shinzohub Transactions and Transaction details#231
[Explorer]: Shinzohub Transactions and Transaction details#231NiranjanaBinoy wants to merge 14 commits into
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
shinzo-explorer | 547cf18 | Commit Preview URL Branch Preview URL |
Jun 09 2026, 06:05 PM |
| unwatch() | ||
| } | ||
| }, [count]) | ||
| }, [count, publicClient]) |
There was a problem hiding this comment.
Lint warning fix
|
|
||
| import { useMemo } from 'react'; | ||
| import { useShinzohubTransactionIndex } from '../../hook/use-shinzohub-transaction-index'; | ||
| import { useShinzohubTransactionsSync } from '@/pages/transactions/hooks/shinzohub/use-shinzohub-transactions-sync'; |
There was a problem hiding this comment.
Existing hook is renamed for clarity
| queryKey: ['transaction-logs', hash], | ||
| enabled: !!hash && enabled, | ||
| queryKey: ['ethereum', 'transaction-logs', hash], | ||
| enabled: chain === 'ethereum' && !!hash && !!tx, |
There was a problem hiding this comment.
to make sure the api fetch call happens only for ethereum not shinzohub.
There was a problem hiding this comment.
why could it possibly be called on shinzohub-related pages? Do you have this hook usages running globally? I imagine that ethereum-related hooks shouldn't even be called on shinzohub pages
There was a problem hiding this comment.
suggestion: refactor it in a way that the hook doesn't depend on useChainPathSegment hook. It should only be called in the pages where it is actually needed
| @@ -0,0 +1,209 @@ | |||
| 'use client'; | |||
|
|
|||
There was a problem hiding this comment.
This is a new component added for Shinzohub transaction details; It fetches data from Shinzohub specific hooks and use DataList to display i, same as in EthereumTransactionCard.
| case 'ethereum': | ||
| return <TransactionLogs txHash={hash} />; | ||
| default: | ||
| return null; |
There was a problem hiding this comment.
Making sure the transcationlogs get rendered for only ethereum network.
| case 'shinzohub': | ||
| return <ShinzohubTransactionCard txHash={hash} />; | ||
| default: | ||
| return null; |
There was a problem hiding this comment.
Switch based on chain to render the appropriate transaction card.
| import { getPublicClient } from '@/shared/viem/client'; | ||
| import type { Transaction } from 'viem'; | ||
|
|
||
| const TX_INDEX_QUERY_KEY = ['shinzohub', 'transaction-index'] as const; |
There was a problem hiding this comment.
Most of the changes in this hook is renaming the variables for clarity
| case 'shinzohub': | ||
| return <ShinzohubTransactionsPageClient pageParams={pageParams} /> | ||
| default: | ||
| return <div>Invalid chain</div> |
There was a problem hiding this comment.
Chain based rendering of the TransactionPageClient
| @@ -0,0 +1,47 @@ | |||
| "use client" | |||
|
|
|||
There was a problem hiding this comment.
New component to render the transactions list for the Shinzohub. this one uses the Shinzohub specific use-shinzohub-transcations hook for the data fetching.
| queryKey: ['transaction-logs', hash], | ||
| enabled: !!hash && enabled, | ||
| queryKey: ['ethereum', 'transaction-logs', hash], | ||
| enabled: chain === 'ethereum' && !!hash && !!tx, |
There was a problem hiding this comment.
suggestion: refactor it in a way that the hook doesn't depend on useChainPathSegment hook. It should only be called in the pages where it is actually needed
| import { formatUnits } from "viem"; | ||
|
|
||
| export const formatGasPrice = (gasPrice: string) => { | ||
| return Number(formatUnits(BigInt(gasPrice), 9)).toFixed(2); |
There was a problem hiding this comment.
question: is gas always measured with 9 decimals?
There was a problem hiding this comment.
As we are formating the gasPrice to GWEI, which is Giga-WEI, it should be 9 from what I could find.
cc @dvncan or @soniasingla can you confirm this?
There was a problem hiding this comment.
viem have a formatGwei for the same conversion, I am replacing this function with that in #235
| # Optional overrides per path: /ethereum/* vs /shinzohub/* (Shinzo chain id 91273002) | ||
| NEXT_PUBLIC_ETHEREUM_RPC_URL= | ||
| NEXT_PUBLIC_SHINZOHUB_RPC_URL= | ||
| NEXT_PUBLIC_SHINZOHUB_RPC_URL=http://rpc.develop.devnet.shinzo.network:8545 |
There was a problem hiding this comment.
suggestion: add a proxy endpoint and make the viem client configurable to use the proxy when calling ShinzoHub. It would make the deployed Explorer load data correctly. Limit this proxy endpoint to same-site requests, so it won't be available for anyone else to use.
There was a problem hiding this comment.
I have added the url in this file just for testing guid lines, I have added the staging proxy url to the deployed app.
Unexpected. This definitely shouldn't be a work of the frontend. With this logic, all we'll do is start a DoS attack on a ShinzoHub node, and we surely don't want that. I agree on using a DB from Cloudflare. Ideally, it should start the data-filling process as soon as the explorer is deployed, and keep the backend stateful - always watching for new blocks and processing them when needed. If you think this is too much for the current PR, then we can leave it minimal and simply render transactions only for the last block, or show 0 if it doesn't have it. It would require removing the localStorage tx saving logic and infinite requests logic. |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ❌ Deployment failed View logs |
shinzo-webapp-staging | 8e0b215 | Jun 04 2026, 08:59 PM |
8e0b215 to
b5d5985
Compare


Pull Request
Description
The PR uses the existing transactions and transaction-details components for Shinzohub.
Changes
@page/shinzohub/homeare moved to@page/shinzohub-homeavoiding an extra step in the folder structure. These files does not have any new changes, they only reflect the path changes.transactionsandtransaction-detailsfolders are organized to/hookand/uifolders respectively./hookfolder, all the existing ethereum based hooks are moved to ethereum folder and shinzohub related hooks are in the shinzohub folder./uifolder, we have reused most of the components, intransactionsI have updated thepage.tsxto call the chain based page clients and introducedEthereumTransactionsPageClientandShinzohubTransactionsPageClientfor chain specific data rendering.transaction-detailsI haveEthereumTransactionCardandShinzohubTransactionCardwhich uses teh respective hooks to fetch the related data to be displayed.Related Issue
fixes #161
Steps to Test
Worker urls => https://feat-shinzohub-txns-shinzo-explorer.shinzo-492.workers.dev/shinzohub/txs
https://feat-shinzohub-txns-shinzo-explorer.shinzo-492.workers.dev/shinzohub/tx/--hash value --
NEXT_PUBLIC_SHINZOHUB_RPC_URL=http://rpc.develop.devnet.shinzo.network:8545to the .env fileChecklist
Notes