2️⃣Testing plugin features
Let's do a few tests with Polkadot API element.
There's a field RPC URL, you can leave it empty, the plugin will connect to Polkadot mainnet RPC automatically in this case.
Get latest block
1. Add a text element on the page
Find it in the same category where are the plugin elements, and drag and drop it on the page. 2. Click in the text field, you will see a blue button that says, Insert dynamic data, click on it, and then select Polkadot API. You will see a list of all plugin states, select Last Block Nr
Now to get the result in this action, we need to run the plugin function (action) to get the latest block.
2. Call action Last Block
We will call this action when we will click a button. In the same way you added the text element, add a button on your page. In the button settings, click Start/Edit workflow
Workflow is where all the actions/functions are made. It is the logic of your app.
3. Run Get Last Block action
Click on add an action field, and look for Last Block in the Element Actions category
4. Test it
Open your page by clicking on Preview button (see Bubble basics page). Click on the button and see result in the text field that we have added earlier.
Handle API loading
Sometimes the API can take longer to load, the plugin have a state that shows if it is ready to be used. Check API is initialising state Let's add this to our button, we will make it disabled if the API is still loading.
2. Add condition to the button
In the app editor, click on the button then do these steps (See the video bellow)
2. Test the button
As in previous steps, open preview, you will notice that you can't click the button instantly when page loads, it depends on how fast the API loads.
Dynamic settings
The function we tested above is a simple one without any parameters. Let's try the action to get the balance for the given address.
1. Add a button and an input
In the same way we did before, add an input and a new button on the page. On the new button, click Start/Edit workflow, it will open a separate workflow for this button specifically.
2. Setup Get Balance Workflow
In the same way we added Last Block action, look for Get Balance of Address action and add it. You will notice that it has a field Address
Click in this field and then on the button insert dynamic data that will appear. Select the input that we were added earlier and then the value of it.
3. Show balance
We will do it the same way we did when showing the last block number. Add a new text element, and using the dynamic button, select Polkadot API Get balance result
4. Test it
Here is my result
You are ready to implement any other action.
You can open the demo page in the app editor, see how it works from the inside with other features implemented. In the same way we implement API features, you can implement the features from keyring element or any other element.
Last updated