Update to version 0.9.1 of questionable

This commit is contained in:
Mark Spanbroek 2021-05-10 09:42:38 +02:00 committed by markspanbroek
parent 0e34b69d7d
commit c57ecde046
3 changed files with 4 additions and 7 deletions

View File

@ -14,6 +14,6 @@ requires "nim >= 1.2.6",
"stew#head",
"protobufserialization >= 0.2.0 & < 0.3.0",
"https://github.com/status-im/nim-nitro >= 0.4.0 & < 0.5.0",
"questionable >= 0.7.0 & < 0.8.0",
"questionable >= 0.9.1 & < 0.10.0",
"upraises >= 0.1.0 & < 0.2.0",
"asynctest >= 0.2.1 & < 0.3.0"

View File

@ -39,11 +39,10 @@ func parse(_: type UInt256, bytes: seq[byte]): ?UInt256 =
UInt256.fromBytesBE(bytes).some
func init*(_: type Pricing, message: PricingMessage): ?Pricing =
let address = EthAddress.parse(message.address)
let price = UInt256.parse(message.price)
if address.isNone or price.isNone:
without address =? EthAddress.parse(message.address) and
price =? UInt256.parse(message.price):
return Pricing.none
Pricing(address: address.get, price: price.get).some
Pricing(address: address, price: price).some
func init*(_: type StateChannelUpdate, state: SignedState): StateChannelUpdate =
StateChannelUpdate(update: state.toJson.toBytes)

View File

@ -31,8 +31,6 @@ func parse(_: type UInt256, bytes: seq[byte]): ?UInt256 =
UInt256.fromBytesBE(bytes).some
func init*(_: type Presence, message: PresenceMessage): ?Presence =
mixin parsedCid, parsedPrice
without parsedCid =? Cid.init(message.cid):
return none Presence