πInstruction Filters
All filter types that can be applied to instruction query 'filter' objects
Overview
Several of Carpool's instruction queries accept a filter object in the POST body. This is an abstraction on top of Elasticsearch and is made to help users perform powerful aggregations and searches. Below you can find all possible filters for instruction queries
Instruction Filters
π INSTRUCTION_ACCOUNT
Description:
Filter for instructions that contain a specific account
Schema fields:
type*
accountPubKey*
accountName
Schema
"filter": {
"type": "INSTRUCTION_ACCOUNT",
"accountPubKey": "string",
"accountName": "string" // A specific account in an instruction's args (via IDL). Leave blank to match any account in the instruction.
}Example
"filter": {
"type": "INSTRUCTION_ACCOUNT",
"accountPubKey": "8mpTNU6vpLSD9mWx4BQt2S6sz2yP39ZhQ9TuMXY4MgUz",
"accountName": "authority"
}1οΈβ£ INSTRUCTION_ARG_NUMERIC
Description:
Search for instructions with specific numeric arguments present
Schema fields:
type*
path*
range*
Schema
"filter": {
"type": "INSTRUCTION_ARG_NUMERIC",
"path": "string", // Dot-delimited for nested fields
"range": NumericRange
}NumericRange type
// Either an equality check, or GTE/LTE range, one of which must be set.
export type NumericRange = XOR<XOR<{
gte: number;
lte?: number;
}, {
gte?: number;
lte: number;
}>, { eq: number }>;Example - 1
"filter": {
"type": "INSTRUCTION_ARG_NUMERIC",
"path": "args.clientOrderId",
"range": {
"gte": 2
}
}Example - 2
"filter": {
"type": "INSTRUCTION_ARG_NUMERIC",
"path": "data.creators.percentageShare",
"range": {
"eq": 100
}
}Combining Filters
It is important to note that you can also combine any of the above filters within a single query. You can return results based on an AND or OR condition.
AND
Schema
Example
OR
Schema
Example
Negating Filters
You can also negate filters if you'd like to look for all instructions that do not match the filter criteria. To negate, simply add "negate": true to the top level of the filter.
Example
Last updated