DOT (Polkadot) Wallet Integration
Getting Started
To develop Polkadot wallet functionality for Cactus Link, firstly install Cactus Link.
The Polkadot wallet integration follows the Polkadot.js extension API.
Enabling the Extension
To request access from the wallet extension:
import { web3Enable } from '@polkadot/extension-dapp';
const extensions = await web3Enable('your-dapp-name');
Accessing Accounts
import { web3Accounts } from '@polkadot/extension-dapp';
const accounts = await web3Accounts();
console.log(accounts);
Supported Methods
| Method | Description |
|---|---|
pub(authorize.tabV2) |
Request connection authorization from the wallet |
pub(accounts.list) / pub(accounts.listV2) |
List all available accounts |
pub(accounts.subscribe) |
Subscribe to account changes in real time |
pub(metadata.list) |
Get cached chain metadata |
pub(extrinsic.sign) |
Sign a Substrate extrinsic payload |
pub(bytes.sign) |
Sign arbitrary bytes |
Supported Events
| Event | Description |
|---|---|
pub(accounts.subscribe) |
Fires when accounts are added, removed, or chain is switched |
pub(accounts.subscribeV2) |
V2 version of accounts subscription |
pub(accounts.unsubscribe) |
Unsubscribe from account updates |
Test Site
https://polkadot.js.org/apps/#/staking-async/actions