coinbase / onchainkit

React components and TypeScript utilities to help you build top-tier onchain apps.
https://onchainkit.xyz
MIT License
514 stars 114 forks source link

Bug: Docs improperly set connectors on rainbowkit's getDefaultConfig #1076

Open mykcryptodev opened 1 month ago

mykcryptodev commented 1 month ago

Describe the bug and the steps to reproduce it

  1. Go to the wallet aggregator section of the docs

  2. Notice how the getDefaultConfig is setting a "connectors" key: Screenshot 2024-08-15 at 7 21 15 PM

  3. Connectors arent available as a key on the getDefaultConfig param:

    Object literal may only specify known properties, and 'connectors' does not exist in type 'GetDefaultConfigParameters<[{ blockExplorers: { readonly default: { readonly name: "Basescan"; readonly url: "https://basescan.org"; readonly apiUrl: "https://api.basescan.org/api"; }; }; contracts: { readonly l2OutputOracle: { ...; }; ... 8 more ...; readonly l2ToL1MessagePasser: { ...; }; }; ... 9 more ...; serial...'.ts(2353)

What's the expected behavior?

Use createConfig from wagmi to include the connectors like this:

const connectors = connectorsForWallets( 
  [
    {
      groupName: 'Recommended Wallet',
      wallets: [coinbaseWallet],
    },
    {
      groupName: 'Other Wallets',
      wallets: [rainbowWallet, metaMaskWallet],
    },
  ],
  {
    appName: 'onchainkit',
    projectId: env.NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID,
  },
);

const wagmiConfig = createConfig({
  chains: [base],
  multiInjectedProviderDiscovery: false,
  connectors,
  ssr: false,
  transports: {
    [base.id]: http(),
  },
});

requires importing { http, createConfig } from 'wagmi'

also, the props type is missing in the example:

type Props = {
  children: ReactNode;
};

What version of the libraries are you using?

No response

Zizzamia commented 1 month ago

Great point, let me get this prioritized. cc @cpcramer