Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] Cannot use getInjectedConnector/hasInjectedProvider externally #2249

Closed
1 task done
haowang1013 opened this issue Nov 26, 2024 · 1 comment
Closed
1 task done

Comments

@haowang1013
Copy link

haowang1013 commented Nov 26, 2024

Is there an existing issue for this?

  • I have searched the existing issues

RainbowKit Version

2.2.0

wagmi Version

2.13.0

Current Behavior

Hi,

I need to integrate the immutable passport wallet into our app and based on existing wallets in the repo it should be as easy as the following

import { getInjectedConnector, hasInjectedProvider } from '@rainbow-me/rainbowkit/dist/wallets/getInjectedConnector'

export const passportWallet = (): Wallet => ({
    id: 'immutable-passport',
    name: 'Immutable Passport',
    rdns: 'com.immutable.wallet',
    iconUrl: '',
    iconBackground: '#fff',
    installed: hasInjectedProvider({ flag: 'isPassport' } as any),
    createConnector: getInjectedConnector({ flag: 'isPassport' } as any),
})

The problem is that it doesn't really work in React because getInjectedConnector/hasInjectedProvider are not exported:

Module not found: Error: Package path ./dist/wallets/getInjectedConnector is not exported from package xxx\node_modules\@rainbow-me\rainbowkit (see exports field in xxx\node_modules\@rainbow-me\rainbowkit\package.json)

Expected Behavior

I should be able to use getInjectedConnector/hasInjectedProvider to implement a custom injected wallet externally.
Is there any particular reason these 2 are not exposed?

Steps To Reproduce

No response

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

No response

Anything else?

No response

@DanielSinclair
Copy link
Collaborator

These are internal functions because their behavior may change. There is quite a bit of complexity in how we choose which provider to pick. I'd recommend just implementing this behavior yourself, similar to the following example from Web3Auth that creates a RainbowKit connector to interact with their modal. I assume you wouldn't need hasInjectedProvider. https://github.com/Web3Auth/web3auth-pnp-examples/blob/37f002032d6781efec82e8fffc4357438ffa022d/web-modal-sdk/wagmi-examples/rainbowkit-modal-example/src/RainbowWeb3authConnector.tsx#L42

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants