Wallet Adapter Plugin for SDK Wallet Builders
A wallet adapter plugin allows dapps to use your wallet. With the AIP-62 Wallet standard, dapps can simply update their version of aptos-wallet-adapter
to connect to newly added Wallet plugins.
Implementing a wallet plugin for an SDK wallet which can be imported via npm has three main steps:
- Implement a wallet adapter plugin for your SDK wallet.
- Publish your plugin on npm.
- Update the
aptos-wallet-adapter
package to let dapps know about your wallet.
1. Implement the Wallet Adapter Plugin.
Section titled “1. Implement the Wallet Adapter Plugin.”You can use the wallet-standard
repo’s example to implement an AIP-62 compatible wallet adapter plugin that dapps can automatically recognize.
-
Create a new typescript repository.
-
Copy the into that new repo.
-
Follow the instructions in that example to make it use your wallet to execute the AIP-62 functions.
Test your changes by:
Section titled “Test your changes by:”-
Clone the repository.
-
Navigate to in the example dapp.
-
Replace with your implementation of the AIP-62 standard.
- You will have to update the import in
aptos-wallet-adapter/apps/nextjs-example/src/app/page.tsx
to use your Wallet instead ofMyWallet
. - For local testing purposes, you can leave the
registerWallet
code, but SDK wallets do not need that once they have been added to theaptos-wallet-standard
core package.
- You will have to update the import in
-
Run a local version of the dapp by following the instructions in the .
-
Click “Connect a Wallet”
You should see your wallet on the list of connections.
-
Connect to your wallet.
- You can then use the demo dapp features to verify your other wallet features work as expected.
- This simulates how a real dapp will interact with your wallet.
2. Once tested, publish a new npm package for your SDK wallet code by following this guide. (Ex. AptosConnect)
Section titled “2. Once tested, publish a new npm package for your SDK wallet code by following this guide. (Ex. AptosConnect)”3. Update wallet-adapter-core
to know about your extension.
Section titled “3. Update wallet-adapter-core to know about your extension.”In order for dapp users who are not already using your wallet to get the option to create an account with your wallet, you need to update wallet-adapter-core
with your browser extension’s download link.
-
Fork the monorepo. ()
-
Open your fork in a local editor such as VSCode.
-
Create a new branch for your changes.
Terminal window git checkout -b your-wallet -
Navigate to .
-
Import your SDK wallet npm package.
Terminal window pnpm i @yourpackage -
Import your wallet in .
For example with AptosConnect:
import { AptosConnectWallet } from "@aptos-connect/wallet-adapter-plugin"; -
Add code to push an instance of your wallet to sdkWallets inside getSDKWallets (in sdkWallets.ts).
sdkWallets.push(new YourWallet(dappConfig)); -
In type.ts, update the type AvailableWallets to include your wallet’s name.
export type AvailableWallets = "Nightly" | "Petra" | "T wallet" | "Your Wallet's Name"; -
Update the at the top-level of the aptos-wallet-adapter to include your wallet in the list of AIP-62 compatible wallets.
-
Commit and push your changes to your fork.
-
Follow to open a pull request for the repo.
Resources
Section titled “Resources”- Wallet Adapter Demo App
- Live site
- Source code
- See
standardWallet.ts
for an example implementation of an AIP-62 compatible wallet-adapter plugin.
wallet-standard
source code.wallet-adapter-core
source code.- AIP-62 standard.