Skip to content

How to generate a wallet connect uri #2129

Answered by magiziz
hernan-clich asked this question in Q&A
Discussion options

You must be logged in to vote

@hernan-clich This can be a bit tricky, but it's possible.

First add walletConnect connector to your createConfig like this:

import { createConfig, http } from 'wagmi';
import { mainnet } from 'wagmi/chains';
import { walletConnect } from 'wagmi/connectors';

const config = createConfig({
  connectors: [
    walletConnect({
      projectId: 'YOUR_PROJECT_ID',
      showQrModal: false,
    }),
  ],
  chains: [mainnet],
  transports: {
    [mainnet.id]: http(),
  },
});

Then you can create a component that gets the WalletConnect URI (WalletConnectUri.tsx):

import { Connector, useConnect } from 'wagmi';

export function WalletConnectUri() {
  const { connect, connectors } = useConnect();

  /…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@hernan-clich
Comment options

Answer selected by hernan-clich
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants