⚙️Installation

How to install the plugin

Add the plugin element on the page where you will use it, it can also be inside a reusable element like Header or Footer.

Make sure that the plugin element is not inside a group that can be hidden under certain circumstances, for example on mobile devices.

Initialise the plugin

Run - Load App action

First step that you need to do to run the plugin, is start the action Load App. This will initialise the polkadot.js instance, API connection and if it is the first time a user visits your app, he will be asked to allow connection of your app to his wallet extension. Example There are 2 fields in this action, App Name and RCP

App Name

This is the name of your app that will be shown in extension popups when the user will be asked to accept certain actions. For example, on the Authorise popup:

RPC url

This field is Optional! Leave empty to use the default Polkadot RPC url.

Example

In our wallet demo, we have added this action on Page is loaded event. You can run this event on any other event, for example when a certain button click.

As you can see, for the demo we use Westend testnet, and for that, in the RPC field we use Westend RPC URL that is: wss://westend-rpc.polkadot.io

Useful States

A few useful states will inform you about the plugin status.

Is Extension installed

State type: Yes/No

This state will inform if the user has the extension installed.

Note: If it is NO, this also could mean that the user denied your app access.

Connected Wallets

State type: Text List

Will show the connected wallet addresses from the extension. Can be more than one.

Connected Wallets Name

State type: Text List

Names of the connected wallet, each index represents the wallet address at the same index from Connected Wallets state.

For example: Wallet with index 1: AB123

Wallet Name index 1: My Main Wallet

So it means that the wallet with the index 1 (AB123) has the name with the index 1 that is My Main Wallet

See an example of how it can be used in the demo app editor here Look for the Repeating Group called Connected Wallets

API is initializing

State type: Yes/No

The API connection may load longer than the plugin connection, the API connection is needed when doing the Sign and Send Transaction, so before doing it, make sure this state is NO. If the API is still loading, the state will be Yes, when it will finish loading and will be ready to use, it will be NO.

Last updated

Was this helpful?