Display different views
- For example, I have a form where my users can enter values into an input and submit a transaction. Then, I want to display a success message once a transaction is successful.
- I have two different views. Let's call them form and success.
text('ETH -> WETH'),
call_fn(weth, deposit, [ value(eth(ETH)) ], ),
- The prompt above is displayed only if the view is set to form.
- The view switches to success once the user clicks on the "WRAP" button and the deposit transaction is minted successfully.
text('ETH successfully swapped!'),
button('New Swap', [ set(view, form) ])
- The prompt above is displayed only if the view is set to success.
- When the user clicks on the "New Swap" button he will set back the view to form.