cat-signer-api 0.1.0

An api client for working with the OP_CAT signer
Documentation
#[cfg(feature = "api-client")]
pub mod client;

use bitcoin::{ScriptBuf, TxOut, XOnlyPublicKey};
use cat_envelope::TaptreeElement;
use serde::{Deserialize, Serialize};

pub use cat_envelope;

#[derive(Debug, Copy, Clone, Serialize, Deserialize)]
pub struct GetPubkeyResponse {
    pub pubkey: XOnlyPublicKey,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ValidateTxInputRequest {
    /// Hex encoded Transaction
    pub tx: String,
    /// Input index to validate and sign
    pub index: usize,
    /// Previous outputs for all inputs in order
    pub prevouts: Vec<TxOut>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SignTxInputRequest {
    /// Hex encoded Transaction
    pub tx: String,
    /// Input index to validate and sign
    pub index: usize,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SignTxInputResponse {
    /// Hex encoded Transaction
    pub tx: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct WrapScriptRequest {
    #[serde(flatten)]
    pub taptree_element: TaptreeElement,
    /// Internal key used for the address, if None is given,
    /// NUMS key will be used
    pub internal_key: Option<XOnlyPublicKey>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct WrapScriptResponse {
    /// Wrapped script
    pub script: ScriptBuf,
    /// Finalized output script for the address
    pub output_script: ScriptBuf,
    /// Address
    pub address: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct WrapTaptreeRequest {
    /// List of scripts
    pub scripts: Vec<TaptreeElement>,
    /// Internal key used for the address, if None is given,
    /// NUMS key will be used
    pub internal_key: Option<XOnlyPublicKey>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct WrapTaptreeResponse {
    /// Finalized output script for the address
    pub output_script: ScriptBuf,
    /// Address
    pub address: String,
}