Aptos Connect is a MetaMask Snap that allows users to interact with the Aptos blockchain directly from MetaMask. This snap provides various Aptos-related functionalities, such as generating accounts, signing messages, and sending transactions.
Example website: https://aptos.netlify.app/
Demo Video: https://youtu.be/f2-FAUYnf-g
To use Aptos Connect in your project, install the npm package:
npm install aptos-connect
- Account Management: Generate new Aptos accounts, view public and private keys, and get account addresses.
- Transaction Signing: Sign and send Aptos transactions, including funding accounts and transferring Aptos coins.
- Message Signing: Sign arbitrary messages directly from MetaMask.
- Data Persistence: Save and retrieve data across sessions.
- RPC Interaction: Perform RPC requests to Aptos nodes for account balances, transaction history, and more.
...
packages/
site/ # Frontend application built using Gatsby
src/
components/ # React components for UI
pages/ # Main app pages (index.tsx)
utils/ # Helper functions
snap/ # MetaMask Snap logic
src/
cryptoUtils.ts # Utility functions for key management
index.tsx # Main Snap logic, handling RPC requests
utils.ts # Aptos-specific utilities
...
- getAccountAddress: Retrieve the Aptos account address for a given derivation path.
- getPublicKey: Get the public key for the specified derivation path.
- getPrivateKey: Obtain the private key (sensitive).
- createNewAccount: Generate a new Aptos account.
- signMessage: Sign a message with the private key.
- sign&sendTxn: Sign and send a transaction on the Aptos blockchain.
- setData: Save data in metamask's encrypted storage.
- getData: Retrieve data.
- clearData: Clear all data.
Check more about all rpc methods here.
To run the project locally, clone the repository and install dependencies using Yarn:
git clone https://github.com/vedant-asati/aptos-snap.git
yarn install
yarn start
Frontend development:
cd packages/site
yarn install
yarn start
Snap development:
cd packages/snap
yarn install
yarn start
The production snap is available as Snap ID: npm:aptos-connect
.
The locally started snap is available as Snap ID: local:http://localhost:8080
.
This project is licensed under the Apache 2.0 License and MIT License.