Skip to content
Open
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
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ reqwest = { version = "0.6", optional = true }
clippy = {version = "0.0", optional = true}
chrono = "0.4"
hidapi = "0.4"
openalias = { version = "0.2", optional = true }

[dev-dependencies]
tempdir = "0.3"
Expand All @@ -61,3 +62,4 @@ default = ["http", "emerald-rocksdb"]
http = ["hyper", "reqwest"]
dev = ["clippy"]
fs-storage = []
openalias-support = ["openalias"]
2 changes: 1 addition & 1 deletion shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ with pkgs;
stdenv.mkDerivation {
name = "emerald-env";
buildInputs = [
rustc cargo openssl pkgconfig
rustc cargo openssl pkgconfig libusb
];
}
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ extern crate hex;
extern crate hidapi;
extern crate emerald_rocksdb as rocksdb;

#[cfg(feature = "openalias-support")]
extern crate openalias;

mod core;
pub mod addressbook;
pub mod keystore;
Expand Down
19 changes: 18 additions & 1 deletion src/rpc/serves.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,24 @@ pub fn sign_transaction(
wallet_manager: &Mutex<RefCell<WManager>>,
) -> Result<Params, Error> {
let storage_ctrl = storage.lock().unwrap();
let (transaction, additional) = params.into_full();
let (mut transaction, additional) = params.into_full();

#[cfg(feature = "openalias-support")]
{
use openalias;

if !transaction.to.starts_with("0x") {
if let Ok(addresses) = openalias::addresses(&transaction.to) {
for address in addresses {
if &address.cryptocurrency == "etc" {
transaction.to = address.address;
break;
}
}
}
}
}

let storage = storage_ctrl.get_keystore(&additional.chain)?;
let addr = Address::from_str(&transaction.from)?;

Expand Down