diff --git a/Cargo.lock b/Cargo.lock
index 291527151..47763e751 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -549,7 +549,7 @@ version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
-name = "eip712"
+name = "eip-712"
version = "0.1.0"
dependencies = [
"ethabi 6.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2509,7 +2509,7 @@ version = "1.12.0"
dependencies = [
"ansi_term 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cid 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "eip712 0.1.0",
+ "eip-712 0.1.0",
"ethash 1.12.0",
"ethcore 1.12.0",
"ethcore-io 1.12.0",
diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml
index dc000d73b..9babb4f77 100644
--- a/rpc/Cargo.toml
+++ b/rpc/Cargo.toml
@@ -58,7 +58,7 @@ parity-updater = { path = "../updater" }
parity-version = { path = "../util/version" }
patricia-trie = "0.3.0"
rlp = { version = "0.3.0", features = ["ethereum"] }
-eip712 = { path = "../util/EIP-712" }
+eip-712 = { path = "../util/EIP-712" }
stats = { path = "../util/stats" }
vm = { path = "../ethcore/vm" }
diff --git a/rpc/src/lib.rs b/rpc/src/lib.rs
index 4cacb9587..ac0d3dd6f 100644
--- a/rpc/src/lib.rs
+++ b/rpc/src/lib.rs
@@ -62,7 +62,7 @@ extern crate parity_runtime;
extern crate parity_updater as updater;
extern crate parity_version as version;
extern crate patricia_trie as trie;
-extern crate eip712;
+extern crate eip_712;
extern crate rlp;
extern crate stats;
extern crate vm;
diff --git a/rpc/src/v1/helpers/eip191.rs b/rpc/src/v1/helpers/eip191.rs
index 56ceba5f2..44d234568 100644
--- a/rpc/src/v1/helpers/eip191.rs
+++ b/rpc/src/v1/helpers/eip191.rs
@@ -16,7 +16,7 @@
//! EIP-191 compliant decoding + hashing
use v1::types::{EIP191Version, Bytes, PresignedTransaction};
-use eip712::{hash_structured_data, EIP712};
+use eip_712::{hash_structured_data, EIP712};
use serde_json::{Value, from_value};
use v1::helpers::errors;
use jsonrpc_core::Error;
diff --git a/rpc/src/v1/impls/personal.rs b/rpc/src/v1/impls/personal.rs
index e42a91b1f..97f0eaf62 100644
--- a/rpc/src/v1/impls/personal.rs
+++ b/rpc/src/v1/impls/personal.rs
@@ -39,7 +39,7 @@ use v1::types::{
EIP191Version,
};
use v1::metadata::Metadata;
-use eip712::{EIP712, hash_structured_data};
+use eip_712::{EIP712, hash_structured_data};
use jsonrpc_core::types::Value;
/// Account management (personal) rpc implementation.
diff --git a/rpc/src/v1/traits/personal.rs b/rpc/src/v1/traits/personal.rs
index cda33f4cf..0073d0a28 100644
--- a/rpc/src/v1/traits/personal.rs
+++ b/rpc/src/v1/traits/personal.rs
@@ -15,7 +15,7 @@
// along with Parity. If not, see .
//! Personal rpc interface.
-use eip712::EIP712;
+use eip_712::EIP712;
use jsonrpc_core::types::Value;
use jsonrpc_core::{BoxFuture, Result};
use v1::types::{Bytes, U128, H160, H256, H520, TransactionRequest, RichRawTransaction as RpcRichRawTransaction, EIP191Version};
diff --git a/util/EIP-712/Cargo.toml b/util/EIP-712/Cargo.toml
index aaee48bcc..baf0bfc89 100644
--- a/util/EIP-712/Cargo.toml
+++ b/util/EIP-712/Cargo.toml
@@ -1,7 +1,14 @@
[package]
-name = "eip712"
+name = "eip-712"
version = "0.1.0"
authors = ["Parity Technologies "]
+repository = "https://github.com/paritytech/parity-ethereum"
+documentation = "https://docs.rs/eip-712"
+readme = "README.md"
+description = "eip-712 encoding"
+keywords = ["eip-712", "eip712", "eip"]
+license = "GPL-3.0"
+edition = "2018"
[dependencies]
serde_derive = "1.0"
diff --git a/util/EIP-712/README.md b/util/EIP-712/README.md
new file mode 100644
index 000000000..8ddb84bb4
--- /dev/null
+++ b/util/EIP-712/README.md
@@ -0,0 +1,62 @@
+# EIP-712 ![Crates.io](https://img.shields.io/crates/d/EIP-712.svg) [![Released API docs](https://docs.rs/EIP-712/badge.svg)](https://docs.rs/EIP-712)
+
+## Example
+
+```rust
+use eip_712::{EIP712, hash_structured_data};
+use serde_json::from_str;
+use rustc_hex::ToHex;
+
+fn main() {
+ let json = r#"{
+ "primaryType": "Mail",
+ "domain": {
+ "name": "Ether Mail",
+ "version": "1",
+ "chainId": "0x1",
+ "verifyingContract": "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC"
+ },
+ "message": {
+ "from": {
+ "name": "Cow",
+ "wallet": "0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826"
+ },
+ "to": {
+ "name": "Bob",
+ "wallet": "0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB"
+ },
+ "contents": "Hello, Bob!"
+ },
+ "types": {
+ "EIP712Domain": [
+ { "name": "name", "type": "string" },
+ { "name": "version", "type": "string" },
+ { "name": "chainId", "type": "uint256" },
+ { "name": "verifyingContract", "type": "address" }
+ ],
+ "Person": [
+ { "name": "name", "type": "string" },
+ { "name": "wallet", "type": "address" }
+ ],
+ "Mail": [
+ { "name": "from", "type": "Person" },
+ { "name": "to", "type": "Person" },
+ { "name": "contents", "type": "string" }
+ ]
+ }
+ }"#;
+ let typed_data = from_str::(json).unwrap();
+
+ assert_eq!(
+ hash_structured_data(typed_data).unwrap().to_hex::(),
+ "be609aee343fb3c4b28e1df9e632fca64fcfaede20f02e86244efddf30957bd2"
+ )
+}
+
+```
+
+## License
+
+This crate is distributed under the terms of GNU GENERAL PUBLIC LICENSE version 3.0.
+
+See [LICENSE](../../LICENSE) for details.
diff --git a/util/EIP-712/src/eip712.rs b/util/EIP-712/src/eip712.rs
index fea97a988..add2a97ed 100644
--- a/util/EIP-712/src/eip712.rs
+++ b/util/EIP-712/src/eip712.rs
@@ -21,6 +21,7 @@ use ethereum_types::{U256, H256, Address};
use regex::Regex;
use validator::Validate;
use validator::ValidationErrors;
+use lazy_static::lazy_static;
pub(crate) type MessageTypes = HashMap>;
diff --git a/util/EIP-712/src/encode.rs b/util/EIP-712/src/encode.rs
index 2add93db5..865d6c2f1 100644
--- a/util/EIP-712/src/encode.rs
+++ b/util/EIP-712/src/encode.rs
@@ -23,9 +23,9 @@ use std::str::FromStr;
use itertools::Itertools;
use indexmap::IndexSet;
use serde_json::to_value;
-use parser::{Parser, Type};
-use error::{Result, ErrorKind, serde_error};
-use eip712::{EIP712, MessageTypes};
+use crate::parser::{Parser, Type};
+use crate::error::{Result, ErrorKind, serde_error};
+use crate::eip712::{EIP712, MessageTypes};
use rustc_hex::FromHex;
use validator::Validate;
use std::collections::HashSet;
@@ -162,7 +162,7 @@ fn encode_data(
check_hex(&string)?;
- let mut bytes = (&string[2..])
+ let bytes = (&string[2..])
.from_hex::>()
.map_err(|err| ErrorKind::HexParseError(format!("{}", err)))?;
diff --git a/util/EIP-712/src/lib.rs b/util/EIP-712/src/lib.rs
index b881a45e3..d5a9ae2d1 100644
--- a/util/EIP-712/src/lib.rs
+++ b/util/EIP-712/src/lib.rs
@@ -156,26 +156,13 @@
//! }
//! ```
-#![warn(missing_docs, unused_extern_crates)]
+#![warn(missing_docs)]
-extern crate serde_json;
-extern crate ethabi;
-extern crate ethereum_types;
-extern crate keccak_hash;
-extern crate itertools;
-extern crate failure;
-extern crate indexmap;
-extern crate lunarity_lexer;
-extern crate toolshed;
-extern crate regex;
-extern crate validator;
#[macro_use]
extern crate validator_derive;
#[macro_use]
extern crate serde_derive;
-#[macro_use]
-extern crate lazy_static;
-extern crate rustc_hex;
+
mod eip712;
mod error;
@@ -183,8 +170,8 @@ mod parser;
mod encode;
/// the EIP-712 encoding function
-pub use encode::hash_structured_data;
+pub use crate::encode::hash_structured_data;
/// encoding Error types
-pub use error::{ErrorKind, Error};
+pub use crate::error::{ErrorKind, Error};
/// EIP712 struct
-pub use eip712::EIP712;
+pub use crate::eip712::EIP712;
diff --git a/util/EIP-712/src/parser.rs b/util/EIP-712/src/parser.rs
index 7f515f7c9..1da74b539 100644
--- a/util/EIP-712/src/parser.rs
+++ b/util/EIP-712/src/parser.rs
@@ -16,7 +16,7 @@
//! Solidity type-name parsing
use lunarity_lexer::{Lexer, Token};
-use error::*;
+use crate::error::*;
use toolshed::Arena;
use std::{fmt, result};