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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#[macro_use]
extern crate cfg_if;
#[cfg(target_arch = "wasm32")]
extern crate wasm_bindgen;
#[cfg(target_arch = "wasm32")]
extern crate cxmr_currency;
cfg_if! {
if #[cfg(target_arch = "wasm32")] {
extern crate console_error_panic_hook;
#[allow(unused_imports)]
use console_error_panic_hook::set_once as set_panic_hook;
}
}
cfg_if! {
if #[cfg(target_arch = "wasm32")] {
extern crate wee_alloc;
#[global_allocator]
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
}
}
#[cfg(target_arch = "wasm32")]
pub mod currency {
use std::str::FromStr;
use wasm_bindgen::prelude::*;
use cxmr_currency::CurrencyPair;
#[wasm_bindgen]
pub fn split_pair(s: &str) -> CurrencyPair {
CurrencyPair::from_str(s).unwrap()
}
}