Purser simplifies interaction with Ethereum based wallets. It supports both hardware and software wallets and provides a consistent and predictable interface to work with during dApp development.
Purser is:
Simple - Has an easy and intuitive API. Get started in minutes!
Predictable - Uses the same commands for all wallet types.
Sane - Maintains developer health by using proper error messages, validations and sanitisers.
Plug & Play - Supports Hardware (Ledger, Trezor) and Software (ethers.js) wallets out of the box.
Purser was brought to you by the fine folks at Colony. To learn more about Colony, you can visit the website or read the white paper.
To use the software wallet (based on the ethers wallet):
yarn add @colony/purser-software
Create a new wallet
import { create } from '@colony/purser-software'
const wallet = await create();
console.log(wallet); // { address: '...', privateKey: '...', publicKey: '...' }or open an existing one (based on the mnemnonic)
import { open } from '@colony/purser-software'
const wallet = await open({ mnemonic: '...' });
console.log(wallet); // { address: '...', privateKey: '...', publicKey: '...' }For hardware wallets (let's use trezor in this example) do:
yarn add @colony/purser-trezor
import { open } from '@colony/purser-trezor'
const wallet = await open();
console.log(wallet); // { address: '...', otherAddrresses: [...], publicKey: '...' }
wallet.setDefaultAddress(2); // Sets the current address to the third address in the list of `otherAddresses`Please see the documentation with detailed examples and explanations.
Purser is a monorepo consisting of a collection of Ethereum wallet libraries:
purser-core: A collection ofhelpers,utils,validatorsandnormalizersto assist the individual purser modules.purser-ledger: Ajavascriptlibrary to interact with a Ledger based Ethereum wallet.purser-metamask: Ajavascriptlibrary to interact with the a Metamask based Ethereum wallet.purser-software: Ajavascriptlibrary to interact with a software Ethereum wallet, based on the ethers.js library.purser-trezor: Ajavascriptlibrary to interact with a Trezor based Ethereum wallet.
We plan to add support more hardware wallets and other features that will make wallet interactions even easier. Stay tuned!
We welcome all contributions to Purser. You can help by adding support for new wallet types, testing existing wallets, or improving the documentation.
Please read our Contributing Guidelines for how to get started.
The purser monorepo and each individual purser library are MIT licensed.