Skip to main content
Research Preview — This API is under development.

Contains

Check if a geometry is inside a container geometry.
POST /compute/v0/contains

Request Body

chainId
number
required
Target chain ID (e.g., 84532 for Base Sepolia, 8453 for Base).
container
Input
required
The containing geometry (typically a polygon). Can be a UID, GeoJSON, or offchain attestation reference.
geometry
Input
required
The geometry to check. Can be a UID, GeoJSON, or offchain attestation reference.
schema
string
required
EAS schema UID to issue the attestation against.
recipient
string
Ethereum address to receive the attestation. Defaults to zero address if not provided.

Example Request

curl -X POST https://api.astral.global/compute/v0/contains \
  -H "Content-Type: application/json" \
  -d '{
    "chainId": 84532,
    "container": "0xpolygon...",
    "geometry": "0xpoint...",
    "schema": "0xschema...",
    "recipient": "0xdef456..."
  }'

Response

result
boolean
required
true if the geometry is inside the container, false otherwise
operation
string
required
Always “contains”
timestamp
number
required
Unix timestamp of computation
inputRefs
string[]
required
Array containing [containerRef, geometryRef]

Example Response

{
  "result": true,
  "operation": "contains",
  "timestamp": 1706400000,
  "inputRefs": [
    "0xpolygon...",
    "0xpoint..."
  ],
  "attestation": {
    "schema": "0x...",
    "attester": "0x...",
    "recipient": "0xdef456...",
    "data": "0x...",
    "signature": "0x..."
  },
  "delegatedAttestation": {
    "signature": "0x...",
    "attester": "0x...",
    "deadline": 1706403600
  }
}

Notes

  • Uses PostGIS ST_Contains function
  • The container must completely contain the geometry for true
  • Points on the boundary may return false (use intersects for boundary cases)

SDK Method

See astral.compute.contains()