0xPolygonMiden / examples

Examples of using Polygon Miden
MIT License
18 stars 18 forks source link

feat: Sending structs from Rust to TS #74

Closed Dominik1999 closed 1 year ago

Dominik1999 commented 1 year ago

Closes #52

I created a new struct in the Rust backend called Outputs. Outputs are returned to the React frontend when running run_program or prove_program. Outputs include

#[wasm_bindgen(getter_with_clone)]
pub struct Outputs {
    pub stack_output: Vec<u64>, 
    pub trace_length: usize,
    pub program_info: Option<Vec<u8>>,
    pub overflow_addrs: Option<Vec<u64>>,
    pub proof: Option<Vec<u8>>,
}

The proof is stored in the browser for later use

        // Store the proof in the session storage
        if (proof) {
          sessionStorage.setItem("proof", proof.toString())  
          }
Fumuran commented 1 year ago

I think we should update the Outputs struct in the PR comment, since now it also stores program_info. But still looks good to me!