Skip to content

Commit

Permalink
Merge pull request #538 from Dozie2001/refactor/remove-goerili-group
Browse files Browse the repository at this point in the history
Refactor/remove goerili group
  • Loading branch information
vplasencia authored Jul 5, 2024
2 parents 8a260cd + 82d4c98 commit ed20897
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 142 deletions.
35 changes: 0 additions & 35 deletions apps/dashboard/src/api/semaphoreAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,38 +63,3 @@ export async function getGroup(groupId: string): Promise<Group | null> {
return null
}
}

/**
* It returns the Semaphore on-chain groups on Goerli for a specific admin.
* @param adminAddress The admin address.
* @returns The list of groups.
*/
export async function getGoerliGroups(
adminAddress: string
): Promise<Group[] | null> {
const goerliSubgraph = new SemaphoreSubgraph("goerli")

try {
const groups = await goerliSubgraph.getGroups({
members: true,
filters: { admin: adminAddress }
})

return groups.map((group) => {
const groupName = parseGroupName(group.id)

return {
id: group.id,
name: groupName,
treeDepth: group.merkleTree.depth,
members: group.members as string[],
admin: group.admin as string,
type: "on-chain"
}
})
} catch (error) {
console.error(error)

return null
}
}
63 changes: 0 additions & 63 deletions apps/dashboard/src/components/goerli-group.tsx

This file was deleted.

46 changes: 2 additions & 44 deletions apps/dashboard/src/pages/groups.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,22 @@ import {
InputRightElement,
Spinner,
Text,
VStack,
Stack,
Link as ChakraLink
VStack
} from "@chakra-ui/react"
import { useCallback, useContext, useEffect, useState } from "react"
import { FiSearch } from "react-icons/fi"
import { Link, useNavigate } from "react-router-dom"
import { getGroups as getOffchainGroups } from "../api/bandadaAPI"
import {
getGroups as getOnchainGroups,
getGoerliGroups
} from "../api/semaphoreAPI"
import { getGroups as getOnchainGroups } from "../api/semaphoreAPI"
import GroupCard from "../components/group-card"
import { AuthContext } from "../context/auth-context"
import { Group } from "../types"
import GoerliGroupCard from "../components/goerli-group"
import ApiKeyComponent from "../components/api-key"

export default function GroupsPage(): JSX.Element {
const { admin } = useContext(AuthContext)
const [_isLoading, setIsLoading] = useState(false)
const [_groups, setGroups] = useState<Group[]>([])
const [_goerliGroups, setGoerliGroups] = useState<Group[]>([])
const [_searchField, setSearchField] = useState<string>("")
const navigate = useNavigate()

Expand All @@ -59,11 +52,6 @@ export default function GroupsPage(): JSX.Element {
})
])

const goerliGroups = await getGoerliGroups(admin.address)
if (goerliGroups) {
setGoerliGroups((groups) => [...groups, ...goerliGroups])
}

setIsLoading(false)
}
})()
Expand Down Expand Up @@ -165,36 +153,6 @@ export default function GroupsPage(): JSX.Element {
))}
</Grid>
)}

{!_isLoading && _goerliGroups.length > 0 && (
<Box>
<Text fontSize="22px" mt="5">
Groups on Goerli (name/id)
</Text>
<Text mt="2">The Goerli network is deprecated.</Text>
<Stack spacing="5" my="5">
{_goerliGroups.map((group) => (
<GoerliGroupCard
key={group.id}
name={group.name}
id={group.id}
/>
))}
</Stack>
<Text>
To fetch more information about the Goerli groups
you can use the{" "}
<ChakraLink
href="https://docs.semaphore.pse.dev/V3/guides/fetching-data"
isExternal
textDecoration="underline"
>
@semaphore-protocol/data
</ChakraLink>{" "}
package.
</Text>
</Box>
)}
</VStack>
</Container>
)
Expand Down

0 comments on commit ed20897

Please sign in to comment.