List Vouchers
Get voucher based on its index:
voucher(
voucherIndex: Int!
inputIndex: Int!
): Voucher!
Arguments
voucherIndex
(Int!
)
inputIndex
(Int!
)
Type
Voucher
Representation of a transaction that can be carried out on the base layer blockchain, such as a transfer of assets.
Example usage
1. Query a detailed voucher, including proof, using both the voucherIndex
and inputIndex
:
query voucher($voucherIndex: Int!, $inputIndex: Int!) {
voucher(voucherIndex: $voucherIndex, inputIndex: $inputIndex) {
index
input {
index
}
destination
payload
proof {
validity {
inputIndexWithinEpoch
outputIndexWithinInput
outputHashesRootHash
vouchersEpochRootHash
noticesEpochRootHash
machineStateHash
outputHashInOutputHashesSiblings
outputHashesInEpochSiblings
}
context
}
}
}
Here, the query takes two variables: voucherIndex
and inputIndex
.
{
"voucherIndex": 1,
"inputIndex": 5
}
Get vouchers with support for pagination:
vouchers(
first: Int
last: Int
after: String
before: String
): VoucherConnection!
Arguments
first
(Int
)
Get at most the first n
entries(forward pagination).
last
(Int
)
Get at most the last n
entries(backward pagination).
after
(String
)
Get entries that come after the provided cursor(forward pagination).
before
(String
)
Get entries that come before the provided cursor(backward pagination).
Type
VoucherConnection
Pagination result.
Example usage
1. Query all vouchers:
query vouchers {
vouchers {
edges {
node {
index
input {
index
}
destination
payload
}
}
}
}
2. Query vouchers based on their inputIndex
:
query vouchersByInput($inputIndex: Int!) {
input(index: $inputIndex) {
vouchers {
edges {
node {
index
input {
index
}
destination
payload
}
}
}
}
}
{
"inputIndex": 1
}
In this example, the query is set to retrieve all vouchers at inputIndex
1