Skip to main content

Inputs

Inputs represent requests submitted to the application to advance its state.

1. Get Input by Index

Retrieve a specific input based on its identifier.

query getInput($inputIndex: Int!) {
input(index: $inputIndex) {
index
status
timestamp
msgSender
blockNumber
payload
}
}

Arguments

NameTypeDescription
inputIndexIntIndex of the input to retrieve.

Response Type

Input

2. Get Inputs

Retrieve a list of inputs with support for pagination.

query inputs(
$first: Int
$last: Int
$after: String
$before: String
$where: InputFilter
) {
inputs(
first: $first
last: $last
after: $after
before: $before
where: $where
) {
edges {
node {
index
status
timestamp
msgSender
blockNumber
payload
}
}
pageInfo {
hasNextPage
hasPreviousPage
startCursor
endCursor
}
}
}

Arguments

NameTypeDescription
firstIntGet at most the first n entries (forward pagination).
lastIntGet at most the last n entries (backward pagination).
afterStringGet entries after the provided cursor (forward pagination).
beforeStringGet entries before the provided cursor (backward pagination).
whereInputFilterFilter criteria for inputs.

Response Type

InputConnection

pagination and filtering
  • You cannot mix forward pagination (first, after) with backward pagination (last, before) in the same query.

  • The where argument allows you to filter inputs based the InputFilter.

  • When using where with after or before, the filter is applied first, and then the pagination is applied to the filtered results.

3. Get Input Result

Retrieve the result of a specific input, including its associated notices, vouchers, and reports.

query getInputResult($inputIndex: Int!) {
input(index: $inputIndex) {
status
timestamp
msgSender
blockNumber
reports {
edges {
node {
index
input {
index
}
payload
}
}
}
notices {
edges {
node {
index
input {
index
}
payload
}
}
}
vouchers {
edges {
node {
index
input {
index
}
destination
payload
}
}
}
}
}

Arguments

NameTypeDescription
inputIndexIntIndex of the input to retrieve.

Response Type

Input with nested connections for reports, notices, and vouchers.

Examples

  1. Fetching a specific input:

    query {
    input(index: 5) {
    index
    status
    timestamp
    msgSender
    blockNumber
    payload
    }
    }
  2. Listing earlier(first 5) inputs:

    query {
    inputs(first: 5) {
    edges {
    node {
    index
    status
    timestamp
    msgSender
    payload
    }
    }
    pageInfo {
    hasNextPage
    endCursor
    }
    }
    }
  3. Retrieving input results:

    query {
    input(index: 10) {
    status
    timestamp
    notices {
    edges {
    node {
    index
    payload
    }
    }
    }
    vouchers {
    edges {
    node {
    index
    destination
    payload
    }
    }
    }
    }
    }
  4. Using pagination and filtering:

    query {
    inputs(first: 5, where: { indexLowerThan: 1 }) {
    edges {
    node {
    index
    status
    timestamp
    msgSender
    payload
    }
    }
    pageInfo {
    hasNextPage
    endCursor
    }
    }
    }

© 2024 Cartesi Foundation Ltd. All rights reserved.

The Cartesi Project is commissioned by the Cartesi Foundation.

We use cookies to ensure that we give you the best experience on our website. By using the website, you agree to the use of cookies.