mirror of
https://github.com/aljazceru/cdk.git
synced 2026-01-06 22:45:53 +01:00
chore: remove dead code
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#[allow(clippy::all, clippy::pedantic, clippy::restriction, clippy::nursery)]
|
||||
#[allow(dead_code)]
|
||||
pub(crate) mod lnrpc {
|
||||
tonic::include_proto!("lnrpc");
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ use std::collections::BTreeMap;
|
||||
|
||||
use cdk_common::secret::Secret;
|
||||
use cdk_common::util::hex;
|
||||
use cdk_common::{Amount, HTLCWitness, P2PKWitness, PublicKey};
|
||||
use cdk_common::{Amount, PublicKey};
|
||||
use tonic::Status;
|
||||
|
||||
use super::*;
|
||||
@@ -192,31 +192,6 @@ impl TryInto<cdk_common::Proof> for Proof {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<cdk_common::ProofDleq> for ProofDleq {
|
||||
fn from(value: cdk_common::ProofDleq) -> Self {
|
||||
ProofDleq {
|
||||
e: value.e.as_secret_bytes().to_vec(),
|
||||
s: value.s.as_secret_bytes().to_vec(),
|
||||
r: value.r.as_secret_bytes().to_vec(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl TryInto<cdk_common::ProofDleq> for ProofDleq {
|
||||
type Error = Status;
|
||||
|
||||
fn try_into(self) -> Result<cdk_common::ProofDleq, Self::Error> {
|
||||
Ok(cdk_common::ProofDleq {
|
||||
e: cdk_common::SecretKey::from_slice(&self.e)
|
||||
.map_err(|e| Status::from_error(Box::new(e)))?,
|
||||
s: cdk_common::SecretKey::from_slice(&self.s)
|
||||
.map_err(|e| Status::from_error(Box::new(e)))?,
|
||||
r: cdk_common::SecretKey::from_slice(&self.r)
|
||||
.map_err(|e| Status::from_error(Box::new(e)))?,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl TryInto<cdk_common::BlindSignature> for BlindSignature {
|
||||
type Error = cdk_common::error::Error;
|
||||
|
||||
@@ -256,48 +231,6 @@ impl TryInto<cdk_common::BlindedMessage> for BlindedMessage {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<cdk_common::Witness> for Witness {
|
||||
fn from(value: cdk_common::Witness) -> Self {
|
||||
match value {
|
||||
cdk_common::Witness::P2PKWitness(P2PKWitness { signatures }) => Witness {
|
||||
witness_type: Some(witness::WitnessType::P2pkWitness(P2pkWitness {
|
||||
signatures,
|
||||
})),
|
||||
},
|
||||
cdk_common::Witness::HTLCWitness(HTLCWitness {
|
||||
preimage,
|
||||
signatures,
|
||||
}) => Witness {
|
||||
witness_type: Some(witness::WitnessType::HtlcWitness(HtlcWitness {
|
||||
preimage,
|
||||
signatures: signatures.unwrap_or_default(),
|
||||
})),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl TryInto<cdk_common::Witness> for Witness {
|
||||
type Error = Status;
|
||||
fn try_into(self) -> Result<cdk_common::Witness, Self::Error> {
|
||||
match self.witness_type {
|
||||
Some(witness::WitnessType::P2pkWitness(P2pkWitness { signatures })) => {
|
||||
Ok(P2PKWitness { signatures }.into())
|
||||
}
|
||||
Some(witness::WitnessType::HtlcWitness(hltc_witness)) => Ok(HTLCWitness {
|
||||
preimage: hltc_witness.preimage,
|
||||
signatures: if hltc_witness.signatures.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(hltc_witness.signatures)
|
||||
},
|
||||
}
|
||||
.into()),
|
||||
None => Err(Status::invalid_argument("Witness type not set")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<()> for EmptyRequest {
|
||||
fn from(_: ()) -> Self {
|
||||
EmptyRequest {}
|
||||
|
||||
@@ -104,16 +104,6 @@ message Proof {
|
||||
bytes c = 4;
|
||||
}
|
||||
|
||||
message ProofDLEQ {
|
||||
bytes e = 1;
|
||||
bytes s = 2;
|
||||
bytes r = 3;
|
||||
}
|
||||
|
||||
message SigningResponse {
|
||||
Error error = 1;
|
||||
BlindSignatures blind_signatures = 2;
|
||||
}
|
||||
message BlindSignatures {
|
||||
repeated BlindSignature blind_signatures = 1;
|
||||
}
|
||||
@@ -130,28 +120,6 @@ message BlindSignatureDLEQ {
|
||||
bytes s = 2;
|
||||
}
|
||||
|
||||
// Witness type
|
||||
message Witness {
|
||||
oneof witness_type {
|
||||
P2PKWitness p2pk_witness = 1;
|
||||
HTLCWitness htlc_witness = 2;
|
||||
}
|
||||
}
|
||||
|
||||
// P2PKWitness type
|
||||
message P2PKWitness {
|
||||
// List of signatures
|
||||
repeated string signatures = 1;
|
||||
}
|
||||
|
||||
// HTLCWitness type
|
||||
message HTLCWitness {
|
||||
// Preimage
|
||||
string preimage = 1;
|
||||
// List of signatures
|
||||
repeated string signatures = 2;
|
||||
}
|
||||
|
||||
enum ErrorCode {
|
||||
ERROR_CODE_UNSPECIFIED = 0;
|
||||
ERROR_CODE_AMOUNT_OUTSIDE_LIMIT = 1;
|
||||
|
||||
@@ -69,15 +69,6 @@ pub enum GrantType {
|
||||
RefreshToken,
|
||||
}
|
||||
|
||||
#[cfg(feature = "wallet")]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub struct AccessTokenRequest {
|
||||
pub grant_type: GrantType,
|
||||
pub client_id: String,
|
||||
pub username: String,
|
||||
pub password: String,
|
||||
}
|
||||
|
||||
#[cfg(feature = "wallet")]
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub struct RefreshTokenRequest {
|
||||
|
||||
Reference in New Issue
Block a user