-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also, some of `charms-spell-checker` and `charms`.
- Loading branch information
Showing
12 changed files
with
149 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
`charms_data` provides data types and functions for Charms apps. | ||
|
||
`charms_data::util` provides simple CBOR serialization/deserialization functions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
This is the only crate you need to get started coding a Charms app. | ||
|
||
## Usage | ||
|
||
Run this command to create a new Charms app: | ||
|
||
```sh | ||
charms app new my-app | ||
``` | ||
|
||
It will create a new directory called `my-app` with a basic Charms app template. | ||
|
||
It'll have this in `Cargo.toml`: | ||
|
||
```toml | ||
[dependencies] | ||
charms-sdk = { version = "0.3.0" } | ||
``` | ||
|
||
This is how the entire `src/main.rs` looks like: | ||
|
||
```rust | ||
#![no_main] | ||
charms_sdk::main!(my_app::app_contract); | ||
``` | ||
|
||
The most important function in the app is `app_contract` in `src/lib.rs`: | ||
|
||
```rust | ||
use charms_sdk::data::{ | ||
check, App, Data, Transaction, NFT, TOKEN, | ||
}; | ||
|
||
pub fn app_contract(app: &App, tx: &Transaction, x: &Data, w: &Data) -> bool { | ||
match app.tag { | ||
NFT => { | ||
check!(nft_contract_satisfied(app, tx, x, w)) | ||
} | ||
TOKEN => { | ||
check!(token_contract_satisfied(app, tx, x, w)) | ||
} | ||
_ => todo!(), | ||
} | ||
true | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
`charms-spell-checker` is not a spelling checker: it's a validator for spells. | ||
|
||
It is run inside a zkVM to produce recursive proofs of correctness for spells — metadata on top of transactions that | ||
specifies what charms are created on top of transactions' outputs. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters