Skip to content

Commit

Permalink
add a tip about the witgen macro
Browse files Browse the repository at this point in the history
  • Loading branch information
ryancwalsh authored Jul 25, 2022
1 parent e57cdef commit 7e8064c
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,33 @@ How much does this increase your contract size? In our tests so far, contracts c

This admin panel then reads in that Custom Section, decompresses the brotli, and uses [react-jsonschema-form](https://github.com/rjsf-team/react-jsonschema-form) to allow interacting with the contract.

# Tips

## witgen macro

If you define a type that RAEN doesn't recognize (such as in this line `type Amount = Balance;` where RAEN doesn't recognize `Amount`), your build may result in an error like:

```
You probably need to add a `witgen` macro to the missing type
Add 'witgen' as a dependency to add to type definition. e.g.
Error: no type named `amount`
```

To fix this:

1. You might want to run `cargo add witgen` (which will edit your `Cargo.toml` to include a line like `witgen = "0.14.0"`).
2. Add `use witgen::witgen;` near the top of the file that was causing the error.
3. Add `#[witgen]` as a line before the definition of the type. E.g.:

```
use witgen::witgen;
#[witgen]
type Amount = Balance;
```

# Contribute

* Clone this repository
Expand Down

0 comments on commit 7e8064c

Please sign in to comment.