This repository contained references (e.g. Chains & Connectors) for the Wagmi repositories.
- Chains: Are now managed in the Viem repo
- Connectors: Are now managed in the Wagmi repo
Thanks to everyone that contributed here!
Collection of Chains & Connectors for wagmi
License: MIT License
This repository contained references (e.g. Chains & Connectors) for the Wagmi repositories.
Thanks to everyone that contributed here!
When trying to add auroraTestnet from wagmi/chains it returns following error:
Uncaught SyntaxError: The requested module '/node_modules/.vite/deps/wagmi_chains.js?v=7431360a' does not provide an export named 'auroraTestnet'
should not give an error
import { goerli,
polygonMumbai,
auroraTestnet
} from "wagmi/chains";
//.....
const { chains, provider } = configureChains(
[goerli,
polygonMumbai,
auroraTestnet
],
[infuraProvider({ apiKey: 'myKey'}),
publicProvider()]
);
No response
No response
0.12
Whenever i scan the WalletConnect QR code, i should be able to see my app icon and name on the connection modal that is triggered on the mobile app we are using to scan the QR code.
I keep getting 'localhost' and the initial letter of my app name as the icon.
Just for testing i've passed the metadata as in the docs: walletConnectWallet({ chains, options: { projectId: WALLET_CONNECT_PROJECT_ID, metadata: { name: 'wagmi', description: 'my wagmi app', url: 'https://wagmi.sh', icons: ['https://wagmi.sh/icon.png'], }, }, }),
but it doesn't seem to work.
Maybe im doing something wrong.
I should be able to see the app icon and name on the connect modal and on each wallet interaction.
No response
No response
0.10.12
Following the WCv2 + wagmi solution
https://github.com/WalletConnect/web3modal/tree/V2/examples/react
When trying to disconnect (from useDisconnect) i get this error:
Once this error pops it will not let me reconnect again
I would like to be able to disconnect and reconnect non-stop.
No response
No response
0.12.4
on triggering write action from Wagmi for any available contract methods, Meta mask not opening, need to open it manually and then accept the transaction there.
this is only happening on Mobile android and IOS, the web is working perfectly.
write action should open or switch to meta mask as the wallet is already connected.
Try Wagmi write example in the docs, also not working on mobile
No response
No response
When using wagmi walletConnect on vite, an error occurs. This error is caused by vite's use of dynamic import during its build process.
I suggest memoizing this dynamic import, or converting it to a regular import: https://github.com/wagmi-dev/references/blob/5ed73ed2dc2a0e767ece992b9d0890d4513d5334/packages/connectors/src/walletConnect.ts#L312
vite.config.ts
build: { rollupOptions: { output: { inlineDynamicImports: true, }, }, }
No response
I try a fix: main...omarsy:references:main
More users currently are starting using smart contract wallets multichain, especially safe multisig. Smart contract wallet can be deployed selectively on specific chain. Current configuration of WalletConnectConnector
doesn't respect this and sends ethereum mainnet as required network. Dapp should be able to work equally on different chains without specifying required network. Because smart contract wallet may be not deployed on required chain, but deployed on optional chains. Wallet can't continue working with dapp because it violates wallet connect protocol 2.4. Session Namespaces MUST contain at least one account in requested chains.
Code responsible for selecting required and optional chains:
const [defaultChain, ...optionalChains] = this.chains.map(({ id }) => id)
...
chains: [defaultChain],
optionalChains: optionalChains,
Dapp should be able to send proposal with empty required chains
and not empty optional chains
.
From dapp development perspective I think that required chains
make sense in rare cases, for instance, if dapp's contracts are deployed only on one chain. When dapp works on several chains it doesn't make sense to provide them as required because wallet may be deployed only in part of them, they should be provided as optional.
For instance, if dapp configures 1 chain then it should be required. If dapp configures several chains then all chains should be optional.
No response
No response
No response
i want to error handling connect when already metamask opened.
but when UNSTABLE_shimOnConnectSelectAccount is true no ResourceUnavailable error throw
i found when UNSTABLE_shimOnConnectSelectAccount is true, only throw UserRejectedRequestError.
why not throw ResourceUnavailable error ?
my code and metamask file code image below
async function connectWallet() {
try {
const connectResult = await connectAsync()
return Promise.resolve(connectResult)
} catch (e) {
if (e.name === 'ResourceUnavailable') {
return
}
if (e.name === 'UserRejectedRequestError') {
// TODO 예외사항처리필요
return
}
}
}
when UNSTABLE_shimOnConnectSelectAccount true and metamask already open throw error
No response
No response
No response
1.0.2
Coinbase wallets built using @ wagmi/core sometimes choose to cancel by default when the user does not proceed to the next step, resulting in the inability to proceed to the next step。If login=>has not been clicked yet after calling Coinbase, the console has already prompted:
希望能在用户确认操作后,再进行
No response
No response
No response
Get the following error on my call to new SafeConnector:
TypeError: SafeAppsSDK is not a constructor
Should instantiate with no error.
import { configureChains, createClient } from 'wagmi'
import { mainnet, goerli } from 'wagmi/chains'
import { SafeConnector } from 'wagmi/connectors/safe'
import { publicProvider } from 'wagmi/providers/public'
const { chains, provider } = configureChains(
[mainnet, goerli],
[publicProvider()],
)
const client = createClient({
autoConnect: false,
connectors: [
// Error is thrown here
new SafeConnector({
chains,
}),
new MetaMaskConnector({
chains,
}),
],
provider,
})
This is in a nextjs app. I'll try to get a minimal reproducible example app up later today.
I got started with the create-wagmi next.js project and am running into an issue configuring a new chain.
Returning an error configuring new chains 'canto' and 'goerli' which is preventing from connecting to the desired chains.
Here's the code:
import { getDefaultClient } from 'connectkit'
import { createClient, configureChains } from 'wagmi'
import { canto, goerli } from '@wagmi/chains'
import { publicProvider } from 'wagmi/providers/public'
const { chains, provider } = configureChains(
[canto, goerli],
[publicProvider()]
)
Here's the error (also same for goerli
Type '{ readonly id: 7700; readonly name: "Canto"; readonly network: "canto"; readonly nativeCurrency: { readonly decimals: 18; readonly name: "Canto"; readonly symbol: "CANTO"; }; readonly rpcUrls: { readonly default: { ...; }; readonly public: { ...; }; }; readonly blockExplorers: { ...; }; }' is not assignable to type 'Chain'.
The types of 'rpcUrls.default.http' are incompatible between these types.
The type 'readonly ["https://canto.slingshot.finance"]' is 'readonly' and cannot be assigned to the mutable type 'string[]'.
When I try to change the import to import { canto, goerli } from 'wagmi/chains'
then 'canto' doesn't exist and I receive the following error:
Module '"wagmi/chains"' has no exported member 'canto'.
So in the docs it says the below:
But if that were the case I wouldn't need to do
Entirely possible this is a configuration error on my side but couldn't be more confused.
I tried creating a new variable canto and making it type Chain but I circle back to the read only error when I do that.
My current workaround is just doing the work in here but this should just be handled out of the box or I'm possibly ridiculous
The chains that I configure should connect out of the box based on the documentation. On connecting wallet, all chains in my configureChains() hook should function properly and connect/switch networks automatically.
*assumes you have metamask set up
npm init wagmi -- --template next-connectkit
npm run dev
No response
No response
no Alchemy support for Sepolia chain
latest
An error shows up on the browser console each time a user connects using the WalletConnect connector.
Connection seems to be established, not sure if it has any negative impact.
Happens on all browsers and wallet apps tested.
No errors are shown on the console.
Connect to any wallet using the WalletConnect (v2) connector.
The error shows up on the browser console.
https://wagmi.sh/examples/connect-wallet
With slingshot mobile wallet (that does not support the test network I'm trying to switch to), the following error occurs on useSwitchNetwork(...).switch
construction:
Throw source: https://github.com/wagmi-dev/references/blob/main/packages/connectors/src/walletConnect.ts#L254
The error should be handled internally by wagmi, and result in setting useSwitchNetwork(...).isError
to true
, and useSwitchNetwork(...).error
to a useful error.
useSwitchNetwork
No response
In general, wagmi should consider hiring a plucky intern (perhaps from Waterloo to work on testing and bugfixing the matrix of (all popular wallets) x (wallet-specific error cases).
Of course, mobile wallet support is very important as we move into this next phase of growing crypto to global ubiquity.
Popular mobile wallets include
Wallet-specific error cases for the intern to cover include
I'm having a very strange issue that I cannot figure out and it's driving me crazy, so I'm hoping someone could shed some light on this. I'm using Web3Modal
, which uses w3mConnectors
as connectors. This, under the hood, creates an array with InjectedConnector
and WalletConnectConnector
(since I'm using version 2) as seen here: https://github.com/WalletConnect/web3modal/blob/V2/chains/ethereum/src/utils.ts#L35.
What's the problem? when I run this in my local all good (typical, right?). When I deploy this in Vercel, I get an exception becauseWalletConnectConnector
instance is missing setStorage
method, failing here: https://github.com/wagmi-dev/wagmi/blob/main/packages/core/src/config.ts#L124.
The only thing I can think of is that I'm pulling the wrong version of some package. See screenshot of the walletConnect
instance in my local (first item of the list):
Now see screenshot of walletConnect
in Vercel:
Last one seems to have a slightly different interface, and if you go down the prototype, you don't see the method setStorage
:
Whereas in my local you see it:
Both my local and Vercel are building the project using Node 18.x. Following is the list of dependencies:
"dependencies": {
"@wagmi/core": "^1.2.0",
"@web3modal/ethereum": "^2.4.7",
"@web3modal/html": "^2.4.7",
"viem": "^1.0.7"
}
Please let me know if I can provide with some more information. What I'm hoping here is that someone might have an idea what the problem could be because I ran out of them.
WalletConnectConnector
instance extends Base connector, https://github.com/wagmi-dev/references/blob/e6fcfa938a95424a70f275409a6b620dfd7c980e/packages/connectors/src/base.ts, which contains the method setStorage
N/A
No response
I'm testing in Chrome browser. The issue, as mentioned above, happens only when I deploy in Vercel. I don't have such issue when I run the dev environment nor when I run the production bundle in my local, so there must be something happening with the build on prod that might be pulling some wrong version?. I'm using Vite to build a SvelteKit project (Node 18.x). Following are the dev dependencies in case this is also needed:
"devDependencies": {
"@playwright/test": "^1.28.1",
"@sveltejs/adapter-auto": "^2.0.0",
"@sveltejs/adapter-static": "^2.0.2",
"@sveltejs/kit": "^1.5.0",
"@typescript-eslint/eslint-plugin": "^5.45.0",
"@typescript-eslint/parser": "^5.45.0",
"autoprefixer": "^10.4.14",
"daisyui": "3.1.1",
"eslint": "^8.28.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-simple-import-sort": "^10.0.0",
"eslint-plugin-svelte": "^2.26.0",
"postcss": "^8.4.24",
"prettier": "^2.8.0",
"prettier-plugin-svelte": "^2.8.1",
"svelte": "^3.54.0",
"svelte-check": "^3.0.1",
"tailwindcss": "^3.3.2",
"tslib": "^2.4.1",
"typescript": "^5.0.0",
"vite": "^4.3.0",
"vite-tsconfig-paths": "^4.2.0",
"vitest": "^0.32.2"
}
Once again, I don't expect an answer to this issue, but some opinion. Thanks a lot
We experienced some cryptic error reported by Sentry on production:
TypeError: Cannot read properties of undefined (reading 'code')
at ig.<anonymous>(./node_modules/@wagmi/connectors/dist/chunk-FIR52KXR.js:165:1)
at MF(app:///inpage.js:13:7359)
at DE.emit(app:///inpage.js:13:7250)
at ig.<anonymous>(app:///inpage.js:57:186389)
at MF(app:///inpage.js:13:7359)
at DE.emit(app:///inpage.js:13:7310)
at DE.<anonymous>(app:///inpage.js:57:186783)
at MF(app:///inpage.js:13:7359)
at DE.emit(app:///inpage.js:13:7310)
at u(app:///inpage.js:13:7980)
at nc.a [as _write](app:///inpage.js:13:7780)
at oE(app:///inpage.js:10:9380)
at Phe(app:///inpage.js:10:9250)
at Ei.write(app:///inpage.js:10:8049)
at HE.I(app:///inpage.js:10:23460)
at O0e(app:///inpage.js:1:58696)
at Mn.emit(app:///inpage.js:1:61564)
at gE(app:///inpage.js:10:20095)
at xN(app:///inpage.js:10:19991)
at jn.push(app:///inpage.js:10:19416)
at qE._write(app:///inpage.js:13:8927)
at oE(app:///inpage.js:10:9380)
at Phe(app:///inpage.js:10:9250)
at Ei.write(app:///inpage.js:10:8049)
at Hv.I(app:///inpage.js:10:23460)
at O0e(app:///inpage.js:1:58696)
at Mn.emit(app:///inpage.js:1:61564)
at gE(app:///inpage.js:10:20095)
at xN(app:///inpage.js:10:19991)
at jn.push(app:///inpage.js:10:19416)
at Hv._onMessage(app:///inpage.js:10:31156)
Figured out it's rooted in some disconnect handling logic https://github.com/wagmi-dev/references/blob/4b016df3f4930f49f9bb995a580a2729d3828bf9/packages/connectors/src/injected.ts#L316
No error occurred
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'code')
at FrameProvider.<anonymous> (chunk-ACKAHAMS.js?v=26c3fe09:157:17)
at FrameProvider.emit (<anonymous>:1:11485)
at Connection.<anonymous> (<anonymous>:1:1198)
at Connection.emit (<anonymous>:1:11485)
at <anonymous>:1:15141
https://stackblitz.com/edit/new-wagmi
OS: macOS 13.4
Browser: Chromium 110.0.5481.100 (arm64)
Wallet: Frame v0.6.6
I'm migrating to WalletConnect v2 and followed the steps mentioned in the documentation:
https://docs.walletconnect.com/2.0/advanced/migration-from-v1.x/dapps#wagmi
I upgraded to "wagmi": "^0.12.0" (because I would like to keep using ethers) and included the walletConnectProjectId inside the config object for WalletConnectConnector.
Also, to use useWeb3Modal(), upgraded to "@web3modal/react": "^2.2.0".
Are these changes enough? v1 is going to be dropped on June 28 and I want to make sure my users will still be able to connect to my dapp.
When I connect using MetaMaskConnector it works as expected, but when I try the WalletConnectConnector I'm not able to connect with any wallet by scanning the QR code.
Open the Link to Minimal Reproductible Example, click on "Connect to WalletConnect" button and then scan the QR code using a mobile wallet like MetaMask, TrustWallet.
On MetaMask I scan the code and then nothing happens.
On TrustWallet I get a popup saying "WalletConnect - Connecting may take a few seconds", but nothing happens.
https://codesandbox.io/s/hardcore-solomon-778k2t?file=/src/App.js
No response
While making use of useEnsName
hook in Wagmi, i am getting the error : Uncaught Error: No QueryClient set, use QueryClientProvider to set one
the following is the snippet used for calling the hook
const { data: ensName, isError, isLoading } = useEnsName({ address: '0x93905fd3f9b8732015f2b3Ca6c16Cbcb60ECf895', onError(error) { console.log('Error', error) }, })
should give ENS name for the address : 0x93905fd3f9b8732015f2b3Ca6c16Cbcb60ECf895
Just following useEnsName
hook guide in docs
No response
"@wagmi/core": "^1.2.0"
Hello Team,
I have upgraded my app to "@wagmi/core": "^1.2.0", and using WalletConnectConnector. The multichain feature is working fine but whenever I am using single chain and scanning the QR code, I am getting the below issue on console.
browser.js:202 Error: Chains must not be empty
at index.es.js:1:3373
at _ZoneDelegate.invoke (zone.js:368:26)
at Object.onInvoke (core.mjs:26262:33)
at _ZoneDelegate.invoke (zone.js:367:52)
at Zone.run (zone.js:129:43)
at zone.js:1257:36
at _ZoneDelegate.invokeTask (zone.js:402:31)
at core.mjs:25948:55
at AsyncStackTaggingZoneSpec.onInvokeTask (core.mjs:25948:36)
at _ZoneDelegate.invokeTask (zone.js:401:60)
Here is my code sample:
const ms = new MetaMaskConnector({....});
const wc= new WalletConnectConnector({
chains: [goerli],
options: {
projectId: '***---***'
},
})
const myApp = createConfig({
autoConnect: true,
connectors: [ms, wc],
publicClient,
webSocketPublicClient,
});
Connect function:
async function connectNow(type: string): void {
await connect({
connector: type === 'metamask' ? ms : wc
})
}
0.11.2
Wallet is not automatically connected when using WalletConnect v2.
With WalletConnect v1 it works as expected.
No response
No response
No response
No response
0.3.40
After install @wagmi/connectors 2.0.0, viem 0.3.40, I catch error in file @wagmi/connectors/dist/injected.d.ts when run project. type Chain is used in this file but it has no exported in viem
Namespace '"/Users/hoangbtmrk/Projects/Bitmark/feral-file-server/client/node_modules/viem/dist/types/types/eip1193"' has no exported member 'Chain'
Should not give error
No response
shimDisconnectKey
in injected is always undefined.shimDisconnect
even in connectors that extend InjectedConnector. This is because shimDisconnectKey
is initialized before the id
from the child class is available.
This causes issues when there are multiple connectors used that extend InjectedConnector (or are) but have different shimDisconnect values e.g. using both MetaMaskConnector with shimDisconnect:true and InjectedConnector shimDisconnect:false at the same time. In this case autoConnect will still reconnect to metamask even after disconnecting effectively ignoring the shimDisconnect value.
The shimDisconnectKey
should be unique to the connector.
Use both MetaMaskConnector and InjectedConnector in the same Wagmi Client with different shimDisconnect values
No response
No response
0.12.1
Connecting the wallet opens a new tab with a connection request. But when I try to sign a message it changes my app's tab to wallet app leaving my app. WalletConnectV1 works fine
It should open a new tab with the signature request as it does in V1.
No response
No response
0.10.1 (also tested on 0.9.4)
As of today, having the Phantom Wallet browser plugin installed in a Chromium-based browser, will remove the Injected/MetaMask connector options from Wagmi.
We have also had users report the same issue.
Installing Phantom Wallet should have no impact on whether or not the MetaMask/Injected options show up (it's a Solana-based wallet). The MetaMask/Injected connector options should still show.
You can use the "Connect Wallet" sample on the wagmi.sh website to reproduce the error.
The same issue is not reproducible on pages like Opensea and Uniswap, so it looks like it may not be outside our hands to fix this. One of our users has reported that clearing cookies can also solve the issue.
No response
No response
@wagmi/core
- 0.10.2
When connecting a wallet (in my case Metamask) on mobile using the WalletConnect legacy connector and performing any sort of transaction - a request will be made to https://mainnet.infura.io/v3/undefined
and fail. You can see in the code below, the only chain that was defined was polygonMumbai
.
I've found a workaround using the following:
const walletConnectProvider = await client.connector?.getProvider()
const chainId = await client.connector.getChainId()
walletConnectorProvider.http = walletConnectProvider.setHttpProvider(chainId)
This seems to fix it and requests now go to https://matic-mumbai.chainstacklabs.com
.
All of this was done using the publicProvider()
. Unfortunately, there's a related second issue where if instead of the publicProvider
, I use the alchemyProvider()
with a proper api key, the request still goes to chainstacklabs.
I expect the request to go to the correct RPC url depending on the chain & providers defined in configureChains
without the need of a workaround.
const chains = [polygonMumbai]
const { provider } = configureChains(chains, [
publicProvider()
])
export const client = createClient({
autoConnect: true,
provider,
connectors: [
new WalletConnectLegacyConnector({
chains,
options: {},
}),
],
})
await connect({ connector: client.connectors[0] })
// Do some action like sendTransaction or writeContract here
Related issues:
wevm/wagmi#116
wevm/wagmi#365
0.12.10
I am using wagmi
and WalletConnectConnector
to create a custom QR Code using display_uri
.
I get the uri
and create a QR code from it.
When I scan it I get an error with message Chains must not be empty
.
But when I use the same code with WalletConnectLegacyConnector
from wagmi, then the wallet connects without any issues.
💥 And it is not only happening with me.
I just tested the Getting Started guide of ConnectKit with WalletConnectConnector
and it was showing the same error while it was working fine with WalletConnectLegacyConnector
.
👉🏻 I am not sure if the issue is in wagmi's WalletConnectConnector
or in @walletconnect/ethereum-provider
Wallet Connect should not throw error Chains must not be empty
and should connect successfully.
client.ts
import { configureChains, createClient } from "wagmi";
import { mainnet } from "wagmi/chains";
import { WalletConnectConnector } from "wagmi/connectors/walletConnect";
import { publicProvider } from "wagmi/providers/public";
import { Config } from "@/config";
const supportedChains = [mainnet];
const { chains, provider } = configureChains(supportedChains, [
publicProvider(),
]);
export const wagmiClient = createClient({
autoConnect: true,
connectors: [
new WalletConnectConnector({
chains,
options: {
projectId: Config.Blockchain.WALLET_CONNECT_PROJECT_ID,
showQrModal: false,
},
}),
],
provider,
});
Context Providers
"use client";
import { WagmiConfig } from "wagmi";
import { ConnectKitProvider } from "connectkit";
import { wagmiClient } from "@/web3/wagmi/client";
interface Props {
children: React.ReactNode;
}
const Providers: React.FC<Props> = ({ children }) => {
return (
<>
<WagmiConfig client={wagmiClient}>
<ConnectKitProvider>{children}</ConnectKitProvider>
</WagmiConfig>
</>
);
};
export default Providers;
Home Page
"use client";
import { ConnectKitButton } from "connectkit";
export default async function Home() {
return (
<>
<h1>Home</h1>
<ConnectKitButton />
</>
);
}
https://github.com/mhm13dev/wagmi-wallet-connect-v2/tree/chains-empty-issue
No response
In #270, the following zkSync Multicall3 addresses were added:
0x47898B2C52C957663aE9AB46922dCec150a2272c
for zkSync Era mainnet0x89e4EDbEC85362a285d7a1D5D255ccD2b8106be2
for zkSync Era goerli testnetEven though we can't (yet) get the standard 0xcA11bde05977b3631167028862bE2a173976CA11
address on zkSync, I thought it'd be nice if we could have the same address for both zkSync chains, so in mds1/multicall#76 (comment) @xalexec was kind enough to redeploy Multicall3 to 0xF9cda624FBC7e059355ce98a31693d299FACd963
on both chains.
I'm going to use these as the canonical addresses in updated Multicall3 docs, so figured it'd be good to update them here too. I'm happy to PR this in tomorrow, but figured I'd open this issue as a placeholder for now / sanity check you're ok with this change.
(not technically a bug, but this felt like the right place to put this)
No response
No response
No response
No response
I noticed today that when the Polygon Mumbai public/default RPC (https://matic-mumbai.chainstacklabs.com/) was down, despite configuring higher priority RPC nodes with configureChains
, the failing public RPC node was the only node that was contacted for estimating gas or sending transactions.
The connector should either:
configureChains
No response
No response
No response
0.12.18
React test throwing below error. when updating walletConnect to v2
TypeError: EthereumProvider.init is not a function
❯ WalletConnectConnector.initProvider_fn node_modules/@wagmi/connectors/dist/walletConnect.js:222:58
testing lib : vitest
I used rainbowkit for connect : "@rainbow-me/rainbowkit": "0.12.15",
No response
No response
No response
No response
when i remove lineaTestnet
, then its working fine
import { lineaTestnet, arbitrumGoerli } from 'wagmi/chains';
const { chains, provider, webSocketProvider } = configureChains(
[lineaTestnet, arbitrumGoerli],
[
infuraProvider({ apiKey: process.env.NEXT_PUBLIC_INFURA_API_KEY }),
publicProvider(),
],
);
Should be able to connect linea testnet via infura
wagmi version: ^0.12.12
import { lineaTestnet, arbitrumGoerli } from 'wagmi/chains';
const { chains, provider, webSocketProvider } = configureChains(
[lineaTestnet, arbitrumGoerli],
[
infuraProvider({ apiKey: process.env.NEXT_PUBLIC_INFURA_API_KEY }),
publicProvider(),
],
);
const connectors = connectorsForWallets([
{
groupName: 'Recommended',
wallets: [
injectedWallet({ chains }),
rainbowWallet({
chains,
projectId: process.env.NEXT_PUBLIC_INFURA_PROJECT_ID,
}),
metaMaskWallet({
chains,
projectId: process.env.NEXT_PUBLIC_INFURA_PROJECT_ID,
}),
coinbaseWallet({ chains, appName: 'test' }),
walletConnectWallet({
chains,
projectId: process.env.NEXT_PUBLIC_INFURA_PROJECT_ID,
}),
],
},
]);
const wagmiClient = createClient({
autoConnect: true,
connectors,
provider,
webSocketProvider,
});
No response
tested to replace
readonly infura: {
readonly http: readonly ["https://consensys-zkevm-goerli-prealpha.infura.io/v3"];
readonly webSocket: readonly ["wss://consensys-zkevm-goerli-prealpha.infura.io/ws/v3"];
};
with
rpcUrls: {
infura: {
http: ['https://linea-goerli.infura.io/v3'],
webSocket: ['wss://linea-goerli.infura.io/v3'],
},
but still getting same error,
I tested infura rpc url https://linea-goerli.infura.io/v3 is working to get ethBalance
If for some reason extension doesn't immediately inject the window.ethereum
object, connector will miss the update. This leads to a broken experience, because even though the user has the extensions, UI will act like they don't.
Should better handle the async nature of extension injection. I suggest something like https://github.com/MetaMask/detect-provider is used, which is built for exactly this reason.
This is hard to reproduce in an isolated environment, but I can reproduce this consistently when using a bunch of extensions (e.g Phantom, Solflare, and other wallets...)
No response
No response
Currently, the WalletConnectConnector accepts the following parameters
constructor(config: {
chains?: Chain[];
options: WalletConnectOptions;
});
According to these documents
But the documentation also includes theme customization(themeConfig).
It would be nice to add this config for more detailed customization for WalletConnectConnector. At least the themeZIndex
parameter
No response
No response
0.10.14
when run the app using version: '2'
of walletConnect got an error unhandledRejection: TypeError: WalletConnectProvider.init is not a function at WalletConnectConnector.getUniversalProvider_fn
, this result in missing walletConnect connector
example of the wagmi client: export const wagmi = createClient({ connectors: [ ...modalConnectors({ appName: 'appName', chains, version: '2', projectId: walletConnectId }), ], provider, });
expect to create the wallet connect connector using version 2
create the wagmi client using web3modal connector and set version: '2'
export const wagmi = createClient({ connectors: [ ...modalConnectors({ appName: 'appName', chains, version: '2', projectId: walletConnectId }), ], provider, });
No response
terminal log when serve the app: error - unhandledRejection: TypeError: WalletConnectProvider.init is not a function at WalletConnectConnector.getUniversalProvider_fn (.../@wagmi/connectors/dist/walletConnect.js:290:73)
0.11.2
I get The method eth_signTypedData_v4 does not exist/is not available
error when I use signTypedDataAsync
with WalletConnect v2. When I use WalletConnect v1 it works as expected. Tested with Trust and AlphaWallet on iOS.
No response
No response
No response
No response
0.12.13
OS: Android 11.
Platform: React
Using wagmi^0.12.13
After connecting to TrustWallet using WalletConnect, If I request a signature using
sign message from wagmi/actions,
following error is raised:
{context: "client"} 'Invalid Session Properties requested'
.
The sign message should return signature.
No response
https://github.com/ThakerJayam/test_wagmi
No response
0.11.7
I have installed the following Chrome browser extensions: MetaMask, Exodus, Crypto.com, OneKey.
Checking this example https://wagmi.sh/examples/connect-wallet (and following the same steps locally), I have the following issues:
First issue:
When I open WalletConnect and select Desktop, OneKey appears 3 times, and on click of one of the above (installed extensions) I get for each errors like:
Failed to launch 'cryptowallet://wc?uri=wc%3A420a9173-567d-47c2-96ee-092d4d128107%401%3Fbridge%3Dhttps%253A%252F%252Ff.bridge.walletconnect.org%26key%3D2fda74876a8aac70a239f9b4119f238a0423909684623422049199c7fc963819' because the scheme does not have a registered handler.
And instead of opening the browser extension wallet, a blank page opens in a new tab.
Also, I get similar behaviour and errors as above for other wallets like: Ledger, Wallet3, Bobablocks.
Second issue
In local example, I added the following config:
connectors: [
new MetaMaskConnector({
chains,
options: {
shimChainChangedDisconnect: false
}
}),
new WalletConnectConnector({
chains,
options: {
qrcode: true,
version: '2',
projectId: PROJECT_ID
}
})
],
Now, using v2 I see in the modal, as desktop wallets, only Zerion, Infinity, pier, UniPass, Fireblocks, Marble, Prema. And all these wallets are displayed multiple times.
Clicking on Zerion, Infinity, Prema I get for each errors like:
Not allowed to launch 'premawallet://wc?uri=wc%3Aeca3afbc064b31f89d3799b181e20bdd278add38fb1946925a1ca65330911009%402%3Frelay-protocol%3Dirn%26symKey%3Dacc756f87a5b7ce5beffb878a583de5b8c2a48082346cc6dfcd5b38483c1f32c' because a user gesture is required.
localhost/:1 Failed to launch 'premawallet://wc?uri=wc%3Aeca3afbc064b31f89d3799b181e20bdd278add38fb1946925a1ca65330911009%402%3Frelay-protocol%3Dirn%26symKey%3Dacc756f87a5b7ce5beffb878a583de5b8c2a48082346cc6dfcd5b38483c1f32c' because the scheme does not have a registered handler.
First issue:
I would expect clicking on one of the wallets to open the installed browser extension for that respective wallet.
Second issue
I would expect to see all the desktop wallets showed here https://web3modal.com/.
Also, to be able to scan the qr code and connect from my MetaMask mobile app, like I can do here https://web3modal.com/.
First issue:
Install the following Chrome browser extensions: MetaMask, Exodus, Crypto.com, OneKey.
Go to https://wagmi.sh/examples/connect-wallet and click on WalletConnect, then try to connect to one of the installed browser extensions. (you will get a blank page)
Second issue
Keep only MetaMask browser extension.
npm install @web3modal/ethereum @web3modal/react wagmi ethers@^5
Then follow this steps: https://wagmi.sh/examples/connect-wallet
And use the following connectors:
connectors: [
new MetaMaskConnector({
chains,
options: {
shimChainChangedDisconnect: false
}
}),
new WalletConnectConnector({
chains,
options: {
qrcode: true,
version: '2',
projectId: PROJECT_ID
}
})
],
https://codesandbox.io/s/billowing-butterfly-8xg7yo
0.12.18
connection link
from my dApp to WalletConnect.Connection refused: Incompatible chain detected.
Make sure the Dapp only uses Goerli to interact with this Safe.
If I try to do same thing but with a Safe multisig on mainnet, it works.
When no account connected on the dApp connect from any of the supported networks configured on wagmi.
No response
https://stackblitz.com/edit/new-wagmi-mtfvcu?file=src%2Fwagmi.ts
No response
2.0.0
I'm getting Attempt to connect to relay via transportOpen has stalled. Retrying..
message sometimes when I try to load our website after we upgraded to wallet connect v2. However, this issue did not occur on wallet connect v1.
No response
I expected to load our website without encountering this error message: Attempt to connect to relay via
transportOpen has stalled. Retrying..
No response
No response
0.12.6
When I set autoConnect: true
in createClient
and use WalletConnectLegacyConnector
, wagmi doesn't get the currently connected chain in my wallet upon auto connect. It uses the old (cached?) chain from localStorage
keyed in wagmi.store
instead, while the walletconnect
key in localStorage
is updated to reflect the correct chain in my wallet.
Here is wagmi.store
in localStorage (has outdated chainId 5):
Here is walletconnect
in localStorage (has correct chainId 10):
On auto connect, wagmi should have the current chain my wallet is set to. It should not use the old chain.
autoConnect: true
in your wagmi clienthttps://stackblitz.com/edit/new-wagmi-dyqaux?file=src/wagmi.ts
No response
0.9.2
Both Fantom Mainnet and Fantom Testnet have the same chain Id of 250.
After examining @wagmi/chains/dist/index.js I see that both chains have same Id. All other details seem to be correct.
Code snippet as follows:
`// src/fantom.ts
var fantom = {
id: 250,
name: "Fantom",
network: "fantom",
nativeCurrency: {
decimals: 18,
name: "Fantom",
symbol: "FTM"
},
rpcUrls: {
default: { http: ["https://rpc.ankr.com/fantom"] }
},
blockExplorers: {
etherscan: { name: "FTMScan", url: "https://ftmscan.com" },
default: { name: "FTMScan", url: "https://ftmscan.com" }
},
contracts: {
multicall3: {
address: "0xca11bde05977b3631167028862be2a173976ca11",
blockCreated: 33001987
}
}
};
// src/fantomTestnet.ts
var fantomTestnet = {
id: 250,
name: "Fantom Testnet",
network: "fantom-testnet",
nativeCurrency: {
decimals: 18,
name: "Fantom",
symbol: "FTM"
},
rpcUrls: {
default: { http: ["https://rpc.testnet.fantom.network"] }
},
blockExplorers: {
etherscan: { name: "FTMScan", url: "https://testnet.ftmscan.com" },
default: { name: "FTMScan", url: "https://testnet.ftmscan.com" }
},
contracts: {
multicall3: {
address: "0xca11bde05977b3631167028862be2a173976ca11",
blockCreated: 8328688
}
}
};`
No response
Initialize both Fantom and Fantom Testnet in the same dApp you will encounter an ethers exception.
It should be an easy fix by changing line 197 in index.js to id: 4002,
.
Thanks for this great library. Cheers
No response
No response
const connector = new WalletConnectConnector(...)
When running the code above, I encounter the following error in my environment:
Uncaught (in promise) TypeError: EthereumProvider.init is not a function at WalletConnectConnector.initProvider_fn
The library's exports and imports appear to be correct in the code, but for some reason, it doesn't work as expected in specific environments. The exact conditions causing this unexpected behavior are unknown. (I'm building the application using Rails + esbuild, but it doesn't have any particularly unusual configurations.)
In the problematic environment, the entire module is bound to EthereumProvider as default: EthereumProvider. Consequently, there is no init function available.
The following image is an examination of the return value of await import("@walletconnect/ethereum-provider"), which is executed within the library.
The problematic function in question is as follows.
https://github.com/wagmi-dev/references/blob/598d149657961271811ae3c18bbeae4c52a6a00c/packages/connectors/src/walletConnect.ts#L279-L310
Ensure that the provider initialization can be performed without throwing the above exception: Uncaught (in promise) TypeError: EthereumProvider.init is not a function at WalletConnectConnector.initProvider_fn
.
Please make the following specific changes to the code:
const {
EthereumProvider,
OPTIONAL_EVENTS,
OPTIONAL_METHODS
} = await import("@walletconnect/ethereum-provider");
Since EthereumProvider
is already exported from the module, I believe this modification should resolve the issue. In my local environment, making the above changes prevented the exception from occurring.
Unless there is a specific reason that requires default: EthereumProvider
, please modify the code as indicated above.
Unfortunately, I cannot identify specific steps or code snippets to reproduce the behavior.
The issue occurs in two Rails applications that I am involved with. However, it does not occur in another Rails application developed by my colleague.
To be honest, I have no idea what could be causing it. The issue persists even with other versions such as 0.10.10
.
It appears to be some form of environment dependency, but I am unsure.
No response
I'm not the only one struggling with the same exception. There are others who have encountered it as well:
https://github.com/orgs/WalletConnect/discussions/2687
To resolve this issue, I forked wagmi
, made the necessary modifications locally, and used the built version with the fixes. Continuing to do this going forward is quite cumbersome.
Since it seems to be a minor fix, I kindly request you to make the necessary modifications.
Hi, could you change the name from Binance Smart Chain
to BNB Smart Chain
?
https://github.com/wagmi-dev/references/blob/bf7959e2c1aaae1f9a2f9d6d41c30f569e33c2e5/packages/chains/src/bsc.ts#L5
Using prepareWriteContract
without an explicit value
will work fine with most connectors except within a Safe environment.
Note: I wasn't sure if I should publish this here, but figured it's best to keep it close to where the Safe SDK is being used.
prepareWriteContract
should count the optional value parameter (or {value: undefined}
) as a non-payable transaction and proceed with the setup (e.g. simulateContract, ...) without trying to make use of that param.
While walletClient
s provided by regular connectors like Metamask will work fine and process the transaction flow, within Safe the transaction will fail with the following error:
As you can see, it attempts to convert undefined
to what probably is an ethers.BigNumber instance used by the Safe SDK.
A quick fix was to explicitly attribute 0n
to the value argument (no ETH passing through) in prepareWriteContract
.
No response
Side-note: I imagine the Safe integration needs to be revisited in light of the viem update, as well as due to other issues such as wevm/wagmi#2461
H/T @gavriliumircea
0.12.6
Related to wevm/wagmi#1942, there's a small bug where if the user accepts a network add, but then rejects the subsequent network switch, the switchNetwork(...).error.cause
is still set to the error that triggered the add and hasn't been updated to the switch error.
Rejection of a network switch returns User rejected the request.
regardless of whether or not the switch rejection followed a network add.
e.cause.message ~= "User rejected the request."
Unrecognized chain ID "...". Try adding the chain using wallet_addEthereumChain first.
--> should be User rejected the request.
No response
No response
"@wagmi/core" "1.3.0"
const chains = [goerli]
const { provider: wagmiProvider } = configureChains(chains, [
infuraProvider({
apiKey: 'redacted'
}),
w3mProvider({ projectId: this.walletConnectProjectId })
])
const wagmiClient = createClient({
autoConnect: true,
connectors: w3mConnectors({
projectId: this.walletConnectProjectId,
version: 2,
chains
}),
provider: wagmiProvider,
chains
})
getNetwork
from wagmi/core returns the incorrect chainId 5 (goerli)switchNetwork
does nothinggetNetwork
to return the chain which is currently connected (on mobile metamask)switchNetwork
to prompt the user on mobile wallet to switch chainsSee above
No response
We are using the w3mConnectors with infura fallback provider for reads
pnpm i
to install dependencies.pnpm build
to build distconnectors/dist/injected.d.ts
:This behavior is stopping my project running.
There is not type error and projects which used this package work fine.
pnpm i
to install dependencies.pnpm build
to build distHere is a repo
No response
0.12.6
In the examples, I see that the desktop wallets are shown:
However, using the standard configuration of:
new WalletConnectConnector({
chains,
options: {
projectId: '...',
},
})
I get no desktop options:
Additionally, WalletConnect
on mobile shows no available options
Wallet options are shown
No response
No response
No response
No response
No response
No response
No response
0.10.8
there is not enough rps infura when you use this chane
Currently the default list of required methods is used
Allow to pass the list of required methods to the WalletConnectConnector
No response
No response
No response
1.1.1
@web3modal/html: 2.4.5
@web3modal/ethereum: 2.4.5
Unsupported wc_ method. wc_sessionPropose
After scan the QR code, wallet should connect successfully
import { Web3Modal } from "@web3modal/html";
import { EthereumClient, w3mConnectors, w3mProvider } from '@web3modal/ethereum'
import { publicProvider } from "@wagmi/core/providers/public";
import { InjectedConnector } from '@wagmi/core/connectors/injected'
import { configureChains, createConfig, getWalletClient } from "@wagmi/core";
import { WalletConnectConnector } from '@wagmi/core/connectors/walletConnect';
const setupConnectModal = () => {
const projectId = process.env.WALLET_CONNECT_PROJECT_ID
const { chains, publicClient, webSocketPublicClient } = configureChains(
[polygon],
[w3mProvider({ projectId }), publicProvider()]
);
const wagmiConfig = createConfig({
autoConnect: true,
connectors: [
new InjectedConnector({
chains,
options: {
shimDisconnect: true
}
}),
new WalletConnectConnector({
chains: chains,
options: {
projectId: projectId,
isNewChainsStale: true,
},
}),
...w3mConnectors({ chains, version: 2, projectId })
],
publicClient,
webSocketPublicClient
});
const ethereumClient = new EthereumClient(wagmiConfig, chains);
const web3Modal = new Web3Modal(
{ projectId },
ethereumClient
)
return web3Modal
}
export const ConnectModal = setupConnectModal()
import { ConnectModal } from "xxx";
...
await ConnectModal.openModal()
No response
I can connect to my dapp if I use WalletConnect v1 WalletConnectLegacyConnector
(@wagmi/core/connectors/walletConnectLegacy)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.