From b6bc29b6a0628c4617c2a5d80f71ca754480fc95 Mon Sep 17 00:00:00 2001 From: ignaciosantise <25931366+ignaciosantise@users.noreply.github.com> Date: Wed, 28 Aug 2024 17:44:19 -0300 Subject: [PATCH] fix: save modal data as a ref --- wallets/rn_cli_wallet/android/app/build.gradle | 2 +- wallets/rn_cli_wallet/src/modals/SessionSignModal.tsx | 3 +-- wallets/rn_cli_wallet/src/store/ModalStore.ts | 4 ++-- wallets/rn_cli_wallet/src/store/SettingsStore.ts | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/wallets/rn_cli_wallet/android/app/build.gradle b/wallets/rn_cli_wallet/android/app/build.gradle index 2d002140..87b28e0e 100644 --- a/wallets/rn_cli_wallet/android/app/build.gradle +++ b/wallets/rn_cli_wallet/android/app/build.gradle @@ -89,7 +89,7 @@ android { applicationId "com.walletconnect.web3wallet.rnsample" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 31 + versionCode 32 versionName "1.0" resValue "string", "build_config_package", "com.walletconnect.web3wallet.rnsample" } diff --git a/wallets/rn_cli_wallet/src/modals/SessionSignModal.tsx b/wallets/rn_cli_wallet/src/modals/SessionSignModal.tsx index 012184e2..dfbfef64 100644 --- a/wallets/rn_cli_wallet/src/modals/SessionSignModal.tsx +++ b/wallets/rn_cli_wallet/src/modals/SessionSignModal.tsx @@ -32,6 +32,7 @@ export default function SessionSignModal() { const {request, chainId} = params; const chain = PresetsUtil.getChainData(chainId.split(':')[1]); const peerMetadata = session?.peer?.metadata as SignClientTypes.Metadata; + const method = requestEvent?.params?.request?.method!; // Get message, convert it to UTF8 string if it is valid hex const message = getSignParamsMessage(request.params); @@ -80,8 +81,6 @@ export default function SessionSignModal() { } }, [requestEvent, topic]); - const method = requestEvent?.params?.request?.method!; - // Ensure request and wallet are defined if (!requestEvent || !session) { return Missing request data; diff --git a/wallets/rn_cli_wallet/src/store/ModalStore.ts b/wallets/rn_cli_wallet/src/store/ModalStore.ts index 7a8f8087..7db083ad 100644 --- a/wallets/rn_cli_wallet/src/store/ModalStore.ts +++ b/wallets/rn_cli_wallet/src/store/ModalStore.ts @@ -1,6 +1,6 @@ import {SessionTypes, SignClientTypes} from '@walletconnect/types'; import {Web3WalletTypes} from '@walletconnect/web3wallet'; -import {proxy} from 'valtio'; +import {proxy, ref} from 'valtio'; /** * Types @@ -44,7 +44,7 @@ const ModalStore = { open(view: State['view'], data: State['data']) { state.view = view; - state.data = data; + state.data = data ? ref(data) : undefined; state.open = true; }, diff --git a/wallets/rn_cli_wallet/src/store/SettingsStore.ts b/wallets/rn_cli_wallet/src/store/SettingsStore.ts index 0c448362..46bec50c 100644 --- a/wallets/rn_cli_wallet/src/store/SettingsStore.ts +++ b/wallets/rn_cli_wallet/src/store/SettingsStore.ts @@ -64,7 +64,7 @@ const SettingsStore = { state.activeChainId = value; }, - setCurrentRequestVerifyContext(context: Verify.Context) { + setCurrentRequestVerifyContext(context?: Verify.Context) { state.currentRequestVerifyContext = context; },