-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b484130
commit 4b5074f
Showing
9 changed files
with
8,681 additions
and
3,314 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
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,10 +1,87 @@ | ||
<div align="center"> | ||
|
||
<h1><code>WASM-CAIRO</code></h1> | ||
<h1><code>WASM-Cairo</code></h1> | ||
|
||
<strong>A Cairo Webassembly Project.</strong> | ||
<strong>A suite of development tools and an environment for Cairo 1.10, all based on WebAssembly.</strong> | ||
|
||
<p> | ||
By CryptonerCN@StarknetAstro | ||
</p> | ||
<sub>Built with 🦀🕸 by <a href="https://twitter.com/cryptonerdcn">cryptonerdcn from Starknet Astro</a></sub> | ||
</div> | ||
|
||
|
||
## 🚴 Usage | ||
|
||
|
||
### 🛠️ Build WASM-bindgen's WASM-Cairo Toolkit | ||
With Modules | ||
|
||
``` | ||
wasm-pack build --release --target --out-dir ./pkg | ||
``` | ||
|
||
No Modules | ||
|
||
``` | ||
wasm-pack build --release --target no-modules --out-dir ./pkg | ||
``` | ||
|
||
You will find `wasm-cairo_bg.wasm` and `wasm-cairo.js` in `pkg` folder. | ||
|
||
|
||
### 🛠️ Build Astro Editor | ||
|
||
``` | ||
wasm-pack build --release --target no-modules --out-dir ./dist/pkg --out-name wasm-cairo | ||
``` | ||
|
||
Then run | ||
``` | ||
node app.js | ||
``` | ||
For local web instance. | ||
|
||
### 🛠️ Build WASMTIME's WASM-Cairo Toolkit | ||
|
||
``` | ||
cargo build --target wasm32-wasi --release | ||
``` | ||
|
||
You can test it by using: | ||
|
||
Compile Cairo | ||
|
||
``` | ||
./wasmtime_test.sh compileCairoProgram ./cairo_files/HelloStarknetAstro.cairo ./cairo_files/HelloStarknetAstro.sierra | ||
``` | ||
|
||
Run | ||
``` | ||
./wasmtime_test.sh runCairoProgram ./cairo_files/HelloStarknetAstro.cairo | ||
``` | ||
|
||
Compile Contract | ||
|
||
``` | ||
./wasmtime_test.sh compileStarknetContract ./cairo_files/erc20.cairo ./cairo_files/erc20.json | ||
``` | ||
|
||
## 🔋 Batteries Included | ||
|
||
* [`wasm-bindgen`](https://github.com/rustwasm/wasm-bindgen) for communicating | ||
between WebAssembly and JavaScript. | ||
* [`console_error_panic_hook`](https://github.com/rustwasm/console_error_panic_hook) | ||
for logging panic messages to the developer console. | ||
* [`wee_alloc`](https://github.com/rustwasm/wee_alloc), an allocator optimized | ||
for small code size. | ||
* [`Cairo`](https://github.com/starkware-libs/cairo) for Cairo-lang support. | ||
* `LICENSE-APACHE` and `LICENSE-MIT`: most Rust projects are licensed this way, so these are included for you | ||
|
||
## License | ||
|
||
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) | ||
|
||
### Contribution | ||
|
||
Unless you explicitly state otherwise, any contribution intentionally | ||
submitted for inclusion in the work by you, as defined in the Apache-2.0 | ||
license, shall be dual licensed as above, without any additional terms or | ||
conditions. |
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