Using Injected, okxwallet or okexwallet can't connect with OKX wallet
leonace924 opened this issue · comments
Pegasus commented
Describe the bug
export const okxConnector = injected({target: 'okxWallet'})
using targeted okx wallet, either okxWallet or oKExWallet is not available to connect with the wallet and return ProviderNotFoundError, while using injected({target: 'metamask'}) is ok to connect with my metamask wallet
Link to Minimal Reproducible Example
No response
Steps To Reproduce
No response
Wagmi Version
2.5.19
Viem Version
2.9.13
TypeScript Version
5.2.2
Check existing issues
- I checked there isn't already an issue for the bug I encountered.
Anything else?
No response
Glitch commented
OKX supports EIP-6963, you can filter the connector by its id.
Pegasus commented
@glitch-txs , could you give me a advice to implement it correctly?
I used injected, but didn't work
This was what I did
injected({
target() {
return {
id: "okxwallet",
name: "OKX Wallet",
provider: () => {
if (typeof window !== "undefined") return
const isOkxWallet = (ethereum) => {
return !!ethereum?.isOkxWallet
}
if (isOkxWallet(window.ethereum)) {
return window.ethereum
}
if (window.ethereum?.providers)
return window.ethereum.providers.find(isOkxWallet) ?? null
return window["okxwallet"] ?? null
}
}
}
})