Skip to main content

Readers

A reader method is immutable, and any updates you make to the passed in state argument are ignored.

A reader method gets passed a context of type ReaderContext. A ReaderContext can only be used to make calls to other reader methods.

Here's an example of a reader method called Balance on our Account state that returns the account's current balance:

async def Balance(
self,
context: ReaderContext,
state: Account.State,
request: BalanceRequest,
) -> BalanceResponse:
return BalanceResponse(balance=state.balance)