Skip to main content

SubWallet

Overview

SubWallet, Polkadot{.js}, and Talisman extensions allow dApps to connect to them via public interaction with the injectedWeb3 object of the window browser.

  • SubWallet (public with properties subwallet-js)
  • Polkadot{.js} (public with properties polkadot-js)
  • Talisman (public with properties talisman)

20

You can open the injectedWeb3 object in your browser's devtools.

21

How to integrate with a dApp

info

Refer to these examples:

  • Check the extension is active:
    • When a wallet extension is active in a browser it will modify window.injectedWeb3 by adding its interaction and specifying the name.
    • For example: check the SubWallet extension by this code: window.injectedWeb3 && window.injectedWeb3['subwallet-js']
  • Enable integration with your dApp by using the method enable() of the extension interaction object
const SubWalletExtension = window.injectedWeb3['subwallet-js'];
const extension = await SubWalletExtension.enable();

After running the code extension, a popup will appear to confirm integration with your dApp.

  • After enabling, the extension variable may contain the following objects:
    • accounts: Allow getting account data with 2 methods: get() and subscribe().
    • signer: Allow to sign data with 2 methods: signPayload() and signRaw().
    • metadata: Allow getting additional metadata list with method get() and add/update with provide().

Use with TypeScript

If your dApp is written with TypeScript you will need to add @polkadot/extension-inject to your package.json to get the extension interfaces.