|
@@ -1,53 +1,10 @@
|
|
|
use std::ops::Deref;
|
|
|
|
|
|
-use cashu::nuts::{RequestMintResponse, SplitRequest, SplitResponse};
|
|
|
+use cashu::nuts::{SplitRequest, SplitResponse};
|
|
|
use wasm_bindgen::prelude::*;
|
|
|
|
|
|
use crate::error::{into_err, Result};
|
|
|
-use crate::types::{JsAmount, JsBolt11Invoice};
|
|
|
-
|
|
|
-#[wasm_bindgen(js_name = RequestMintResponse)]
|
|
|
-pub struct JsRequestMintResponse {
|
|
|
- inner: RequestMintResponse,
|
|
|
-}
|
|
|
-
|
|
|
-impl Deref for JsRequestMintResponse {
|
|
|
- type Target = RequestMintResponse;
|
|
|
- fn deref(&self) -> &Self::Target {
|
|
|
- &self.inner
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-impl From<RequestMintResponse> for JsRequestMintResponse {
|
|
|
- fn from(inner: RequestMintResponse) -> JsRequestMintResponse {
|
|
|
- JsRequestMintResponse { inner }
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-#[wasm_bindgen(js_class = RequestMintResponse)]
|
|
|
-impl JsRequestMintResponse {
|
|
|
- #[wasm_bindgen(constructor)]
|
|
|
- pub fn new(pr: JsBolt11Invoice, hash: String) -> JsRequestMintResponse {
|
|
|
- JsRequestMintResponse {
|
|
|
- inner: RequestMintResponse {
|
|
|
- pr: pr.deref().clone(),
|
|
|
- hash,
|
|
|
- },
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /// Get Bolt11 Invoice
|
|
|
- #[wasm_bindgen(getter)]
|
|
|
- pub fn invoice(&self) -> JsBolt11Invoice {
|
|
|
- self.inner.pr.clone().into()
|
|
|
- }
|
|
|
-
|
|
|
- /// Get Hash
|
|
|
- #[wasm_bindgen(getter)]
|
|
|
- pub fn hash(&self) -> String {
|
|
|
- self.inner.hash.to_string()
|
|
|
- }
|
|
|
-}
|
|
|
+use crate::types::JsAmount;
|
|
|
|
|
|
#[wasm_bindgen(js_name = SplitRequest)]
|
|
|
pub struct JsSplitRequest {
|