mirror of
https://github.com/RoboSats/taptrade-core.git
synced 2025-07-22 10:43:26 +00:00
combine imports
This commit is contained in:
@ -4,15 +4,6 @@ pub mod handler_errors;
|
||||
|
||||
use self::communication_utils::*;
|
||||
use super::*;
|
||||
use axum::{
|
||||
http::StatusCode,
|
||||
response::{IntoResponse, Response},
|
||||
routing::{get, post},
|
||||
Extension, Json, Router,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::net::SocketAddr;
|
||||
use tokio::net::TcpListener;
|
||||
|
||||
//
|
||||
// Axum handler functions
|
||||
|
@ -1,17 +1,4 @@
|
||||
use super::*;
|
||||
use anyhow::Context;
|
||||
use bdk::{
|
||||
bitcoin::{
|
||||
hashes::Hash,
|
||||
key::XOnlyPublicKey,
|
||||
psbt::{PartiallySignedTransaction, Prevouts},
|
||||
sighash::{SighashCache, TapSighashType},
|
||||
Address,
|
||||
},
|
||||
miniscript::Descriptor,
|
||||
};
|
||||
use musig2::{BinaryEncoding, LiftedSignature};
|
||||
use std::str::FromStr;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum PayoutProcessingResult {
|
||||
|
@ -3,15 +3,6 @@
|
||||
|
||||
use super::*;
|
||||
use anyhow::Ok;
|
||||
use bdk::bitcoin::consensus::encode::deserialize;
|
||||
use bdk::bitcoin::{OutPoint, Transaction};
|
||||
use bdk::bitcoin::{TxIn, Txid};
|
||||
use bdk::bitcoincore_rpc::{Client, RpcApi};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
|
||||
use std::ops::Deref;
|
||||
use std::sync::RwLock;
|
||||
use tokio::sync::oneshot;
|
||||
|
||||
struct Mempool {
|
||||
transactions: Arc<RwLock<HashMap<Txid, Vec<TxIn>>>>,
|
||||
|
@ -1,14 +1,11 @@
|
||||
pub mod bond_monitoring;
|
||||
pub mod coordinator_utils;
|
||||
// pub mod create_taproot;
|
||||
pub mod mempool_monitoring;
|
||||
pub mod tx_confirmation_monitoring;
|
||||
// pub mod create_taproot;
|
||||
|
||||
use self::coordinator_utils::*;
|
||||
use super::*;
|
||||
|
||||
use musig2::{KeyAggContext, PartialSignature};
|
||||
|
||||
pub async fn process_order(
|
||||
coordinator: Arc<Coordinator>,
|
||||
offer: &OfferRequest,
|
||||
|
@ -1,13 +1,3 @@
|
||||
use std::str::FromStr;
|
||||
|
||||
|
||||
use bdk::{
|
||||
bitcoin::Txid,
|
||||
bitcoincore_rpc::{
|
||||
jsonrpc::Error as JsonRpcError, Error as CoreRpcError, RpcApi,
|
||||
},
|
||||
};
|
||||
|
||||
use super::*;
|
||||
|
||||
fn get_confirmations(
|
||||
|
@ -1,17 +1,7 @@
|
||||
#[cfg(test)]
|
||||
mod db_tests;
|
||||
|
||||
use anyhow::Context;
|
||||
|
||||
use futures_util::StreamExt;
|
||||
|
||||
|
||||
|
||||
use super::*;
|
||||
use bdk::bitcoin::address::Address;
|
||||
use sqlx::{sqlite::SqlitePoolOptions, Pool, Row, Sqlite};
|
||||
use std::env;
|
||||
use std::str::FromStr;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct CoordinatorDB {
|
||||
|
@ -3,24 +3,67 @@ mod coordinator;
|
||||
mod database;
|
||||
mod wallet;
|
||||
|
||||
use anyhow::{anyhow, Result};
|
||||
use bdk::{database::MemoryDatabase};
|
||||
use std::{
|
||||
collections::{HashMap, HashSet},
|
||||
env, fmt,
|
||||
net::SocketAddr,
|
||||
ops::Deref,
|
||||
str::FromStr,
|
||||
sync::{Arc, RwLock},
|
||||
time::{SystemTime, UNIX_EPOCH},
|
||||
};
|
||||
|
||||
use anyhow::{anyhow, Context, Result};
|
||||
use axum::{
|
||||
http::StatusCode,
|
||||
response::{IntoResponse, Response},
|
||||
routing::{get, post},
|
||||
Extension, Json, Router,
|
||||
};
|
||||
use bdk::{
|
||||
bitcoin::{
|
||||
self,
|
||||
address::Payload,
|
||||
bip32::ExtendedPrivKey,
|
||||
consensus::encode::deserialize,
|
||||
hashes::Hash,
|
||||
key::{secp256k1, XOnlyPublicKey},
|
||||
psbt::{Input, PartiallySignedTransaction, Prevouts},
|
||||
sighash::{SighashCache, TapSighashType},
|
||||
Address, Network, OutPoint, Transaction, TxIn, Txid,
|
||||
},
|
||||
bitcoincore_rpc::{
|
||||
jsonrpc::Error as JsonRpcError, Client, Error as CoreRpcError, RawTx, RpcApi,
|
||||
},
|
||||
blockchain::{rpc::Auth, Blockchain, ConfigurableBlockchain, GetTx, RpcBlockchain, RpcConfig},
|
||||
database::{Database, MemoryDatabase},
|
||||
descriptor::Descriptor,
|
||||
miniscript::{descriptor::TapTree, policy::Concrete, Tap, ToPublicKey},
|
||||
sled::Tree,
|
||||
template::Bip86,
|
||||
wallet::verify::*,
|
||||
KeychainKind, SignOptions, SyncOptions, Wallet,
|
||||
};
|
||||
use communication::{api::*, api_server, communication_utils::*, handler_errors::*};
|
||||
use coordinator::{
|
||||
bond_monitoring::*, coordinator_utils::*,
|
||||
bond_monitoring::*, coordinator_utils::*, mempool_monitoring::MempoolHandler,
|
||||
tx_confirmation_monitoring::update_transaction_confirmations, *,
|
||||
};
|
||||
use database::CoordinatorDB;
|
||||
use dotenvy::dotenv;
|
||||
use futures_util::StreamExt;
|
||||
use log::{debug, error, info, trace, warn};
|
||||
use musig2::{AggNonce as MusigAggNonce, PubNonce as MusigPubNonce};
|
||||
use rand::Rng;
|
||||
use std::{
|
||||
env,
|
||||
sync::Arc,
|
||||
time::{SystemTime, UNIX_EPOCH},
|
||||
use musig2::{
|
||||
secp256k1::PublicKey as MuSig2PubKey, AggNonce as MusigAggNonce, BinaryEncoding, KeyAggContext,
|
||||
LiftedSignature, PartialSignature, PubNonce as MusigPubNonce,
|
||||
};
|
||||
use rand::Rng;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sqlx::{sqlite::SqlitePoolOptions, Pool, Row, Sqlite};
|
||||
use tokio::{
|
||||
net::TcpListener,
|
||||
sync::{oneshot, Mutex},
|
||||
};
|
||||
use tokio::sync::Mutex;
|
||||
use validator::{Validate, ValidationError};
|
||||
use wallet::{escrow_psbt::*, wallet_utils::*, *};
|
||||
|
||||
|
@ -1,12 +1,4 @@
|
||||
use super::*;
|
||||
use bdk::{
|
||||
bitcoin::{psbt::PartiallySignedTransaction},
|
||||
descriptor::{Descriptor},
|
||||
miniscript::{descriptor::TapTree, policy::Concrete, Tap, ToPublicKey},
|
||||
SignOptions,
|
||||
};
|
||||
use musig2::{secp256k1::PublicKey as MuSig2PubKey, KeyAggContext};
|
||||
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct EscrowPsbtConstructionData {
|
||||
|
@ -7,29 +7,6 @@ mod wallet_tests;
|
||||
|
||||
pub use self::escrow_psbt::*;
|
||||
use super::*;
|
||||
use anyhow::Context;
|
||||
use bdk::{
|
||||
bitcoin::{
|
||||
self,
|
||||
address::Payload,
|
||||
bip32::ExtendedPrivKey,
|
||||
consensus::encode::deserialize,
|
||||
key::{secp256k1, XOnlyPublicKey},
|
||||
Address,
|
||||
Network::Regtest,
|
||||
Transaction,
|
||||
},
|
||||
bitcoincore_rpc::{Client, RawTx, RpcApi},
|
||||
blockchain::{rpc::Auth, Blockchain, ConfigurableBlockchain, RpcBlockchain, RpcConfig},
|
||||
database::MemoryDatabase,
|
||||
sled::{Tree},
|
||||
template::Bip86,
|
||||
wallet::verify::*,
|
||||
KeychainKind, SyncOptions, Wallet,
|
||||
};
|
||||
use coordinator::mempool_monitoring::MempoolHandler;
|
||||
use std::{collections::HashMap, str::FromStr};
|
||||
use std::{fmt, ops::Deref};
|
||||
// use verify_tx::*;
|
||||
|
||||
#[derive(Clone)]
|
||||
@ -70,12 +47,12 @@ pub async fn init_coordinator_wallet() -> Result<CoordinatorWallet<MemoryDatabas
|
||||
username: env::var("BITCOIN_RPC_USER")?,
|
||||
password: env::var("BITCOIN_RPC_PASSWORD")?,
|
||||
},
|
||||
network: Regtest,
|
||||
network: Network::Regtest,
|
||||
// wallet_name: env::var("BITCOIN_RPC_WALLET_NAME")?,
|
||||
wallet_name: bdk::wallet::wallet_name_from_descriptor(
|
||||
Bip86(wallet_xprv, KeychainKind::External),
|
||||
Some(Bip86(wallet_xprv, KeychainKind::Internal)),
|
||||
Regtest,
|
||||
Network::Regtest,
|
||||
&secp_context,
|
||||
)?,
|
||||
sync_params: None,
|
||||
|
@ -1,9 +1,5 @@
|
||||
/// construction of the transaction spending the escrow output after a successfull trade as keyspend transaction
|
||||
use super::*;
|
||||
use bdk::bitcoin::psbt::Input;
|
||||
|
||||
use bdk::bitcoin::OutPoint;
|
||||
use bdk::miniscript::Descriptor;
|
||||
|
||||
fn get_tx_fees_abs_sat(blockchain_backend: &RpcBlockchain) -> Result<(u64, u64)> {
|
||||
let feerate = blockchain_backend.estimate_fee(6)?;
|
||||
|
@ -1,11 +1,4 @@
|
||||
use super::*;
|
||||
use bdk::{
|
||||
bitcoin::{psbt::Input, Address, Network},
|
||||
blockchain::GetTx,
|
||||
database::Database,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub struct PsbtInput {
|
||||
pub psbt_input: Input,
|
||||
|
Reference in New Issue
Block a user