Otterspace Docs
Ask or search…
K
🐙

Subgraph

Subgraphs are our read-only APIs that subscribe to our on-chain events and construct easy-to-consume entities for clients.
The subgraphs urls are network specific and following the following template
  • API: https://api.thegraph.com/subgraphs/name/otterspace-xyz/badges-[network-name]
  • Interactive: https://thegraph.com/hosted-service/subgraph/otterspace-xyz/badges-[network-name]

Get a list of communities

{
rafts(where: {totalSpecsCount_gt: 0}) {
id
metadata {
name
}
totalSpecsCount
totalBadgesCount
specs {
metadata {
name
}
totalBadgesCount
}
}
}

Get active badges of a community

{
badges(
where: {
spec_: {
raft: "rafts:1"
}
status_in: ["MINTED", "REINSTATED"]
}
) {
id
owner
status
createdAt
spec {
metadata {
name
expiresAt
}
}
}
}

Get all the badge specs of a community

{
raft(id: "rafts:1") {
id
metadata {
name
}
totalSpecsCount
totalBadgesCount
specs {
uri
totalBadgesCount
metadata {
name
}
}
}
}

Get all the owners of a badge

{
badgeSpec(id: "bafyreicl3unvw6tvzjfduvrhxbfi74gsob6mpf6ekn3s2nkopqz2phtx7e") {
id
metadata {
name
description
image
expiresAt
}
totalBadgesCount
badges {
id
owner
status
createdAt
}
}
}

Get badges owned by an address

{
badges(where: {owner: "0x77B476429826C5ba77885D08F272d89D8F1Ed0e4"}) {
id
createdAt
status
spec {
id
metadata {
name
description
expiresAt
image
}
raft {
id
metadata {
name
image
}
}
}
}
}

Check if an address owns a certain badge

{
badges(
where: {owner: "0x77B476429826C5ba77885D08F272d89D8F1Ed0e4", spec_in: ["bafyreicl3unvw6tvzjfduvrhxbfi74gsob6mpf6ekn3s2nkopqz2phtx7e", "bafyreia2lnu2jmr6sqqijzd3xt6fw2qriyy2vbq57zikzrkeyxfvlpqp3i"]}
) {
id
owner
status
createdAt
}
}