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