@@ -11,12 +11,12 @@ use std::{
11
11
12
12
use bech32:: { FromBase32 , ToBase32 } ;
13
13
use bls_signatures_rs:: { bn256, bn256:: Bn256 , MultiSignature } ;
14
+ use core:: fmt:: Display ;
14
15
use ethereum_types:: U256 ;
15
16
use failure:: Fail ;
16
17
use futures:: future:: BoxFuture ;
17
18
use ordered_float:: OrderedFloat ;
18
19
use serde:: { Deserialize , Deserializer , Serialize } ;
19
- use core:: fmt:: Display ;
20
20
21
21
use partial_struct:: PartialStruct ;
22
22
use witnet_crypto:: {
@@ -1605,28 +1605,14 @@ pub struct ValueTransferOutput {
1605
1605
/// Address that will receive the value
1606
1606
pub pkh : PublicKeyHash ,
1607
1607
/// Transferred value in nanowits
1608
- #[ serde(
1609
- serialize_with = "u64_to_string" ,
1610
- deserialize_with = "number_from_string"
1611
- ) ]
1608
+ #[ serde( deserialize_with = "number_from_string" ) ]
1612
1609
pub value : u64 ,
1613
1610
/// The value attached to a time-locked output cannot be spent before the specified
1614
1611
/// timestamp. That is, they cannot be used as an input in any transaction of a
1615
1612
/// subsequent block proposed for an epoch whose opening timestamp predates the time lock.
1616
1613
pub time_lock : u64 ,
1617
1614
}
1618
1615
1619
- pub fn u64_to_string < S > ( val : & u64 , serializer : S ) -> Result < S :: Ok , S :: Error >
1620
- where
1621
- S : serde:: Serializer ,
1622
- {
1623
- if serializer. is_human_readable ( ) {
1624
- serializer. serialize_str ( & val. to_string ( ) )
1625
- } else {
1626
- serializer. serialize_u64 ( * val)
1627
- }
1628
- }
1629
-
1630
1616
pub fn number_from_string < ' de , T , D > ( deserializer : D ) -> Result < T , D :: Error >
1631
1617
where
1632
1618
D : Deserializer < ' de > ,
@@ -1668,10 +1654,12 @@ pub struct DataRequestOutput {
1668
1654
/// Data request structure
1669
1655
pub data_request : RADRequest ,
1670
1656
/// Reward in nanowits that will be earned by honest witnesses
1657
+ #[ serde( deserialize_with = "number_from_string" ) ]
1671
1658
pub witness_reward : u64 ,
1672
1659
/// Number of witnesses that will resolve this data request
1673
1660
pub witnesses : u16 ,
1674
1661
/// This fee will be earn by the miner when include commits and/or reveals in the block
1662
+ #[ serde( deserialize_with = "number_from_string" ) ]
1675
1663
pub commit_and_reveal_fee : u64 ,
1676
1664
/// The minimum percentage of non-error reveals required to consider this data request as
1677
1665
/// "resolved" instead of as "error".
@@ -1683,6 +1671,7 @@ pub struct DataRequestOutput {
1683
1671
/// this data request.
1684
1672
/// This field must be >= collateral_minimum, or zero.
1685
1673
/// If zero, it will be treated as collateral_minimum.
1674
+ #[ serde( deserialize_with = "number_from_string" ) ]
1686
1675
pub collateral : u64 ,
1687
1676
}
1688
1677
@@ -1732,6 +1721,7 @@ impl DataRequestOutput {
1732
1721
pub struct StakeOutput {
1733
1722
pub authorization : KeyedSignature ,
1734
1723
pub key : StakeKey < PublicKeyHash > ,
1724
+ #[ serde( deserialize_with = "number_from_string" ) ]
1735
1725
pub value : u64 ,
1736
1726
}
1737
1727
0 commit comments