Under Construction This DApp is in development

Integration Examples & Tutorials

This section provides hands-on examples of how to leverage OmniSocial’s identity, governance, and social modules in your own decentralized apps, bots, or dashboards.

Each tutorial is concise, code-driven, and designed to get you building fast.

📛 Using OmniSocial Identity in Your dApp

Goal: Fetch a user's active PersonaNFT and reputation in specific domains using GraphQL.

Tools: GraphQL, Apollo Client (or fetch), PersonaID or .omni domain.

# Get active persona and rep
query GetUserIdentityAndRep($wallet: String!) {
  wallet(id: $wallet) {
    activePersona {
      id
      handle
      label
    }
    reputations {
      domain
      score
    }
  }
}

Example output:

{
  "activePersona": {
    "handle": "daoqueen.omni",
    "label": "DAO Manager"
  },
  "reputations": [
    { "domain": "governance", "score": "1600" },
    { "domain": "content", "score": "890" }
  ]
}

✅ You can use this to display identity cards, rank users, or gate content by rep level.

📰 Building a Custom Feed Reader

Goal: Render a custom feed of posts by a specific user or tag using OmniSocial’s subgraph.

query FeedByPersona($personaId: String!) {
  posts(where: {persona: $personaId}, orderBy: timestamp, orderDirection: desc) {
    content
    timestamp
    persona {
      handle
    }
  }
}

React Example (using Apollo):

const { data } = useQuery(FEED_QUERY, {
  variables: { personaId: "0x123..." }
});
return data.posts.map(p => <PostCard key={p.id} {...p} />);

✅ Extend this to show followers-only feeds, tags, or time filters.

🗳 Writing a Governance Proposal Script

Goal: Programmatically create a proposal using ethers.js and DAO contract ABI.

Setup:

npm install ethers

Example Script:

const dao = new ethers.Contract(DAO_ADDRESS, DAO_ABI, wallet);

const tx = await dao.createProposal(
  "Fund community newsletter",
  dao.interface.encodeFunctionData("sendTip", [editorAddress, ethers.utils.parseEther("5.0"), "Great work!"]),
  DAO_ADDRESS
);
await tx.wait();
console.log("Proposal submitted!");

✅ Add this to a governance dashboard or auto-proposal system.

🧠 Use Reputation to Gate Content

Goal: Only allow users with sufficient rep to unlock premium posts.

query CanAccess($wallet: String!) {
  wallet(id: $wallet) {
    reputations(where: {domain: "content"}) {
      score
    }
  }
}

Frontend Check:

if (reputationScore >= 1000) {
  showPremiumContent();
} else {
  showLockedContent();
}

✅ Combine with PersonaNFT and RepModule for dynamic access control

Last updated

Was this helpful?