diff --git a/advanced/dapps/react-dapp-v2/src/components/OriginSimulationDropdown.tsx b/advanced/dapps/react-dapp-v2/src/components/OriginSimulationDropdown.tsx index 7fab26188..9f4a72f72 100644 --- a/advanced/dapps/react-dapp-v2/src/components/OriginSimulationDropdown.tsx +++ b/advanced/dapps/react-dapp-v2/src/components/OriginSimulationDropdown.tsx @@ -27,7 +27,18 @@ const SelectOption = styled.option` `; const OriginSimulationDropdown = (props: OriginSimulationProps) => { - const { origin, show } = props; + const { show } = props; + const [selectedOrigin, setSelectedOrigin] = React.useState(props.origin); + React.useEffect(() => { + if (!show) { + return; + } + + setSelectedOrigin( + localStorage.getItem("wallet_connect_dapp_origin") || props.origin + ); + }, [show]); + const setOrigin = React.useCallback((origin: string) => { localStorage.setItem("wallet_connect_dapp_origin", origin); location.reload(); @@ -36,13 +47,15 @@ const OriginSimulationDropdown = (props: OriginSimulationProps) => {
{show && ( setOrigin(e?.target?.value)} > {ORIGIN_OPTIONS.map((e, i) => { + const seleted = e.value === selectedOrigin; + console.log("selected", seleted, e.value); return ( - + {e.label} ); diff --git a/advanced/dapps/react-dapp-v2/src/contexts/ClientContext.tsx b/advanced/dapps/react-dapp-v2/src/contexts/ClientContext.tsx index 28f1b2872..f82a8d1c9 100644 --- a/advanced/dapps/react-dapp-v2/src/contexts/ClientContext.tsx +++ b/advanced/dapps/react-dapp-v2/src/contexts/ClientContext.tsx @@ -297,8 +297,18 @@ export function ClientContextProvider({ logger: DEFAULT_LOGGER, relayUrl: relayerRegion, projectId: DEFAULT_PROJECT_ID, + metadata: { + name: "React App", + description: "App to test WalletConnect network", + url: claimedOrigin, + icons: [], + }, }); - + if (claimedOrigin === "unknown") { + //@ts-expect-error - private property + _client.core.verify.verifyUrlV3 = "0xdeafbeef"; + console.log("verify", _client.core.verify); + } setClient(_client); setOrigin(_client.metadata.url); console.log("metadata url:", _client.metadata); @@ -323,6 +333,7 @@ export function ClientContextProvider({ useEffect(() => { const claimedOrigin = localStorage.getItem("wallet_connect_dapp_origin") || origin; + console.log("claimedOrigin:", claimedOrigin); let interval: NodeJS.Timer; // simulates `UNKNOWN` validation by removing the verify iframe thus preventing POST message if (claimedOrigin === "unknown") {