创建名称为‘hello_world’的Cairo 本地程序项目
(1)执行命令:
$ scarb new hello_world
Created `hello_world` package.
(2)创建成功后,使用tree命令可以查看目录结构,如下:
$ tree
.
└── hello_world
├── Scarb.toml
└── src
└── lib.cairo
2 directories, 2 files
(3)如果该项目要作为 Starknet 合约进行编译的话,需要在Scarb.toml
中添加如下依赖:
[dependencies]
starknet = ">=2.1.0"
[[target.starknet-contract]]
添加后Scarb.toml文件内容如下:
$ cat Scarb.toml
[package]
name = "hello_world"
version = "0.1.0"
edition = "2023_10"
# See more keys and their definitions at https://docs.swmansion.com/scarb/docs/reference/manifest.html
[dependencies]
starknet = ">=2.1.0"
[[target.starknet-contract]]