Integration Instructions
Or how to integrate SubWallet and other Polkadot and Kusama wallets into your DApps
Overview
SubWallet, Polkadot{.js} and Talisman extensions allow DApp to connect with them by publicizing their interaction in object injectedWeb3 of window browser.
SubWallet (public with properties
subwallet-js)Polkadot{.js} (public with properties
polkadot-js)Talisman (public with properties
talisman)

You can open injectedWeb3 object in Chrome devtools.

How to integrate wallets into DApps
Check extension's activation:
When a wallet extension is active in browser it will modify
window.injectedWeb3by adding its interaction with a specific name.For example, check SubWallet extension by these code:
window.injectedWeb3 && window.injectedWeb3['subwallet-js']
Enable intergation into your DApp by method
enable()of extension interaction object.const SubWalletExtension = window.injectedWeb3['subwallet-js'] const extension = await SubWalletExtension.enable()After running, these code extension will show popup confirmation to confirm integration into your DApp
After enabling,
extensionvariable can contain these objects:accounts: Allow getting accounts' data with 2 methods,getandsubscribe.signer: Allow signing data with 2 methods,signPayloadandsignRaw.metadata: Allow getting additional metadata list with methodgetand adding/updating with methodprovide.
Last updated