Skip to content

Commit

Permalink
Merge pull request #20 from cryptonerdcn/feature/allow_warning
Browse files Browse the repository at this point in the history
Allow warning.
  • Loading branch information
cryptonerdcn authored Apr 17, 2024
2 parents 358d239 + a949de1 commit 4ee58ae
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wasm-cairo"
version = "0.8.3"
version = "0.8.4"
authors = ["cryptonerdcn <[email protected]>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wasm-cairo",
"version": "1.8.3",
"version": "1.8.4",
"description": "Wasm of Cairo compiler.",
"main": "index.js",
"scripts": {
Expand Down
15 changes: 8 additions & 7 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ pub fn main() -> anyhow::Result<()> {
}
"runCairoProgram" => {
let cairo_program_result_str =
run_cairo_program(args.input_program_string.unwrap(), None, true, true);
run_cairo_program(args.input_program_string.unwrap(), None, true, true, false, true);
println!("{}", cairo_program_result_str.unwrap());
}
"compileStarknetContract" => {
let sierra_contract_str =
compile_starknet_contract(args.input_program_string.unwrap(), true);
compile_starknet_contract(args.input_program_string.unwrap(), true, true);
println!("{}", sierra_contract_str.unwrap());
}
_ => {
Expand Down Expand Up @@ -75,16 +75,17 @@ fn compile_cairo_program(cairo_program: String, replace_ids: bool) -> Result<Str
fn run_cairo_program(
cairo_program: String,
available_gas: Option<usize>,
allow_warnings: bool,
print_full_memory: bool,
run_profiler: bool,
use_dbg_print_hint: bool,
) -> Result<String, Error> {
// TODO: Add support for run_profiler and allow_warnings
let cairo_program_result = run_with_input_program_string(
&cairo_program,
available_gas,
false,
allow_warnings,
print_full_memory,
false,
run_profiler,
use_dbg_print_hint,
);
let cairo_program_result_str = match cairo_program_result {
Expand All @@ -99,11 +100,11 @@ fn run_cairo_program(

fn compile_starknet_contract(
starknet_contract: String,
allow_warnings: bool,
replace_ids: bool,
) -> Result<String, Error> {
// TODO: Add support for allow_warnings
let sierra_contract =
starknet_wasm_compile_with_input_string(&starknet_contract, false, replace_ids, None, None, None);
starknet_wasm_compile_with_input_string(&starknet_contract, allow_warnings, replace_ids, None, None, None);
let sierra_contract_str = match sierra_contract {
Ok(sierra_program) => sierra_program.to_string(),
Err(e) => {
Expand Down
10 changes: 4 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,8 @@ pub fn compile_cairo_program(cairo_program: String, replace_ids: bool) -> Result
}

#[wasm_bindgen(js_name = runCairoProgram)]
pub fn run_cairo_program(cairo_program: String, available_gas: Option<usize>, print_full_memory: bool, use_dbg_print_hint: bool) -> Result<String, JsError> {
// TODO: Add support for run_profiler and allow_warnings
let cairo_program_result = run_with_input_program_string(&cairo_program, available_gas, false, print_full_memory, false, use_dbg_print_hint);
pub fn run_cairo_program(cairo_program: String, available_gas: Option<usize>, allow_warnings: bool, print_full_memory: bool, run_profiler: bool, use_dbg_print_hint: bool) -> Result<String, JsError> {
let cairo_program_result = run_with_input_program_string(&cairo_program, available_gas, allow_warnings, print_full_memory, run_profiler, use_dbg_print_hint);
let cairo_program_result_str = match cairo_program_result {
Ok(cairo_program_result_str) => {
cairo_program_result_str
Expand All @@ -59,9 +58,8 @@ pub fn run_cairo_program(cairo_program: String, available_gas: Option<usize>, pr
}

#[wasm_bindgen(js_name = compileStarknetContract)]
pub fn compile_starknet_contract(starknet_contract: String, replace_ids: bool) -> Result<String, JsError> {
// TODO: Add support for allow_warnings
let sierra_contract = starknet_wasm_compile_with_input_string(&starknet_contract, false, replace_ids, None, None, None);
pub fn compile_starknet_contract(starknet_contract: String, allow_warnings: bool, replace_ids: bool) -> Result<String, JsError> {
let sierra_contract = starknet_wasm_compile_with_input_string(&starknet_contract, allow_warnings, replace_ids, None, None, None);
let sierra_contract_str = match sierra_contract {
Ok(sierra_program) => {
sierra_program.to_string()
Expand Down

0 comments on commit 4ee58ae

Please sign in to comment.