mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-10-01 01:45:40 -04:00
ci: update msrv and github actions toolchains
This commit is contained in:
parent
ab5d4a1ed5
commit
4ca1f8da5e
3
.github/workflows/build-release-binaries.yml
vendored
3
.github/workflows/build-release-binaries.yml
vendored
@ -52,8 +52,9 @@ jobs:
|
|||||||
|
|
||||||
- uses: Swatinem/rust-cache@v2.2.0
|
- uses: Swatinem/rust-cache@v2.2.0
|
||||||
|
|
||||||
- uses: dtolnay/rust-toolchain@stable
|
- uses: dtolnay/rust-toolchain@master
|
||||||
with:
|
with:
|
||||||
|
toolchain: 1.63
|
||||||
targets: armv7-unknown-linux-gnueabihf
|
targets: armv7-unknown-linux-gnueabihf
|
||||||
|
|
||||||
- name: Build ${{ matrix.target }} ${{ matrix.bin }} release binary
|
- name: Build ${{ matrix.target }} ${{ matrix.bin }} release binary
|
||||||
|
3
.github/workflows/ci.yml
vendored
3
.github/workflows/ci.yml
vendored
@ -75,8 +75,9 @@ jobs:
|
|||||||
|
|
||||||
- uses: Swatinem/rust-cache@v2.2.0
|
- uses: Swatinem/rust-cache@v2.2.0
|
||||||
|
|
||||||
- uses: dtolnay/rust-toolchain@stable
|
- uses: dtolnay/rust-toolchain@master
|
||||||
with:
|
with:
|
||||||
|
toolchain: 1.63
|
||||||
targets: armv7-unknown-linux-gnueabihf
|
targets: armv7-unknown-linux-gnueabihf
|
||||||
|
|
||||||
- name: Build binary
|
- name: Build binary
|
||||||
|
@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Minimum Supported Rust Version (MSRV) bumped to 1.63
|
||||||
|
|
||||||
## [0.12.1] - 2023-01-09
|
## [0.12.1] - 2023-01-09
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
@ -338,7 +342,7 @@ It is possible to migrate critical data from the old db to the sqlite but there
|
|||||||
- Fixed an issue where Alice would not verify if Bob's Bitcoin lock transaction is semantically correct, i.e. pays the agreed upon amount to an output owned by both of them.
|
- Fixed an issue where Alice would not verify if Bob's Bitcoin lock transaction is semantically correct, i.e. pays the agreed upon amount to an output owned by both of them.
|
||||||
Fixing this required a **breaking change** on the network layer and hence old versions are not compatible with this version.
|
Fixing this required a **breaking change** on the network layer and hence old versions are not compatible with this version.
|
||||||
|
|
||||||
[Unreleased]: https://github.com/comit-network/xmr-btc-swap/compare/0.12.1...HEAD
|
[unreleased]: https://github.com/comit-network/xmr-btc-swap/compare/0.12.1...HEAD
|
||||||
[0.12.1]: https://github.com/comit-network/xmr-btc-swap/compare/0.12.0...0.12.1
|
[0.12.1]: https://github.com/comit-network/xmr-btc-swap/compare/0.12.0...0.12.1
|
||||||
[0.12.0]: https://github.com/comit-network/xmr-btc-swap/compare/0.11.0...0.12.0
|
[0.12.0]: https://github.com/comit-network/xmr-btc-swap/compare/0.11.0...0.12.0
|
||||||
[0.11.0]: https://github.com/comit-network/xmr-btc-swap/compare/0.10.2...0.11.0
|
[0.11.0]: https://github.com/comit-network/xmr-btc-swap/compare/0.10.2...0.11.0
|
||||||
|
@ -50,7 +50,7 @@ Please have a look at the [contribution guidelines](./CONTRIBUTING.md).
|
|||||||
## Rust Version Support
|
## Rust Version Support
|
||||||
|
|
||||||
Please note that only the latest stable Rust toolchain is supported.
|
Please note that only the latest stable Rust toolchain is supported.
|
||||||
All stable toolchains since 1.62 _should_ work.
|
All stable toolchains since 1.63 _should_ work.
|
||||||
|
|
||||||
## Contact
|
## Contact
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ pub struct OutKey {
|
|||||||
pub unlocked: bool,
|
pub unlocked: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, PartialEq)]
|
#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]
|
||||||
pub struct BaseResponse {
|
pub struct BaseResponse {
|
||||||
pub credits: u64,
|
pub credits: u64,
|
||||||
pub status: Status,
|
pub status: Status,
|
||||||
@ -165,7 +165,7 @@ pub struct BaseResponse {
|
|||||||
pub untrusted: bool,
|
pub untrusted: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, PartialEq)]
|
#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]
|
||||||
pub struct GetOIndexesResponse {
|
pub struct GetOIndexesResponse {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub base: BaseResponse,
|
pub base: BaseResponse,
|
||||||
@ -173,7 +173,7 @@ pub struct GetOIndexesResponse {
|
|||||||
pub o_indexes: Vec<u64>,
|
pub o_indexes: Vec<u64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Deserialize, PartialEq)]
|
#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Eq)]
|
||||||
pub enum Status {
|
pub enum Status {
|
||||||
#[serde(rename = "OK")]
|
#[serde(rename = "OK")]
|
||||||
Ok,
|
Ok,
|
||||||
|
@ -157,7 +157,7 @@ pub struct Transfer {
|
|||||||
pub unsigned_txset: String,
|
pub unsigned_txset: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Deserialize, Serialize, PartialEq)]
|
#[derive(Clone, Copy, Debug, Deserialize, Serialize, PartialEq, Eq)]
|
||||||
pub struct BlockHeight {
|
pub struct BlockHeight {
|
||||||
pub height: u32,
|
pub height: u32,
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
[toolchain]
|
[toolchain]
|
||||||
channel = "1.62"
|
channel = "1.63" # also update this in the readme, changelog, and github actions
|
||||||
components = ["clippy"]
|
components = ["clippy"]
|
||||||
targets = ["armv7-unknown-linux-gnueabihf"]
|
targets = ["armv7-unknown-linux-gnueabihf"]
|
||||||
|
@ -171,7 +171,7 @@ fn env_config(is_testnet: bool) -> env::Config {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(thiserror::Error, Debug, Clone, Copy, PartialEq, Serialize)]
|
#[derive(thiserror::Error, Debug, Clone, Copy, PartialEq, Eq, Serialize)]
|
||||||
#[error("Invalid Bitcoin address provided, expected address on network {expected:?} but address provided is on {actual:?}")]
|
#[error("Invalid Bitcoin address provided, expected address on network {expected:?} but address provided is on {actual:?}")]
|
||||||
pub struct BitcoinAddressNetworkMismatch {
|
pub struct BitcoinAddressNetworkMismatch {
|
||||||
#[serde(with = "crate::bitcoin::network")]
|
#[serde(with = "crate::bitcoin::network")]
|
||||||
@ -180,7 +180,7 @@ pub struct BitcoinAddressNetworkMismatch {
|
|||||||
actual: bitcoin::Network,
|
actual: bitcoin::Network,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq, Eq)]
|
||||||
pub struct Arguments {
|
pub struct Arguments {
|
||||||
pub testnet: bool,
|
pub testnet: bool,
|
||||||
pub json: bool,
|
pub json: bool,
|
||||||
@ -190,7 +190,7 @@ pub struct Arguments {
|
|||||||
pub cmd: Command,
|
pub cmd: Command,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq, Eq)]
|
||||||
pub enum Command {
|
pub enum Command {
|
||||||
Start {
|
Start {
|
||||||
resume_only: bool,
|
resume_only: bool,
|
||||||
|
@ -84,7 +84,7 @@ const DEFAULT_MIN_BUY_AMOUNT: f64 = 0.002f64;
|
|||||||
const DEFAULT_MAX_BUY_AMOUNT: f64 = 0.02f64;
|
const DEFAULT_MAX_BUY_AMOUNT: f64 = 0.02f64;
|
||||||
const DEFAULT_SPREAD: f64 = 0.02f64;
|
const DEFAULT_SPREAD: f64 = 0.02f64;
|
||||||
|
|
||||||
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, PartialEq)]
|
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq)]
|
||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
pub data: Data,
|
pub data: Data,
|
||||||
@ -123,13 +123,13 @@ impl TryFrom<config::Config> for Config {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize)]
|
||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
pub struct Data {
|
pub struct Data {
|
||||||
pub dir: PathBuf,
|
pub dir: PathBuf,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize)]
|
||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
pub struct Network {
|
pub struct Network {
|
||||||
#[serde(deserialize_with = "addr_list::deserialize")]
|
#[serde(deserialize_with = "addr_list::deserialize")]
|
||||||
@ -181,7 +181,7 @@ mod addr_list {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize)]
|
||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
pub struct Bitcoin {
|
pub struct Bitcoin {
|
||||||
pub electrum_rpc_url: Url,
|
pub electrum_rpc_url: Url,
|
||||||
@ -191,7 +191,7 @@ pub struct Bitcoin {
|
|||||||
pub network: bitcoin::Network,
|
pub network: bitcoin::Network,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize)]
|
||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
pub struct Monero {
|
pub struct Monero {
|
||||||
pub wallet_rpc_url: Url,
|
pub wallet_rpc_url: Url,
|
||||||
@ -200,14 +200,14 @@ pub struct Monero {
|
|||||||
pub network: monero::Network,
|
pub network: monero::Network,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize)]
|
||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
pub struct TorConf {
|
pub struct TorConf {
|
||||||
pub control_port: u16,
|
pub control_port: u16,
|
||||||
pub socks5_port: u16,
|
pub socks5_port: u16,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize)]
|
||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
pub struct Maker {
|
pub struct Maker {
|
||||||
#[serde(with = "::bitcoin::util::amount::serde::as_btc")]
|
#[serde(with = "::bitcoin::util::amount::serde::as_btc")]
|
||||||
|
@ -5,7 +5,7 @@ use rust_decimal::Decimal;
|
|||||||
use std::fmt::{Debug, Display, Formatter};
|
use std::fmt::{Debug, Display, Formatter};
|
||||||
|
|
||||||
/// Represents the rate at which we are willing to trade 1 XMR.
|
/// Represents the rate at which we are willing to trade 1 XMR.
|
||||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
pub struct Rate {
|
pub struct Rate {
|
||||||
/// Represents the asking price from the market.
|
/// Represents the asking price from the market.
|
||||||
ask: bitcoin::Amount,
|
ask: bitcoin::Amount,
|
||||||
|
@ -108,7 +108,7 @@ impl SecretKey {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Serialize, Deserialize, PartialEq)]
|
#[derive(Debug, Copy, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
||||||
pub struct PublicKey(Point);
|
pub struct PublicKey(Point);
|
||||||
|
|
||||||
impl PublicKey {
|
impl PublicKey {
|
||||||
|
@ -13,7 +13,7 @@ use serde::{Deserialize, Serialize};
|
|||||||
const SCRIPT_SIZE: usize = 34;
|
const SCRIPT_SIZE: usize = 34;
|
||||||
const TX_LOCK_WEIGHT: usize = 485;
|
const TX_LOCK_WEIGHT: usize = 485;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
||||||
pub struct TxLock {
|
pub struct TxLock {
|
||||||
inner: PartiallySignedTransaction,
|
inner: PartiallySignedTransaction,
|
||||||
pub(in crate::bitcoin) output_descriptor: Descriptor<::bitcoin::PublicKey>,
|
pub(in crate::bitcoin) output_descriptor: Descriptor<::bitcoin::PublicKey>,
|
||||||
|
@ -37,7 +37,7 @@ impl Add<u32> for BlockHeight {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
pub enum ExpiredTimelocks {
|
pub enum ExpiredTimelocks {
|
||||||
None,
|
None,
|
||||||
Cancel,
|
Cancel,
|
||||||
|
@ -876,7 +876,7 @@ impl EstimateFeeRate for Client {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, PartialEq)]
|
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
||||||
pub enum ScriptStatus {
|
pub enum ScriptStatus {
|
||||||
Unseen,
|
Unseen,
|
||||||
InMempool,
|
InMempool,
|
||||||
@ -893,7 +893,7 @@ impl ScriptStatus {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, PartialEq)]
|
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
||||||
pub struct Confirmed {
|
pub struct Confirmed {
|
||||||
/// The depth of this transaction within the blockchain.
|
/// The depth of this transaction within the blockchain.
|
||||||
///
|
///
|
||||||
|
@ -28,7 +28,7 @@ const DEFAULT_BITCOIN_CONFIRMATION_TARGET_TESTNET: usize = 1;
|
|||||||
|
|
||||||
const DEFAULT_TOR_SOCKS5_PORT: &str = "9050";
|
const DEFAULT_TOR_SOCKS5_PORT: &str = "9050";
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq, Eq)]
|
||||||
pub struct Arguments {
|
pub struct Arguments {
|
||||||
pub env_config: env::Config,
|
pub env_config: env::Config,
|
||||||
pub debug: bool,
|
pub debug: bool,
|
||||||
@ -38,7 +38,7 @@ pub struct Arguments {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Represents the result of parsing the command-line parameters.
|
/// Represents the result of parsing the command-line parameters.
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq, Eq)]
|
||||||
pub enum ParseResult {
|
pub enum ParseResult {
|
||||||
/// The arguments we were invoked in.
|
/// The arguments we were invoked in.
|
||||||
Arguments(Box<Arguments>),
|
Arguments(Box<Arguments>),
|
||||||
@ -246,7 +246,7 @@ where
|
|||||||
Ok(ParseResult::Arguments(Box::new(arguments)))
|
Ok(ParseResult::Arguments(Box::new(arguments)))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq, Eq)]
|
||||||
pub enum Command {
|
pub enum Command {
|
||||||
BuyXmr {
|
BuyXmr {
|
||||||
seller: Multiaddr,
|
seller: Multiaddr,
|
||||||
@ -610,14 +610,14 @@ fn parse_monero_address(s: &str) -> Result<monero::Address> {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(thiserror::Error, Debug, Clone, Copy, PartialEq)]
|
#[derive(thiserror::Error, Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
#[error("Invalid monero address provided, expected address on network {expected:?} but address provided is on {actual:?}")]
|
#[error("Invalid monero address provided, expected address on network {expected:?} but address provided is on {actual:?}")]
|
||||||
pub struct MoneroAddressNetworkMismatch {
|
pub struct MoneroAddressNetworkMismatch {
|
||||||
expected: monero::Network,
|
expected: monero::Network,
|
||||||
actual: monero::Network,
|
actual: monero::Network,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(thiserror::Error, Debug, Clone, Copy, PartialEq, Serialize)]
|
#[derive(thiserror::Error, Debug, Clone, Copy, PartialEq, Eq, Serialize)]
|
||||||
#[error("Invalid Bitcoin address provided, expected address on network {expected:?} but address provided is on {actual:?}")]
|
#[error("Invalid Bitcoin address provided, expected address on network {expected:?} but address provided is on {actual:?}")]
|
||||||
pub struct BitcoinAddressNetworkMismatch {
|
pub struct BitcoinAddressNetworkMismatch {
|
||||||
#[serde(with = "crate::bitcoin::network")]
|
#[serde(with = "crate::bitcoin::network")]
|
||||||
|
@ -2,7 +2,7 @@ use anyhow::anyhow;
|
|||||||
|
|
||||||
const LATEST_RELEASE_URL: &str = "https://github.com/comit-network/xmr-btc-swap/releases/latest";
|
const LATEST_RELEASE_URL: &str = "https://github.com/comit-network/xmr-btc-swap/releases/latest";
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub enum Version {
|
pub enum Version {
|
||||||
Current,
|
Current,
|
||||||
Available,
|
Available,
|
||||||
|
@ -70,7 +70,7 @@ pub enum Alice {
|
|||||||
Done(AliceEndState),
|
Done(AliceEndState),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, strum::Display, Debug, Deserialize, Serialize, PartialEq)]
|
#[derive(Copy, Clone, strum::Display, Debug, Deserialize, Serialize, PartialEq, Eq)]
|
||||||
pub enum AliceEndState {
|
pub enum AliceEndState {
|
||||||
SafelyAborted,
|
SafelyAborted,
|
||||||
BtcRedeemed,
|
BtcRedeemed,
|
||||||
|
@ -5,7 +5,7 @@ use std::cmp::max;
|
|||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use time::ext::NumericalStdDuration;
|
use time::ext::NumericalStdDuration;
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Serialize)]
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
pub bitcoin_lock_mempool_timeout: Duration,
|
pub bitcoin_lock_mempool_timeout: Duration,
|
||||||
pub bitcoin_lock_confirmed_timeout: Duration,
|
pub bitcoin_lock_confirmed_timeout: Duration,
|
||||||
|
@ -230,7 +230,7 @@ mod wire {
|
|||||||
use bitcoin::util::amount::ParseAmountError;
|
use bitcoin::util::amount::ParseAmountError;
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, PartialEq)]
|
#[derive(Debug, Deserialize, PartialEq, Eq)]
|
||||||
#[serde(tag = "event")]
|
#[serde(tag = "event")]
|
||||||
pub enum Event {
|
pub enum Event {
|
||||||
#[serde(rename = "systemStatus")]
|
#[serde(rename = "systemStatus")]
|
||||||
|
@ -39,7 +39,7 @@ pub fn private_key_from_secp256k1_scalar(scalar: bitcoin::Scalar) -> PrivateKey
|
|||||||
PrivateKey::from_scalar(Scalar::from_bytes_mod_order(bytes))
|
PrivateKey::from_scalar(Scalar::from_bytes_mod_order(bytes))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Serialize, Deserialize, PartialEq)]
|
#[derive(Clone, Copy, Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||||
pub struct PrivateViewKey(#[serde(with = "monero_private_key")] PrivateKey);
|
pub struct PrivateViewKey(#[serde(with = "monero_private_key")] PrivateKey);
|
||||||
|
|
||||||
impl PrivateViewKey {
|
impl PrivateViewKey {
|
||||||
@ -78,7 +78,7 @@ impl From<PublicViewKey> for PublicKey {
|
|||||||
#[derive(Clone, Copy, Debug)]
|
#[derive(Clone, Copy, Debug)]
|
||||||
pub struct PublicViewKey(PublicKey);
|
pub struct PublicViewKey(PublicKey);
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Deserialize, Serialize, PartialEq, PartialOrd)]
|
#[derive(Debug, Copy, Clone, Deserialize, Serialize, PartialEq, Eq, PartialOrd)]
|
||||||
pub struct Amount(u64);
|
pub struct Amount(u64);
|
||||||
|
|
||||||
// Median tx fees on Monero as found here: https://www.monero.how/monero-transaction-fees, XMR 0.000_008 * 2 (to be on the safe side)
|
// Median tx fees on Monero as found here: https://www.monero.how/monero-transaction-fees, XMR 0.000_008 * 2 (to be on the safe side)
|
||||||
@ -185,7 +185,7 @@ impl fmt::Display for Amount {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||||
pub struct TransferProof {
|
pub struct TransferProof {
|
||||||
tx_hash: TxHash,
|
tx_hash: TxHash,
|
||||||
#[serde(with = "monero_private_key")]
|
#[serde(with = "monero_private_key")]
|
||||||
@ -205,7 +205,7 @@ impl TransferProof {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: add constructor/ change String to fixed length byte array
|
// TODO: add constructor/ change String to fixed length byte array
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||||
pub struct TxHash(pub String);
|
pub struct TxHash(pub String);
|
||||||
|
|
||||||
impl From<TxHash> for String {
|
impl From<TxHash> for String {
|
||||||
@ -227,7 +227,7 @@ pub struct InsufficientFunds {
|
|||||||
pub actual: Amount,
|
pub actual: Amount,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(thiserror::Error, Debug, Clone, PartialEq)]
|
#[derive(thiserror::Error, Debug, Clone, PartialEq, Eq)]
|
||||||
#[error("Overflow, cannot convert {0} to u64")]
|
#[error("Overflow, cannot convert {0} to u64")]
|
||||||
pub struct OverflowError(pub String);
|
pub struct OverflowError(pub String);
|
||||||
|
|
||||||
@ -470,10 +470,10 @@ mod tests {
|
|||||||
use rand::rngs::OsRng;
|
use rand::rngs::OsRng;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, PartialEq)]
|
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||||
pub struct MoneroPrivateKey(#[serde(with = "monero_private_key")] crate::monero::PrivateKey);
|
pub struct MoneroPrivateKey(#[serde(with = "monero_private_key")] crate::monero::PrivateKey);
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, PartialEq)]
|
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||||
pub struct MoneroAmount(#[serde(with = "monero_amount")] crate::monero::Amount);
|
pub struct MoneroAmount(#[serde(with = "monero_amount")] crate::monero::Amount);
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use libp2p::rendezvous::Namespace;
|
use libp2p::rendezvous::Namespace;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone, Copy)]
|
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
||||||
pub enum XmrBtcNamespace {
|
pub enum XmrBtcNamespace {
|
||||||
Mainnet,
|
Mainnet,
|
||||||
Testnet,
|
Testnet,
|
||||||
|
@ -37,7 +37,7 @@ pub mod protocol {
|
|||||||
>;
|
>;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq)]
|
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
pub struct BlockchainNetwork {
|
pub struct BlockchainNetwork {
|
||||||
#[serde(with = "crate::bitcoin::network")]
|
#[serde(with = "crate::bitcoin::network")]
|
||||||
pub bitcoin: bitcoin::Network,
|
pub bitcoin: bitcoin::Network,
|
||||||
|
@ -258,7 +258,7 @@ impl From<SpotPriceResponse> for Result<monero::Amount, Error> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, thiserror::Error, PartialEq)]
|
#[derive(Clone, Debug, thiserror::Error, PartialEq, Eq)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
#[error("Seller currently does not accept incoming swap requests, please try again later")]
|
#[error("Seller currently does not accept incoming swap requests, please try again later")]
|
||||||
NoSwapsAccepted,
|
NoSwapsAccepted,
|
||||||
|
@ -101,11 +101,11 @@ impl From<BobState> for State {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(thiserror::Error, Debug, Clone, Copy, PartialEq)]
|
#[derive(thiserror::Error, Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
#[error("Not in the role of Alice")]
|
#[error("Not in the role of Alice")]
|
||||||
pub struct NotAlice;
|
pub struct NotAlice;
|
||||||
|
|
||||||
#[derive(thiserror::Error, Debug, Clone, Copy, PartialEq)]
|
#[derive(thiserror::Error, Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
#[error("Not in the role of Bob")]
|
#[error("Not in the role of Bob")]
|
||||||
pub struct NotBob;
|
pub struct NotBob;
|
||||||
|
|
||||||
|
@ -560,7 +560,7 @@ impl State4 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
|
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)]
|
||||||
pub struct State5 {
|
pub struct State5 {
|
||||||
#[serde(with = "monero_private_key")]
|
#[serde(with = "monero_private_key")]
|
||||||
s_a: monero::PrivateKey,
|
s_a: monero::PrivateKey,
|
||||||
|
Loading…
Reference in New Issue
Block a user