Currently, there is no way to know if a box is being used as an input in mempool. So I propose to add a boolean field called beingSpent in BoxResolver do address this as a one-query way.
If this field is selected in the query, it should return true if the boxId is present in node_u_inputs.
Observe that using @FieldResolver() decorator is not the best approach for this specific case, since it can result in multiple undesired database queries for a single GraphQL query. You can take a look at AddressResolver specifically at balance field to see a way to avoid this by using isFieldSelected function.
Currently, there is no way to know if a box is being used as an input in mempool. So I propose to add a boolean field called
beingSpent
inBoxResolver
do address this as a one-query way.If this field is selected in the query, it should return
true
if theboxId
is present innode_u_inputs
.Observe that using
@FieldResolver()
decorator is not the best approach for this specific case, since it can result in multiple undesired database queries for a single GraphQL query. You can take a look atAddressResolver
specifically atbalance
field to see a way to avoid this by usingisFieldSelected
function.