Fix intents path to use namespace and chainId (#92)

This commit is contained in:
IshaVenikar 2024-04-15 16:42:06 +05:30 committed by Nabarun Gogoi
parent 3809ce88b1
commit 984cad8e48
2 changed files with 7 additions and 7 deletions

View File

@ -17,7 +17,7 @@ export default function Main() {
config: { config: {
screens: { screens: {
SignRequest: { SignRequest: {
path: 'sign/:network/:address/:message', path: 'sign/:namespace/:chaindId/:address/:message',
}, },
}, },
}, },

View File

@ -103,12 +103,13 @@ const SignRequest = ({ route }: SignRequestProps) => {
const sanitizePath = useCallback( const sanitizePath = useCallback(
(path: string) => { (path: string) => {
const regex = /^\/sign\/(eip155|cosmos)\/(.+)\/(.+)$/; const regex = /^\/sign\/(eip155|cosmos)\/(.+)\/(.+)\/(.+)$/;
const match = path.match(regex); const match = path.match(regex);
if (match) { if (match) {
const [, network, address, message] = match; const [, namespace, chainId, address, message] = match;
return { return {
network, namespace,
chainId,
address, address,
message, message,
}; };
@ -125,9 +126,8 @@ const SignRequest = ({ route }: SignRequestProps) => {
const sanitizedRoute = sanitizePath(route.path); const sanitizedRoute = sanitizePath(route.path);
sanitizedRoute && sanitizedRoute &&
retrieveData( retrieveData(
sanitizedRoute.network, sanitizedRoute.namespace,
// TODO: Take chainId from route.path sanitizedRoute.chainId,
selectedNetwork!.chainId!,
sanitizedRoute.address, sanitizedRoute.address,
sanitizedRoute.message, sanitizedRoute.message,
); );