From 984cad8e48ca334adb2399e7ceb1f8243e378d08 Mon Sep 17 00:00:00 2001 From: IshaVenikar <145848618+IshaVenikar@users.noreply.github.com> Date: Mon, 15 Apr 2024 16:42:06 +0530 Subject: [PATCH] Fix intents path to use namespace and chainId (#92) --- index.js | 2 +- src/screens/SignRequest.tsx | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index e160e8c..d356f7a 100644 --- a/index.js +++ b/index.js @@ -17,7 +17,7 @@ export default function Main() { config: { screens: { SignRequest: { - path: 'sign/:network/:address/:message', + path: 'sign/:namespace/:chaindId/:address/:message', }, }, }, diff --git a/src/screens/SignRequest.tsx b/src/screens/SignRequest.tsx index 3063049..291c86f 100644 --- a/src/screens/SignRequest.tsx +++ b/src/screens/SignRequest.tsx @@ -103,12 +103,13 @@ const SignRequest = ({ route }: SignRequestProps) => { const sanitizePath = useCallback( (path: string) => { - const regex = /^\/sign\/(eip155|cosmos)\/(.+)\/(.+)$/; + const regex = /^\/sign\/(eip155|cosmos)\/(.+)\/(.+)\/(.+)$/; const match = path.match(regex); if (match) { - const [, network, address, message] = match; + const [, namespace, chainId, address, message] = match; return { - network, + namespace, + chainId, address, message, }; @@ -125,9 +126,8 @@ const SignRequest = ({ route }: SignRequestProps) => { const sanitizedRoute = sanitizePath(route.path); sanitizedRoute && retrieveData( - sanitizedRoute.network, - // TODO: Take chainId from route.path - selectedNetwork!.chainId!, + sanitizedRoute.namespace, + sanitizedRoute.chainId, sanitizedRoute.address, sanitizedRoute.message, );