cat_signer_api/
lib.rs

1#[cfg(feature = "api-client")]
2pub mod client;
3
4use bitcoin::{ScriptBuf, TxOut, XOnlyPublicKey};
5use cat_envelope::TaptreeElement;
6use serde::{Deserialize, Serialize};
7
8pub use cat_envelope;
9
10#[derive(Debug, Copy, Clone, Serialize, Deserialize)]
11pub struct GetPubkeyResponse {
12    pub pubkey: XOnlyPublicKey,
13}
14
15#[derive(Debug, Clone, Serialize, Deserialize)]
16pub struct ValidateTxInputRequest {
17    /// Hex encoded Transaction
18    pub tx: String,
19    /// Input index to validate and sign
20    pub index: usize,
21    /// Previous outputs for all inputs in order
22    pub prevouts: Vec<TxOut>,
23}
24
25#[derive(Debug, Clone, Serialize, Deserialize)]
26pub struct SignTxInputRequest {
27    /// Hex encoded Transaction
28    pub tx: String,
29    /// Input index to validate and sign
30    pub index: usize,
31}
32
33#[derive(Debug, Clone, Serialize, Deserialize)]
34pub struct SignTxInputResponse {
35    /// Hex encoded Transaction
36    pub tx: String,
37}
38
39#[derive(Debug, Clone, Serialize, Deserialize)]
40pub struct WrapScriptRequest {
41    #[serde(flatten)]
42    pub taptree_element: TaptreeElement,
43    /// Internal key used for the address, if None is given,
44    /// NUMS key will be used
45    pub internal_key: Option<XOnlyPublicKey>,
46}
47
48#[derive(Debug, Clone, Serialize, Deserialize)]
49pub struct WrapScriptResponse {
50    /// Wrapped script
51    pub script: ScriptBuf,
52    /// Finalized output script for the address
53    pub output_script: ScriptBuf,
54    /// Address
55    pub address: String,
56}
57
58#[derive(Debug, Clone, Serialize, Deserialize)]
59pub struct WrapTaptreeRequest {
60    /// List of scripts
61    pub scripts: Vec<TaptreeElement>,
62    /// Internal key used for the address, if None is given,
63    /// NUMS key will be used
64    pub internal_key: Option<XOnlyPublicKey>,
65}
66
67#[derive(Debug, Clone, Serialize, Deserialize)]
68pub struct WrapTaptreeResponse {
69    /// Finalized output script for the address
70    pub output_script: ScriptBuf,
71    /// Address
72    pub address: String,
73}