How to Integrate

Installation

Currently, the adapter supports a React provider for you to include in your app.

Install the React provider:

npm install @aptos-labs/wallet-adapter-react

The latest version of the wallet adapter supports AIP-62 Wallet Standard integration by resolving wallets that support both standards.

Since the AIP-62 wallet standard uses event communication between a dapp and a wallet, the dapp does not need to install, maintain, and pass to the wallet adapter multiple wallet plugins (packages). Furthermore, for any wallet that compatible with the AIP-62 wallet standard, the wallet adapter will detect the wallet by default.


Import dependencies

In the App.jsx file:

Import the AptosWalletAdapterProvider:

import { AptosWalletAdapterProvider } from "@aptos-labs/wallet-adapter-react";


Wrap your app with the Provider, pass it the plugins (wallets) you want to have on your app as an array, and include an autoConnect option (set to false by default):


<AptosWalletAdapterProvider autoConnect={true}>
<App />
</AptosWalletAdapterProvider>


To also support previous standard, dapp should provide a wallets array to the React provider. That way the adapter will resolve both wallet standards and provide to the end user with the dapp's installed wallets and with the AIP-62 wallet standard compatible wallets.


const wallets = [new SomeAptosWallet()];
<AptosWalletAdapterProvider plugins={wallets} autoConnect={true}>
<App />
</AptosWalletAdapterProvider>;