1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use crate::ast::Constant;
use ergo_lib::sigma_protocol;
use wasm_bindgen::prelude::*;
extern crate derive_more;
use derive_more::{From, Into};
#[wasm_bindgen]
#[derive(PartialEq, Debug, Clone, From, Into)]
pub struct ContextExtension(sigma_protocol::prover::ContextExtension);
#[wasm_bindgen]
impl ContextExtension {
pub fn len(&self) -> usize {
self.0.values.len()
}
pub fn get(&self, key: u8) -> Constant {
self.0.values.get(&key).unwrap().clone().into()
}
pub fn keys(&self) -> Vec<u8> {
self.0.values.keys().cloned().collect()
}
}