Conditions
This section focuses on Condition
types, composition and usage.
Base Conditions
Base conditions define specific criteria, and each includes a returnValueTest
to compare the actual execution result with the expected value. These include:
TimeCondition
– time-based conditions using block height and other blockchain-based timestamps. Example: only allow access after a certain timestamp.RpcCondition
– based on RPC calls as defined in Ethereum's Official API. Example: allow access if the requestor address holds a minimum ETH balance.ContractCondition
– uses on-chain state, allowing arbitrary contract function calls. Example: allow access if this requestor holds a special-purpose NFT.JSON Endpoint Conditions - uses state from a JSON HTTPS endpoint. Example: allow discount on event tickets/merchandise if there is "bad" weather according to a specific weather API.
JWTCondition
- validates JSON Web Tokens (JWTs) against a specified public key.Signing Object Conditions - validates objects submitted for threshold signing meet specified criteria by inspecting the values of designated fields (eg.
UserOperation
for ERC-4337)
Each base condition defines a returnValueTest
used to compare the obtained execution value with the expected value for the condition.
returnValueTest
A returnValueTest
is a mechanism used by a condition to evaluate whether a specific execution result meets a specified criterion. It allows dynamic comparisons between the actual returned value and the expected value.
It consists of three key components:
comparator
: defines the comparison operation to apply between the actual value obtained and the expected value. The available operators include:==
: equal to!=
: not equal to>
: greater than<
: less than>=
: greater than or equal to<=
: less than or equal toin
: value in array of values!in
: value not in array of values
value
: the expected value to compare against the actual returned value.index
(optional): indicates the position of the value to use for comparison within a list or array when multiple values are returned. If the response includes several values, this index determines which entry to evaluate. If the index is not specified, the entire response is used. For instance, if the array["apple", "banana", "grape"]
is returned during execution, an index of1
would select"banana"
as the value for comparison.
Context Variables
Context variables provide the ability for placeholder values to be defined within conditions at creation time, and be dynamically populated at verification time e.g. current user wallet address.
Logical Conditions
Logical conditions use control structures to determine overall condition outcomes based on the results of underlying conditions. These include:
CompoundCondition
- allows conditions to be combined using logical operators such asor
,and
¬
.SequentialCondition
- chains conditions to be executed in a specific order, where the outcome of one condition can be used by subsequent conditions.IfThenElseCondition
- implements branching logic for conditions where the flow follows an if-then-else structure i.e. IFCONDITION_A
THENCONDITION_B
ELSECONDITION_C
Last updated