@blocto/rainbowkit-connector
TypeScript icon, indicating that this package has built-in type declarations

2.0.3 • Public • Published

rainbowkit-connector

Blocto SDK connector for RainbowKit React library.

How to use

Install package

yarn add @blocto/rainbowkit-connector

Use it in your code

import {
  getDefaultWallets,
  connectorsForWallets,
  RainbowKitProvider,
  ConnectButton
} from "@rainbow-me/rainbowkit";
import { configureChains, createConfig, WagmiConfig } from "wagmi";
import { polygon, optimism, arbitrum, bsc, mainnet } from "wagmi/chains";
import { publicProvider } from 'wagmi/providers/public';
import { alchemyProvider } from 'wagmi/providers/alchemy';
import { bloctoWallet } from '@blocto/rainbowkit-connector';

const { chains, publicClient, webSocketPublicClient } = configureChains(
  [polygon, optimism, arbitrum, bsc, mainnet],
  [alchemyProvider({ apiKey: process.env.ALCHEMY_ID || "" }), publicProvider()]
);

const { wallets } = getDefaultWallets({
  appName: "My RainbowKit App",
  projectId: "YOUR_PROJECT_ID",
  chains
});

const connectors = connectorsForWallets([
  ...wallets,
  {
    groupName: "Other",
    wallets: [
      bloctoWallet({ chains }), // add BloctoWallet
    ]
  }
]);

const wagmiConfig = createConfig({
  autoConnect: true,
  connectors,
  publicClient,
  webSocketPublicClient,
});

export const App = () => {
  return (
    <WagmiConfig client={wagmiConfig}>
      <RainbowKitProvider chains={chains}>
        <ConnectButton />
      </RainbowKitProvider>
    </WagmiConfig>
  );
};

Package Sidebar

Install

npm i @blocto/rainbowkit-connector

Weekly Downloads

105

Version

2.0.3

License

Apache-2.0

Unpacked Size

9.98 kB

Total Files

5

Last publish

Collaborators

  • q20274982
  • sanyu1225
  • mordochi
  • scottphc
  • boczeratul
  • chiakic