Skip to content

Commit

Permalink
fix: get vrf status in pending block
Browse files Browse the repository at this point in the history
  • Loading branch information
EvolveArt committed Aug 7, 2024
1 parent d095697 commit f0e3041
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pragma-sdk/pragma_sdk/onchain/mixins/randomness.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
VRFRequestParams,
VRFSubmitParams,
)
from pragma_sdk.onchain.types.types import BlockId

logger = get_pragma_sdk_logger()

Expand Down Expand Up @@ -191,6 +192,7 @@ async def get_request_status(
self,
caller_address: Address,
request_id: int,
block_id: Optional[BlockId] = "latest",
) -> RequestStatus:
"""
Query the status of a request given the caller address and request ID.
Expand All @@ -202,6 +204,7 @@ async def get_request_status(
(response,) = await self.randomness.functions["get_request_status"].call(
caller_address,
request_id,
block_number=block_id,
)
return RequestStatus(response.variant)

Expand Down Expand Up @@ -386,7 +389,7 @@ async def handle_random(

statuses = await asyncio.gather(
*[
self.get_request_status(event.caller_address, event.request_id)
self.get_request_status(event.caller_address, event.request_id, block_id="pending")
for event in events
]
)
Expand Down

0 comments on commit f0e3041

Please sign in to comment.