Output addresses with checksum.
This commit is contained in:
parent
404ceb39b9
commit
7821daf532
4 changed files with 11 additions and 6 deletions
|
@ -7,6 +7,7 @@ default-run = "server"
|
|||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
eth_checksum = "0.1.2"
|
||||
json = "^0.12.4"
|
||||
num-bigint = "^0.4.3"
|
||||
serde = { version = "1.0.149", features = ["serde_derive"] }
|
||||
|
|
|
@ -99,9 +99,9 @@ fn main() {
|
|||
maxFlowValue: flow.to_decimal(),
|
||||
transferSteps: transfers.iter().enumerate().map(|(i, e)| {
|
||||
json::object!{
|
||||
from: e.from.to_string(),
|
||||
to: e.to.to_string(),
|
||||
token: e.token.to_string(),
|
||||
from: e.from.to_checksummed_hex(),
|
||||
to: e.to.to_checksummed_hex(),
|
||||
token: e.token.to_checksummed_hex(),
|
||||
value: e.capacity.to_decimal(),
|
||||
step: i,
|
||||
}
|
||||
|
|
|
@ -166,9 +166,9 @@ fn compute_transfer(
|
|||
flow: flow.to_string(),
|
||||
final: max_distance.is_none(),
|
||||
transfers: transfers.into_iter().map(|e| json::object! {
|
||||
from: e.from.to_string(),
|
||||
to: e.to.to_string(),
|
||||
token_owner: e.token.to_string(),
|
||||
from: e.from.to_checksummed_hex(),
|
||||
to: e.to.to_checksummed_hex(),
|
||||
token_owner: e.token.to_checksummed_hex(),
|
||||
value: e.capacity.to_string()
|
||||
}).collect::<Vec<_>>(),
|
||||
},
|
||||
|
|
|
@ -11,6 +11,10 @@ impl Address {
|
|||
pub fn to_bytes(self) -> [u8; 20] {
|
||||
self.0
|
||||
}
|
||||
|
||||
pub fn to_checksummed_hex(&self) -> String {
|
||||
eth_checksum::checksum(&self.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
impl Debug for Address {
|
||||
|
|
Loading…
Reference in a new issue