From 6b0a730a2d852d5f1f7fb43bbba4e5000276c429 Mon Sep 17 00:00:00 2001 From: IshaVenikar Date: Thu, 24 Apr 2025 14:59:36 +0530 Subject: [PATCH 1/8] Create iframe component for signing messages --- .env.example | 1 - src/App.tsx | 9 ++ src/screens/SignMessageEmbed.tsx | 177 +++++++++++++++++++++++++++++++ src/types.ts | 1 + src/utils/constants.ts | 12 +++ 5 files changed, 199 insertions(+), 1 deletion(-) create mode 100644 src/screens/SignMessageEmbed.tsx diff --git a/.env.example b/.env.example index d563968..e5066ca 100644 --- a/.env.example +++ b/.env.example @@ -4,5 +4,4 @@ REACT_APP_DEFAULT_GAS_PRICE=0.025 # Reference: https://github.com/cosmos/cosmos-sdk/issues/16020 REACT_APP_GAS_ADJUSTMENT=2 REACT_APP_LACONICD_RPC_URL=https://laconicd-sapo.laconic.com - REACT_APP_DEPLOY_APP_URL= diff --git a/src/App.tsx b/src/App.tsx index ac840a9..827b397 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -41,6 +41,7 @@ import { AutoSignIn } from "./screens/AutoSignIn"; import { checkSufficientFunds, getPathKey, sendMessage } from "./utils/misc"; import useAccountsData from "./hooks/useAccountsData"; import { useWebViewHandler } from "./hooks/useWebViewHandler"; +import SignMessageEmbed from "./screens/SignMessageEmbed"; const Stack = createStackNavigator(); @@ -390,6 +391,14 @@ const App = (): React.JSX.Element => { header: () => <>, }} /> +
, + }} + /> ; + +const SignMessageEmbed = ({ route }: SignRequestProps) => { + const [displayAccount, setDisplayAccount] = useState(); + const [message, setMessage] = useState(''); + const [chainId, setChainId] = useState(''); + const [signDoc, setSignDoc] = useState(null); + const [signerAddress, setSignerAddress] = useState(''); + const [origin, setOrigin] = useState(''); + const [sourceWindow, setSourceWindow] = useState(null); + const [isLoading, setIsLoading] = useState(true); + const [isApproving, setIsApproving] = useState(false); + + const navigation = + useNavigation>(); + + const signMessageHandler = async () => { + if (!signDoc || !signerAddress || !sourceWindow) return; + + setIsApproving(true); + try { + const requestAccount = await retrieveSingleAccount(COSMOS, chainId, signerAddress); + const path = (await getPathKey(`${COSMOS}:${chainId}`, requestAccount!.index)).path; + const mnemonic = await getMnemonic(); + const cosmosAccount = await getCosmosAccounts(mnemonic, path, 'zenith'); + + const cosmosAminoSignature = await cosmosAccount.cosmosWallet.signAmino( + signerAddress, + signDoc, + ); + + const signature = cosmosAminoSignature.signature.signature; + + sendMessage( + sourceWindow, + 'ZENITH_SIGNED_MESSAGE', + { signature }, + origin, + ); + + navigation.navigate('Home'); + } catch (err) { + console.error('Signing failed:', err); + sendMessage( + sourceWindow!, + 'ZENITH_SIGNED_MESSAGE', + { error: err }, + origin, + ); + } finally { + setIsApproving(false); + } + }; + + + const rejectRequestHandler = async () => { + if (sourceWindow && origin) { + sendMessage( + sourceWindow, + 'ZENITH_SIGNED_MESSAGE', + { error: 'User rejected the request' }, + origin, + ); + } + navigation.navigate('Home'); + }; + + useEffect(() => { + const handleCosmosSignMessage = async (event: MessageEvent) => { + if (event.data.type !== 'SIGN_ZENITH_MESSAGE') return; + + try { + const { signerAddress, signDoc } = event.data.params; + + setSignerAddress(signerAddress); + setSignDoc(signDoc); + setMessage(signDoc.memo || ''); + setOrigin(event.origin); + setSourceWindow(event.source as Window); + setChainId(event.data.chainId); + + const requestAccount = await retrieveSingleAccount( + COSMOS, + event.data.chainId, + signerAddress, + ); + + setDisplayAccount(requestAccount); + setIsLoading(false); + } catch (err) { + console.error('Error preparing sign request:', err); + setIsLoading(false); + } + }; + + window.addEventListener('message', handleCosmosSignMessage); + return () => window.removeEventListener('message', handleCosmosSignMessage); + }, []); + + useEffect(() => { + navigation.setOptions({ + // eslint-disable-next-line react/no-unstable-nested-components + header: ({ options, back }) => { + const title = getHeaderTitle(options, 'Sign Message'); + + return ( + + {back && ( + { + await rejectRequestHandler(); + navigation.navigate('Home'); + }} + /> + )} + + + ); + }, + }); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [navigation, route.name]); + + return ( + <> + {isLoading ? ( + + + + ) : ( + <> + + + + {message} + + + + + + + + )} + + ); +}; + +export default SignMessageEmbed; diff --git a/src/types.ts b/src/types.ts index 3b7341e..84ce968 100644 --- a/src/types.ts +++ b/src/types.ts @@ -40,6 +40,7 @@ export type StackParamsList = { }; "wallet-embed": undefined; "auto-sign-in": undefined; + "sign-message-embed": undefined; }; export type Account = { diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 8d03e44..7113d0b 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -18,6 +18,18 @@ export const DEFAULT_NETWORKS: NetworksFormData[] = [ gasPrice: '0.001', isDefault: true, }, + { + chainId: 'zenith-testnet', + networkName: 'zenithd testnet', + namespace: COSMOS, + rpcUrl: 'http://127.0.0.1:26657', + blockExplorerUrl: '', + nativeDenom: 'znt', + addressPrefix: 'zenith', + coinType: '118', + gasPrice: '0.01', + isDefault: true, + }, { chainId: 'laconic_9000-1', networkName: 'laconicd', -- 2.45.2 From 39bfed8517b37081f197e2b339593ff1af37f754 Mon Sep 17 00:00:00 2001 From: IshaVenikar Date: Thu, 24 Apr 2025 17:33:08 +0530 Subject: [PATCH 2/8] Modify route name --- .env.example | 1 + src/App.tsx | 2 +- src/screens/SignMessageEmbed.tsx | 2 +- src/types.ts | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.env.example b/.env.example index e5066ca..d563968 100644 --- a/.env.example +++ b/.env.example @@ -4,4 +4,5 @@ REACT_APP_DEFAULT_GAS_PRICE=0.025 # Reference: https://github.com/cosmos/cosmos-sdk/issues/16020 REACT_APP_GAS_ADJUSTMENT=2 REACT_APP_LACONICD_RPC_URL=https://laconicd-sapo.laconic.com + REACT_APP_DEPLOY_APP_URL= diff --git a/src/App.tsx b/src/App.tsx index 827b397..8066c61 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -392,7 +392,7 @@ const App = (): React.JSX.Element => { }} /> ; +type SignRequestProps = NativeStackScreenProps; const SignMessageEmbed = ({ route }: SignRequestProps) => { const [displayAccount, setDisplayAccount] = useState(); diff --git a/src/types.ts b/src/types.ts index 84ce968..31d4c3f 100644 --- a/src/types.ts +++ b/src/types.ts @@ -40,7 +40,7 @@ export type StackParamsList = { }; "wallet-embed": undefined; "auto-sign-in": undefined; - "sign-message-embed": undefined; + "sign-request-embed": undefined; }; export type Account = { -- 2.45.2 From 572eda86257076e2b790e6f9f8bf3778d480c213 Mon Sep 17 00:00:00 2001 From: Shreerang Kale Date: Fri, 25 Apr 2025 10:02:54 +0530 Subject: [PATCH 3/8] Update config to take comma separated list of allowed URLs --- .env.example | 2 +- src/screens/AutoSignIn.tsx | 4 +++- stack/stack-orchestrator/config/app/run.sh | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.env.example b/.env.example index d563968..49a4f5f 100644 --- a/.env.example +++ b/.env.example @@ -5,4 +5,4 @@ REACT_APP_DEFAULT_GAS_PRICE=0.025 REACT_APP_GAS_ADJUSTMENT=2 REACT_APP_LACONICD_RPC_URL=https://laconicd-sapo.laconic.com -REACT_APP_DEPLOY_APP_URL= +REACT_APP_ALLOWED_URLS= diff --git a/src/screens/AutoSignIn.tsx b/src/screens/AutoSignIn.tsx index d9ab05b..a791230 100644 --- a/src/screens/AutoSignIn.tsx +++ b/src/screens/AutoSignIn.tsx @@ -16,7 +16,9 @@ export const AutoSignIn = () => { const handleSignIn = async (event: MessageEvent) => { if (event.data.type !== 'AUTO_SIGN_IN') return; - if (event.origin !== process.env.REACT_APP_DEPLOY_APP_URL) { + const allowedUrls = process.env.REACT_APP_ALLOWED_URLS?.split(',').map(url => url.trim()); + + if (!allowedUrls?.includes(event.origin)) { console.log('Unauthorized app.'); return; } diff --git a/stack/stack-orchestrator/config/app/run.sh b/stack/stack-orchestrator/config/app/run.sh index 5cdfcfa..41fcb32 100755 --- a/stack/stack-orchestrator/config/app/run.sh +++ b/stack/stack-orchestrator/config/app/run.sh @@ -17,7 +17,7 @@ REACT_APP_WALLET_CONNECT_PROJECT_ID=$WALLET_CONNECT_ID \ REACT_APP_DEFAULT_GAS_PRICE=$CERC_DEFAULT_GAS_PRICE \ REACT_APP_GAS_ADJUSTMENT=$CERC_GAS_ADJUSTMENT \ REACT_APP_LACONICD_RPC_URL=$CERC_LACONICD_RPC_URL \ -REACT_APP_DEPLOY_APP_URL=$CERC_DEPLOY_APP_URL \ +REACT_APP_ALLOWED_URLS=$CERC_ALLOWED_URLS \ yarn build # Define the directory and file path -- 2.45.2 From 7205a1cf76e8a29ecb8e9e7482a53b342abfeb2c Mon Sep 17 00:00:00 2001 From: Shreerang Kale Date: Fri, 25 Apr 2025 10:24:01 +0530 Subject: [PATCH 4/8] Update stack config --- .../compose/docker-compose-laconic-wallet-web.yml | 2 +- stack/stack-orchestrator/config/app/run.sh | 2 +- stack/stack-orchestrator/stack/laconic-wallet-web/README.md | 5 ++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/stack/stack-orchestrator/compose/docker-compose-laconic-wallet-web.yml b/stack/stack-orchestrator/compose/docker-compose-laconic-wallet-web.yml index 9ae5335..79bd086 100644 --- a/stack/stack-orchestrator/compose/docker-compose-laconic-wallet-web.yml +++ b/stack/stack-orchestrator/compose/docker-compose-laconic-wallet-web.yml @@ -10,7 +10,7 @@ services: CERC_DEFAULT_GAS_PRICE: ${CERC_DEFAULT_GAS_PRICE:-0.025} CERC_GAS_ADJUSTMENT: ${CERC_GAS_ADJUSTMENT:-2} CERC_LACONICD_RPC_URL: ${CERC_LACONICD_RPC_URL:-https://laconicd.laconic.com} - CERC_DEPLOY_APP_URL: ${CERC_DEPLOY_APP_URL} + CERC_ALLOWED_URLS: ${CERC_ALLOWED_URLS} command: ["bash", "/scripts/run.sh"] volumes: - ../config/app/run.sh:/scripts/run.sh diff --git a/stack/stack-orchestrator/config/app/run.sh b/stack/stack-orchestrator/config/app/run.sh index 41fcb32..72d0e17 100755 --- a/stack/stack-orchestrator/config/app/run.sh +++ b/stack/stack-orchestrator/config/app/run.sh @@ -10,7 +10,7 @@ echo "WALLET_CONNECT_ID: ${WALLET_CONNECT_ID}" echo "CERC_DEFAULT_GAS_PRICE: ${CERC_DEFAULT_GAS_PRICE}" echo "CERC_GAS_ADJUSTMENT: ${CERC_GAS_ADJUSTMENT}" echo "CERC_LACONICD_RPC_URL: ${CERC_LACONICD_RPC_URL}" -echo "CERC_DEPLOY_APP_URL: ${CERC_DEPLOY_APP_URL}" +echo "CERC_ALLOWED_URLS: ${CERC_ALLOWED_URLS}" # Build with required env REACT_APP_WALLET_CONNECT_PROJECT_ID=$WALLET_CONNECT_ID \ diff --git a/stack/stack-orchestrator/stack/laconic-wallet-web/README.md b/stack/stack-orchestrator/stack/laconic-wallet-web/README.md index 6e0567c..50be17d 100644 --- a/stack/stack-orchestrator/stack/laconic-wallet-web/README.md +++ b/stack/stack-orchestrator/stack/laconic-wallet-web/README.md @@ -64,9 +64,8 @@ Instructions for running the `laconic-wallet-web` using [laconic-so](https://git # RPC endpoint of laconicd node (default: https://laconicd.laconic.com) CERC_LACONICD_RPC_URL= - # Deploy app URL used for checking origin of the messages for auto-sign-in route - # Deploy app repo: https://git.vdb.to/cerc-io/snowballtools-base - CERC_DEPLOY_APP_URL= + # Allowed urls is a comma separated list of allowed urls for auto-sign-in route + CERC_ALLOWED_URLS= ``` ## Start the deployment -- 2.45.2 From 50a87ca2300bf158c734d1237ed04bfac9d47c6a Mon Sep 17 00:00:00 2001 From: Shreerang Kale Date: Fri, 25 Apr 2025 11:58:08 +0530 Subject: [PATCH 5/8] Check for allowed URLs in get or create accounts --- .env.example | 1 + src/App.tsx | 1 - src/hooks/useGetOrCreateAccounts.ts | 18 ++++++++++++++++-- src/screens/AutoSignIn.tsx | 11 +++++++++-- 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/.env.example b/.env.example index 49a4f5f..2e44075 100644 --- a/.env.example +++ b/.env.example @@ -5,4 +5,5 @@ REACT_APP_DEFAULT_GAS_PRICE=0.025 REACT_APP_GAS_ADJUSTMENT=2 REACT_APP_LACONICD_RPC_URL=https://laconicd-sapo.laconic.com +# Example: https://example-url-1.com,https://example-url-2.com REACT_APP_ALLOWED_URLS= diff --git a/src/App.tsx b/src/App.tsx index 8066c61..201489f 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -395,7 +395,6 @@ const App = (): React.JSX.Element => { name="sign-request-embed" component={SignMessageEmbed} options={{ - // eslint-disable-next-line react/no-unstable-nested-components header: () =>
, }} /> diff --git a/src/hooks/useGetOrCreateAccounts.ts b/src/hooks/useGetOrCreateAccounts.ts index 28b51f7..8a0e10b 100644 --- a/src/hooks/useGetOrCreateAccounts.ts +++ b/src/hooks/useGetOrCreateAccounts.ts @@ -6,6 +6,8 @@ import useAccountsData from "./useAccountsData"; import { useNetworks } from "../context/NetworksContext"; import { useAccounts } from "../context/AccountsContext"; +const REACT_APP_ALLOWED_URLS = process.env.REACT_APP_ALLOWED_URLS + const useGetOrCreateAccounts = () => { const { networksData } = useNetworks(); const { getAccountsData } = useAccountsData(); @@ -31,6 +33,18 @@ const useGetOrCreateAccounts = () => { const handleCreateAccounts = async (event: MessageEvent) => { if (event.data.type !== 'REQUEST_CREATE_OR_GET_ACCOUNTS') return; + if (!REACT_APP_ALLOWED_URLS) { + console.log('allowed URLs are not set.'); + return; + } + + const allowedUrls = REACT_APP_ALLOWED_URLS.split(',').map(url => url.trim()); + + if (!allowedUrls.includes(event.origin)) { + console.log('Unauthorized app.'); + return; + } + const accountsData = await getOrCreateAccountsForChain(event.data.chainId); sendMessage( @@ -42,7 +56,7 @@ const useGetOrCreateAccounts = () => { const autoCreateAccounts = async () => { const defaultChainId = networksData[0]?.chainId; - + if (!defaultChainId) { console.log('useGetOrCreateAccounts: No default chainId found'); return; @@ -60,7 +74,7 @@ const useGetOrCreateAccounts = () => { window.addEventListener('message', handleCreateAccounts); const isAndroidWebView = !!(window.Android); - + if (isAndroidWebView) { autoCreateAccounts(); } diff --git a/src/screens/AutoSignIn.tsx b/src/screens/AutoSignIn.tsx index a791230..bb19267 100644 --- a/src/screens/AutoSignIn.tsx +++ b/src/screens/AutoSignIn.tsx @@ -7,6 +7,8 @@ import { sendMessage } from '../utils/misc'; import useAccountsData from '../hooks/useAccountsData'; import useGetOrCreateAccounts from '../hooks/useGetOrCreateAccounts'; +const REACT_APP_ALLOWED_URLS = process.env.REACT_APP_ALLOWED_URLS + export const AutoSignIn = () => { const { networksData } = useNetworks(); @@ -16,9 +18,14 @@ export const AutoSignIn = () => { const handleSignIn = async (event: MessageEvent) => { if (event.data.type !== 'AUTO_SIGN_IN') return; - const allowedUrls = process.env.REACT_APP_ALLOWED_URLS?.split(',').map(url => url.trim()); + if (!REACT_APP_ALLOWED_URLS) { + console.log('allowed URLs are not set.'); + return; + } - if (!allowedUrls?.includes(event.origin)) { + const allowedUrls = REACT_APP_ALLOWED_URLS.split(',').map(url => url.trim()); + + if (!allowedUrls.includes(event.origin)) { console.log('Unauthorized app.'); return; } -- 2.45.2 From b9ded9d718e9907bbf243e39f127deb118eeefd2 Mon Sep 17 00:00:00 2001 From: AdityaSalunkhe21 Date: Fri, 25 Apr 2025 12:02:28 +0530 Subject: [PATCH 6/8] Update zenith RPC URL --- src/utils/constants.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 7113d0b..5549b7c 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -22,7 +22,7 @@ export const DEFAULT_NETWORKS: NetworksFormData[] = [ chainId: 'zenith-testnet', networkName: 'zenithd testnet', namespace: COSMOS, - rpcUrl: 'http://127.0.0.1:26657', + rpcUrl: 'https://zenith-node-rpc.com', blockExplorerUrl: '', nativeDenom: 'znt', addressPrefix: 'zenith', -- 2.45.2 From 9f5f3cb5ef9dfa71ec4a86e17c3791859038e0b4 Mon Sep 17 00:00:00 2001 From: Shreerang Kale Date: Fri, 25 Apr 2025 12:46:36 +0530 Subject: [PATCH 7/8] Add allowed origins check while signining messages --- src/hooks/useGetOrCreateAccounts.ts | 2 +- src/screens/AutoSignIn.tsx | 2 +- src/screens/SignMessageEmbed.tsx | 18 ++++++++++++++++-- .../stack/laconic-wallet-web/README.md | 6 +++--- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/hooks/useGetOrCreateAccounts.ts b/src/hooks/useGetOrCreateAccounts.ts index 8a0e10b..d5fcc47 100644 --- a/src/hooks/useGetOrCreateAccounts.ts +++ b/src/hooks/useGetOrCreateAccounts.ts @@ -6,7 +6,7 @@ import useAccountsData from "./useAccountsData"; import { useNetworks } from "../context/NetworksContext"; import { useAccounts } from "../context/AccountsContext"; -const REACT_APP_ALLOWED_URLS = process.env.REACT_APP_ALLOWED_URLS +const REACT_APP_ALLOWED_URLS = process.env.REACT_APP_ALLOWED_URLS; const useGetOrCreateAccounts = () => { const { networksData } = useNetworks(); diff --git a/src/screens/AutoSignIn.tsx b/src/screens/AutoSignIn.tsx index bb19267..f018831 100644 --- a/src/screens/AutoSignIn.tsx +++ b/src/screens/AutoSignIn.tsx @@ -7,7 +7,7 @@ import { sendMessage } from '../utils/misc'; import useAccountsData from '../hooks/useAccountsData'; import useGetOrCreateAccounts from '../hooks/useGetOrCreateAccounts'; -const REACT_APP_ALLOWED_URLS = process.env.REACT_APP_ALLOWED_URLS +const REACT_APP_ALLOWED_URLS = process.env.REACT_APP_ALLOWED_URLS; export const AutoSignIn = () => { const { networksData } = useNetworks(); diff --git a/src/screens/SignMessageEmbed.tsx b/src/screens/SignMessageEmbed.tsx index 8717411..6dfe836 100644 --- a/src/screens/SignMessageEmbed.tsx +++ b/src/screens/SignMessageEmbed.tsx @@ -16,6 +16,8 @@ import { getCosmosAccounts, retrieveSingleAccount } from '../utils/accounts'; import { getMnemonic, getPathKey, sendMessage } from '../utils/misc'; import { COSMOS } from '../utils/constants'; +const REACT_APP_ALLOWED_URLS = process.env.REACT_APP_ALLOWED_URLS; + type SignRequestProps = NativeStackScreenProps; const SignMessageEmbed = ({ route }: SignRequestProps) => { @@ -70,7 +72,6 @@ const SignMessageEmbed = ({ route }: SignRequestProps) => { } }; - const rejectRequestHandler = async () => { if (sourceWindow && origin) { sendMessage( @@ -87,6 +88,19 @@ const SignMessageEmbed = ({ route }: SignRequestProps) => { const handleCosmosSignMessage = async (event: MessageEvent) => { if (event.data.type !== 'SIGN_ZENITH_MESSAGE') return; + + if (!REACT_APP_ALLOWED_URLS) { + console.log('allowed URLs are not set.'); + return; + } + + const allowedUrls = REACT_APP_ALLOWED_URLS.split(',').map(url => url.trim()); + + if (!allowedUrls.includes(event.origin)) { + console.log('Unauthorized app.'); + return; + } + try { const { signerAddress, signDoc } = event.data.params; @@ -102,7 +116,7 @@ const SignMessageEmbed = ({ route }: SignRequestProps) => { event.data.chainId, signerAddress, ); - + setDisplayAccount(requestAccount); setIsLoading(false); } catch (err) { diff --git a/stack/stack-orchestrator/stack/laconic-wallet-web/README.md b/stack/stack-orchestrator/stack/laconic-wallet-web/README.md index 50be17d..f28151e 100644 --- a/stack/stack-orchestrator/stack/laconic-wallet-web/README.md +++ b/stack/stack-orchestrator/stack/laconic-wallet-web/README.md @@ -49,6 +49,9 @@ Instructions for running the `laconic-wallet-web` using [laconic-so](https://git # WalletConnect project ID, same should be used in the laconic-wallet WALLET_CONNECT_ID= + # Allowed urls is a comma separated list of allowed urls + CERC_ALLOWED_URLS= + # Optional # WalletConnect code for hostname verification @@ -63,9 +66,6 @@ Instructions for running the `laconic-wallet-web` using [laconic-so](https://git # RPC endpoint of laconicd node (default: https://laconicd.laconic.com) CERC_LACONICD_RPC_URL= - - # Allowed urls is a comma separated list of allowed urls for auto-sign-in route - CERC_ALLOWED_URLS= ``` ## Start the deployment -- 2.45.2 From 08b3a84c24445afcf5a6124c08bd1244a56b6312 Mon Sep 17 00:00:00 2001 From: Shreerang Kale Date: Fri, 25 Apr 2025 13:17:52 +0530 Subject: [PATCH 8/8] Remove unnecessary dependancies --- src/hooks/useWebViewHandler.ts | 2 +- src/screens/SignMessageEmbed.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hooks/useWebViewHandler.ts b/src/hooks/useWebViewHandler.ts index 9085ecd..7a0c99c 100644 --- a/src/hooks/useWebViewHandler.ts +++ b/src/hooks/useWebViewHandler.ts @@ -40,7 +40,7 @@ export const useWebViewHandler = () => { const path = `/sign/${selectedNetwork.namespace}/${selectedNetwork.chainId}/${currentAccount.address}/${encodeURIComponent(message)}`; const pathRegex = /^\/sign\/(eip155|cosmos)\/(.+)\/(.+)\/(.+)$/; const match = path.match(pathRegex); - + if (!match) { window.Android?.onSignatureError?.('Invalid signing path'); return; diff --git a/src/screens/SignMessageEmbed.tsx b/src/screens/SignMessageEmbed.tsx index 6dfe836..35f6930 100644 --- a/src/screens/SignMessageEmbed.tsx +++ b/src/screens/SignMessageEmbed.tsx @@ -151,7 +151,7 @@ const SignMessageEmbed = ({ route }: SignRequestProps) => { }, }); // eslint-disable-next-line react-hooks/exhaustive-deps - }, [navigation, route.name]); + }, [navigation]); return ( <> -- 2.45.2