Installation
How to install the plugin
Last updated
Was this helpful?
How to install the plugin
Last updated
Was this helpful?
Add the plugin element on the page where you will use it, it can also be inside a reusable element like Header or Footer.
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. There are 2 fields in this action, App Name and RCP
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:
This field is Optional! Leave empty to use the default Polkadot RPC url.
In our , 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
A few useful states will inform you about the plugin status.
State type: Yes/No
This state will inform if the user has the extension installed.
State type: Text List
Will show the connected wallet addresses from the extension. Can be more than one.
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
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.
See an example of how it can be used in the demo app editor Look for the Repeating Group called Connected Wallets