Skip to content

Commit

Permalink
Update routes to conform to EIP-3091
Browse files Browse the repository at this point in the history
  • Loading branch information
csillag committed Jun 14, 2023
1 parent 9df15ad commit ef75d82
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
1 change: 1 addition & 0 deletions .changelog/524.cfg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update routes to conform to EIP-3091
14 changes: 7 additions & 7 deletions src/app/utils/route-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,27 @@ export abstract class RouteUtils {
}

static getLatestTransactionsRoute = ({ network, layer }: SearchScope) => {
return `/${encodeURIComponent(network)}/${encodeURIComponent(layer)}/transactions`
return `/${encodeURIComponent(network)}/${encodeURIComponent(layer)}/tx`
}

static getLatestBlocksRoute = ({ network, layer }: SearchScope) => {
return `/${encodeURIComponent(network)}/${encodeURIComponent(layer)}/blocks`
return `/${encodeURIComponent(network)}/${encodeURIComponent(layer)}/block`
}

static getBlockRoute = ({ network, layer }: SearchScope, blockHeight: number) => {
return `/${encodeURIComponent(network)}/${encodeURIComponent(layer)}/blocks/${encodeURIComponent(
return `/${encodeURIComponent(network)}/${encodeURIComponent(layer)}/block/${encodeURIComponent(
blockHeight,
)}`
}

static getTransactionRoute = (scope: SearchScope, txHash: string) => {
return `/${encodeURIComponent(scope.network)}/${encodeURIComponent(
scope.layer,
)}/transactions/${encodeURIComponent(txHash)}`
return `/${encodeURIComponent(scope.network)}/${encodeURIComponent(scope.layer)}/tx/${encodeURIComponent(
txHash,
)}`
}

static getAccountRoute = ({ network, layer }: SearchScope, account: string) => {
return `/${encodeURIComponent(network)}/${encodeURIComponent(layer)}/account/${encodeURIComponent(
return `/${encodeURIComponent(network)}/${encodeURIComponent(layer)}/address/${encodeURIComponent(
account,
)}`
}
Expand Down
10 changes: 5 additions & 5 deletions src/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,16 @@ export const routes: RouteObject[] = [
},

{
path: `blocks`,
path: `block`,
element: <BlocksPage />,
},
{
path: `blocks/:blockHeight`,
path: `block/:blockHeight`,
element: <BlockDetailPage />,
loader: blockHeightParamLoader,
},
{
path: `account/:address`,
path: `address/:address`,
element: <AccountDetailsPage />,
loader: addressParamLoader,
children: [
Expand All @@ -87,11 +87,11 @@ export const routes: RouteObject[] = [
],
},
{
path: `transactions`,
path: `tx`,
element: <TransactionsPage />,
},
{
path: `transactions/:hash`,
path: `tx/:hash`,
element: <TransactionDetailPage />,
loader: transactionParamLoader,
},
Expand Down

0 comments on commit ef75d82

Please sign in to comment.