Skip to content

Commit

Permalink
chore: only load WalletConnect when configured
Browse files Browse the repository at this point in the history
  • Loading branch information
michael1011 committed Dec 11, 2024
1 parent 74f0a54 commit 04a5a27
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/components/WalletConnect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,21 @@ export const WalletConnect = () => {
useWeb3Signer();

const [createdKit] = createResource(async () => {
const projectId = import.meta.env.VITE_WALLETCONNECT_PROJECT_ID;
if (projectId === undefined) {
log.warn("WalletConnect project id not set");
return undefined;
}

const configRsk = config.assets[RBTC];

const { appKit, EthersAdapter } = await loader.get();
const created = appKit.createAppKit({
projectId,
themeMode: "dark",
enableEIP6963: false,
enableInjected: false,
adapters: [new EthersAdapter()],
projectId: import.meta.env.VITE_WALLETCONNECT_PROJECT_ID as string,
networks: [
{
id: configRsk.network.chainId,
Expand Down Expand Up @@ -84,7 +90,11 @@ export const WalletConnect = () => {
// eslint-disable-next-line solid/reactivity
createEffect(async () => {
if (openWalletConnectModal()) {
await createdKit().open();
const kit = createdKit();

if (kit !== undefined) {
await kit.open();
}
}
});

Expand Down

0 comments on commit 04a5a27

Please sign in to comment.