Skip to content

Commit

Permalink
Update README.md testing guide
Browse files Browse the repository at this point in the history
  • Loading branch information
DelevoXDG committed Sep 14, 2023
1 parent 9d4a2a3 commit 90ea5f5
Showing 1 changed file with 24 additions and 20 deletions.
44 changes: 24 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Just add the package to the dependencies array in your `Package.swift` file:
```Swift
dependencies: [
...
.package(url: "https://github.com/software-mansion/starknet.swift.git", from: "0.1.0")
.package(url: "https://github.com/software-mansion/starknet.swift.git", from: "0.7.0")
]

Then add `starknet.swift` to the dependencies array of every target you want to use the package in.
Expand All @@ -34,38 +34,42 @@ and run the demo app on ios simulator, to be able to access the local devnet ins

## Development

#### Git hooks
### Git hooks
Install hooks by running `install_hooks.sh` script from `Scripts` folder.

#### Code formatting
### Code formatting
This project uses [SwiftFormat](https://github.com/nicklockwood/SwiftFormat) for linting and formatting code. You can install it by running `brew install swiftformat`. Unformatted code will be rejected by pre push hook and lint github action. To format code in the project, run
```
```bash
swiftformat .
```
in main project directory.

#### Testing
Due to reliability on `starknet-devnet` for testing, tests can only be ran on macos targets. Additionaly you'll need to set two environment variables.
`DEVNET_PATH` that points to `starknet-devnet` cli, and `STARKNET_PATH` that points to `starknet` cli. You can set them in xcode scheme or by running these
commands:

```
export DEVNET_PATH="$(which starknet-devnet)"
export STARKNET_PATH="$(which starknet)"
### Testing
#### Platforms
Due to reliability on `starknet-devnet-rs` for testing, tests can be ran on **macOS targets only**.
#### Prerequisites
You will need to set some environment variables:
- `DEVNET_PATH` - points to `starknet-devnet-rs` cli
- `SCARB_PATH` - points to `scarb` cli.
- `SNCAST_PATH` - points to `sncast` cli.

You can set them in XCode scheme or by running these commands:
```bash
export DEVNET_PATH="$(which starknet-devnet-rs)"
export SCARB_PATH="$(which scarb)"
export SNCAST_PATH="$(which sncast)"
```
This assumes you already have installed [`starknet-devnet`](https://github.com/Shard-Labs/starknet-devnet) and [`cairo-lang`](https://www.cairo-lang.org/docs/quickstart.html) python packages.
This assumes you already have the following tools installed:
- [`starknet-devnet-rs`](https://github.com/0xSpaceShard/starknet-devnet-rs)
- [`scarb`](https://github.com/software-mansion/scarb)
- [`starknet-foundry`](https://github.com/foundry-rs/starknet-foundry) - provides `sncast` module

---

The compiled contracts are required for testing. They can be generated by running the following command:
```
./Tests/StarknetTests/Resources/compileContracts.sh
```

#### Binary dependencies
## Binary dependencies
This project depends on two binary frameworks.
- crypto-cpp from starkware, with c bindings. Compiled for ios and macosx targets. Built in [this repo](https://github.com/software-mansion-labs/crypto-cpp-swift)
- generate_k method, from starknet-rs sdk, wrapped in a c binding. Compiled for ios and macosx targets. Built in [this repo](https://github.com/bartekryba/starknet-rs-c-bindings)

### Acknowledgements
## Acknowledgements
This product includes software developed by the "Marcin Krzyzanowski" (http://krzyzanowskim.com/).

0 comments on commit 90ea5f5

Please sign in to comment.