diff --git a/client/src/app/routes.tsx b/client/src/app/routes.tsx index 4c9a80667..763f898db 100644 --- a/client/src/app/routes.tsx +++ b/client/src/app/routes.tsx @@ -31,7 +31,8 @@ import StardustBlock from "./routes/stardust/Block"; import StardustFoundry from "./routes/stardust/Foundry"; import { Landing as StardustLanding } from "./routes/stardust/landing/Landing"; import NovaLanding from "./routes/nova/landing/Landing"; -import NftRedirectRoute from "./routes/stardust/NftRedirectRoute"; +import NftRedirectRouteStardust from "./routes/stardust/NftRedirectRoute"; +import NftRedirectRouteNova from "./routes/nova/NftRedirectRoute"; import StardustOutputList from "./routes/stardust/OutputList"; import StardustOutputPage from "./routes/stardust/OutputPage"; import NovaBlockPage from "./routes/nova/Block"; @@ -169,7 +170,7 @@ const buildAppRoutes = (protocolVersion: string, withNetworkContext: (wrappedCom , , , - , + , , , , @@ -189,6 +190,7 @@ const buildAppRoutes = (protocolVersion: string, withNetworkContext: (wrappedCom , , , + , , , , diff --git a/client/src/app/routes/nova/NftRedirectRoute.tsx b/client/src/app/routes/nova/NftRedirectRoute.tsx new file mode 100644 index 000000000..1d3778d73 --- /dev/null +++ b/client/src/app/routes/nova/NftRedirectRoute.tsx @@ -0,0 +1,36 @@ +import { AddressType } from "@iota/sdk-wasm-nova/web"; +import React from "react"; +import { Redirect, RouteComponentProps } from "react-router-dom"; +import { AddressHelper } from "~helpers/nova/addressHelper"; +import { useNetworkInfoNova } from "~/helpers/nova/networkInfo"; + +interface NftRedirectRouteProps { + /** + * The network. + */ + network: string; + + /** + * The nftId to redirect. + */ + nftId: string; +} + +const ADDRESS_ROUTE = "addr"; + +const NftRedirectRoute: React.FC> = ({ + match: { + params: { network, nftId }, + }, +}) => { + const { bech32Hrp } = useNetworkInfoNova((s) => s.networkInfo); + const nftAddress = AddressHelper.buildAddress(bech32Hrp, nftId, AddressType.Nft); + const redirectState = { + addressDetails: nftAddress, + }; + const routeParam = nftAddress.bech32; + const redirect = `/${network}/${ADDRESS_ROUTE}/${routeParam}`; + return ; +}; + +export default NftRedirectRoute;