Mobile Wallets
Integration
WalletConnect 1.0(Deprecated)
Connect

Connect

Cosmostation Mobile Wallet supports dApps via WalletConnect.(Deprecated)

WalletConnect Example Code (opens in a new tab)

WalletConnect Example Page (opens in a new tab)

import WalletConnect from "@walletconnect/client";
 
export async function connect() {
  const connector = new WalletConnect({
    bridge: "https://bridge.walletconnect.org",
    signingMethods: [
      "cosmostation_wc_accounts_v1",
      "cosmostation_wc_sign_tx_v1",
    ],
    qrcodeModal: new CosmostationWCModal(),
  });
 
  await connector.createSession();
 
  return connector;
}

Modal

Use CosmostationModal when initializing WalletConnect to use DeepLink and QRCode connect.

Install
yarn add @cosmostation/wc-modal
import CosmostationWCModal from "@cosmostation/wc-modal";

Event

By implementing connect/disconnect event, handle connect state event.

const connector = await connect();
 
connector.on("connect", (error, payload) => {
  if (error) {
    setConnected(false);
    throw error;
  }
  setConnected(true);
});
 
connector.on("disconnect", (error, payload) => {
  setConnected(false);
});