Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

training-dapp-1 #462

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docs/tutorials/dapp.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
title: Create your minimum dapp on Tezos
authors: 'Benjamin Fuentes (Marigold)'
authors: 'Benjamin Fuentes'
last_update:
date: 27 November 2023
date: 29 October 2024
---

> dApp : A decentralized application is a type of distributed open source software application that runs on a peer-to-peer (P2P) blockchain network rather than on a single computer. DApps are visibly similar to other software applications that are supported on a website or mobile device.
Expand Down Expand Up @@ -33,8 +33,8 @@ This tutorial uses Typescript, so it will be easier if you are familiar with Jav

1. Make sure that you have installed these tools:

- [Node.JS and NPM](https://nodejs.org/en/download/): NPM is required to install the web application's dependencies.
- [Taqueria](https://taqueria.io/), version 0.45.0 or later: Taqueria is a platform that makes it easier to develop and test dApps.
- [Node.JS and NPM](https://nodejs.org/en/download/): NPM is required to install the web application's dependencies and node version >=20
- [Taqueria](https://taqueria.io/), version 0.62.0 or later: Taqueria is a platform that makes it easier to develop and test dApps.
- [Docker](https://docs.docker.com/engine/install/): Docker is required to run Taqueria.
- [jq](https://stedolan.github.io/jq/download/): Some commands use the `jq` program to extract JSON data.
- [`yarn`](https://yarnpkg.com/): The frontend application uses yarn to build and run (see this article for details about [differences between `npm` and `yarn`](https://www.geeksforgeeks.org/difference-between-npm-and-yarn/)).
Expand All @@ -51,6 +51,6 @@ The application looks like this:

![Example of the table of addresses and which addresses poked them](/img/tutorials/dapp-table.png)

The code for the completed application is in this GitHub repository: [solution](https://github.com/marigold-dev/training-dapp-1/tree/main/solution)
The code for the completed application is in this GitHub repository: [solution]( https://github.com/trilitech/tutorial-applications/tree/main/training-dapp-1)

When you're ready, move to the next section [Create your minimum dApp on Tezos](/tutorials/dapp/part-1) to begin setting up the application.
10 changes: 5 additions & 5 deletions docs/tutorials/dapp/part-1.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
title: 'Part 1: Create your minimum dApp on Tezos'
authors: 'Benjamin Fuentes (Marigold)'
authors: 'Benjamin Fuentes'
last_update:
date: 22 May 2024
date: 29 October 2024
---

To start working with the application, you create a Taqueria project and use it to deploy the Poke contract.
Expand Down Expand Up @@ -97,7 +97,7 @@ The LIGO command-line provides sub-commands to test your LIGO code.
1. Compile the contract with Taqueria (Force to use a specific LIGO version with `TAQ_LIGO_IMAGE` Taqueria environment variable).

```bash
TAQ_LIGO_IMAGE=ligolang/ligo:1.6.0 taq compile pokeGame.jsligo
TAQ_LIGO_IMAGE=ligolang/ligo:1.7.0 taq compile pokeGame.jsligo
```

Taqueria is generating the `.tz` Michelson file in the `artifacts` folder. The Michelson language is the default stack language used by the Michelson VM to run your code on a node. It is something similar to WASM.
Expand All @@ -119,7 +119,7 @@ The LIGO command-line provides sub-commands to test your LIGO code.
1. Compile all (contract + initial storage)

```bash
TAQ_LIGO_IMAGE=ligolang/ligo:1.6.0 taq compile pokeGame.jsligo
TAQ_LIGO_IMAGE=ligolang/ligo:1.7.0 taq compile pokeGame.jsligo
```

It compiles both source code and storage.
Expand All @@ -138,7 +138,7 @@ The LIGO command-line provides sub-commands to test your LIGO code.

```bash
taq install @taqueria/plugin-octez-client
TAQ_LIGO_IMAGE=ligolang/ligo:1.6.0 taq compile pokeGame.jsligo
TAQ_LIGO_IMAGE=ligolang/ligo:1.7.0 taq compile pokeGame.jsligo
taq simulate pokeGame.tz --param pokeGame.parameter.default_parameter.tz
```

Expand Down
24 changes: 12 additions & 12 deletions docs/tutorials/dapp/part-2.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: 'Part 2: Inter-contract calls and testing'
authors: 'Benjamin Fuentes (Marigold)'
authors: 'Benjamin Fuentes'
last_update:
date: 22 May 2024
---
Expand All @@ -27,13 +27,13 @@ sequenceDiagram

## Get the code

Get the code from the first session: https://github.com/marigold-dev/training-dapp-1/blob/main/solution
Get the code from the first session: https://github.com/trilitech/tutorial-applications/tree/main/training-dapp-1

```bash
git clone https://github.com/marigold-dev/training-dapp-1.git
git clone https://github.com/trilitech/tutorial-applications.git
```

Reuse the code from the previous smart contract: https://github.com/marigold-dev/training-dapp-1/blob/main/solution/contracts/pokeGame.jsligo
Reuse the code from the previous smart contract: https://github.com/trilitech/tutorial-applications/tree/main/training-dapp-1/contracts/pokeGame.jsligo

Install all libraries locally:

Expand Down Expand Up @@ -103,7 +103,7 @@ sequenceDiagram
1. Compile your contract.

```bash
TAQ_LIGO_IMAGE=ligolang/ligo:1.6.0 taq compile pokeGame.jsligo
TAQ_LIGO_IMAGE=ligolang/ligo:1.7.0 taq compile pokeGame.jsligo
```

Write a second function `pokeAndGetFeedback` involving the call to another contract a bit later, let's do unit testing first!
Expand Down Expand Up @@ -213,7 +213,7 @@ sequenceDiagram
1. Run the test

```bash
TAQ_LIGO_IMAGE=ligolang/ligo:1.6.0 taq test unit_pokeGame.jsligo
TAQ_LIGO_IMAGE=ligolang/ligo:1.7.0 taq test unit_pokeGame.jsligo
```

The output should give you intermediary logs and finally the test results.
Expand Down Expand Up @@ -329,7 +329,7 @@ The function to call on the second contract is `GetFeedback: (contract_callback:
1. Compile the contract.

```bash
TAQ_LIGO_IMAGE=ligolang/ligo:1.6.0 taq compile pokeGame.jsligo
TAQ_LIGO_IMAGE=ligolang/ligo:1.7.0 taq compile pokeGame.jsligo
```

1. (Optional) Write a unit test for this new function `pokeAndGetFeedback`.
Expand Down Expand Up @@ -397,7 +397,7 @@ sequenceDiagram
1. Compile the contract.

```bash
TAQ_LIGO_IMAGE=ligolang/ligo:1.6.0 taq compile pokeGame.jsligo
TAQ_LIGO_IMAGE=ligolang/ligo:1.7.0 taq compile pokeGame.jsligo
```

1. (Optional) Write a unit test for the updated function `pokeAndGetFeedback`.
Expand Down Expand Up @@ -479,7 +479,7 @@ The higher the percentage of mutants killed, the more effective your tests are.
1. Run the test.

```bash
TAQ_LIGO_IMAGE=ligolang/ligo:1.6.0 taq test mutation_pokeGame.jsligo
TAQ_LIGO_IMAGE=ligolang/ligo:1.7.0 taq test mutation_pokeGame.jsligo
```

Output:
Expand Down Expand Up @@ -531,7 +531,7 @@ The higher the percentage of mutants killed, the more effective your tests are.
1. Run again the mutation tests.

```bash
TAQ_LIGO_IMAGE=ligolang/ligo:1.6.0 taq test mutation_pokeGame.jsligo
TAQ_LIGO_IMAGE=ligolang/ligo:1.7.0 taq test mutation_pokeGame.jsligo
```

Output
Expand All @@ -557,14 +557,14 @@ The higher the percentage of mutants killed, the more effective your tests are.

## Update the frontend

1. Reuse the dApp files from [the previous session](https://github.com/marigold-dev/training-dapp-1/tree/main/solution/app).
1. Reuse the dApp files from [the previous session](https://github.com/trilitech/tutorial-applications/tree/main/training-dapp-1/app).

1. Redeploy a new version of the smart contract.

> Note: You can set `feedback` value to any action other than default `kiss` string (it is more fun for other to discover it).

```bash
TAQ_LIGO_IMAGE=ligolang/ligo:1.6.0 taq compile pokeGame.jsligo
TAQ_LIGO_IMAGE=ligolang/ligo:1.7.0 taq compile pokeGame.jsligo
taq generate types ./app/src
taq deploy pokeGame.tz -e "testing"
```
Expand Down
14 changes: 7 additions & 7 deletions docs/tutorials/dapp/part-3.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: 'Part 3: Tickets'
authors: 'Benjamin Fuentes (Marigold)'
authors: 'Benjamin Fuentes'
last_update:
date: 22 May 2024
---
Expand Down Expand Up @@ -31,9 +31,9 @@ sequenceDiagram

## Prerequisites

Prerequisites are the same as the first session: https://github.com/marigold-dev/training-dapp-1#memo-prerequisites.
Prerequisites are the same as the first session: https://docs.tezos.com/tutorials/dapp#prerequisites.

Get the code from the session 2 solution [here](https://github.com/marigold-dev/training-dapp-2/tree/main/solution).
Get the code from the session 2 solution [here](https://github.com/trilitech/tutorial-applications/tree/main/training-dapp-2).

## Tickets

Expand Down Expand Up @@ -221,7 +221,7 @@ Minting is the action of creating a ticket from the void. In general, minting op
```bash
npm i

TAQ_LIGO_IMAGE=ligolang/ligo:1.6.0 taq compile pokeGame.jsligo
TAQ_LIGO_IMAGE=ligolang/ligo:1.7.0 taq compile pokeGame.jsligo
```

Check on logs that everything is fine.
Expand All @@ -237,7 +237,7 @@ Minting is the action of creating a ticket from the void. In general, minting op
1. Compile again.

```bash
TAQ_LIGO_IMAGE=ligolang/ligo:1.6.0 taq compile pokeGame.jsligo
TAQ_LIGO_IMAGE=ligolang/ligo:1.7.0 taq compile pokeGame.jsligo
```

This time you should see the `DUP` warning generated by the **find** function.
Expand Down Expand Up @@ -368,7 +368,7 @@ Update the unit test files to see if you can still poke.
1. Run the test, and look at the logs to track execution.

```bash
TAQ_LIGO_IMAGE=ligolang/ligo:1.6.0 taq test unit_pokeGame.jsligo
TAQ_LIGO_IMAGE=ligolang/ligo:1.7.0 taq test unit_pokeGame.jsligo
```

The first test should be fine.
Expand Down Expand Up @@ -408,7 +408,7 @@ Update the unit test files to see if you can still poke.
Let's play with the CLI to compile and deploy.

```bash
TAQ_LIGO_IMAGE=ligolang/ligo:1.6.0 taq compile pokeGame.jsligo
TAQ_LIGO_IMAGE=ligolang/ligo:1.7.0 taq compile pokeGame.jsligo
taq generate types ./app/src
taq deploy pokeGame.tz -e testing
```
Expand Down
30 changes: 15 additions & 15 deletions docs/tutorials/dapp/part-4.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: 'Part 4: Smart contract upgrades'
authors: 'Benjamin Fuentes (Marigold)'
authors: 'Benjamin Fuentes'
last_update:
date: 22 May 2024
---
Expand All @@ -19,9 +19,9 @@ Let's see some tricks that allow you to upgrade a contract.

# Prerequisites

There is nothing more than you need on the first session: https://github.com/marigold-dev/training-dapp-1#memo-prerequisites.
There is nothing more than you need on the first session: https://docs.tezos.com/tutorials/dapp#prerequisites.

Get the code from the session 3 or the solution [here](https://github.com/marigold-dev/training-dapp-3/tree/main/solution).
Get the code from the session 3 or the solution [here](https://github.com/trilitech/tutorial-applications/tree/main/training-dapp-3).

# Upgrades

Expand Down Expand Up @@ -262,7 +262,7 @@ It is required to:

```bash
npm i
TAQ_LIGO_IMAGE=ligolang/ligo:1.6.0 taq compile pokeGame.jsligo
TAQ_LIGO_IMAGE=ligolang/ligo:1.7.0 taq compile pokeGame.jsligo
```

1. Redeploy to testnet
Expand Down Expand Up @@ -310,7 +310,7 @@ It is required to:
1. Compile all and call an init transaction.

```bash
TAQ_LIGO_IMAGE=ligolang/ligo:1.6.0 taq compile pokeGame.jsligo
TAQ_LIGO_IMAGE=ligolang/ligo:1.7.0 taq compile pokeGame.jsligo
taq call pokeGame --param pokeGame.parameter.default_parameter.tz -e testing
```

Expand Down Expand Up @@ -706,7 +706,7 @@ sequenceDiagram
1. Compile.

```bash
TAQ_LIGO_IMAGE=ligolang/ligo:1.6.0 taq compile pokeGame.jsligo
TAQ_LIGO_IMAGE=ligolang/ligo:1.7.0 taq compile pokeGame.jsligo
```

All good.
Expand Down Expand Up @@ -928,7 +928,7 @@ sequenceDiagram
1. Compile.

```bash
TAQ_LIGO_IMAGE=ligolang/ligo:1.6.0 taq compile proxy.jsligo
TAQ_LIGO_IMAGE=ligolang/ligo:1.7.0 taq compile proxy.jsligo
```

#### Deployment
Expand All @@ -950,7 +950,7 @@ sequenceDiagram
1. Compile and deploy it.

```bash
TAQ_LIGO_IMAGE=ligolang/ligo:1.6.0 taq compile proxy.jsligo
TAQ_LIGO_IMAGE=ligolang/ligo:1.7.0 taq compile proxy.jsligo
taq deploy proxy.tz -e testing
```

Expand Down Expand Up @@ -985,7 +985,7 @@ sequenceDiagram
1. Deploy the underlying V1 contract.

```bash
TAQ_LIGO_IMAGE=ligolang/ligo:1.6.0 taq compile pokeGame.jsligo
TAQ_LIGO_IMAGE=ligolang/ligo:1.7.0 taq compile pokeGame.jsligo
taq deploy pokeGame.tz -e testing
```

Expand Down Expand Up @@ -1073,7 +1073,7 @@ sequenceDiagram
1. Compile & Call it.

```bash
TAQ_LIGO_IMAGE=ligolang/ligo:1.6.0 taq compile proxy.jsligo
TAQ_LIGO_IMAGE=ligolang/ligo:1.7.0 taq compile proxy.jsligo
taq call proxy --param proxy.parameter.initProxyWithV1.tz -e testing
```

Expand Down Expand Up @@ -1102,8 +1102,8 @@ sequenceDiagram
1. Go on the frontend side, recompile all, and generate typescript classes.

```bash
TAQ_LIGO_IMAGE=ligolang/ligo:1.6.0 taq compile pokeGame.jsligo
TAQ_LIGO_IMAGE=ligolang/ligo:1.6.0 taq compile proxy.jsligo
TAQ_LIGO_IMAGE=ligolang/ligo:1.7.0 taq compile pokeGame.jsligo
TAQ_LIGO_IMAGE=ligolang/ligo:1.7.0 taq compile proxy.jsligo
taq generate types ./app/src
```

Expand Down Expand Up @@ -1406,7 +1406,7 @@ sequenceDiagram
```

```bash
TAQ_LIGO_IMAGE=ligolang/ligo:1.6.0 taq compile pokeGame.jsligo
TAQ_LIGO_IMAGE=ligolang/ligo:1.7.0 taq compile pokeGame.jsligo
taq deploy pokeGame.tz -e testing --storage pokeGame.storage.storageV2.tz
```

Expand Down Expand Up @@ -1492,7 +1492,7 @@ sequenceDiagram
1. Call the proxy to make the changes.

```bash
TAQ_LIGO_IMAGE=ligolang/ligo:1.6.0 taq compile proxy.jsligo
TAQ_LIGO_IMAGE=ligolang/ligo:1.7.0 taq compile proxy.jsligo
taq call proxy --param proxy.parameter.initProxyWithV2.tz -e testing
```

Expand Down Expand Up @@ -1549,7 +1549,7 @@ sequenceDiagram
1. Compile.

```bash
TAQ_LIGO_IMAGE=ligolang/ligo:1.6.0 taq compile proxy.jsligo
TAQ_LIGO_IMAGE=ligolang/ligo:1.7.0 taq compile proxy.jsligo
taq call proxy --param proxy.parameter.changeVersionV1ToV2.tz -e testing
```

Expand Down
Loading