0

I have an event that looks like this:

    event ItemListed(
        address indexed seller,
        address indexed nftAddress,
        uint256 indexed tokenId,
        uint256 price
    );

And I'd like to index all 4. However, can the graph only index the indexed parameters? With my graph setup, I have an event handler that looks like:

export function handleItemListed(event: ItemListedEvent): void {
    let itemListed = ItemListed.load(
        getIdFromEventParams(event.params.tokenId, event.params.nftAddress)
    )
    if (!itemListed) {
        itemListed = new ItemListed(
            getIdFromEventParams(event.params.tokenId, event.params.nftAddress)
        )
    }
    itemListed.seller = event.params.seller
    itemListed.nftAddress = event.params.nftAddress
    itemListed.tokenId = event.params.tokenId
    itemListed.price = event.params.price
    itemListed.save()
}

However, price is not showing up on my playground.

enter image description here

1 Answer 1

1

It can index non-indexed parameters, so long as it has the ABI. You have to add the variable to your query field!

{
  itemListeds(first: 5) {
    id
    seller
    nftAddress
    tokenId
    price
  }
}

enter image description here

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.