During the beta development of the WalletConnect clients, there were NPM packages distributed for Browser, React-Native and NodeJS clients which targetted different platforms.
# For Browser apps> @walletconnect/browser# For React-Native apps> @walletconnect/react-native# For NodeJS apps> @walletconnect/node
Now it's unnecessary to choose between the different packages and there is a single isomorphic client distributed on NPM package for all platforms
# For all apps> @walletconnect/client
If you used to integrate any of the above standalone clients for WalletConnect, we describe below how you should migrate to the isomorphic client now distributed
Migrating from Browser Client
Migrating from the Browser client to the isomorphic client is as simple as replacing with the new client package.
Another thing to note about Browser client specifically is that now the QRCode Modal integration has been simplified and the qrcode-modal package can now be injected and handled by the client itself.
Before
import WalletConnect from"@walletconnect/browser";import QRCodeModal from"@walletconnect/qrcode-modal";// Create a connectorconstconnector=newWalletConnect({ bridge:"https://bridge.walletconnect.org",// Required});// Check if connection is already establishedif (!connector.connected) {// create new sessionconnector.createSession().then(() => {// get uri for QR Code modalconsturi=connector.uri;// display QR Code modalQRCodeModal.open(uri, () => {console.log("QR Code Modal closed"); }); });}// Subscribe to connection eventsconnector.on("connect", (error, payload) => {if (error) {throw error; }// Close QR Code ModalQRCodeModal.close();// Get provided accounts and chainIdconst { accounts,chainId } =payload.params[0];});
After
import WalletConnect from"@walletconnect/client";import QRCodeModal from"@walletconnect/qrcode-modal";// Create a connectorconstconnector=newWalletConnect({ bridge:"https://bridge.walletconnect.org",// Required qrcodeModal: QRCodeModal,});// Check if connection is already establishedif (!connector.connected) {// create new sessionconnector.createSession();}// Subscribe to connection eventsconnector.on("connect", (error, payload) => {if (error) {throw error; }// Get provided accounts and chainIdconst { accounts,chainId } =payload.params[0];});
Migrating from React-Native Client
Migrating from the React-Native client to the isomorphic client you need to replace with the new client package and update the constructor arguments.
Previously the React-Native client required you to pass the clientMeta and push options as part of the second argument, however now the clientMeta is part of the first argument and push options is isolated in the second argument.
Previously the NodeJS client required you to pass the clientMeta as part of the second argument, however now the clientMeta is part of the first argument.