Coinbase WalletLink Authentication

Hello Everyone I am trying to setup WalletLink with Moralis but am stuck and not getting any errors so I am unsure what the issue is.

Could you also suggest how to get this working with ‘Ethers’ instead of ‘Web3’?

I am able to click a button to see the WalletLink popup I then scan the QR code which works fine the app lets me authenticate but then nothing happens from with my NextJS app, no errors, no user set, no change in isAuthenticated.

Wallet Link Function:

const loginWalletLink = async () => {
    await authenticate({ connector: customEnable });
  };

Customer Enable Function:

const customEnable = async () => {
    class MoralisWalletLinkProvider {
      walletLink = new WalletLink({
        appName: "App Name",
        appLogoUrl: "APP_LOGO_URL",
        darkMode: true,
      });
      async activate() {
        const ethereum = this.walletLink.makeWeb3Provider(
          "https://mainnet.infura.io/v3/infura-api-key",
          1
        );
        await ethereum.send("eth_requestAccounts"); //ethereum.enable(); // or ethereum.send('eth_requestAccounts')
        this.web3 = new Web3(ethereum);
        this.isActivated = true;
        return this.web3;
      }
    }

    const web3Provider = new MoralisWalletLinkProvider();
    const web3 = await web3Provider.activate();
    return web3;
  };

I believe your issue is that need to change the “https://mainnet.infura.io/v3/infura-api-key” to use a speedy node in moralis, and click the endpoint of the network like ETH.

I have the CoinbaseWalletSDK all working on my site. Please note, they just updated to 3.0.1 which does change some of the instances.

Hey, can you link your repo here (if possible) so I can go through how you’ve implemented it?
Just can’t quite seem to figure it out right now.

I will have to create a demo repository as my boss will not release the production code as private.

1 Like

I understand that might be unnecessary work, though I would really appreciate if you could create something barebones if/when you have the time available to you.
Thanks for taking the time to respond