mirror of
https://github.com/aljazceru/cdk.git
synced 2026-02-04 20:55:59 +01:00
remove ProofsStatus from cashu
This commit is contained in:
@@ -29,7 +29,6 @@ interface Secret {
|
||||
sequence<u8> as_bytes();
|
||||
};
|
||||
|
||||
|
||||
// NUT00
|
||||
|
||||
interface Id {
|
||||
|
||||
@@ -28,7 +28,6 @@ mod ffi {
|
||||
pub use crate::types::amount::Amount;
|
||||
pub use crate::types::Bolt11Invoice;
|
||||
pub use crate::types::KeySetInfo;
|
||||
pub use crate::types::ProofsStatus;
|
||||
pub use crate::types::Secret;
|
||||
|
||||
pub use cashu::types::InvoiceStatus;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
pub mod amount;
|
||||
pub mod bolt11_invoice;
|
||||
pub mod keyset_info;
|
||||
pub mod proofs_status;
|
||||
pub mod secret;
|
||||
|
||||
pub use bolt11_invoice::Bolt11Invoice;
|
||||
pub use keyset_info::KeySetInfo;
|
||||
pub use proofs_status::ProofsStatus;
|
||||
pub use secret::Secret;
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
use std::{ops::Deref, sync::Arc};
|
||||
|
||||
use cashu::types::ProofsStatus as ProofsStatusSdk;
|
||||
|
||||
use crate::MintProof;
|
||||
|
||||
pub struct ProofsStatus {
|
||||
inner: ProofsStatusSdk,
|
||||
}
|
||||
|
||||
impl Deref for ProofsStatus {
|
||||
type Target = ProofsStatusSdk;
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.inner
|
||||
}
|
||||
}
|
||||
|
||||
impl ProofsStatus {
|
||||
pub fn new(spendable: Vec<Arc<MintProof>>, spent: Vec<Arc<MintProof>>) -> Self {
|
||||
Self {
|
||||
inner: ProofsStatusSdk {
|
||||
spendable: spendable
|
||||
.iter()
|
||||
.map(|p| p.as_ref().deref().clone())
|
||||
.collect(),
|
||||
spent: spent.iter().map(|p| p.as_ref().deref().clone()).collect(),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub fn spendable(&self) -> Vec<Arc<MintProof>> {
|
||||
self.inner
|
||||
.spendable
|
||||
.clone()
|
||||
.into_iter()
|
||||
.map(|p| Arc::new(p.into()))
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub fn spent(&self) -> Vec<Arc<MintProof>> {
|
||||
self.inner
|
||||
.spent
|
||||
.clone()
|
||||
.into_iter()
|
||||
.map(|p| Arc::new(p.into()))
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user