Coder Social home page Coder Social logo

rainbowkit-celo's Introduction

Rainbowkit-celo

This is a plugin to help rainbowkit developers support the CELO protocol faster. It includes the chain information as well as the main CELO wallets (Valora, Celo Wallet, Celo Terminal...).

Installation

npm install @celo/rainbowkit-celo

This package has a few peer dependencies and expect them to be installed too. Follow their instructions if that's not done yet.

Here's the exhaustive list:

npm install @rainbow-me/rainbowkit @wagmi/chains wagmi viem

A note on version compatibility

After version 0.8.0 inclusive, this package has the most significant digit match the version of @rainbow-me/rainbowkit it is compatible with.

IE for @rainbow-me/[email protected] use @celo/[email protected]

Usage

import {
  connectorsForWallets,
  RainbowKitProvider,
} from "@rainbow-me/rainbowkit";
import {
  metaMaskWallet,
  omniWallet,
  walletConnectWallet,
} from "@rainbow-me/rainbowkit/wallets";
import { configureChains, createClient, WagmiConfig } from "wagmi";
import { jsonRpcProvider } from "wagmi/providers/jsonRpc";

// Import known recommended wallets
import { Valora, CeloWallet, CeloDance } from "@celo/rainbowkit-celo/wallets";

// Import CELO chain information
import { Alfajores, Celo } from "@celo/rainbowkit-celo/chains";

const { chains, provider } = configureChains(
  [Alfajores, Celo],
  [
    jsonRpcProvider({
      rpc: (chain) => ({ http: chain.rpcUrls.default.http[0] }),
    }),
  ]
);

// Note for older use with wagmi before 0.9 / rainbowkit before 0.8.1 configure
// const { chains, provider } = configureChains(
//   [Alfajores, Celo],
//   [jsonRpcProvider({ rpc: (chain) => ({ http: chain.rpcUrls.default }) })]
// );

const connectors = connectorsForWallets([
  {
    groupName: "Recommended with CELO",
    wallets: [
      Valora({ chains }),
      CeloWallet({ chains }),
      CeloDance({ chains }),
      metaMaskWallet({ chains }),
      omniWallet({ chains }),
      walletConnectWallet({ chains }),
    ],
  },
]);

const wagmiClient = createClient({
  autoConnect: true,
  connectors,
  provider,
});

// ... Your exisiting app.

Adding wallets to the config

If the wallet exists in the normal rainbow kit package you can add it to the Supports Celo list at lists/index.ts

If the wallet needs a new config add a new file in wallets folder with the config needed for you wallet. Then import this to the lists/index.ts file

Example app

In apps/example there's an example app that showcases the usage of the package.

In order to run it, execute following commands:

$ yarn build

$ yarn dev

Then you can access the app by opening your browser and visiting http://localhost:3001/

rainbowkit-celo's People

Contributors

aaronmgdr avatar arthurgousset avatar dckesler avatar dependabot[bot] avatar dhenpadilla avatar github-actions[bot] avatar jcortejoso avatar jeanregisser avatar lvpeschke avatar montera82 avatar nicolasbrugneaux avatar pputman-clabs avatar renovate[bot] avatar shazarre avatar therealharpaljadeja avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.