Giter Club home page Giter Club logo

references's Introduction

References

This repository contained references (e.g. Chains & Connectors) for the Wagmi repositories.

Thanks to everyone that contributed here!

references's People

Contributors

0xartcro avatar 3commascapital avatar aaronmgdr avatar akaryatrh avatar akash1412 avatar begmuhommet avatar codingwithmanny avatar danielsinclair avatar deniscarriere avatar github-actions[bot] avatar glitch-txs avatar graykode avatar hlopes-ledger avatar iainnash avatar jxom avatar nautsimon avatar olegshilov avatar oxsaturn avatar simonerom avatar siosio34 avatar skylarbarrera avatar songkeys avatar spenciefy avatar stanleyding avatar syedahkam avatar tateb avatar thegreataxios avatar tmm avatar tower1229 avatar xzilja avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

references's Issues

auroraTestnet can`t be added

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

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'

Expected Behavior

should not give an error

Steps To Reproduce

import { goerli,
polygonMumbai,
auroraTestnet
} from "wagmi/chains";

    //.....
    
    const { chains, provider } = configureChains(
[goerli,
 polygonMumbai,
 auroraTestnet
 
],

[infuraProvider({ apiKey: 'myKey'}),
 publicProvider()]

);

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

No response

Anything else?

No response

bug: WalletConnect app metadata not working

Is there an existing issue for this?

  • I have searched the existing issues

Package Version

0.12

Current Behavior

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.

Expected Behavior

I should be able to see the app icon and name on the connect modal and on each wallet interaction.

Steps To Reproduce

No response

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

No response

Anything else?

image

bug: Error when disconnect WCv2

Is there an existing issue for this?

  • I have searched the existing issues

Package Version

0.10.12

Current Behavior

Following the WCv2 + wagmi solution

https://github.com/WalletConnect/web3modal/tree/V2/examples/react

When trying to disconnect (from useDisconnect) i get this error:
Screenshot 2023-01-22 at 13 19 47

Once this error pops it will not let me reconnect again
Screenshot 2023-01-22 at 13 17 12

Expected Behavior

I would like to be able to disconnect and reconnect non-stop.

Steps To Reproduce

  1. Connect using WCv2 modal.
  2. Disconnect using wagmi disconnect

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

No response

Anything else?

No response

bug: Metamask not opening automatically on triggering Wagmi write function on Mobile

Is there an existing issue for this?

  • I have searched the existing issues

Package Version

0.12.4

Current Behavior

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.

Expected Behavior

write action should open or switch to meta mask as the wallet is already connected.

Steps To Reproduce

  • connect wallet through meta mask
  • Run any write action in your contract

Try Wagmi write example in the docs, also not working on mobile

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

No response

Anything else?

No response

bug: Dynamic import on walletconnect connector causes an error

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When using wagmi walletConnect on vite, an error occurs. This error is caused by vite's use of dynamic import during its build process.

Expected Behavior

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

Steps To Reproduce

  1. Clone this project: https://github.com/jxom/create-wagmi-49
  2. yarn build
  3. yarn preview
  4. Try to connect to the ledger => this will fail
  5. Go to vite.config.ts
  6. add this to disable the dynamic import build: { rollupOptions: { output: { inlineDynamicImports: true, }, }, }
  7. yarn build
  8. yarn preview
  9. Try to connect with ledger it will work

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

No response

Anything else?

I try a fix: main...omarsy:references:main

WC v2 Proposal namespaces with respect of smart contract wallets

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

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,

Expected Behavior

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.

Steps To Reproduce

No response

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

No response

Anything else?

No response

bug: UNSTABLE_shimOnConnectSelectAccount is true and metamask is already open not rejected error

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

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

image

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
      }


    }
  }

Expected Behavior

when UNSTABLE_shimOnConnectSelectAccount true and metamask already open throw error

Steps To Reproduce

No response

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

No response

Anything else?

No response

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

Is there an existing issue for this?

  • I have searched the existing issues

Package Version

1.0.2

Current Behavior

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:
image

Expected Behavior

希望能在用户确认操作后,再进行

Steps To Reproduce

No response

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

No response

Anything else?

No response

bug: new SafeConnector throws error

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Get the following error on my call to new SafeConnector:

TypeError: SafeAppsSDK is not a constructor

Expected Behavior

Should instantiate with no error.

Steps To Reproduce

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,
})

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

Codesandbox

Anything else?

This is in a nextjs app. I'll try to get a minimal reproducible example app up later today.

bug: Incompatible read only type cannot be assigned to the mutable type string[] - Configuring chains

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

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:
image
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

Expected Behavior

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.

Steps To Reproduce

*assumes you have metamask set up

  • open a new directory
  • run npm init wagmi -- --template next-connectkit
  • copy-paste the code in the description into the 'wagmi.ts' file
  • run npm run dev
  • try and connect the wallet to the canto chain -- can be imported by going to chainlist and finding canto and importing it to your wallet

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

No response

Anything else?

No response

bug: Error: No matching key. pairing: undefined

Is there an existing issue for this?

  • I have searched the existing issues

Package Version

latest

Current Behavior

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.

Expected Behavior

No errors are shown on the console.

Steps To Reproduce

Connect to any wallet using the WalletConnect (v2) connector.
The error shows up on the browser console.

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

https://wagmi.sh/examples/connect-wallet

Anything else?

image

bug: WalletConnectConnector throws uncaught error on switchNetwork init failure

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

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:

image

Throw source: https://github.com/wagmi-dev/references/blob/main/packages/connectors/src/walletConnect.ts#L254

Expected Behavior

The error should be handled internally by wagmi, and result in setting useSwitchNetwork(...).isError to true, and useSwitchNetwork(...).error to a useful error.

Steps To Reproduce

  1. download slingshot mobile wallet
  2. ask it to switch to an unsupported network using useSwitchNetwork

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

No response

Anything else?

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

  • rainbow
  • coinbase wallet
  • metamask mobile
  • slingshot

Wallet-specific error cases for the intern to cover include

  • switch network construction
  • switch network rejection by user
  • add network rejection by user
  • transaction sign rejection by user
  • unaffordability of gas fee (note interaction with account abstraction)

bug: WalletConnect instance missing setStorage method

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

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):
Screenshot 2023-06-26 at 10 37 49

Now see screenshot of walletConnect in Vercel:
Screenshot 2023-06-26 at 10 46 26

Last one seems to have a slightly different interface, and if you go down the prototype, you don't see the method setStorage:
Screenshot 2023-06-26 at 10 43 58

Whereas in my local you see it:
Screenshot 2023-06-26 at 10 44 34

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.

Expected Behavior

WalletConnectConnector instance extends Base connector, https://github.com/wagmi-dev/references/blob/e6fcfa938a95424a70f275409a6b620dfd7c980e/packages/connectors/src/base.ts, which contains the method setStorage

Steps To Reproduce

N/A

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

No response

Anything else?

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

bug: TypeError: Cannot read properties of undefined (reading 'code')

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

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

Expected Behavior

No error occurred

Steps To Reproduce

  1. Open https://stackblitz.com/edit/new-wagmi and wait for ready
  2. Connect your wallet via "Injected" button
  3. Then (maybe) let your computer go to sleep (I closed the lid of my MacBook with all cables disconnected for more than 30 min.)
  4. Reopen the computer, the following error can be seen in console:
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

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

https://stackblitz.com/edit/new-wagmi

Anything else?

OS: macOS 13.4
Browser: Chromium 110.0.5481.100 (arm64)
Wallet: Frame v0.6.6

bug: <title>Migrating to WalletConnect v2

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

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".

Expected Behavior

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.

Steps To Reproduce

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.

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

https://codesandbox.io/s/hardcore-solomon-778k2t?file=/src/App.js

Anything else?

No response

bug: Uncaught Error: No QueryClient set, use QueryClientProvider to set one

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

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) }, })

Expected Behavior

should give ENS name for the address : 0x93905fd3f9b8732015f2b3Ca6c16Cbcb60ECf895

Steps To Reproduce

Just following useEnsName hook guide in docs

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

No response

Anything else?

image

bug: WalletConnectConnector not supporting single chain

Is there an existing issue for this?

  • I have searched the existing issues

Package Version

"@wagmi/core": "^1.2.0"

Current Behavior

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
    })
  }

bug: autoConnect doesn't work for WalletConnect v2

Is there an existing issue for this?

  • I have searched the existing issues

Package Version

0.11.2

Current Behavior

Wallet is not automatically connected when using WalletConnect v2.
With WalletConnect v1 it works as expected.

Expected Behavior

No response

Steps To Reproduce

No response

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

No response

Anything else?

No response

bug: <eip1193 has no exported member 'Chain'>

Is there an existing issue for this?

  • I have searched the existing issues

Package Version

0.3.40

Current Behavior

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'

Expected Behavior

Should not give error

Steps To Reproduce

  • Install @wagmi/connectors 2.0.0 & viem 0.3.40
  • run project and catch error

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

No response

Anything else?

Screen Shot 2023-05-31 at 09 58 37

bug: shimDisconnectKey is always undefined.shimDisconnect

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

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.

Expected Behavior

The shimDisconnectKey should be unique to the connector.

Steps To Reproduce

Use both MetaMaskConnector and InjectedConnector in the same Wagmi Client with different shimDisconnect values

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

No response

Anything else?

No response

bug: [Marble Wallet/WalletConnect V2] When trying to sign message the wallet page opens in same tab leaving the app

Is there an existing issue for this?

  • I have searched the existing issues

Package Version

0.12.1

Current Behavior

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

Expected Behavior

It should open a new tab with the signature request as it does in V1.

Steps To Reproduce

  1. Go to https://wagmi.sh/examples/sign-message
  2. Connect wallet with marble wallet using walletConnect
  3. Try to sign a message

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

No response

Anything else?

No response

bug: Injected/MetaMask connector options no longer detected if Phantom wallet is installed

Is there an existing issue for this?

  • I have searched the existing issues

Package Version

0.10.1 (also tested on 0.9.4)

Current Behavior

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.

Expected Behavior

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.

Steps To Reproduce

You can use the "Connect Wallet" sample on the wagmi.sh website to reproduce the error.

  1. Open the "Connect Wallet" sample on the Wagmi website https://wagmi.sh/examples/connect-wallet in Google Chrome or another Chromium-based wallet. "MetaMask" and "Injected" options should show.
  2. Download Phantom Wallet https://phantom.app/download
  3. Refresh the "Connect Wallet" sample page
  4. MetaMask/Injected should now be gone

bilde

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.

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

No response

Anything else?

No response

bug: WalletConnectLegacyConnector used wrong RPC url

Is there an existing issue for this?

  • I have searched the existing issues

Package Version

@wagmi/core - 0.10.2

Current Behavior

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.

Expected Behavior

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.

Steps To Reproduce

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

Anything else?

Related issues:
wevm/wagmi#116
wevm/wagmi#365

bug: "Chains must not be empty" using WalletConnect V2

Is there an existing issue for this?

  • I have searched the existing issues

Package Version

0.12.10

Current Behavior

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.

Error for V2:
image

💥 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

Expected Behavior

Wallet Connect should not throw error Chains must not be empty and should connect successfully.

Steps To Reproduce

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 />
    </>
  );
}

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

https://github.com/mhm13dev/wagmi-wallet-connect-v2/tree/chains-empty-issue

Anything else?

No response

bug: Update zkSync Multicall3 addresses

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

In #270, the following zkSync Multicall3 addresses were added:

  • 0x47898B2C52C957663aE9AB46922dCec150a2272c for zkSync Era mainnet
  • 0x89e4EDbEC85362a285d7a1D5D255ccD2b8106be2 for zkSync Era goerli testnet

Even 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)

Expected Behavior

No response

Steps To Reproduce

No response

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

No response

Anything else?

No response

bug: WalletConnectConnector does not respect FallbackProvider from configureChains

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

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.

Expected Behavior

The connector should either:

  • respect the FallbackProvider created by configureChains
  • provide a method for specifying fallback RPC nodes
  • provide a method for specifying a single RPC node

Steps To Reproduce

No response

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

No response

Anything else?

No response

bug: EthereumProvider.init is not a function

Is there an existing issue for this?

  • I have searched the existing issues

Package Version

0.12.18

Current Behavior

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",

Expected Behavior

No response

Steps To Reproduce

No response

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

No response

Anything else?

No response

bug: Wagmi createClient error 500, when using lineaTestnet

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

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(),
    ],
  );
image

Expected Behavior

Should be able to connect linea testnet via infura
image

Steps To Reproduce

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,
  });

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

No response

Anything else?

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

(MetaMask) getProvider should handle cases where ethereum is not immediately injected

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

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.

Expected Behavior

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.

Steps To Reproduce

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...)

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

No response

Anything else?

No response

bug: <Walletconnect v2 without themeConfig>

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Currently, the WalletConnectConnector accepts the following parameters

constructor(config: {
        chains?: Chain[];
        options: WalletConnectOptions;
  });

According to these documents

Expected Behavior

But the documentation also includes theme customization(themeConfig).

Steps To Reproduce

It would be nice to add this config for more detailed customization for WalletConnectConnector. At least the themeZIndex parameter

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

No response

Anything else?

No response

bug: walletConnect v2 with wagmi client

Is there an existing issue for this?

  • I have searched the existing issues

Package Version

0.10.14

Current Behavior

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, });

Expected Behavior

expect to create the wallet connect connector using version 2

Steps To Reproduce

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, });

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

No response

Anything else?

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)

bug: signTypedData doesn't work with WalletConnect v2

Is there an existing issue for this?

  • I have searched the existing issues

Package Version

0.11.2

Current Behavior

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.

Expected Behavior

No response

Steps To Reproduce

No response

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

No response

Anything else?

No response

WalletConnect+TrustWallet: Invalid Session Properties requested

Is there an existing issue for this?

  • I have searched the existing issues

Package Version

0.12.13

Current Behavior

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'.

Expected Behavior

The sign message should return signature.

Steps To Reproduce

No response

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

https://github.com/ThakerJayam/test_wagmi

Anything else?

No response

bug: WalletConnectConnector shows duplicated liks for v2 and opens blank pages for v1

Is there an existing issue for this?

  • I have searched the existing issues

Package Version

0.11.7

Current Behavior

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.

Expected Behavior

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/.

Steps To Reproduce

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
      }
    })
  ],

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

https://codesandbox.io/s/billowing-butterfly-8xg7yo

Anything else?

duplicated-wallets
zerion

bug: Issue with supported networks using WalletConnect v2

Is there an existing issue for this?

  • I have searched the existing issues

Package Version

0.12.18

Current Behavior

  1. My dApp is not connected with any account. We have wagmi configured with multiple chains [mainnet, goerli, arbitrum, optimism, polygon].
  2. I open the connector on the dApp (the WC v2 modal is opened)
  3. I go to GnosisSafe wallet connect section (with a Safe Multisig on Goerli).
  4. Copy the connection link from my dApp to WalletConnect.
  5. Both sites (Safe and dApp) throws an error:
    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.

CleanShot 2023-06-29 at 12 53 32

Expected Behavior

When no account connected on the dApp connect from any of the supported networks configured on wagmi.

Steps To Reproduce

No response

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

https://stackblitz.com/edit/new-wagmi-mtfvcu?file=src%2Fwagmi.ts

Anything else?

No response

Attempt to connect to relay via `transportOpen` has stalled. Retrying

Is there an existing issue for this?

  • I have searched the existing issues

Package Version

2.0.0

Current Behavior

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.

Expected Behavior

No response

Steps To Reproduce

I expected to load our website without encountering this error message: Attempt to connect to relay via transportOpen has stalled. Retrying..

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

No response

Anything else?

No response

bug: autoConnect for WalletConnectLegacyConnector doesn't use the currently connected chain

Is there an existing issue for this?

  • I have searched the existing issues

Package Version

0.12.6

Current Behavior

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):
image

Here is walletconnect in localStorage (has correct chainId 10):
image

Expected Behavior

On auto connect, wagmi should have the current chain my wallet is set to. It should not use the old chain.

Steps To Reproduce

  1. In a wagmi app, connect with WalletConnectLegacy connector and make sure you configure autoConnect: true in your wagmi client
  2. In your wallet, choose any chain, for example Goerli (chainId 5)
  3. Close the wagmi app
  4. In your wallet, change the chain, for example Optimism (chainId 10)
  5. Open the wagmi app again
  6. Observe the currently connected chain in the wagmi app, it is still the one in step 2 and not the current chain in your wallet

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

https://stackblitz.com/edit/new-wagmi-dyqaux?file=src/wagmi.ts

Anything else?

No response

Bug: <Fantom Testnet has incorrect ChainId>

Is there an existing issue for this?

  • I have searched the existing issues

Package Version

0.9.2

Current Behavior

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
}
}
};`

Expected Behavior

No response

Steps To Reproduce

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

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

No response

Anything else?

No response

bug: TypeError: EthereumProvider.init

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

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.
スクリーンショット 2023-06-27 16 51 28

The problematic function in question is as follows.
https://github.com/wagmi-dev/references/blob/598d149657961271811ae3c18bbeae4c52a6a00c/packages/connectors/src/walletConnect.ts#L279-L310

Expected Behavior

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.

Steps To Reproduce

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.

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

No response

Anything else?

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.

bug: safe sdk having trouble with value-less write transactions

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

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.

Expected Behavior

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.

Steps To Reproduce

While walletClients provided by regular connectors like Metamask will work fine and process the transaction flow, within Safe the transaction will fail with the following error:

Screenshot 2023-06-15 at 23 37 11

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.

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

No response

Anything else?

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

bug: after accepting an auto network add, rejecting auto network switch returns error related to add and not switch

Is there an existing issue for this?

  • I have searched the existing issues

Package Version

0.12.6

Current Behavior

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.

Expected Behavior

Rejection of a network switch returns User rejected the request. regardless of whether or not the switch rejection followed a network add.

Steps To Reproduce

  1. reject switch to existing network --> e.cause.message ~= "User rejected the request."
  2. delete network from wallet
  3. accept add of new network, then reject switch to it --> Unrecognized chain ID "...". Try adding the chain using wallet_addEthereumChain first. --> should be User rejected the request.

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

No response

Anything else?

No response

bug: core package `getNetwork` and `switchNetwork` not working with WalletConnect

Is there an existing issue for this?

  • I have searched the existing issues

Package Version

"@wagmi/core" "1.3.0"

Current Behavior

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
    })
  • Connect wallet by scanning wallet connect QR code with mobile metamask
  • Metamask on mobile is on mainnet chainId 1 when connecting
  • Call getNetwork from wagmi/core returns the incorrect chainId 5 (goerli)
  • Call switchNetwork does nothing

Expected Behavior

  • expect call to getNetwork to return the chain which is currently connected (on mobile metamask)
  • expect call to switchNetwork to prompt the user on mobile wallet to switch chains

Steps To Reproduce

See above

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

No response

Anything else?

We are using the w3mConnectors with infura fallback provider for reads

bug: Type Error in `connectors/injected.ts`

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

  • Downloaded this repo and run pnpm i to install dependencies.
  • Run pnpm build to build dist
  • I get Error in connectors/dist/injected.d.ts:
    image

This behavior is stopping my project running.

Expected Behavior

There is not type error and projects which used this package work fine.

Steps To Reproduce

  • Downloaded this repo and run pnpm i to install dependencies.
  • Run pnpm build to build dist

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

Here is a repo

Anything else?

No response

bug: Walletconnect Desktop Options are Hidden

Is there an existing issue for this?

  • I have searched the existing issues

Package Version

0.12.6

Current Behavior

In the examples, I see that the desktop wallets are shown:

image

However, using the standard configuration of:

new WalletConnectConnector({
      chains,
      options: {
        projectId: '...',
      },
    })

I get no desktop options:

image

Additionally, WalletConnect on mobile shows no available options

Expected Behavior

Wallet options are shown

Steps To Reproduce

No response

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

No response

Anything else?

No response

WalletConnectConnector, missing options of QR code modal

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

https://github.com/wagmi-dev/references/blob/e486dbfc7c3e7643d3d3aaf46b738e156bc57917/packages/connectors/src/walletConnect.ts#L15-L64

https://github.com/wagmi-dev/references/blob/e486dbfc7c3e7643d3d3aaf46b738e156bc57917/packages/connectors/src/walletConnect.ts#L273-L287

Expected Behavior

No response

Steps To Reproduce

No response

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

No response

Anything else?

No response

bug: cannot specify the required methods for WalletConnect

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Currently the default list of required methods is used

Expected Behavior

Allow to pass the list of required methods to the WalletConnectConnector

Steps To Reproduce

No response

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

No response

Anything else?

No response

bug: Unsupported wc_ method. wc_sessionPropose

Is there an existing issue for this?

  • I have searched the existing issues

Package Version

1.1.1

@web3modal/html: 2.4.5
@web3modal/ethereum: 2.4.5

Current Behavior

  1. Open the modal
  2. Scan QR code
  3. The modal shows Connection declined, then failed to connect wallet
  4. An error message also prints on console: Unsupported wc_ method. wc_sessionPropose

Expected Behavior

After scan the QR code, wallet should connect successfully

Steps To Reproduce

  1. Setup Web3Modal
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()
  1. Open the modal
import { ConnectModal } from "xxx";

...

await ConnectModal.openModal()

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

No response

Anything else?

I can connect to my dapp if I use WalletConnect v1 WalletConnectLegacyConnector (@wagmi/core/connectors/walletConnectLegacy)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.