Skip to content

Commit

Permalink
Support Optimism-Goerli donations
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammadranjbarz committed Aug 8, 2023
1 parent b7eeb1d commit 9194155
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ export const getNetworkNameById = (networkId: number): string => {
case 5:
return 'goerli'
case 10 :
return 'optimistic'
return 'optimism'
case 420 :
return 'optimism-goerli'
case 100 :
return 'gnosis'
case 137:
Expand All @@ -144,10 +146,10 @@ export const getNetworkNameById = (networkId: number): string => {

export const filterRawDonationsByChain = (gqlResult :{donations :GivethIoDonation[]}, chain ?: "all-other-chains" |"optimism"): GivethIoDonation[]=>{
if (chain === 'optimism'){
return gqlResult.donations.filter(donation => donation.transactionNetworkId === 10)
return gqlResult.donations.filter(donation => donation.transactionNetworkId === 10 || donation.transactionNetworkId === 420)
}else if (chain === "all-other-chains") {
// Exclude Optimism donations and return all other donations
return gqlResult.donations.filter(donation => donation.transactionNetworkId !== 10)
return gqlResult.donations.filter(donation => donation.transactionNetworkId !== 10 && donation.transactionNetworkId !== 420)
}else{
return gqlResult.donations
}
Expand Down

0 comments on commit 9194155

Please sign in to comment.