Skip to content

Releases: rainbow-me/rainbowkit

@rainbow-me/[email protected]

15 Oct 09:09
d1c0e9b
Compare
Choose a tag to compare

Minor Changes

  • f02bced: The Authentication API now supports ERC-1271 and ERC-6492 for smart contract signature verification to enable Sign-in with Ethereum for Smart Contract Wallets, including Coinbase Smart Wallet and Argent.

    We have also deprecated the siwe and ethers peer dependencies in favor of viem/siwe to make RainbowKit even more seamless.

    No changes are necessary for dApps that don't rely on the Authentication API.

    Follow the appropriate steps below to migrate.

    NextAuth Authentication

    1. Remove siwe and ethers
    npm uninstall siwe ethers
    1. Upgrade RainbowKit, rainbowkit-siwe-next-auth, and viem
    npm i @rainbow-me/rainbowkit@^2.2.0 rainbow-me/rainbowkit-siwe-next-auth@^0.5.0 viem@^2.12.0
    1. Create a Public Client

    This allows viem to verify smart contract signatures.

    const config = getDefaultConfig({
      /* your config */
    });
    + const publicClient = config.getClient().extend(publicActions);
    1. Adjust your authorize implementation in /api/auth/[...nextauth].ts
    - import { SiweMessage } from 'siwe';
    + import {
    +   type SiweMessage,
    +   parseSiweMessage,
    +   validateSiweMessage,
    + } from 'viem/siwe';
    
    export function getAuthOptions(req: IncomingMessage): NextAuthOptions {
      const providers = [
        CredentialsProvider({
          async authorize(credentials: any) {
    
    -       const siwe = new SiweMessage(
    -         JSON.parse(credentials?.message || '{}'),
    -       );
    +       const siweMessage = parseSiweMessage(
    +         credentials?.message,
    +       ) as SiweMessage;
    
    +       if (!validateSiweMessage({
    +         address: siweMessage?.address,
    +         message: siweMessage,
    +       })) {
    +         return null;
    +       }
    
            /* ... */
    
    -       await siwe.verify({ signature: credentials?.signature || '' });
    +       const valid = await publicClient.verifyMessage({
    +         address: siweMessage?.address,
    +         message: credentials?.message,
    +         signature: credentials?.signature,
    +       });
    
    +       if (!valid) {
    +         return null;
    +       }
          },
          /* ... */
        })
      ]
    }

    Reference the with-next-siwe-next-auth example for more guidance.

    Custom Authentication

    1. Remove siwe and ethers
    npm uninstall siwe ethers
    1. Upgrade RainbowKit and viem
    npm i @rainbow-me/rainbowkit@^2.2.0 viem@^2.12.0
    1. Create a Public Client

    This allows viem to verify smart contract signatures.

    const config = getDefaultConfig({
      /* your config */
    });
    
    + const publicClient = config.getClient().extend(publicActions);
    1. Adjust your createAuthenticationAdapter implementation
    - import { SiweMessage } from 'siwe';
    + import { createSiweMessage } from 'viem/siwe';
    
    createAuthenticationAdapter({
      getNonce: async () => {
        const response = await fetch('/api/nonce');
        return await response.text();
      },
    
      createMessage: ({ nonce, address, chainId }) => {
    -   return new SiweMessage({
    +   return createSiweMessage({
          domain: window.location.host,
          address,
          statement: 'Sign in with Ethereum to the app.',
          uri: window.location.origin,
          version: '1',
          chainId,
          nonce,
        });
      },
    
    - getMessageBody: ({ message }) => {
    -   return message.prepareMessage();
    - },
    
      /* ... */
    })
    1. Adopt generateSiweNonce
    - import { generateNonce } from 'siwe';
    + import { generateSiweNonce } from 'viem/siwe';
    
    - req.session.nonce = generateNonce();
    + req.session.nonce = generateSiweNonce();
    1. Adopt parseSiweMessage and verifyMessage if your Verify handler
    - import { SiweMessage } from 'siwe';
    + import { parseSiweMessage, type SiweMessage } from 'viem/siwe';
    
    const { message, signature } = req.body;
    - const siweMessage = new SiweMessage(message);
    - const { success, error, data } = await siweMessage.verify({
    -  signature,
    - });
    + const siweMessage = parseSiweMessage(message) as SiweMessage;
    + const success = await publicClient.verifyMessage({
    +   address: siweMessage.address,
    +   message,
    +   signature,
    + });
    
    - if (!success) throw error;
    + if (!success) throw new Error('Invalid signature.');
    
    - if (data.nonce !== req.session.nonce)
    + if (siweMessage.nonce !== req.session.nonce)
    +   return res.status(422).json({ message: 'Invalid nonce.' });

    Reference the with-next-siwe-iron-session example for more guidance.

@rainbow-me/[email protected]

15 Oct 09:06
d1c0e9b
Compare
Choose a tag to compare

Minor Changes

  • f02bced: The Authentication API now supports ERC-1271 and ERC-6492 for smart contract signature verification to enable Sign-in with Ethereum for Smart Contract Wallets.

    We have also deprecated the siwe and ethers peer dependencies in favor of viem/siwe.

    Follow the appropriate steps below to migrate.

    1. Remove siwe and ethers
    npm uninstall siwe ethers
    1. Upgrade RainbowKit, rainbowkit-siwe-next-auth, and viem
    npm i @rainbow-me/rainbowkit@^2.2.0 rainbow-me/rainbowkit-siwe-next-auth@^0.5.0 viem@^2.12.0
    1. Create a Public Client

    This allows viem to verify smart contract signatures.

    const config = getDefaultConfig({
      /* your config */
    });
    + const publicClient = config.getClient().extend(publicActions);
    1. Adjust your authorize implementation in /api/auth/[...nextauth].ts
    - import { SiweMessage } from 'siwe';
    + import {
    +   type SiweMessage,
    +   parseSiweMessage,
    +   validateSiweMessage,
    + } from 'viem/siwe';
    
    export function getAuthOptions(req: IncomingMessage): NextAuthOptions {
      const providers = [
        CredentialsProvider({
          async authorize(credentials: any) {
    
    -       const siwe = new SiweMessage(
    -         JSON.parse(credentials?.message || '{}'),
    -       );
    +       const siweMessage = parseSiweMessage(
    +         credentials?.message,
    +       ) as SiweMessage;
    
    +       if (!validateSiweMessage({
    +         address: siweMessage?.address,
    +         message: siweMessage,
    +       })) {
    +         return null;
    +       }
    
            /* ... */
    
    -       await siwe.verify({ signature: credentials?.signature || '' });
    +       const valid = await publicClient.verifyMessage({
    +         address: siweMessage?.address,
    +         message: credentials?.message,
    +         signature: credentials?.signature,
    +       });
    
    +       if (!valid) {
    +         return null;
    +       }
          },
          /* ... */
        })
      ]
    }

    Reference the with-next-siwe-next-auth example for more guidance.

@rainbow-me/[email protected]

26 Sep 06:22
48552cb
Compare
Choose a tag to compare

Patch Changes

  • 4014d80: Added vi-VN and vi locale support for the Vietnamese language.
  • f93cd0e: Added ParaSwap Wallet support with paraSwapWallet wallet connector
  • 6393498: Added Best Wallet support with bestWallet wallet connector

@rainbow-me/[email protected]

10 Sep 02:24
d8c64ee
Compare
Choose a tag to compare

Patch Changes

  • 63d8386: Added Valora support with valoraWallet wallet connector
  • d46637a: Added safeWallet wallet connector to getDefaultConfig by default to improve the Safe Wallet app browser connection flow with a Safe button included by default in the wallet list
  • 8d9a4e6: Fixed an issue where some options in the "Get Wallet" flow would appear as a blank page, or lack a back button to return to the Connect flow.

@rainbow-me/[email protected]

22 Aug 06:02
7c51cea
Compare
Choose a tag to compare

Patch Changes

  • c08f620: Added zh-HK and zh-TW locales for Traditional Chinese language support. You can also specify zh-Hans and zh-Hant locales to refer to the writing systems directly.

    Reference our guide to learn more about Localization.

  • 675f9dd: Added icon for Gnosis Chain

  • f65b5c4: Added icon for Celo chain

  • 9c36bfd: Added Kaia Wallet support with kaiaWallet wallet connector

@rainbow-me/[email protected]

05 Aug 08:49
379bc56
Compare
Choose a tag to compare

Patch Changes

  • 72fe07d: Added Binance Web3 Wallet support with binanceWallet wallet connector
  • b530c80: Added mobile support for zealWallet wallet connector
  • 7f6e36e: Added missing rdns property for some wallets. This allows them to be discoverable as an EIP-6963 connector.
  • 2eeb7b9: Improved the Safe Wallet app browser connection flow with a Safe button included by default in the wallet list
  • d02d73f: Resolved an issue where the Phantom wallet did not appear as an EIP-6963 connector.

@rainbow-me/[email protected]

02 Jul 18:56
57cae39
Compare
Choose a tag to compare

Patch Changes

  • 7b00be5: Added Seif Wallet support with seifWallet wallet connector
  • 23e33b9: Added mantle and mantleTestnet network support
  • 001a0a9: Resolved an issue in development where browser detection would throw an error if navigator.userAgent was unavailable in the browser.

@rainbow-me/[email protected]

31 May 03:53
28c1bf0
Compare
Choose a tag to compare

Patch Changes

  • 2180ddd: Added Nest Wallet support with nestWallet wallet connector

  • fea278a: The coinbaseWallet wallet connector now has a preference argument to control whether Smart Wallet is enabled and available for users. Preference based behavior is documented here.

    Smart Wallet will be enabled by default with all in early June, without a further upgrade.

    Developers can test Smart Wallet with sepolia and baseSepolia chains today by setting smartWalletOnly like so:

    import { coinbaseWallet } from "@rainbow-me/rainbowkit/wallets";
    
    // Enable Coinbase Smart Wallet for testing
    coinbaseWallet.preference = "smartWalletOnly";
    
    // You must manually specify your wallet list with `wallets` in
    // `getDefaultConfig` or `connectorsForWallets` to assign the preference
    const config = getDefaultConfig({
      /* ... */
      wallets: [
        {
          groupName: "Popular",
          wallets: [coinbaseWallet],
        },
      ],
      /* ... */
    });

@rainbow-me/[email protected]

23 May 07:12
e8f299c
Compare
Choose a tag to compare

Patch Changes

  • 725a376: Added Magic Eden Wallet support with magicEdenWallet wallet connector
  • 9be5452: Resolved an issue with the Enhanced Provider when using RainbowKit in Vite without a process.env polyfill

@rainbow-me/[email protected]

18 May 07:04
2d4c86d
Compare
Choose a tag to compare

Minor Changes

  • 82153ed: Upgraded compatible wagmi and @coinbase/wallet-sdk versions to support Coinbase Smart Wallet.

    Smart Wallet enables users to create a new wallet in seconds with Passkeys, without installing an app or extension. Smart Wallet users can use the same account and address across all onchain apps with RainbowKit.

    Smart Wallet and the underlying smart contract is fully compatible with Wagmi, but dApps need to ensure that their offchain signature validation is ERC-6492 compliant to support smart contract wallets. Follow this guide for more information.

    Coinbase Wallet users on desktop and mobile will now interact with a new connection flow in RainbowKit alongside Smart Wallet.

  • 90d6931: Introduced the Enhanced Provider to handle fallback resolutions when a Mainnet provider transport is unavailable.

    ENS names for dApps without a Mainnet provider will now properly resolve. Additional conveniences will be soon be rolling out in RainbowKit.