WIP feat: Seth command parity pt. 1#14
Conversation
|
Looks like there isn't a way to get localized timezone in Rust?
|
| unwrap_or_stdin(decimals)?, | ||
| unwrap_or_stdin(value)? |
There was a problem hiding this comment.
Double stdin args don't work I believe, so best to make the first argument the stdin one, to be consistent with seth.
| ToDec { hexvalue: String }, | ||
| #[structopt(name = "--to-fix")] | ||
| #[structopt(about = "convert integers into fixed point with specified decimals")] | ||
| ToFix { decimals: Option<u128>, value: Option<u128> }, |
There was a problem hiding this comment.
Yeah I tested OG seth and you can only do echo 1 | seth --to-fix 3 (outputs 0.001), double stdin doesn't work so only have value being Option and have decimals be mandatory
| pub fn namehash(ens: &str) -> Result<String> { | ||
| let mut node = vec![0u8; 32]; | ||
|
|
||
| if !ens.is_empty() { |
There was a problem hiding this comment.
Let's use this upstream function instead of re-implementing it.
| /// Ok(()) | ||
| /// } | ||
| /// ``` | ||
| pub fn to_wei(value: u128, unit: String) -> Result<String> { |
There was a problem hiding this comment.
Can you also add a command called format_units and parse_units which calls back to ethers::utils::{parse_units, format_units}? Maybe for the next PR.
| let mut ascii = String::new(); | ||
| for letter in iter.collect::<Vec<_>>() { | ||
| ascii.push(letter.unwrap() as char); | ||
| } |
There was a problem hiding this comment.
This is an example of something you'd do with fold
|
For gas-price, I think it would be useful to return both the value from the provider and the one from Bonus points for some coloring in the return values. I made a similar PR in daptools OG and would be happy to port it here. The end game is to use this command + |
Adds more Seth commands:
seth: --to-fixseth block-numberseth basefeeseth chain-idseth ageseth namehashseth keccakseth gas-priceseth chainseth --to-weiseth --to-uint256seth --to-decseth --to-ascii