Skip to content

Commit

Permalink
init-cairo1 docs (#1588)
Browse files Browse the repository at this point in the history
closes #1584

---------

Co-authored-by: Piotr Magiera <56825108+piotmag769@users.noreply.github.com>
  • Loading branch information
Arcticae and piotmag769 authored Mar 13, 2023
1 parent 306ec59 commit eef9da0
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
sidebar_label: Project initialization
---

# Project initialization

## Creating a project
To create a new Protostar project with cairo1 support, you will need to run the `protostar init-cairo1` command followed by the name of your project. For example:

```shell
protostar init-cairo1 my-project
```

After running the command, the following structure will be generated:

```
my-project/
├── src/
│ └── main.cairo
│ └── lib.cairo
│ └── cairo_project.toml
├── tests/
│ └── test_main.cairo
└── protostar.toml
```

This template contains:

- `src` directory
- `cairo_project.toml` which is needed for compilation
- `main.cairo` file with one function definition
- `lib.cairo` file which defines the module
- `test` directory
- Single test file with one test for function defined in `main.cairo`
- `protostar.toml` containing information about the project

## The protostar.toml
Apart from the usual things you can find in `protostar.toml`, there is a `linked-libarires` entry which is used to find cairo 1 modules in tests and building.
This makes it possible for you to include other modules from your dependencies if they are correct cairo 1 modules (with their own module definition and `cairo_project.toml`).

```
[project]
protostar-version = "0.9.2"
lib-path = "lib"
linked-libraries = ["src"]
[contracts]
```

:::warning
`[contracts]` section is not usable right now, since protostar can't build cairo 1 contracts yet
:::
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ It is a sibling command to the `test` command, it will collect all the tests in

Tests are run on Cairo VM, so no Starknet syscalls are available from the test code.

See [command reference](../../cli-reference.md#test-cairo1) for more details on usage.

:::info
There is no support currently for starknet contracts at the moment, it's a work in progress.
:::
Expand Down

0 comments on commit eef9da0

Please sign in to comment.