A simple browser extension that facilitates managing your Polymesh accounts outside of dapps. Injects the accounts and allows signing transactions for a specific account.
With the Polymesh Wallet, you can:
The extension wraps Polkadot{.js} extension and aims to offer optimized experience to Polymesh dapp users. It retrieves and displays account chain data such as: account balance, Polymesh ID, and onboarding status. Data is retrieved via Websocket API connection, then stored in a central Redux and finally, redux store data gets persisted to local storage.
Additionally, the wallet enables importing user's confidential identity from KYC providers, and then encrypts it with AES and stores in local storage. User must provide a password to decrypt the confidential identity for purpose of viewing, or to generate a uniqueness proof.
Steps to build the extension and view your changes in a browser:
git clone git@github.com:PolymeshAssociation/polymesh-wallet.git
yarn build
or yarn watch
chrome://extensions/
packages/extension/build
Optionally, you can connect to a local Polymesh node running on ws://localhost:9944
, by selecting "Local node" from networks menu, after you enable dev network display.
The repo is split into a number of packages
You can find more information about the directory structure here
The extension is compatible with the convenience @polkadot/extension-dapp wrappers. They allows for any dapps to access the injected extension object for purpose of signing, amongst other things.
Besides the API interface of Polkadot.js extension that we inherit and the re-provide, Polymesh extension provides the few additional APIs highlighted below.
enum NetworkName {
mainnet = "mainnet",
testnet = "testnet",
staging = "staging",
local = "local",
custom = "custom"
}
type NetworkMeta = {
name: NetworkName,
label?: string,
wssUrl: string
}
// An interface that exposes the currently selected network
interface InjectedNetwork {
get: () => Promise<NetworkMeta>;
subscribe: (cb: (network: NetworkMeta) => void) => Unsubcall;
}
interface PolymeshInjected extends Injected {
readonly network: InjectedNetwork;
}
From a dapp, you can access the injected object in order to tap into additional APIs.
web3Enable('A dapp').then((exts) => {
// From the possibly multiple injected objects (eg if Polkadot.js extension is installed as well),
// select Polymesh injected objects.
const wallet = exts.filter(ext => ext.name === 'polywallet')[0]
if (!wallet) {
setError(new Error(`Please install Polymesh wallet extension from Chrome store`));
return;
}
Get or subscribe to the selected network
wallet.network.get().then((network: NetworkMeta) => {
// do something
});
wallet.network.subscribe((network) => {
window.location.reload();
});
The extension has been reviewed and pen-tested in Q2 2021. The results can be found here.