0
votes

When I query the vault and the query returns over 200 results, I see the following error:

Exception in thread "main" net.corda.core.node.services.VaultQueryException: 
Please specify a `PageSpecification` as there are more results [201] than the default page size [200]

How do I specify a PageSpecification?

1

1 Answers

0
votes

Here's an example of a query that extracts every unconsumed ContractState from the vault in pages of size 200, starting from the default page number (page one):

val vaultSnapshot = proxy.vaultQueryBy<ContractState>(
    QueryCriteria.VaultQueryCriteria(Vault.StateStatus.UNCONSUMED), 
    PageSpecification(DEFAULT_PAGE_NUM, 200)
)

You can find more information about page specifications here: https://docs.corda.net/api-vault-query.html#pagination.