-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use BG Ponder Indexer for fetching data (#6)
- Loading branch information
1 parent
e144a16
commit fec7919
Showing
6 changed files
with
122 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { gql, useQuery } from "urql"; | ||
import contracts from "~~/generated/hardhat_contracts"; | ||
|
||
const WithdrawalsQuery = gql` | ||
query Withdrawls($cohortAddress: String!) { | ||
cohortWithdrawals(where: { cohortContractAddress: $cohortAddress }, orderBy: "timestamp", orderDirection: "desc") { | ||
reason | ||
builder | ||
amount | ||
timestamp | ||
builder | ||
id | ||
} | ||
} | ||
`; | ||
|
||
export const useCohortWithdrawEvents = () => { | ||
const [{ data: newWithdrawEventsData, fetching: isLoadingNew }] = useQuery({ | ||
query: WithdrawalsQuery, | ||
variables: { | ||
cohortAddress: contracts[10][0].contracts.SandGardenStreams.address, | ||
}, | ||
}); | ||
|
||
const [{ data: oldWithdrawEventsData, fetching: isLoadingOld }] = useQuery({ | ||
query: WithdrawalsQuery, | ||
variables: { | ||
cohortAddress: contracts[10][0].contracts._SandGardenStreamsOld.address, | ||
}, | ||
}); | ||
|
||
const newContractWithdrawEvents = newWithdrawEventsData?.cohortWithdrawals || []; | ||
const oldContractWithdrawEvents = oldWithdrawEventsData?.cohortWithdrawals || []; | ||
|
||
const data = [...newContractWithdrawEvents, ...oldContractWithdrawEvents]; | ||
|
||
const isLoading = isLoadingNew || isLoadingOld; | ||
|
||
return { data, isLoading }; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fec7919
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
sand-garden – ./
sand-garden-git-main-buidlguidldao.vercel.app
sand-garden.vercel.app
sand-garden-buidlguidldao.vercel.app
sandgarden.buidlguidl.com