Skip to content

Commit

Permalink
using ethers rlp export and delete dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
0xvv committed May 28, 2022
1 parent 1a34c8b commit 0b7b24e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 8 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

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

1 change: 0 additions & 1 deletion cast/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ rustc-hex = "2.1.0"
serde_json = "1.0.67"
chrono = "0.2"
hex = "0.4.3"
rlp = "0.5.1"

[dev-dependencies]
async-trait = "0.1.53"
Expand Down
4 changes: 2 additions & 2 deletions cast/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use ethers_core::{
Abi, AbiParser, Token,
},
types::{Chain, *},
utils::{self, get_contract_address, keccak256, parse_units},
utils::{self, get_contract_address, keccak256, parse_units, rlp},
};
use ethers_etherscan::Client;
use ethers_providers::{Middleware, PendingTransaction};
Expand Down Expand Up @@ -1095,7 +1095,7 @@ impl SimpleCast {
/// ```
pub fn to_rlp(value: String) -> Result<String> {
let val = serde_json::from_str(&value)?;
let item = rlp_converter::Item::value_to_item(&val, false)?;
let item = Item::value_to_item(&val, false)?;
Ok(format!("0x{}", hex::encode(rlp::encode(&item))))
}

Expand Down
6 changes: 2 additions & 4 deletions cast/src/rlp_converter.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
extern crate rlp;

use rlp::{Decodable, DecoderError, Encodable, Rlp, RlpStream};
use ethers_core::utils::rlp::{Decodable, DecoderError, Encodable, Rlp, RlpStream};
use serde_json::Value;
use std::fmt::{Debug, Display, Formatter, LowerHex};

Expand Down Expand Up @@ -122,7 +120,7 @@ impl Display for Item {
#[cfg(test)]
mod test {
use crate::rlp_converter::Item;
use rlp::DecoderError;
use ethers_core::utils::{rlp, rlp::DecoderError};
use serde_json::Result as JsonResult;

// https://en.wikipedia.org/wiki/Set-theoretic_definition_of_natural_numbers
Expand Down

0 comments on commit 0b7b24e

Please sign in to comment.