Skip to content

Commit 4ee58ae

Browse files
authored
Merge pull request #20 from cryptonerdcn/feature/allow_warning
Allow warning.
2 parents 358d239 + a949de1 commit 4ee58ae

File tree

5 files changed

+15
-16
lines changed

5 files changed

+15
-16
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "wasm-cairo"
3-
version = "0.8.3"
3+
version = "0.8.4"
44
authors = ["cryptonerdcn <cryptonerdcn@gmail.com>"]
55
edition = "2018"
66

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "wasm-cairo",
3-
"version": "1.8.3",
3+
"version": "1.8.4",
44
"description": "Wasm of Cairo compiler.",
55
"main": "index.js",
66
"scripts": {

src/cli.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ pub fn main() -> anyhow::Result<()> {
3737
}
3838
"runCairoProgram" => {
3939
let cairo_program_result_str =
40-
run_cairo_program(args.input_program_string.unwrap(), None, true, true);
40+
run_cairo_program(args.input_program_string.unwrap(), None, true, true, false, true);
4141
println!("{}", cairo_program_result_str.unwrap());
4242
}
4343
"compileStarknetContract" => {
4444
let sierra_contract_str =
45-
compile_starknet_contract(args.input_program_string.unwrap(), true);
45+
compile_starknet_contract(args.input_program_string.unwrap(), true, true);
4646
println!("{}", sierra_contract_str.unwrap());
4747
}
4848
_ => {
@@ -75,16 +75,17 @@ fn compile_cairo_program(cairo_program: String, replace_ids: bool) -> Result<Str
7575
fn run_cairo_program(
7676
cairo_program: String,
7777
available_gas: Option<usize>,
78+
allow_warnings: bool,
7879
print_full_memory: bool,
80+
run_profiler: bool,
7981
use_dbg_print_hint: bool,
8082
) -> Result<String, Error> {
81-
// TODO: Add support for run_profiler and allow_warnings
8283
let cairo_program_result = run_with_input_program_string(
8384
&cairo_program,
8485
available_gas,
85-
false,
86+
allow_warnings,
8687
print_full_memory,
87-
false,
88+
run_profiler,
8889
use_dbg_print_hint,
8990
);
9091
let cairo_program_result_str = match cairo_program_result {
@@ -99,11 +100,11 @@ fn run_cairo_program(
99100

100101
fn compile_starknet_contract(
101102
starknet_contract: String,
103+
allow_warnings: bool,
102104
replace_ids: bool,
103105
) -> Result<String, Error> {
104-
// TODO: Add support for allow_warnings
105106
let sierra_contract =
106-
starknet_wasm_compile_with_input_string(&starknet_contract, false, replace_ids, None, None, None);
107+
starknet_wasm_compile_with_input_string(&starknet_contract, allow_warnings, replace_ids, None, None, None);
107108
let sierra_contract_str = match sierra_contract {
108109
Ok(sierra_program) => sierra_program.to_string(),
109110
Err(e) => {

src/lib.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,8 @@ pub fn compile_cairo_program(cairo_program: String, replace_ids: bool) -> Result
4343
}
4444

4545
#[wasm_bindgen(js_name = runCairoProgram)]
46-
pub fn run_cairo_program(cairo_program: String, available_gas: Option<usize>, print_full_memory: bool, use_dbg_print_hint: bool) -> Result<String, JsError> {
47-
// TODO: Add support for run_profiler and allow_warnings
48-
let cairo_program_result = run_with_input_program_string(&cairo_program, available_gas, false, print_full_memory, false, use_dbg_print_hint);
46+
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> {
47+
let cairo_program_result = run_with_input_program_string(&cairo_program, available_gas, allow_warnings, print_full_memory, run_profiler, use_dbg_print_hint);
4948
let cairo_program_result_str = match cairo_program_result {
5049
Ok(cairo_program_result_str) => {
5150
cairo_program_result_str
@@ -59,9 +58,8 @@ pub fn run_cairo_program(cairo_program: String, available_gas: Option<usize>, pr
5958
}
6059

6160
#[wasm_bindgen(js_name = compileStarknetContract)]
62-
pub fn compile_starknet_contract(starknet_contract: String, replace_ids: bool) -> Result<String, JsError> {
63-
// TODO: Add support for allow_warnings
64-
let sierra_contract = starknet_wasm_compile_with_input_string(&starknet_contract, false, replace_ids, None, None, None);
61+
pub fn compile_starknet_contract(starknet_contract: String, allow_warnings: bool, replace_ids: bool) -> Result<String, JsError> {
62+
let sierra_contract = starknet_wasm_compile_with_input_string(&starknet_contract, allow_warnings, replace_ids, None, None, None);
6563
let sierra_contract_str = match sierra_contract {
6664
Ok(sierra_program) => {
6765
sierra_program.to_string()

0 commit comments

Comments
 (0)