Extension Wallet
Integration
APTOS Network
Provider

Provider

The Cosmostation browser extension supports various blockchains and exposes chain-specific providers to enable seamless dApp integration.

This document describes how to integrate Cosmostation Extension with Aptos, using either the official Aptos Wallet Adapter or plain (vanilla) JavaScript.


Aptos Wallet Adapter

Cosmostation fully implements the Aptos Wallet Standard interface defined by aptos-labs.

As a result, you can easily connect to the Cosmostation wallet by using the official Aptos Wallet Adapter packages provided by Aptos Labs, without any Cosmostation-specific code.


Supported Features

The following table summarizes the Aptos wallet features currently supported by the Cosmostation extension:

CategoryFeature KeyVersionMethod / EntryDescription
Connectionstandard:connect1.0.0connect()Establishes a connection and returns available accounts
Connectionstandard:disconnect1.0.0disconnect()Disconnects the currently connected wallet
Eventsstandard:events1.0.0on(event, handler)Subscribes to wallet lifecycle events
Accountaptos:account1.0.0account()Returns the currently selected Aptos account
Networkaptos:getNetwork1.0.0network()Returns the currently connected network info
Signingaptos:signTransaction1.0.0signTransaction(...)Signs an Aptos transaction payload
Messageaptos:signMessage1.0.0signMessage(...)Signs an arbitrary message for off-chain verification

All methods strictly follow the Aptos Wallet Standard, ensuring compatibility with existing Aptos dApps.


References

For detailed specifications and advanced usage, refer to the official Aptos documentation:


Vanilla JavaScript Integration

In addition to the official Aptos Wallet Adapter libraries, Cosmostation also allows direct integration using plain JavaScript.

The exposed provider strictly follows the Aptos Wallet Standard interface, making it suitable for lightweight applications or environments where bundling external libraries is undesirable.


Accessing the Aptos Provider

You can access the Cosmostation Aptos provider directly from the global window object.

const isCosmostationInstalled = 'cosmostation' in window;
 
const getAptosProvider = () => {
  if ('cosmostation' in window) {
    return window.cosmostation.aptos;
  } else {
    // Redirect users to install the Cosmostation extension
    window.open('https://cosmostation.io/wallet/#extension');
    /**
     * Alternatively:
     * window.open(
     *   'https://chrome.google.com/webstore/detail/cosmostation/fpkhgmpbidmiogeglndfbkegfdlnajnf'
     * );
     */
  }
};
 
const provider = getAptosProvider();