LoginSignup
2
1

WalletConnect V4 で許可していないネットワークで接続した際に表示されるネットワーク切り替えモーダルを非表示にする方法

Last updated at Posted at 2024-03-06

概要

WalletConnect V4 を使ってウォレットに接続した際、許可していないネットワークで接続した場合に、自動で表示されるネットワーク切り替えモーダルを非表示にする方法を記載します。


image.png

手順

createWeb3Modalに、allowUnsupportedChainをtrueに設定することで、ネットワーク切り替えモーダルを非表示にすることができます。

import { createWeb3Modal } from '@web3modal/wagmi/react';

createWeb3Modal({
    ...
    // こちらの設定を有効にする
    allowUnsupportedChain: true,
})

補足

直近の修正で追加された機能のため、引数が、設定できない場合はバージョンを上げてください。

ネットワークの切り替えしxy

この記事を書いた時点では、ドキュメントに記載されていない内容でしたので、紹介させていただきました。
開発の役に立てば幸いです。

参考

https://github.com/WalletConnect/web3modal/issues/1891
https://github.com/WalletConnect/web3modal/pull/1982

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1