You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: gitlab-pages/docs/tutorials/taco-shop/testing-contract.md
+8-3Lines changed: 8 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -476,10 +476,15 @@ For example, you can test the `buy_taco` entrypoint with this command:
476
476
<Syntaxsyntax="jsligo">
477
477
478
478
```bash
479
-
ligo run dry-run taco_shop.jsligo -m TacoShop --amount 1 "Buy_taco(1n)" \
479
+
ligo run dry-run taco_shop.jsligo -m TacoShop --amount 1 '["Buy_taco" as "Buy_taco", 1 as nat]' \
480
480
'{admin_address: "tz1QCVQinE8iVj1H2fckqx6oiM85CNJSK9Sx" as address, taco_data: TacoShop.default_taco_data}'
481
481
```
482
482
483
+
The entrypoint and parameter in this command are formatted as a variant type.
484
+
When the contract is compiled to Michelson, its parameter is a variant that has cases for each entrypoint, so you must pass the variant that corresponds to the entrypoint.
485
+
For the purposes of the `ligo run dry-run` command, the variant type is the name of the entrypoint with the first letter in upper case.
486
+
Note also that you can use variables from the contract (as in `TacoShop.default_taco_data`) in the command because the contract parameter and storage value are LIGO expressions.
Note that the entrypoint name starts with a capital letter when you use it in a dry run.
495
498
Note also that you can use variables from the contract (as in `TacoShop.default_taco_data`) in the command because the contract parameter and storage value are LIGO expressions.
496
499
500
+
</Syntax>
501
+
497
502
The address in the dry run command isn't stored beyond this run of the command; you just need to provide any address for the amin address in storage.
498
503
However, you must use the `as address` declaration to specify that the string is a LIGO `address` type; without the type declaration, LIGO would assume that it was a string.
0 commit comments