dwallet
v0.0.21
Published
Set of APIs for decentralized wallet connections
Downloads
27
Maintainers
Readme
DWallet 🤑
Simple typescript package for managing metamask connection in an easy and straightforward way.
Installation
npm install dwallet
Usage
Simple connection to Metamask wallet
import { Metamask } from 'dwallet';
// ...
const metamask = new Metamask();
const connection = await metamask.connect();
const { network, accounts } = metamask.connection;
Listening events
import { Metamask } from 'dwallet';
// ...
const metamask = new Metamask();
const connection = await metamask.connect();
// Accounts changed
metamask.onAccountsChanged((acc: string[]) => {
// do something
});
// Network changed
metamask.onNetworkChanged((net: Network) => {
// do something
});
// User disconnects
metamask.onDisconnect((err: Error) => {
// do something
});
Contribuiting
Issues and PRs are always welcome, as well as suggestions.