simplify getRequest

This commit is contained in:
Eric Mastro 2022-09-19 12:42:17 +10:00 committed by Eric Mastro
parent eb14ca6166
commit ae9467b780
1 changed files with 1 additions and 5 deletions

View File

@ -37,11 +37,7 @@ method requestStorage(market: OnChainMarket,
method getRequest(market: OnChainMarket, method getRequest(market: OnChainMarket,
id: RequestId): Future[?StorageRequest] {.async.} = id: RequestId): Future[?StorageRequest] {.async.} =
try: try:
let request = await market.contract.getRequest(id) return some await market.contract.getRequest(id)
if request != StorageRequest.default:
return some request
else:
return none StorageRequest
except ValueError: except ValueError:
# Unknown request # Unknown request
return none StorageRequest return none StorageRequest