Skip to content
๐ŸŽ‰ Welcome to the new Aptos Docs! Click here to submit feedback!
Wallet Adapter

Wallet Adapter

Decentralized applications often run through a browser extension or mobile application to read on-chain data and submit transactions. The Aptos Wallet Adapter allows for a single interface for apps and wallets to integrate together.

Implementing the Aptos Wallet Adapter

Implementing wallet integration can be difficult for dapps in:

  1. Support and test all edge cases
  2. Implement and maintain different wallet APIs
  3. Provide users with needed functionality the wallet itself doesnโ€™t support
  4. Keep track on all the different wallets in our ecosystem

In addition, creating and implementing a wallet is also not an easy task,

  1. Provide a wallet that follows a known standard, so it is easy to integrate with
  2. Dapp projects need to dedicate time and resources to integrate the wallet within their app
  3. Wallets required to rely solely on a dapp integration effort

When we started building a wallet adapter, we wanted to provide an adapter that can be easy enough for wallets to integrate with and for dapps to use and implement.

For that, we provide an Aptos Wallet Adapter monorepo for wallet and dapps creators to ease development and ensure a smooth process in building projects on the Aptos network. The Aptos Wallet Adapter acts as a service between dapps and wallets and exposes APIs for dapps to interact with the wallets by following our Wallet Standard. This in turns allows dapps to support many wallets with minimal integration efforts, and for wallets to follow a known standard and gain visibility.

Adapter structure

The adapter has three different components, the:

  1. Adapter Core package
  2. Adapter React provider (for dapps)
  3. Adapter Template plugin (for wallets)

This structure offers the following benefits:

  • Modularity (separation of concerns) - separating the adapter into three components can help having more freedom in design, implementation, deployment and usage.
  • Wallets create and own their plugin implementation (instead of having all in the same monorepo):
    • Reduces the packages bundle size used by dapps.
    • Lets them be self-service and support themselves without too much friction.
    • Prevents build failures in case of any bugs/bad implementation/wrong config files/etc.
  • Simplicity - keeps the Provider package very light and small as the major logic is implemented in the core package.
  • Flexibility - for wallets in creating and implementing custom functions.

Following the new Wallet Standard AIP-62 the wallet adapter supports the old wallet adapter standard and the new wallet standard described in AIP-62 while the ecosystem is onboarding to the new standard. Dapps can follow the integration guide here and Wallets can follow the integration guide here

Adapter Core package

The Adapter Core package handles the interaction between the dapp and the wallet. It:

  • Exposes the standard API (and some different functions supported by different wallets)
  • Holds the current wallet state and the installed wallets
  • Emits events on different actions and much more

Dapps should not know this package as dapps interact with the provider, which in turn interacts with the core package; some Types are exposed from the core package for the dapp to use.

Wallets should implement their own plugin class that extends the basic plugin class (properties + events) interface that lives in the core package.

If a wallet supports functions that are not part of the basic plugin interface, a pull request should be made to the core package to include this function, so it can support it. You can take a look at the signTransaction on the wallet core package for guidance.

Adapter React provider

The light Adapter React package is for dapps to import and use. The package contains a Provider and a Context to implement and use within your app.

Follow the Wallet Adapter For Dapp Builders guide on how to use the provider package on your dapp.

Adapter Template plugin

Wallets looking to integrate with the adapter should implement their own wallet plugin, to ease the process we provide you with a pre-made class that implements the basic functionality needed (according to the wallet standard).

The Wallet Adapter Plugin Template repo holds a pre-made class, a test file, and some config files to help you build and publish the plugin as an NPM package.

Follow the Wallet Adapter For Wallet Builders on how to use the template to implement and publish your wallet plugin.