rainbow-me / rainbowkit

The best way to connect a wallet 🌈 🧰
https://rainbowkit.com
MIT License
2.44k stars 665 forks source link

[bug] <OKX extension not working> #1186

Closed nico-limo closed 1 year ago

nico-limo commented 1 year ago

Is there an existing issue for this?

RainbowKit Version

0.12.7

wagmi Version

0.12.1

Current Behavior

I have the OKX extension. The first attempt show on OKX to connect, When I confirm on the OKX extension. The modal is still waiting for a confirm. image image

The extension shows me connected and if I refresh the page image

Expected Behavior

I connect the wallet witth the extension and QR

Steps To Reproduce

Install the extension. Try to connect

Link to Minimal Reproducible Example (CodeSandbox, StackBlitz, etc.)

https://www.tender.fi/

Anything else?

No response

nico-limo commented 1 year ago

Same error on the example image

DanielSinclair commented 1 year ago

@nico-limo Unable to replicate, at least with EVM networks. If Wagmi or OKX Wallet are failing to respond to the RPC call, this hang would be the expected UX for RainbowKit. Some next steps/questions:

nico-limo commented 1 year ago

Hello, I updated to the latest version and still with the issue. Do you setup something else on the config? Here is the setup

import getEnv from '~/utils/getEnv'
import { connectorsForWallets } from '@rainbow-me/rainbowkit'
import {
  injectedWallet,
  walletConnectWallet,
  metaMaskWallet,
  ledgerWallet,
  safeWallet,
  trustWallet,
  okxWallet,
} from '@rainbow-me/rainbowkit/wallets'
import type { MulticallProviderOptions } from 'multicall-provider/.'
import { multicallProvider } from 'multicall-provider/wagmi'
import { createClient, configureChains } from 'wagmi'
import { arbitrum } from 'wagmi/chains'
import { alchemyProvider } from 'wagmi/providers/alchemy'
import { infuraProvider } from 'wagmi/providers/infura'
import { jsonRpcProvider } from 'wagmi/providers/jsonRpc'
import { publicProvider } from 'wagmi/providers/public'

export const multicallProviderOptions: MulticallProviderOptions = {
  // max amount of transactions per multicall call
  batchSize: 60,
  // time in ms to wait for new transactions before sending a batch
  timeWindow: 15,
  // turns on logging to see when it batches requests
  logs: false,
  // The multicall3 contract address is the sam across the main EVM chains
  multicall3: '0xcA11bde05977b3631167028862bE2a173976CA11',
}

const env = getEnv()

const config = configureChains(
  [arbitrum],
  [
    alchemyProvider({
      apiKey: env.ALCHEMY_API_KEY,
      priority: 0,
      stallTimeout: 500,
    }),
    infuraProvider({
      apiKey: env.INFURA_API_KEY,
      priority: 1,
      stallTimeout: 500,
    }),
    jsonRpcProvider({
      rpc: () => ({
        http: env.BLAST_RPC,
        webSocket: env.BLAST_WSS,
      }),
      priority: 2,
      stallTimeout: 500,
    }),
    jsonRpcProvider({
      rpc: () => ({
        http: env.ANKR_RPC,
        webSocket: env.ANKR_WSS,
      }),
      priority: 3,
      stallTimeout: 500,
    }),
    publicProvider({ priority: 4, stallTimeout: 500 }),
  ],
)

export const chains = config.chains
export const provider = multicallProvider(config.provider, multicallProviderOptions)
export const webSocketProvider = multicallProvider(config.webSocketProvider, multicallProviderOptions)

const connectors = connectorsForWallets([
  {
    groupName: 'Recommended',
    wallets: [injectedWallet({ chains }), metaMaskWallet({ chains }), okxWallet({ chains })],
  },
  {
    groupName: 'Others',
    wallets: [
      walletConnectWallet({ chains }),
      ledgerWallet({ chains }),
      //coinbaseWallet({ appName: 'Tender.fi', chains }),
      safeWallet({ chains }),
      trustWallet({ chains }),
      // rainbowWallet({ chains }),
      // zerionWallet({ chains }),
    ],
  },
])

export const wagmiClient = createClient({
  autoConnect: true,
  provider,
  webSocketProvider,
  connectors,
})
DanielSinclair commented 1 year ago

@nico-limo It appears this issue has been resolved. I would assume it was an issue within the OKX provider's RPC implementation, and they have since corrected with an update. Closing as completed. Can reopen if you're still seeing this issue.