use new proc to generate eligibility status

Co-authored-by: gabrielmer <101006718+gabrielmer@users.noreply.github.com>
This commit is contained in:
Sergei Tikhomirov 2024-12-11 14:47:13 +01:00
parent a3bef8150d
commit 22852d683c
2 changed files with 5 additions and 2 deletions

View File

@ -26,7 +26,7 @@ suite "Waku Incentivization Eligibility Codec":
eligibilityProof == decoded
asyncTest "encode eligibility status":
let eligibilityStatus = genEligibilityStatus(true)
let eligibilityStatus = new(EligibilityStatus, true)
let encoded = encode(eligibilityStatus)
let decoded = EligibilityStatus.decode(encoded.buffer).get()
check:

View File

@ -2,7 +2,10 @@ import std/options
import waku/incentivization/rpc
proc genEligibilityStatus*(isEligible: bool): EligibilityStatus =
proc new*(
T: type EligibilityStatus,
isEligible: bool
): T =
if isEligible:
EligibilityStatus(
statusCode: uint32(200),