ソースを参照

refactor: some cashu-sdk-ffi to v1

thesimplekid 1 年間 前
コミット
3301199609

+ 36 - 31
bindings/cashu-ffi/src/cashu.udl

@@ -33,10 +33,6 @@ interface Secret {
 
 
 // NUT00
 // NUT00
 
 
-interface Id {
-    [Throws=CashuError]
-	constructor(string id);
-};
 
 
 interface PublicKey {
 interface PublicKey {
     [Throws=CashuError, Name=from_hex]
     [Throws=CashuError, Name=from_hex]
@@ -112,6 +108,14 @@ interface PreMintSecrets {
 	sequence<Amount> amounts();
 	sequence<Amount> amounts();
 };
 };
 
 
+
+// NUT-02
+
+interface Id {
+    [Throws=CashuError]
+	constructor(string id);
+};
+
 interface KeyPair {
 interface KeyPair {
 	[Name=from_secret_key]
 	[Name=from_secret_key]
 	constructor(SecretKey secret_key);
 	constructor(SecretKey secret_key);
@@ -137,7 +141,6 @@ interface MintKeySet {
 	constructor(string secret, string unit, string derivation_path, u8 max_order);
 	constructor(string secret, string unit, string derivation_path, u8 max_order);
 };
 };
 
 
-
 interface KeysResponse {
 interface KeysResponse {
 	constructor(Keys keys);
 	constructor(Keys keys);
 };
 };
@@ -147,14 +150,28 @@ interface KeySetResponse {
 	sequence<KeySetInfo> keysets();
 	sequence<KeySetInfo> keysets();
 };
 };
 
 
-// --- NUT-04
+// NUT-03
+
+interface SwapRequest {
+	constructor(sequence<Proof> proofs, sequence<BlindedMessage> outputs);
+	sequence<Proof> proofs();
+	sequence<BlindedMessage> outputs();
+	Amount proofs_amount();
+	Amount output_amount();
+};
+
+interface SwapResponse {
+	constructor(sequence<BlindedSignature> promises);
+	sequence<BlindedSignature> signatures();
+};
+
+// NUT-04
 
 
 interface MintQuoteBolt11Request {
 interface MintQuoteBolt11Request {
 	constructor(Amount amount, string unit);
 	constructor(Amount amount, string unit);
 	Amount amount();
 	Amount amount();
 };
 };
 
 
-
 interface MintQuoteBolt11Response {
 interface MintQuoteBolt11Response {
 	constructor(string quote, string request, boolean paid, u64 expiry);
 	constructor(string quote, string request, boolean paid, u64 expiry);
 	string quote();
 	string quote();
@@ -175,8 +192,6 @@ interface MintBolt11Response {
 	sequence<BlindedSignature> signatures();
 	sequence<BlindedSignature> signatures();
 };
 };
 
 
-// ---
-
 // NUT-05
 // NUT-05
 
 
 interface MeltQuoteBolt11Response {
 interface MeltQuoteBolt11Response {
@@ -208,20 +223,21 @@ interface MeltBolt11Response {
 	boolean paid();
 	boolean paid();
 };
 };
 
 
-// ----
-interface SwapRequest {
-	constructor(sequence<Proof> proofs, sequence<BlindedMessage> outputs);
-	sequence<Proof> proofs();
-	sequence<BlindedMessage> outputs();
-	Amount proofs_amount();
-	Amount output_amount();
-};
+// NUT-06
 
 
-interface SwapResponse {
-	constructor(sequence<BlindedSignature> promises);
-	sequence<BlindedSignature> signatures();
+interface MintInfo {
+	constructor(string? name, PublicKey? pubkey, MintVersion? version, string? description, string? description_long, sequence<sequence<string>>? contact, string nuts, string? motd);
+	string? name();
+	PublicKey? pubkey();
+	MintVersion? version();
+	string? description();
+	string? description_long();
+	sequence<sequence<string>>? contact();
+	string? motd();
 };
 };
 
 
+// NUT-07
+
 interface CheckSpendableRequest {
 interface CheckSpendableRequest {
 	constructor(sequence<MintProof> proofs);
 	constructor(sequence<MintProof> proofs);
 	sequence<MintProof> proofs();
 	sequence<MintProof> proofs();
@@ -239,17 +255,6 @@ interface MintVersion {
 	string version();
 	string version();
 };
 };
 
 
-interface MintInfo {
-	constructor(string? name, PublicKey? pubkey, MintVersion? version, string? description, string? description_long, sequence<sequence<string>>? contact, string nuts, string? motd);
-	string? name();
-	PublicKey? pubkey();
-	MintVersion? version();
-	string? description();
-	string? description_long();
-	sequence<sequence<string>>? contact();
-	string? motd();
-};
-
 interface KeySetInfo {
 interface KeySetInfo {
 	constructor(Id id, string unit);
 	constructor(Id id, string unit);
 	
 	

+ 10 - 0
bindings/cashu-ffi/src/nuts/nut00/token.rs

@@ -25,6 +25,16 @@ impl From<&CurrencyUnit> for CurrencyUnitSdk {
     }
     }
 }
 }
 
 
+impl From<CurrencyUnit> for CurrencyUnitSdk {
+    fn from(unit: CurrencyUnit) -> CurrencyUnitSdk {
+        match unit {
+            CurrencyUnit::Sat() => CurrencyUnitSdk::Sat,
+            CurrencyUnit::Usd() => CurrencyUnitSdk::Usd,
+            CurrencyUnit::Custom { unit } => CurrencyUnitSdk::Custom(unit.clone()),
+        }
+    }
+}
+
 impl From<CurrencyUnitSdk> for CurrencyUnit {
 impl From<CurrencyUnitSdk> for CurrencyUnit {
     fn from(unit: CurrencyUnitSdk) -> CurrencyUnit {
     fn from(unit: CurrencyUnitSdk) -> CurrencyUnit {
         match unit {
         match unit {

+ 6 - 0
bindings/cashu-ffi/src/nuts/nut04/mod.rs

@@ -160,3 +160,9 @@ impl MintBolt11Response {
             .collect()
             .collect()
     }
     }
 }
 }
+
+impl From<MintBolt11ResponseSdk> for MintBolt11Response {
+    fn from(inner: MintBolt11ResponseSdk) -> MintBolt11Response {
+        MintBolt11Response { inner }
+    }
+}

+ 93 - 85
bindings/cashu-sdk-ffi/src/cashu_sdk.udl

@@ -8,12 +8,12 @@ interface CashuError {
 };
 };
 
 
 
 
-// Types 
-
+// Types
 
 
 [Enum]
 [Enum]
 interface CurrencyUnit {
 interface CurrencyUnit {
 	Sat();
 	Sat();
+	Usd();
 	Custom(string unit);
 	Custom(string unit);
 };
 };
 
 
@@ -25,26 +25,17 @@ interface Bolt11Invoice {
 };
 };
 
 
 interface Amount {
 interface Amount {
-	u64 to_sat();	
-	u64 to_msat();
-	[Name = from_sat]
-	constructor(u64 sat);
-	[Name = from_msat]
-	constructor(u64 msat);
+	constructor(u64 amount);
  	sequence<Amount> split();
  	sequence<Amount> split();
 };
 };
 
 
-
 interface Secret {
 interface Secret {
 	constructor();
 	constructor();
 	sequence<u8> as_bytes();	
 	sequence<u8> as_bytes();	
 };
 };
 
 
+// NUT00
 
 
-interface Id {
-    [Throws=CashuError]
-	constructor(string id);
-};
 
 
 interface PublicKey {
 interface PublicKey {
     [Throws=CashuError, Name=from_hex]
     [Throws=CashuError, Name=from_hex]
@@ -62,6 +53,7 @@ interface SecretKey {
 interface BlindedMessage {
 interface BlindedMessage {
 	constructor(Id keyset_id, Amount amount, PublicKey b);
 	constructor(Id keyset_id, Amount amount, PublicKey b);
 	Amount amount();
 	Amount amount();
+	Id keyset_id();
 	PublicKey b();	
 	PublicKey b();	
 };
 };
 
 
@@ -70,12 +62,12 @@ interface Proof {
 	Amount amount();
 	Amount amount();
 	Secret secret();
 	Secret secret();
 	PublicKey c();
 	PublicKey c();
-	Id id();
-	};
+	Id keyset_id();
+};
 
 
 interface BlindedSignature {
 interface BlindedSignature {
-	constructor(Id id, Amount amount, PublicKey c);
-	Id id();
+	constructor(Id keyset_id, Amount amount, PublicKey c);
+	Id keyset_id();
 	Amount amount();
 	Amount amount();
 	PublicKey c();
 	PublicKey c();
 };
 };
@@ -85,7 +77,7 @@ interface MintProof {
 	Amount? amount();
 	Amount? amount();
 	Secret secret();
 	Secret secret();
 	PublicKey? c();
 	PublicKey? c();
-	Id? id();
+	Id? keyset_id();
 	
 	
 };
 };
 
 
@@ -98,10 +90,10 @@ interface MintProofs {
 
 
 interface Token {
 interface Token {
     [Throws=CashuError]
     [Throws=CashuError]
-	constructor(string mint, sequence<Proof> token, string? memo, CurrencyUnit? unit);
+	constructor(string mint, sequence<Proof> token, string? memo, string? unit);
 	sequence<MintProofs> token();
 	sequence<MintProofs> token();
 	string? memo();
 	string? memo();
-	CurrencyUnit? unit();
+	string? unit();
 	string to_string();
 	string to_string();
     [Throws=CashuError, Name=from_string]
     [Throws=CashuError, Name=from_string]
 	constructor(string token);
 	constructor(string token);
@@ -119,6 +111,14 @@ interface PreMintSecrets {
 	sequence<Amount> amounts();
 	sequence<Amount> amounts();
 };
 };
 
 
+
+// NUT-02
+
+interface Id {
+    [Throws=CashuError]
+	constructor(string id);
+};
+
 interface KeyPair {
 interface KeyPair {
 	[Name=from_secret_key]
 	[Name=from_secret_key]
 	constructor(SecretKey secret_key);
 	constructor(SecretKey secret_key);
@@ -139,13 +139,11 @@ interface KeySet {
 	Keys keys();
 	Keys keys();
 };
 };
 
 
-
 interface MintKeySet {
 interface MintKeySet {
 	[Name=generate]
 	[Name=generate]
 	constructor(string secret, string unit, string derivation_path, u8 max_order);
 	constructor(string secret, string unit, string derivation_path, u8 max_order);
 };
 };
 
 
-
 interface KeysResponse {
 interface KeysResponse {
 	constructor(Keys keys);
 	constructor(Keys keys);
 };
 };
@@ -155,6 +153,48 @@ interface KeySetResponse {
 	sequence<KeySetInfo> keysets();
 	sequence<KeySetInfo> keysets();
 };
 };
 
 
+// NUT-03
+
+interface SwapRequest {
+	constructor(sequence<Proof> proofs, sequence<BlindedMessage> outputs);
+	sequence<Proof> proofs();
+	sequence<BlindedMessage> outputs();
+	Amount proofs_amount();
+	Amount output_amount();
+};
+
+interface SwapResponse {
+	constructor(sequence<BlindedSignature> promises);
+	sequence<BlindedSignature> signatures();
+};
+
+// NUT-04
+
+interface MintQuoteBolt11Request {
+	constructor(Amount amount, string unit);
+	Amount amount();
+};
+
+interface MintQuoteBolt11Response {
+	constructor(string quote, string request, boolean paid, u64 expiry);
+	string quote();
+	string request();
+	boolean paid();
+	u64 expiry();
+};
+
+
+interface MintBolt11Request {
+	constructor(string quote, sequence<BlindedMessage> outputs);
+	string quote();
+	sequence<BlindedMessage> outputs();
+};
+
+interface MintBolt11Response {
+	constructor(sequence<BlindedSignature> signatures);
+	sequence<BlindedSignature> signatures();
+};
+
 // NUT-05
 // NUT-05
 
 
 interface MeltQuoteBolt11Response {
 interface MeltQuoteBolt11Response {
@@ -171,49 +211,46 @@ interface MeltQuoteBolt11Request {
     [Throws=CashuError]
     [Throws=CashuError]
 	constructor(string request, string unit);
 	constructor(string request, string unit);
 	string request();
 	string request();
-	string unit();
 };
 };
 
 
 interface MeltBolt11Request {
 interface MeltBolt11Request {
     [Throws=CashuError]
     [Throws=CashuError]
-	constructor(sequence<Proof> inputs, string quote);
+	constructor(string quote, sequence<Proof> inputs, sequence<BlindedMessage>? outputs);
 	sequence<Proof> inputs();
 	sequence<Proof> inputs();
 	string quote();
 	string quote();
 };
 };
 
 
-interface RequestMintResponse {
-    [Throws=CashuError]
-	constructor(string invoice, string hash);
-	string invoice();
-	string hash();
-};
-
-interface MintRequest {
-	constructor(sequence<BlindedMessage> outputs);
-	sequence<BlindedMessage> outputs();
-	Amount total_amount();
+interface MeltBolt11Response {
+	constructor(boolean paid, string? payment_preimage, sequence<BlindedSignature>? change);
+	string? payment_preimage();
+	boolean paid();
 };
 };
 
 
-interface PostMintResponse {
-	constructor(sequence<BlindedSignature> promises);
-	sequence<BlindedSignature> promises();
-};
+// NUT-06
 
 
-interface SplitRequest {
-	constructor(sequence<Proof> proofs, sequence<BlindedMessage> outputs);
-	sequence<Proof> proofs();
-	sequence<BlindedMessage> outputs();
-	Amount proofs_amount();
-	Amount output_amount();
+interface MintInfo {
+	constructor(string? name, PublicKey? pubkey, MintVersion? version, string? description, string? description_long, sequence<sequence<string>>? contact, string nuts, string? motd);
+	string? name();
+	PublicKey? pubkey();
+	MintVersion? version();
+	string? description();
+	string? description_long();
+	sequence<sequence<string>>? contact();
+	string? motd();
 };
 };
 
 
-interface SplitResponse {
-	constructor(sequence<BlindedSignature> promises);
-	sequence<BlindedSignature> promises();
-	Amount? promises_amount();
+// NUT-07
 
 
+interface CheckSpendableRequest {
+	constructor(sequence<MintProof> proofs);
+	sequence<MintProof> proofs();
 };
 };
 
 
+interface CheckSpendableResponse {
+	constructor(sequence<boolean> spendable, sequence<boolean> pending);
+	sequence<boolean> spendable();
+	sequence<boolean> pending();
+};
 
 
 interface MintVersion {
 interface MintVersion {
 	constructor(string name, string version);
 	constructor(string name, string version);
@@ -221,16 +258,8 @@ interface MintVersion {
 	string version();
 	string version();
 };
 };
 
 
-interface MintInfo {
-	constructor(string? name, PublicKey? pubkey, MintVersion? version, string? description, string? description_long, sequence<sequence<string>>? contact, sequence<string> nuts, string? motd);
-	string? name();
-	PublicKey? pubkey();
-	MintVersion? version();
-	string? description();
-	string? description_long();
-	sequence<sequence<string>>? contact();
-	sequence<string> nuts();
-	string? motd();
+interface KeySetInfo {
+	constructor(Id id, string unit);
 };
 };
 
 
 enum InvoiceStatus {
 enum InvoiceStatus {
@@ -240,17 +269,6 @@ enum InvoiceStatus {
 	"InFlight"
 	"InFlight"
 };
 };
 
 
-interface ProofsStatus {
-	constructor(sequence<Proof> spendable, sequence<Proof> spent);
-	sequence<Proof> spendable();
-	sequence<Proof> spent();
-};
-
-
-interface KeySetInfo {
-	constructor(Id id, string unit);
-	
-};
 
 
 // Cashu Sdk
 // Cashu Sdk
 
 
@@ -281,23 +299,19 @@ interface Wallet {
 	// [Throws=CashuSdkError]
 	// [Throws=CashuSdkError]
 	// ProofsStatus check_proofs_spent(sequence<Proof> proofs);
 	// ProofsStatus check_proofs_spent(sequence<Proof> proofs);
     [Throws=CashuSdkError]
     [Throws=CashuSdkError]
-	RequestMintResponse request_mint(Amount amount);
-    [Throws=CashuSdkError]
-	Token mint_token(Amount amount, string hash, string? unit, string? memo);
+	Token mint_token(Amount amount, string hash,CurrencyUnit? unit, string? memo);
     [Throws=CashuSdkError]
     [Throws=CashuSdkError]
 	sequence<Proof> mint(Amount amount, string hash);
 	sequence<Proof> mint(Amount amount, string hash);
     [Throws=CashuSdkError]
     [Throws=CashuSdkError]
-	Amount check_fee(Bolt11Invoice invoice);
-    [Throws=CashuSdkError]
 	sequence<Proof> receive(string encoded_token);
 	sequence<Proof> receive(string encoded_token);
     [Throws=CashuSdkError]
     [Throws=CashuSdkError]
-	sequence<Proof> process_split_response(PreMintSecrets blinded_messages, sequence<BlindedSignature> promises);
+	sequence<Proof> process_swap_response(PreMintSecrets blinded_messages, sequence<BlindedSignature> promises);
     [Throws=CashuSdkError]
     [Throws=CashuSdkError]
 	SendProofs send(Amount amount, sequence<Proof> proofs);
 	SendProofs send(Amount amount, sequence<Proof> proofs);
     [Throws=CashuSdkError]
     [Throws=CashuSdkError]
-	Melted melt(Bolt11Invoice invoice, sequence<Proof> proofs, Amount fee_reserve);
+	Melted melt(string quote, sequence<Proof> proofs, Amount fee_reserve);
     [Throws=CashuSdkError]
     [Throws=CashuSdkError]
-	string proof_to_token(sequence<Proof> proof, string? unit, string? memo);
+	string proofs_to_token(sequence<Proof> proof, CurrencyUnit? unit, string? memo);
 };
 };
 
 
 
 
@@ -308,11 +322,5 @@ interface Mint {
 	KeySetResponse keysets();
 	KeySetResponse keysets();
 	KeySet? keyset(Id id);
 	KeySet? keyset(Id id);
     [Throws=CashuSdkError]
     [Throws=CashuSdkError]
-	PostMintResponse process_mint_request(MintRequest mint_request);
-    [Throws=CashuSdkError]
-	SplitResponse process_split_request(SplitRequest split_request);
-    [Throws=CashuSdkError]
-	void verify_melt_request(MeltRequest melt_request);
-    [Throws=CashuSdkError]
-	MeltResponse process_melt_request(MeltRequest melt_request, string preimage, Amount totoal_spent);
+	SwapResponse process_swap_request(SwapRequest swap_request);
 };
 };

+ 7 - 6
bindings/cashu-sdk-ffi/src/lib.rs

@@ -5,12 +5,13 @@ mod wallet;
 
 
 mod ffi {
 mod ffi {
     pub use cashu_ffi::{
     pub use cashu_ffi::{
-        Amount, BlindedMessage, BlindedSignature, Bolt11Invoice, CashuError, CheckFeesRequest,
-        CheckFeesResponse, CheckSpendableRequest, CheckSpendableResponse, Id, InvoiceStatus,
-        KeyPair, KeySet, KeySetInfo, KeySetResponse, Keys, KeysResponse, MeltRequest, MeltResponse,
-        MintInfo, MintKeySet, MintProof, MintProofs, MintRequest, MintVersion, Nut05MeltRequest,
-        Nut05MeltResponse, PostMintResponse, PreMintSecrets, Proof, PublicKey, RequestMintResponse,
-        Secret, SecretKey, SplitRequest, SplitResponse, Token,
+        Amount, BlindedMessage, BlindedSignature, Bolt11Invoice, CashuError, CheckSpendableRequest,
+        CheckSpendableResponse, CurrencyUnit, Id, InvoiceStatus, KeyPair, KeySet, KeySetInfo,
+        KeySetResponse, Keys, KeysResponse, MeltBolt11Request, MeltBolt11Response,
+        MeltQuoteBolt11Request, MeltQuoteBolt11Response, MintBolt11Request, MintBolt11Response,
+        MintInfo, MintKeySet, MintProof, MintProofs, MintQuoteBolt11Request,
+        MintQuoteBolt11Response, MintVersion, Nut05MeltBolt11Request, Nut05MeltBolt11Response,
+        PreMintSecrets, Proof, PublicKey, Secret, SecretKey, SwapRequest, SwapResponse, Token,
     };
     };
 
 
     pub use crate::error::CashuSdkError;
     pub use crate::error::CashuSdkError;

+ 13 - 11
bindings/cashu-sdk-ffi/src/mint.rs

@@ -3,8 +3,8 @@ use std::sync::{Arc, RwLock};
 
 
 use cashu_ffi::{
 use cashu_ffi::{
     Amount, CheckSpendableRequest, CheckSpendableResponse, Id, KeySet, KeySetResponse,
     Amount, CheckSpendableRequest, CheckSpendableResponse, Id, KeySet, KeySetResponse,
-    KeysResponse, MeltRequest, MeltResponse, MintRequest, PostMintResponse, Secret, SplitRequest,
-    SplitResponse,
+    KeysResponse, MeltBolt11Request, MeltBolt11Response, MintBolt11Request, MintBolt11Response,
+    Secret, SwapRequest, SwapResponse,
 };
 };
 use cashu_sdk::mint::Mint as MintSdk;
 use cashu_sdk::mint::Mint as MintSdk;
 
 
@@ -38,6 +38,8 @@ impl Mint {
                 &secret,
                 &secret,
                 keysets,
                 keysets,
                 spent_secrets,
                 spent_secrets,
+                // TODO: quotes
+                vec![],
                 *min_fee_reserve.as_ref().deref(),
                 *min_fee_reserve.as_ref().deref(),
                 percent_fee_reserve,
                 percent_fee_reserve,
             )
             )
@@ -67,8 +69,8 @@ impl Mint {
 
 
     pub fn process_mint_request(
     pub fn process_mint_request(
         &self,
         &self,
-        mint_request: Arc<MintRequest>,
-    ) -> Result<Arc<PostMintResponse>> {
+        mint_request: Arc<MintBolt11Request>,
+    ) -> Result<Arc<MintBolt11Response>> {
         Ok(Arc::new(
         Ok(Arc::new(
             self.inner
             self.inner
                 .write()
                 .write()
@@ -78,15 +80,15 @@ impl Mint {
         ))
         ))
     }
     }
 
 
-    pub fn process_split_request(
+    pub fn process_swap_request(
         &self,
         &self,
-        split_request: Arc<SplitRequest>,
-    ) -> Result<Arc<SplitResponse>> {
+        split_request: Arc<SwapRequest>,
+    ) -> Result<Arc<SwapResponse>> {
         Ok(Arc::new(
         Ok(Arc::new(
             self.inner
             self.inner
                 .write()
                 .write()
                 .unwrap()
                 .unwrap()
-                .process_split_request(split_request.as_ref().deref().clone())?
+                .process_swap_request(split_request.as_ref().deref().clone())?
                 .into(),
                 .into(),
         ))
         ))
     }
     }
@@ -104,7 +106,7 @@ impl Mint {
         ))
         ))
     }
     }
 
 
-    pub fn verify_melt_request(&self, melt_request: Arc<MeltRequest>) -> Result<()> {
+    pub fn verify_melt_request(&self, melt_request: Arc<MeltBolt11Request>) -> Result<()> {
         Ok(self
         Ok(self
             .inner
             .inner
             .write()
             .write()
@@ -114,10 +116,10 @@ impl Mint {
 
 
     pub fn process_melt_request(
     pub fn process_melt_request(
         &self,
         &self,
-        melt_request: Arc<MeltRequest>,
+        melt_request: Arc<MeltBolt11Request>,
         preimage: String,
         preimage: String,
         total_spent: Arc<Amount>,
         total_spent: Arc<Amount>,
-    ) -> Result<Arc<MeltResponse>> {
+    ) -> Result<Arc<MeltBolt11Response>> {
         Ok(Arc::new(
         Ok(Arc::new(
             self.inner
             self.inner
                 .write()
                 .write()

+ 14 - 25
bindings/cashu-sdk-ffi/src/wallet.rs

@@ -1,9 +1,7 @@
 use std::ops::Deref;
 use std::ops::Deref;
 use std::sync::Arc;
 use std::sync::Arc;
 
 
-use cashu_ffi::{
-    BlindedSignature, Bolt11Invoice, PreMintSecrets, Proof, RequestMintResponse, Token,
-};
+use cashu_ffi::{BlindedSignature, CurrencyUnit, PreMintSecrets, Proof, Token};
 use cashu_sdk::client::minreq_client::HttpClient;
 use cashu_sdk::client::minreq_client::HttpClient;
 use cashu_sdk::types::ProofsStatus;
 use cashu_sdk::types::ProofsStatus;
 use cashu_sdk::url::UncheckedUrl;
 use cashu_sdk::url::UncheckedUrl;
@@ -43,23 +41,21 @@ impl Wallet {
         Ok(Arc::new(proofs))
         Ok(Arc::new(proofs))
     }
     }
 
 
-    pub fn request_mint(&self, amount: Arc<Amount>) -> Result<Arc<RequestMintResponse>> {
-        let mint_response = RUNTIME
-            .block_on(async { self.inner.request_mint(*amount.as_ref().deref()).await })?
-            .into();
-        Ok(Arc::new(mint_response))
-    }
-
     pub fn mint_token(
     pub fn mint_token(
         &self,
         &self,
         amount: Arc<Amount>,
         amount: Arc<Amount>,
         hash: String,
         hash: String,
-        unit: Option<String>,
+        unit: Option<CurrencyUnit>,
         memo: Option<String>,
         memo: Option<String>,
     ) -> Result<Arc<Token>> {
     ) -> Result<Arc<Token>> {
         let token = RUNTIME.block_on(async {
         let token = RUNTIME.block_on(async {
             self.inner
             self.inner
-                .mint_token(*amount.as_ref().deref(), &hash, unit, memo)
+                .mint_token(
+                    *amount.as_ref().deref(),
+                    &hash,
+                    memo,
+                    unit.map(|u| u.into()),
+                )
                 .await
                 .await
         })?;
         })?;
 
 
@@ -73,20 +69,13 @@ impl Wallet {
         Ok(proofs.into_iter().map(|p| Arc::new(p.into())).collect())
         Ok(proofs.into_iter().map(|p| Arc::new(p.into())).collect())
     }
     }
 
 
-    pub fn check_fee(&self, invoice: Arc<Bolt11Invoice>) -> Result<Arc<Amount>> {
-        let amount = RUNTIME
-            .block_on(async { self.inner.check_fee(invoice.as_ref().deref().clone()).await })?;
-
-        Ok(Arc::new(amount.into()))
-    }
-
     pub fn receive(&self, encoded_token: String) -> Result<Vec<Arc<Proof>>> {
     pub fn receive(&self, encoded_token: String) -> Result<Vec<Arc<Proof>>> {
         let proofs = RUNTIME.block_on(async { self.inner.receive(&encoded_token).await })?;
         let proofs = RUNTIME.block_on(async { self.inner.receive(&encoded_token).await })?;
 
 
         Ok(proofs.into_iter().map(|p| Arc::new(p.into())).collect())
         Ok(proofs.into_iter().map(|p| Arc::new(p.into())).collect())
     }
     }
 
 
-    pub fn process_split_response(
+    pub fn process_swap_response(
         &self,
         &self,
         blinded_messages: Arc<PreMintSecrets>,
         blinded_messages: Arc<PreMintSecrets>,
         promises: Vec<Arc<BlindedSignature>>,
         promises: Vec<Arc<BlindedSignature>>,
@@ -117,14 +106,14 @@ impl Wallet {
 
 
     pub fn melt(
     pub fn melt(
         &self,
         &self,
-        invoice: Arc<Bolt11Invoice>,
+        quote: String,
         proofs: Vec<Arc<Proof>>,
         proofs: Vec<Arc<Proof>>,
         fee_reserve: Arc<Amount>,
         fee_reserve: Arc<Amount>,
     ) -> Result<Arc<Melted>> {
     ) -> Result<Arc<Melted>> {
         let melted = RUNTIME.block_on(async {
         let melted = RUNTIME.block_on(async {
             self.inner
             self.inner
                 .melt(
                 .melt(
-                    invoice.as_ref().deref().clone(),
+                    quote,
                     proofs.iter().map(|p| p.as_ref().deref().clone()).collect(),
                     proofs.iter().map(|p| p.as_ref().deref().clone()).collect(),
                     *fee_reserve.as_ref().deref(),
                     *fee_reserve.as_ref().deref(),
                 )
                 )
@@ -134,16 +123,16 @@ impl Wallet {
         Ok(Arc::new(melted.into()))
         Ok(Arc::new(melted.into()))
     }
     }
 
 
-    pub fn proof_to_token(
+    pub fn proofs_to_token(
         &self,
         &self,
         proofs: Vec<Arc<Proof>>,
         proofs: Vec<Arc<Proof>>,
-        unit: Option<String>,
+        unit: Option<CurrencyUnit>,
         memo: Option<String>,
         memo: Option<String>,
     ) -> Result<String> {
     ) -> Result<String> {
         Ok(self.inner.proofs_to_token(
         Ok(self.inner.proofs_to_token(
             proofs.iter().map(|p| p.as_ref().deref().clone()).collect(),
             proofs.iter().map(|p| p.as_ref().deref().clone()).collect(),
-            unit,
             memo,
             memo,
+            unit.map(|u| u.into()),
         )?)
         )?)
     }
     }
 }
 }