Skip to content

Commit

Permalink
site
Browse files Browse the repository at this point in the history
  • Loading branch information
ipatka committed Apr 27, 2023
1 parent 0794388 commit ecf8fe5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
Binary file not shown.
21 changes: 10 additions & 11 deletions Implementations/Subgraph/daostar/src/mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,23 @@ export function handleNewRegistration(event: DAOURIRegistered): void {
EIP4824Registration.create(event.params.daoAddress)
let newAddress = event.params.daoAddress.toHex()
registrationInstance = new RegistrationInstance(newAddress)
registrationInstance.registrationNetwork = chainName
registrationInstance.registrationAddress = event.params.daoAddress
registrationInstance.daoAddress = event.params.daoAddress
registrationInstance.daoURI = 'placeholder'
registrationInstance.save()
}

registrationInstance.registrationNetwork = chainName
registrationInstance.registrationAddress = event.params.daoAddress
registrationInstance.daoAddress = event.params.daoAddress
registrationInstance.daoURI = 'placeholder'

registrationInstance.save()
}

export function handleNewURI(event: DAOURIUpdate): void {
let daoAddress = event.params.daoAddress.toHex()
let daoId = daoAddress
let registrationInstance = RegistrationInstance.load(daoId)
let registrationAddress = event.address.toHex()
let registrationInstance = RegistrationInstance.load(registrationAddress)

if (!registrationInstance) log.warning('Invalid instance', [])
if (!registrationInstance) log.warning('Invalid Registration: {}', [registrationAddress])
else {
registrationInstance.daoAddress = event.params.daoAddress
if (event.params.daoURI) {
registrationInstance.daoURI = event.params.daoURI
const ipfsHash = event.params.daoURI.substring(7)
log.info('Fetching ipfs data for: {}', [ipfsHash])
let ipfsData = ipfs.cat(ipfsHash)
Expand Down
6 changes: 4 additions & 2 deletions daostar-website/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ function App() {
const { loading, error, data: mainnetData } = useQuery(queries.REGISTRATIONS, { context: { apiName: 'mainnet' }, variables: { id: 'mainnet' } })
const goerliRes = useQuery(queries.REGISTRATIONS, { context: { apiName: 'goerli' }, variables: { id: 'goerli' } })
const { loading: goerliLoading, error: goerliError, data: goerliData } = goerliRes
// console.log({ mainnetData, goerliData })
console.log({ mainnetData, goerliData })

if (error || goerliError) return 'error'
if (loading || goerliLoading) return 'loading...'
const registrationInstances = mainnetData.registrationNetwork.registrations.concat(goerliData.registrationNetwork.registrations)
const mainnetRegistrations = mainnetData?.registrationNetwork?.registrations || []
const goerliRegistrations = goerliData?.registrationNetwork?.registrations || []
const registrationInstances = mainnetRegistrations.concat(goerliRegistrations)

console.log({ registrationInstances })

Expand Down

0 comments on commit ecf8fe5

Please sign in to comment.