Querying Data

This page contains repeated patterns for fetching data from the Lens API.


Operation Validation

The OperationValidationOutcome type represents the result of validating the feasibility of an operation. This outcome can either indicate success, represented by OperationValidationPassed, or failure, represented by OperationValidationFailed.

type OperationValidationOutcome =  | OperationValidationPassed  | OperationValidationFailed;

Validation Passed

The OperationValidationPassed type indicates that the logged-in user has met all the requirements for the operation that can be checked statically. It provides additional details about requirements that must be evaluated at runtime.

type OperationValidationPassed = {  restrictedSignerRequired: boolean;  extraChecksRequired: UnknownRule[];};
type UnknownRule = {  rule: EvmAddress;  configParams: KeyValue[];};
type KeyValue = {  key: string;  value: string;};

Where:

  • restrictedSignerRequired: A boolean indicating whether the operation requires a signature from one of the restricted signers of the corresponding primitive.

  • extraChecksRequired: An array of UnknownRule objects representing custom rules associated with the operation. The application is responsible for evaluating these rules.

Validation Failed

The OperationValidationFailed type indicates that one or more requirements for the operation were not met.

type OperationValidationFailed = {  unsatisfiedRules: UnsatisfiedRule[];  reason: string;};
type UnsatisfiedRule = {  name: string;  rule: EvmAddress;  reason: string;};

Where:

  • unsatisfiedRules: An array of UnsatisfiedRule objects, each describing:

    • name: The name of the rule.

    • rule: The EvmAddress associated with the rule.

    • reason: Why the rule was not satisfied.

  • reason: A summary of the validation failure.