Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 33 additions & 30 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wasm-cairo"
version = "0.10.2"
version = "0.10.3"
authors = ["cryptonerdcn <cryptonerdcn@gmail.com> (https://twitter.com/cryptonerdcn)"]
edition = "2018"
description = "WASM runtime for Cairo language and Starknet"
Expand All @@ -18,10 +18,11 @@ default = ["console_error_panic_hook", "wee_alloc"]
clap = { version = "4.2.5", features = ["derive"] }
serde_json = "1.0.91"
wasm-bindgen = "0.2.87"
cairo-lang-starknet = { package = "cairo-lang-starknet", git = "https://github.com/cryptonerdcn/cairo.git", rev = "37b729536426532aee6c0633090e5a1e46a2b197"}
cairo-lang-compiler = { package = "cairo-lang-compiler", git = "https://github.com/cryptonerdcn/cairo.git", rev = "37b729536426532aee6c0633090e5a1e46a2b197"}
cairo-lang-runner = { package = "cairo-lang-runner", git = "https://github.com/cryptonerdcn/cairo.git", rev = "37b729536426532aee6c0633090e5a1e46a2b197", features = ["alloc"], default-features = false}
cairo-lang-test-runner = { package = "cairo-lang-test-runner", git = "https://github.com/cryptonerdcn/cairo.git", rev = "37b729536426532aee6c0633090e5a1e46a2b197", features = ["alloc"], default-features = false}
js-sys = "0.3"
cairo-lang-starknet = { package = "cairo-lang-starknet", git = "https://github.com/cryptonerdcn/cairo.git", rev = "79c83907997f9b715d25e9b6693a06c56f482cab"}
cairo-lang-compiler = { package = "cairo-lang-compiler", git = "https://github.com/cryptonerdcn/cairo.git", rev = "79c83907997f9b715d25e9b6693a06c56f482cab"}
cairo-lang-runner = { package = "cairo-lang-runner", git = "https://github.com/cryptonerdcn/cairo.git", rev = "79c83907997f9b715d25e9b6693a06c56f482cab", features = ["alloc"], default-features = false}
cairo-lang-test-runner = { package = "cairo-lang-test-runner", git = "https://github.com/cryptonerdcn/cairo.git", rev = "79c83907997f9b715d25e9b6693a06c56f482cab", features = ["alloc"], default-features = false}


# The `console_error_panic_hook` crate provides better debugging of panics by
Expand Down
22 changes: 21 additions & 1 deletion src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::{path::Path, result};
use cairo_lang_compiler::{
wasm_cairo_interface::compile_cairo_project_with_input_string, CompilerConfig,
};
use cairo_lang_runner::wasm_cairo_interface::run_with_input_program_string;
use cairo_lang_runner::wasm_cairo_interface::{run_with_input_program_string, run_with_sierra_json_string};
use cairo_lang_starknet::wasm_cairo_interface::starknet_wasm_compile_with_input_string;
use cairo_lang_test_runner::wasm_cairo_interface::run_tests_with_input_string_parsed;
/// Command line args parser.
Expand Down Expand Up @@ -41,6 +41,11 @@ pub fn main() -> anyhow::Result<()> {
run_cairo_program(args.input_program_string.unwrap(), None, true, true, false, true);
println!("{}", cairo_program_result_str.unwrap());
}
"runSierraProgram" => {
let sierra_program_result_str =
run_sierra_program(args.input_program_string.unwrap(), None, true, false, true);
println!("{}", sierra_program_result_str.unwrap());
}
"runTests" => {
let test_results_str = run_tests(args.input_program_string.unwrap());
println!("{}", test_results_str.unwrap());
Expand Down Expand Up @@ -103,6 +108,21 @@ fn run_cairo_program(
Ok(cairo_program_result_str)
}

fn run_sierra_program(
sierra_program: String,
available_gas: Option<usize>,
print_full_memory: bool,
run_profiler: bool,
use_dbg_print_hint: bool,
) -> Result<String, Error> {
let sierra_program_result = run_with_sierra_json_string(&sierra_program, available_gas, print_full_memory, run_profiler, use_dbg_print_hint);
let result_str = match sierra_program_result {
Ok(result) => result,
Err(e) => e.to_string()
};
Ok(result_str)
}

fn compile_starknet_contract(
starknet_contract: String,
allow_warnings: bool,
Expand Down
Loading