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).
container
Input
required
The containing geometry (typically a polygon). See Input types for accepted formats.
containee
Input
required
The geometry to check — is this inside the container?
schema
string
EAS schema UID. The server uses a default schema if not provided.
recipient
string
Ethereum address to receive the attestation. Defaults to the zero address.

Example request

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

Response

Returns a BooleanComputeResponse.
result
boolean
required
true if the containee is inside the container, false otherwise.
operation
string
required
Always "contains".
timestamp
number
required
Unix timestamp of computation.
inputRefs
string[]
required
Array containing [containerRef, containeeRef].
attestation
AttestationData
required
Signed EAS attestation. See AttestationData.
delegatedAttestation
DelegatedAttestationData
required
Signature for delegated onchain submission. See DelegatedAttestationData.

Example response

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

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
The field for the inner geometry is containee, not geometry. This naming distinguishes the two inputs unambiguously.

SDK Method

See astral.compute.contains()