mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-12-10 06:15:35 -05:00
Correctly re-export types from bitcoin and monero modules
This commit is contained in:
parent
f5ff50157e
commit
483c819e17
10 changed files with 67 additions and 77 deletions
|
|
@ -2,12 +2,7 @@ pub mod transactions;
|
|||
|
||||
use anyhow::{anyhow, bail, Result};
|
||||
use async_trait::async_trait;
|
||||
use bitcoin::{
|
||||
hashes::{hex::ToHex, Hash},
|
||||
secp256k1,
|
||||
util::psbt::PartiallySignedTransaction,
|
||||
SigHash,
|
||||
};
|
||||
use bitcoin::hashes::{hex::ToHex, Hash};
|
||||
use ecdsa_fun::{adaptor::Adaptor, fun::Point, nonce::Deterministic, ECDSA};
|
||||
use miniscript::{Descriptor, Segwitv0};
|
||||
use rand::{CryptoRng, RngCore};
|
||||
|
|
@ -15,9 +10,9 @@ use serde::{Deserialize, Serialize};
|
|||
use sha2::Sha256;
|
||||
use std::str::FromStr;
|
||||
|
||||
pub use crate::bitcoin::transactions::{TxCancel, TxLock, TxPunish, TxRedeem, TxRefund};
|
||||
pub use bitcoin::{Address, Amount, OutPoint, Transaction, Txid};
|
||||
pub use bitcoin::{util::psbt::PartiallySignedTransaction, *};
|
||||
pub use ecdsa_fun::{adaptor::EncryptedSignature, fun::Scalar, Signature};
|
||||
pub use transactions::{TxCancel, TxLock, TxPunish, TxRedeem, TxRefund};
|
||||
|
||||
pub const TX_FEE: u64 = 10_000;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
use crate::serde::monero_private_key;
|
||||
use anyhow::Result;
|
||||
use async_trait::async_trait;
|
||||
pub use curve25519_dalek::scalar::Scalar;
|
||||
pub use monero::{Address, PrivateKey, PublicKey};
|
||||
use rand::{CryptoRng, RngCore};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::ops::{Add, Sub};
|
||||
|
||||
pub use curve25519_dalek::scalar::Scalar;
|
||||
pub use monero::*;
|
||||
|
||||
pub const MIN_CONFIRMATIONS: u32 = 10;
|
||||
|
||||
pub fn random_private_key<R: RngCore + CryptoRng>(rng: &mut R) -> PrivateKey {
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
use anyhow::Result;
|
||||
use async_trait::async_trait;
|
||||
use backoff::{backoff::Constant as ConstantBackoff, future::FutureOperation as _};
|
||||
use monero::{Address, Network, PrivateKey};
|
||||
use monero_harness::rpc::wallet;
|
||||
use std::{str::FromStr, time::Duration};
|
||||
use xmr_btc::monero::{
|
||||
Amount, CreateWalletForOutput, InsufficientFunds, PrivateViewKey, PublicKey, PublicViewKey,
|
||||
Transfer, TransferProof, TxHash, WatchForTransfer,
|
||||
Address, Amount, CreateWalletForOutput, InsufficientFunds, Network, PrivateKey, PrivateViewKey,
|
||||
PublicKey, PublicViewKey, Transfer, TransferProof, TxHash, WatchForTransfer,
|
||||
};
|
||||
|
||||
pub struct Wallet(pub wallet::Client);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ use tokio::sync::Mutex;
|
|||
use tracing::info;
|
||||
use xmr_btc::{
|
||||
alice::{self, ReceiveBitcoinRedeemEncsig},
|
||||
bitcoin::{BroadcastSignedTransaction, EncryptedSignature, SignTxLock},
|
||||
bitcoin::{self, BroadcastSignedTransaction, EncryptedSignature, SignTxLock},
|
||||
bob::{self, ReceiveTransferProof},
|
||||
monero::{CreateWalletForOutput, Transfer, TransferProof},
|
||||
};
|
||||
|
|
@ -309,8 +309,7 @@ async fn on_chain_happy_path() {
|
|||
|
||||
assert_eq!(
|
||||
alice_final_btc_balance,
|
||||
initial_balances.alice_btc + swap_amounts.btc
|
||||
- bitcoin::Amount::from_sat(xmr_btc::bitcoin::TX_FEE)
|
||||
initial_balances.alice_btc + swap_amounts.btc - bitcoin::Amount::from_sat(bitcoin::TX_FEE)
|
||||
);
|
||||
assert_eq!(
|
||||
bob_final_btc_balance,
|
||||
|
|
@ -411,7 +410,7 @@ async fn on_chain_both_refund_if_alice_never_redeems() {
|
|||
bob_final_btc_balance,
|
||||
// The 2 * TX_FEE corresponds to tx_refund and tx_cancel.
|
||||
initial_balances.bob_btc
|
||||
- bitcoin::Amount::from_sat(2 * xmr_btc::bitcoin::TX_FEE)
|
||||
- bitcoin::Amount::from_sat(2 * bitcoin::TX_FEE)
|
||||
- lock_tx_bitcoin_fee
|
||||
);
|
||||
|
||||
|
|
@ -508,7 +507,7 @@ async fn on_chain_alice_punishes_if_bob_never_acts_after_fund() {
|
|||
assert_eq!(
|
||||
alice_final_btc_balance,
|
||||
initial_balances.alice_btc + swap_amounts.btc
|
||||
- bitcoin::Amount::from_sat(2 * xmr_btc::bitcoin::TX_FEE)
|
||||
- bitcoin::Amount::from_sat(2 * bitcoin::TX_FEE)
|
||||
);
|
||||
assert_eq!(
|
||||
bob_final_btc_balance,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue