mirror of
https://github.com/aljazceru/cdk.git
synced 2026-02-05 05:06:14 +01:00
chore: update ln
This commit is contained in:
@@ -24,7 +24,7 @@ bitcoin = { version = "0.30.0", features=["serde", "rand", "no-std"] }
|
||||
bitcoin_hashes = "0.12.0"
|
||||
hex = "0.4.3"
|
||||
k256 = { version = "0.13.1", features=["arithmetic"] }
|
||||
lightning-invoice = { version = "0.23.0", features=["serde"] }
|
||||
lightning-invoice = { version = "0.24.0", features=["serde"] }
|
||||
rand = "0.8.5"
|
||||
getrandom = { version = "0.2", features = ["js"] }
|
||||
serde = { version = "1.0.160", features = ["derive"]}
|
||||
|
||||
@@ -17,7 +17,7 @@ use crate::nuts::nut09::MintInfo;
|
||||
use crate::nuts::*;
|
||||
use crate::utils;
|
||||
use crate::Amount;
|
||||
pub use crate::Invoice;
|
||||
pub use crate::Bolt11Invoice;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Error {
|
||||
@@ -199,7 +199,7 @@ impl Client {
|
||||
}
|
||||
|
||||
/// Check Max expected fee [NUT-05]
|
||||
pub async fn check_fees(&self, invoice: Invoice) -> Result<CheckFeesResponse, Error> {
|
||||
pub async fn check_fees(&self, invoice: Bolt11Invoice) -> Result<CheckFeesResponse, Error> {
|
||||
let url = self.mint_url.join("checkfees")?;
|
||||
|
||||
let request = CheckFeesRequest { pr: invoice };
|
||||
@@ -223,7 +223,7 @@ impl Client {
|
||||
pub async fn melt(
|
||||
&self,
|
||||
proofs: Vec<Proof>,
|
||||
invoice: Invoice,
|
||||
invoice: Bolt11Invoice,
|
||||
outputs: Option<Vec<BlindedMessage>>,
|
||||
) -> Result<MeltResponse, Error> {
|
||||
let url = self.mint_url.join("melt")?;
|
||||
|
||||
@@ -25,6 +25,6 @@ pub use client::Client;
|
||||
pub use amount::Amount;
|
||||
pub use bitcoin::hashes::sha256::Hash as Sha256;
|
||||
pub use lightning_invoice;
|
||||
pub use lightning_invoice::Invoice;
|
||||
pub use lightning_invoice::Bolt11Invoice;
|
||||
|
||||
pub type Result<T, E = Box<dyn std::error::Error>> = std::result::Result<T, E>;
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
pub use crate::Invoice;
|
||||
pub use crate::Bolt11Invoice;
|
||||
|
||||
/// Mint request response [NUT-03]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct RequestMintResponse {
|
||||
/// Bolt11 payment request
|
||||
pub pr: Invoice,
|
||||
pub pr: Bolt11Invoice,
|
||||
/// Random hash MUST not be the hash of invoice
|
||||
pub hash: String,
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ use serde::{Deserialize, Serialize};
|
||||
use super::nut00::Proofs;
|
||||
use crate::error::Error;
|
||||
use crate::Amount;
|
||||
use crate::Invoice;
|
||||
use crate::Bolt11Invoice;
|
||||
|
||||
/// Check Fees Response [NUT-05]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
@@ -19,7 +19,7 @@ pub struct CheckFeesResponse {
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct CheckFeesRequest {
|
||||
/// Lighting Invoice
|
||||
pub pr: Invoice,
|
||||
pub pr: Bolt11Invoice,
|
||||
}
|
||||
|
||||
/// Melt Request [NUT-05]
|
||||
@@ -27,7 +27,7 @@ pub struct CheckFeesRequest {
|
||||
pub struct MeltRequest {
|
||||
pub proofs: Proofs,
|
||||
/// bollt11
|
||||
pub pr: Invoice,
|
||||
pub pr: Bolt11Invoice,
|
||||
}
|
||||
|
||||
impl MeltRequest {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Lightning fee return
|
||||
// https://github.com/cashubtc/nuts/blob/main/08.md
|
||||
|
||||
use lightning_invoice::Invoice;
|
||||
use lightning_invoice::Bolt11Invoice;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{error::Error, Amount};
|
||||
@@ -13,7 +13,7 @@ use super::nut00::{BlindedMessage, BlindedSignature, Proofs};
|
||||
pub struct MeltRequest {
|
||||
pub proofs: Proofs,
|
||||
/// bollt11
|
||||
pub pr: Invoice,
|
||||
pub pr: Bolt11Invoice,
|
||||
/// Blinded Message that can be used to return change [NUT-08]
|
||||
/// Amount field of blindedMessages `SHOULD` be set to zero
|
||||
pub outputs: Option<Vec<BlindedMessage>>,
|
||||
|
||||
@@ -12,7 +12,7 @@ use crate::nuts::nut03::RequestMintResponse;
|
||||
use crate::nuts::nut06::{SplitPayload, SplitRequest};
|
||||
use crate::types::{Melted, ProofsStatus, SendProofs};
|
||||
use crate::Amount;
|
||||
pub use crate::Invoice;
|
||||
pub use crate::Bolt11Invoice;
|
||||
use crate::{
|
||||
dhke::construct_proofs,
|
||||
error::{self, wallet::Error},
|
||||
@@ -98,7 +98,7 @@ impl Wallet {
|
||||
}
|
||||
|
||||
/// Check fee
|
||||
pub async fn check_fee(&self, invoice: Invoice) -> Result<Amount, error::wallet::Error> {
|
||||
pub async fn check_fee(&self, invoice: Bolt11Invoice) -> Result<Amount, error::wallet::Error> {
|
||||
Ok(self.client.check_fees(invoice).await?.fee)
|
||||
}
|
||||
|
||||
@@ -267,7 +267,7 @@ impl Wallet {
|
||||
|
||||
pub async fn melt(
|
||||
&self,
|
||||
invoice: Invoice,
|
||||
invoice: Bolt11Invoice,
|
||||
proofs: Proofs,
|
||||
fee_reserve: Amount,
|
||||
) -> Result<Melted, error::wallet::Error> {
|
||||
|
||||
Reference in New Issue
Block a user