forked from cerc-io/laconic-wallet
Update intent URL (#2)
Part of https://www.notion.so/WalletConnect-integration-84b2f7377d514d7ead698bebd84f1e31 - Update intent URL to https://wallet.laconic.com/ - Move navigation to index.js Co-authored-by: Adw8 <adwait@deepstacksoft.com> Reviewed-on: cerc-io/laconic-wallet#2
This commit is contained in:
parent
4b0ed0ba9f
commit
59be46c5f0
28
App.tsx
28
App.tsx
@ -2,8 +2,11 @@ import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|||||||
import { Snackbar } from 'react-native-paper';
|
import { Snackbar } from 'react-native-paper';
|
||||||
|
|
||||||
import { SignClientTypes } from '@walletconnect/types';
|
import { SignClientTypes } from '@walletconnect/types';
|
||||||
import { NavigationContainer } from '@react-navigation/native';
|
import { useNavigation } from '@react-navigation/native';
|
||||||
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
import {
|
||||||
|
NativeStackNavigationProp,
|
||||||
|
createNativeStackNavigator,
|
||||||
|
} from '@react-navigation/native-stack';
|
||||||
|
|
||||||
import SignMessage from './components/SignMessage';
|
import SignMessage from './components/SignMessage';
|
||||||
import HomeScreen from './components/HomeScreen';
|
import HomeScreen from './components/HomeScreen';
|
||||||
@ -18,7 +21,6 @@ import useInitialization, {
|
|||||||
import { EIP155_SIGNING_METHODS } from './utils/wallet-connect/EIP155Lib';
|
import { EIP155_SIGNING_METHODS } from './utils/wallet-connect/EIP155Lib';
|
||||||
import { useAccounts } from './context/AccountsContext';
|
import { useAccounts } from './context/AccountsContext';
|
||||||
import { getSignParamsMessage } from './utils/wallet-connect/Helpers';
|
import { getSignParamsMessage } from './utils/wallet-connect/Helpers';
|
||||||
import { navigationRef, navigateTo } from './utils/RootNavigation';
|
|
||||||
import { useRequests } from './context/RequestContext';
|
import { useRequests } from './context/RequestContext';
|
||||||
|
|
||||||
const Stack = createNativeStackNavigator<StackParamsList>();
|
const Stack = createNativeStackNavigator<StackParamsList>();
|
||||||
@ -26,6 +28,9 @@ const Stack = createNativeStackNavigator<StackParamsList>();
|
|||||||
const App = (): React.JSX.Element => {
|
const App = (): React.JSX.Element => {
|
||||||
useInitialization();
|
useInitialization();
|
||||||
|
|
||||||
|
const navigation =
|
||||||
|
useNavigation<NativeStackNavigationProp<StackParamsList>>();
|
||||||
|
|
||||||
const { accounts } = useAccounts();
|
const { accounts } = useAccounts();
|
||||||
|
|
||||||
const { requestSession, setRequestSession } = useRequests();
|
const { requestSession, setRequestSession } = useRequests();
|
||||||
@ -65,7 +70,7 @@ const App = (): React.JSX.Element => {
|
|||||||
case EIP155_SIGNING_METHODS.PERSONAL_SIGN:
|
case EIP155_SIGNING_METHODS.PERSONAL_SIGN:
|
||||||
setRequestSession(requestSessionData);
|
setRequestSession(requestSessionData);
|
||||||
if (address && message) {
|
if (address && message) {
|
||||||
navigateTo('SignRequest', {
|
navigation.navigate('SignRequest', {
|
||||||
network: 'eth',
|
network: 'eth',
|
||||||
address,
|
address,
|
||||||
message,
|
message,
|
||||||
@ -89,19 +94,8 @@ const App = (): React.JSX.Element => {
|
|||||||
//TODO: Investigate dependencies
|
//TODO: Investigate dependencies
|
||||||
});
|
});
|
||||||
|
|
||||||
const linking = {
|
|
||||||
prefixes: ['https://www.laconic-wallet.com'],
|
|
||||||
config: {
|
|
||||||
screens: {
|
|
||||||
SignRequest: {
|
|
||||||
path: 'sign/:network/:address/:message',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NavigationContainer linking={linking} ref={navigationRef}>
|
<>
|
||||||
<Stack.Navigator>
|
<Stack.Navigator>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
name="Laconic"
|
name="Laconic"
|
||||||
@ -161,7 +155,7 @@ const App = (): React.JSX.Element => {
|
|||||||
}}>
|
}}>
|
||||||
Session approved
|
Session approved
|
||||||
</Snackbar>
|
</Snackbar>
|
||||||
</NavigationContainer>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
<category android:name="android.intent.category.BROWSABLE" />
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
<data
|
<data
|
||||||
android:host="www.laconic-wallet.com"
|
android:host="wallet.laconic.com"
|
||||||
android:pathPrefix="/sign"
|
android:pathPrefix="/sign"
|
||||||
android:scheme="https"/>
|
android:scheme="https"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
14
index.js
14
index.js
@ -3,17 +3,31 @@ import 'text-encoding-polyfill';
|
|||||||
import { AppRegistry } from 'react-native';
|
import { AppRegistry } from 'react-native';
|
||||||
import { PaperProvider } from 'react-native-paper';
|
import { PaperProvider } from 'react-native-paper';
|
||||||
|
|
||||||
|
import { NavigationContainer } from '@react-navigation/native';
|
||||||
|
|
||||||
import App from './App';
|
import App from './App';
|
||||||
import { AccountsProvider } from './context/AccountsContext';
|
import { AccountsProvider } from './context/AccountsContext';
|
||||||
import { RequestProvider } from './context/RequestContext';
|
import { RequestProvider } from './context/RequestContext';
|
||||||
import { name as appName } from './app.json';
|
import { name as appName } from './app.json';
|
||||||
|
|
||||||
export default function Main() {
|
export default function Main() {
|
||||||
|
const linking = {
|
||||||
|
prefixes: ['https://wallet.laconic.com'],
|
||||||
|
config: {
|
||||||
|
screens: {
|
||||||
|
SignRequest: {
|
||||||
|
path: 'sign/:network/:address/:message',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
return (
|
return (
|
||||||
<PaperProvider>
|
<PaperProvider>
|
||||||
<AccountsProvider>
|
<AccountsProvider>
|
||||||
<RequestProvider>
|
<RequestProvider>
|
||||||
|
<NavigationContainer linking={linking}>
|
||||||
<App />
|
<App />
|
||||||
|
</NavigationContainer>
|
||||||
</RequestProvider>
|
</RequestProvider>
|
||||||
</AccountsProvider>
|
</AccountsProvider>
|
||||||
</PaperProvider>
|
</PaperProvider>
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
import {
|
|
||||||
CommonActions,
|
|
||||||
createNavigationContainerRef,
|
|
||||||
} from '@react-navigation/native';
|
|
||||||
|
|
||||||
import { StackParamsList } from '../types';
|
|
||||||
|
|
||||||
export const navigationRef = createNavigationContainerRef<StackParamsList>();
|
|
||||||
|
|
||||||
export function navigateTo(routeName: string, params?: object) {
|
|
||||||
if (navigationRef.isReady()) {
|
|
||||||
navigationRef.dispatch(CommonActions.navigate(routeName, params));
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user