metamask-connector
v1.0.1
Published
Rx MetaMask extension connector
Downloads
4
Readme
MetaMask Connector
Rx MetaMask extension connector
Installation
$ npm i metamask-connector -S
Usage
import { connectMetaMask } from "metamask-connector";
// or using default export
import connectMetaMask from "metamask-connector";
const connector = connectMetaMask();
// or with options
const connector = connectMetaMask({
connectionTimeout: 2000, // timeout in ms after DISCONNECTED status is published
// defaults to 1000
accountInterval: 3000, // account interval in ms
// defaults to 1000 ms
});
connector.status; // current status (CONNECTING, CONNECTED, DISCONNECTED)
connector.status$; // current status rx subject
const { account, provider } = connector;
account.address; // selected account address
account.address$; // selected account address rx subject
provider; // selected web3 provider
provider.injected; // is provider injected
provider.injected$; // is provider injected rx subject
Testing
$ npm test
License
The MIT License