-
Notifications
You must be signed in to change notification settings - Fork 61
Home
The Polkadot Wallet snap extends MetaMask capabilities to include support for Polkadot, Kusama, and other Substrate- and FRAME-based blockchains in the Polkadot ecosystem.
This wiki covers the Polkadot Wallet snap architecture, integration steps and detailed API documentation for dApp developers. There is also a usage guide for the example dApp.
Snaps allow developers to safely extend the capabilities of MetaMask. A snap is a program that MetaMask runs in an isolated environment that can customize the wallet experience.
For example, a snap can add new APIs to MetaMask, add support for different blockchain protocols, or modify existing functionality using internal APIs. Snaps are a new way to create web3 end-user experiences by modifying MetaMask in ways that were impossible before 🚀
Learn more about snaps from the official MetaMask documentation.
- Snap Architecture
- dApp Integration
- API Documentation
- Example dApp Usage Guide
- Exporting Snap Account
The MetaMask Polkadot Wallet snap is enabled through the metamask-polkadot-adapter. The procedure is represented in the diagram below and described in more detail inside integration steps.
Once the snap is installed, a new Polkadot account is generated. Account details such as address, public key, and balance can be obtained through the Polkadot Wallet snap API. The snap can also be used to sign transactions and submit them to the network.
Follow these steps to add support for the Polkadot Wallet snap to your dApp.
- Add the metamask-polkadot-adapter package to your project.
npm i @chainsafe/metamask-polkadot-adapter
- [Optional] Add types for the adapter to your project in case you will interact with snap specific API.
npm i @chainsafe/metamask-polkadot-types
-
Enable the Polkadot Wallet snap by calling
enablePolkadotSnap
from the@chainsafe/metamask-polkadot-adapter
package.
Refer to the
source code
of the example dApp (in particular, the
MetaMaskConnector
container
and the
metamask
service)
for more details.