spark_rust/wallet/internal_handlers/traits/
swap.rs

1use super::transfer::LeafKeyTweak;
2use super::transfer::LeafRefundSigningData;
3use crate::error::SparkSdkError;
4use crate::signer::traits::SparkSigner;
5use bitcoin::secp256k1::PublicKey;
6use spark_protos::spark::LeafRefundTxSigningResult;
7use spark_protos::spark::Transfer;
8use std::collections::HashMap;
9use tonic::async_trait;
10
11#[allow(dead_code)]
12pub(crate) struct SendSwapSignRefundsResponse {
13    pub(crate) transfer: Transfer,
14    pub(crate) refund_signature_map: HashMap<String, Vec<u8>>,
15    pub(crate) leaf_refund_signing_data: HashMap<String, LeafRefundSigningData>,
16    pub(crate) leaf_refund_tx_signing_result: Vec<LeafRefundTxSigningResult>,
17}
18
19#[async_trait]
20#[allow(dead_code)]
21pub(crate) trait SwapInternalHandlers<S: SparkSigner + Send + Sync> {
22    async fn send_swap_sign_refunds(
23        &self,
24        leaves: &Vec<LeafKeyTweak>,
25        receiver_identity_pubkey: &PublicKey,
26        expiry_time: u64,
27        adaptor_public_key: &PublicKey,
28    ) -> Result<SendSwapSignRefundsResponse, SparkSdkError>;
29}