Extension Wallet
Integration
APTOS Network
Provider

Provider

Cosmostation extension support various chains.

Code using @cosmostation/extension-client

import { aptos, InstallError } from "@cosmostation/extension-client";
 
try {
  const provider = await aptos();
} catch (e) {
  if (e instanceof InstallError) {
    console.log("not installed");
  }
}

Vanilla Code

const isCosmostation = "cosmostation" in window;
 
const aptos = () => {
  if ("cosmostation" in window) {
    return window.cosmostation.aptos;
  } else {
    window.open("https://cosmostation.io/wallet/#extension");
    /**
     * or window.open("https://chrome.google.com/webstore/detail/cosmostation/fpkhgmpbidmiogeglndfbkegfdlnajnf");
     * */
  }
};
 
const provider = aptos();