How to define and register a query
Request
and Response
along with a handler function with the following signature:
WorldVars
static query used to provide the client with game constants.PlayerLocation
query used to provide the client with the location of the player.query
directory with each query definition in its own separate file.
You can easily create a new query and register it to the world by following these steps:
Define the request/response struct and the handler function
cardinal.WorldContext
.Register the query in the world
RegisterQuery
function and passing in the name of the endpoint and the function handler.WithQueryEVMSupport
option when you register your queries. This will generate the ABI types necessary for interactions with smart contracts.