From ef75d82cc171ab86bf1e9f81fe94d3848cfdc919 Mon Sep 17 00:00:00 2001 From: Csillag Kristof Date: Wed, 14 Jun 2023 11:46:59 +0200 Subject: [PATCH] Update routes to conform to EIP-3091 --- .changelog/524.cfg.md | 1 + src/app/utils/route-utils.ts | 14 +++++++------- src/routes.tsx | 10 +++++----- 3 files changed, 13 insertions(+), 12 deletions(-) create mode 100644 .changelog/524.cfg.md diff --git a/.changelog/524.cfg.md b/.changelog/524.cfg.md new file mode 100644 index 0000000000..89b2a82261 --- /dev/null +++ b/.changelog/524.cfg.md @@ -0,0 +1 @@ +Update routes to conform to EIP-3091 diff --git a/src/app/utils/route-utils.ts b/src/app/utils/route-utils.ts index d664eb871f..93811542a8 100644 --- a/src/app/utils/route-utils.ts +++ b/src/app/utils/route-utils.ts @@ -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, )}` } diff --git a/src/routes.tsx b/src/routes.tsx index 23c9c45197..ec60445ab7 100644 --- a/src/routes.tsx +++ b/src/routes.tsx @@ -56,16 +56,16 @@ export const routes: RouteObject[] = [ }, { - path: `blocks`, + path: `block`, element: , }, { - path: `blocks/:blockHeight`, + path: `block/:blockHeight`, element: , loader: blockHeightParamLoader, }, { - path: `account/:address`, + path: `address/:address`, element: , loader: addressParamLoader, children: [ @@ -87,11 +87,11 @@ export const routes: RouteObject[] = [ ], }, { - path: `transactions`, + path: `tx`, element: , }, { - path: `transactions/:hash`, + path: `tx/:hash`, element: , loader: transactionParamLoader, },