Laika Scenarios
The Multi-call Powerhouse Tool
Create Scenario Request
Laika gives you a powerful toolkit for your life as a Web3 Developer. One of these power tools is the ability to create nodegraphs for your Smart Contract Scenarios! You can hook up as many calls and conditions as you like, creating the dapp flow right in the workspace, to test and develop multi-call events using your Collections. Here, we take you through a small example on how to use this feature. Get Ready. Create all the requests you need and paste the address of the contract you want to interact with. To know more about creating Requests, check out Create a New Request.
Let's Dive In! Select [Scenario Request (beta)] on the left pane.
Select [ New ] to build a Scenario
Name the Scenario and then press [ Create ]
For Scenario Request Nodegraphs, there are 3 types of nodes that you can use.
Request Node: for passing Requests as per your defined parameters
Condition Node: for setting conditions (i.e., if function)
Connector Node: for combining flows of the scenario from 2 flows to 1 flow
To create a Node, there are two ways:
Drag the Node you want from the Toolbox(present at the bottom of the Scenario pane)
Right-click anywhere on the Scenario pane and choose the Node you want to create.
Using a Request Node
After creating a Request Node, a block will pop up on the interface.
Choose the prepared request by selecting the [ Select a method ]
For the Write/Read Method requests, adjust parameters as needed by selecting the [ Edit Parameters ]. If you want to check the status of the current parameters, hover the mouse on the vision icon.
For the Read Method requests, you can state a variable to store the response from the request by clicking on [Assign return to Context ]. Again, if you want to check the status of the current Assign Context, hover the mouse on the vision icon.
Using a Condition Node
After creating a Condition Node, a block will pop up on the interface.
State the value in the LHS (Left Hand Side) box, and the RHS (Right Hand Side) box, then, then select the condition. Stating the value in LHS and RHS boxes can be done in 3 ways:
{{var_name}} : value from the set Environment
Context.context_name : value from Context (Assign in the process of creating a Request Node, Read Request Node)
value : a constant value
Next, to connect the Flow for Condition Node, connect the upper-right dot of the Condition Node to the Node you want to run if the result is “True”. In reverse, connect the lower-right dot of the Condition Node to the Node you want to run if the result is “False”.
Using a Connector Node
After creating a Connector Node, a block will pop up on the interface.
To combine 2 Flows into 1, connect the dots as shown in the picture below.
Need more help? Here's a Video on how to use Scenario Requests!
Last updated