Under Construction This DApp is in development

Subgraph and Data Indexing

OmniSocial uses The Graph to index and query on-chain data in real time.

This allows the frontend and external tools to retrieve rich, filterable data such as wallet personas, proposals, tips, and DAO governance activity.

🧱 Core Entities

The subgraph defines the following key entities:

Entity
Description

Wallet

A user’s smart wallet with fields like address, .omni alias, and personas

Persona

Represents a user's persona NFT, including metadata and reputation values

DAO

A decentralized community created via the DAOFactory

Proposal

A governance proposal with state (active, passed, executed), metadata

Vote

A vote cast by a persona with support (yes/no/abstain) and reputation used

Tip

A tipping event, including sender, receiver, amount, and optional content

🔍 Example GraphQL Queries

🔹 Fetch all proposals in a DAO

{
  proposals(where: { dao: "0xDAO_ADDRESS" }) {
    id
    title
    description
    state
    createdAt
  }
}

🔹 Get a wallet by .omni alias

{
  wallets(where: { alias: "alice.omni" }) {
    id
    alias
    personas {
      id
      username
    }
  }
}

🔹 Show all tips received by a user

{
  tips(where: { receiver: "0xWALLET_ADDRESS" }) {
    id
    amount
    message
    timestamp
    sender {
      alias
    }
  }
}

🛠 Deploying the Subgraph

📍 Localhost (for dev)

From the subgraph/ folder:

  1. Start the local Graph node (Docker)

docker-compose up
  1. Generate code

yarn codegen
  1. Build the subgraph

yarn build
  1. Create & deploy

yarn create-local
yarn deploy-local

✅ Local queries: http://localhost:8000/subgraphs/name/omnisocial

☁️ Hosted Service (The Graph Hosted or Subgraph Studio)

1. Set up Graph account and auth:

graph auth --product hosted-service YOUR_AUTH_TOKEN

2. Deploy:

graph deploy --product hosted-service YOUR_GITHUB_USERNAME/omnisocial

🌐 You can then query the hosted subgraph from your Graph Explorer dashboard.

🧩 Schema Overview (Partial)

type Wallet @entity {
  id: ID!
  alias: String
  personas: [Persona!]! @derivedFrom(field: "wallet")
}

type Persona @entity {
  id: ID!
  username: String!
  wallet: Wallet!
  reputation: BigInt
}

type DAO @entity {
  id: ID!
  name: String!
  proposals: [Proposal!]! @derivedFrom(field: "dao")
}

type Proposal @entity {
  id: ID!
  dao: DAO!
  title: String!
  description: String
  state: String
  createdAt: BigInt
  votes: [Vote!]! @derivedFrom(field: "proposal")
}

type Vote @entity {
  id: ID!
  proposal: Proposal!
  voter: Persona!
  choice: String!
  repUsed: BigInt
}

type Tip @entity {
  id: ID!
  sender: Wallet!
  receiver: Wallet!
  amount: BigInt
  message: String
  timestamp: BigInt
}

🔁 Common Use Cases

Use Case
Query Example

Show all proposals in DAO

proposals(where: { dao })

Resolve .omni alias

wallets(where: { alias })

List tips a user has received

tips(where: { receiver })

Fetch votes on a proposal

votes(where: { proposal })

List all DAOs a user interacts with

Cross-reference via votes or proposals

Last updated

Was this helpful?