forked from cerc-io/laconic-wallet
Remove any type (#57)
* Remove any type for requestEvent parameter * Handle review changes
This commit is contained in:
parent
8bd3b4b567
commit
63faa74e2c
3
App.tsx
3
App.tsx
@ -9,6 +9,7 @@ import {
|
|||||||
NativeStackNavigationProp,
|
NativeStackNavigationProp,
|
||||||
createNativeStackNavigator,
|
createNativeStackNavigator,
|
||||||
} from '@react-navigation/native-stack';
|
} from '@react-navigation/native-stack';
|
||||||
|
import { Web3WalletTypes } from '@walletconnect/web3wallet';
|
||||||
|
|
||||||
import SignMessage from './components/SignMessage';
|
import SignMessage from './components/SignMessage';
|
||||||
import HomeScreen from './components/HomeScreen';
|
import HomeScreen from './components/HomeScreen';
|
||||||
@ -47,7 +48,7 @@ const App = (): React.JSX.Element => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const onSessionRequest = useCallback(
|
const onSessionRequest = useCallback(
|
||||||
async (requestEvent: SignClientTypes.EventArguments['session_request']) => {
|
async (requestEvent: Web3WalletTypes.SessionRequest) => {
|
||||||
const { topic, params } = requestEvent;
|
const { topic, params } = requestEvent;
|
||||||
const { request } = params;
|
const { request } = params;
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ const PairingModal = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const namespaceAccounts: string[] = [];
|
const namespaceAccounts: string[] = [];
|
||||||
requiredNamespaces[key].chains!.map((chain: any) => {
|
requiredNamespaces[key].chains!.map((chain: string) => {
|
||||||
currentAddresses.map(acc =>
|
currentAddresses.map(acc =>
|
||||||
namespaceAccounts.push(`${chain}:${acc}`),
|
namespaceAccounts.push(`${chain}:${acc}`),
|
||||||
);
|
);
|
||||||
|
@ -39,11 +39,13 @@ const SignRequest = ({ route }: SignRequestProps) => {
|
|||||||
useNavigation<NativeStackNavigationProp<StackParamsList>>();
|
useNavigation<NativeStackNavigationProp<StackParamsList>>();
|
||||||
|
|
||||||
const isCosmosSignDirect = useMemo(() => {
|
const isCosmosSignDirect = useMemo(() => {
|
||||||
const requestParams = route.params!.requestEvent
|
const requestParams = route.params!.requestEvent;
|
||||||
? route.params!.requestEvent.params.request
|
|
||||||
: {};
|
|
||||||
|
|
||||||
return requestParams.method === 'cosmos_signDirect';
|
if (!requestParams) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return requestParams.params.request.method === 'cosmos_signDirect';
|
||||||
}, [route.params]);
|
}, [route.params]);
|
||||||
|
|
||||||
const retrieveData = async (
|
const retrieveData = async (
|
||||||
@ -116,6 +118,10 @@ const SignRequest = ({ route }: SignRequestProps) => {
|
|||||||
throw new Error('account not found');
|
throw new Error('account not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!requestEvent) {
|
||||||
|
throw new Error('Request event not found');
|
||||||
|
}
|
||||||
|
|
||||||
const response = await approveWalletConnectRequest(
|
const response = await approveWalletConnectRequest(
|
||||||
requestEvent,
|
requestEvent,
|
||||||
account,
|
account,
|
||||||
|
4
types.ts
4
types.ts
@ -1,4 +1,5 @@
|
|||||||
import { SignClientTypes, SessionTypes } from '@walletconnect/types';
|
import { SignClientTypes, SessionTypes } from '@walletconnect/types';
|
||||||
|
import { Web3WalletTypes } from '@walletconnect/web3wallet';
|
||||||
|
|
||||||
export type StackParamsList = {
|
export type StackParamsList = {
|
||||||
Laconic: undefined;
|
Laconic: undefined;
|
||||||
@ -8,8 +9,7 @@ export type StackParamsList = {
|
|||||||
network: string;
|
network: string;
|
||||||
address: string;
|
address: string;
|
||||||
message: string;
|
message: string;
|
||||||
// TODO: remove any
|
requestEvent?: Web3WalletTypes.SessionRequest;
|
||||||
requestEvent?: any;
|
|
||||||
requestSession?: any;
|
requestSession?: any;
|
||||||
}
|
}
|
||||||
| undefined;
|
| undefined;
|
||||||
|
Loading…
Reference in New Issue
Block a user