Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 0 additions & 7 deletions mm2src/adex_cli/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions mm2src/coins/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ doctest = false
async-std = { version = "1.5", features = ["unstable"] }
async-trait = "0.1.52"
base64 = "0.21.2"
# Todo: remove this and rely on bs58 throught the whole codebase
base58 = "0.2.0"
bip32 = { version = "0.2.2", default-features = false, features = ["alloc", "secp256k1-ffi"] }
bitcoin_hashes = "0.11"
bitcrypto = { path = "../mm2_bitcoin/crypto" }
Expand Down
14 changes: 0 additions & 14 deletions mm2src/coins/lp_coins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
#[macro_use] extern crate ser_error_derive;

use async_trait::async_trait;
use base58::FromBase58Error;
use bip32::ExtendedPrivateKey;
use common::custom_futures::timeout::TimeoutError;
use common::executor::{abortable_queue::WeakSpawner, AbortedError, SpawnFuture};
Expand Down Expand Up @@ -3418,19 +3417,6 @@ impl HttpStatusCode for VerificationError {
}
}

impl From<FromBase58Error> for VerificationError {
fn from(e: FromBase58Error) -> Self {
match e {
FromBase58Error::InvalidBase58Character(c, _) => {
VerificationError::AddressDecodingError(format!("Invalid Base58 Character: {}", c))
},
FromBase58Error::InvalidBase58Length => {
VerificationError::AddressDecodingError(String::from("Invalid Base58 Length"))
},
}
}
}

/// NB: Implementations are expected to follow the pImpl idiom, providing cheap reference-counted cloning and garbage collection.
#[async_trait]
pub trait MmCoin: SwapOps + WatcherOps + MarketCoinOps + Send + Sync + 'static {
Expand Down
2 changes: 1 addition & 1 deletion mm2src/mm2_bitcoin/keys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ authors = ["debris <marek.kotewicz@gmail.com>"]
doctest = false

[dependencies]
bs58 = "0.4.0"
rustc-hex = "2"
base58 = "0.2"
bech32 = "0.9.1"
bitcrypto = { path = "../crypto" }
derive_more = "0.99"
Expand Down
7 changes: 4 additions & 3 deletions mm2src/mm2_bitcoin/keys/src/legacyaddress.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::str::FromStr;
use std::{convert::TryInto, fmt};

use base58::{FromBase58, ToBase58};
use crypto::{checksum, ChecksumType};
use std::ops::Deref;
use {AddressHashEnum, AddressPrefix, DisplayLayout};
Expand Down Expand Up @@ -82,7 +81,7 @@ impl FromStr for LegacyAddress {
where
Self: Sized,
{
let hex = s.from_base58().map_err(|_| Error::InvalidAddress)?;
let hex = bs58::decode(s).into_vec().map_err(|_| Error::InvalidAddress)?;
LegacyAddress::from_layout(&hex)
}
}
Expand All @@ -92,7 +91,9 @@ impl From<&'static str> for LegacyAddress {
}

impl fmt::Display for LegacyAddress {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { self.layout().to_base58().fmt(fmt) }
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
bs58::encode(self.layout().as_ref()).into_string().fmt(fmt)
}
}

impl LegacyAddress {
Expand Down
2 changes: 1 addition & 1 deletion mm2src/mm2_bitcoin/keys/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! Bitcoin keys.

extern crate base58;
extern crate bech32;
extern crate bitcrypto as crypto;
extern crate bs58;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't needed, we can also replace all the extern crate lines from this module, they are all rely on very old API from rustc.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turned out to be a big diff, let's do it in a different PR after the toolchain update is merged.

extern crate derive_more;
extern crate lazy_static;
extern crate primitives;
Expand Down
5 changes: 2 additions & 3 deletions mm2src/mm2_bitcoin/keys/src/private.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

use crate::SECP_SIGN;
use address::detect_checksum;
use base58::{FromBase58, ToBase58};
use crypto::{checksum, ChecksumType};
use hex::ToHex;
use secp256k1::{Message as SecpMessage, SecretKey};
Expand Down Expand Up @@ -110,7 +109,7 @@ impl fmt::Debug for Private {
}

impl fmt::Display for Private {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.layout().to_base58().fmt(f) }
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { bs58::encode(self.layout()).into_string().fmt(f) }
}

impl FromStr for Private {
Expand All @@ -120,7 +119,7 @@ impl FromStr for Private {
where
Self: Sized,
{
let hex = s.from_base58().map_err(|_| Error::InvalidPrivate)?;
let hex = bs58::decode(s).into_vec().map_err(|_| Error::InvalidPrivate)?;
Private::from_layout(&hex)
}
}
Expand Down
Loading