Skip to content

Commit

Permalink
Merge pull request #63 from Giveth/zkevm-cardona
Browse files Browse the repository at this point in the history
zkevm cardona for staging
  • Loading branch information
HrithikSampson authored Oct 2, 2024
2 parents 900df1e + 3e85475 commit 41e4754
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ GIVETHIO_BASE_URL=https://mainnet.serve.giveth.io
TRACE_BASE_URL=https://feathers.beta.giveth.io
PURPLE_LIST=0x1ad91ee08f21be3de0ba2ba6918e714da6b45836,0x63ecc058D97ED7bAb75616B77C96734D0B823f87
MAINNET_NODE_URL=https://mainnet.infura.io/v3/infuraApiKey
ENVIRONMENT=staging
ZKEVM_NODE_HTTP_URL=
ZKEVM_CARDONA_HTTP_URL=
XDAI_NODE_HTTP_URL=

PINATA_API_KEY=
Expand Down
10 changes: 6 additions & 4 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ const xdaiWeb3 = new Web3(xdaiWeb3NodeUrl);

const optimismWeb3NodeUrl = process.env.OPTIMISM_NODE_HTTP_URL
const optimismWeb3 = new Web3(optimismWeb3NodeUrl);

const zkEVMWeb3NodeUrl = process.env.ZKEVM_NODE_HTTP_URL
const isProduction = process.env.ENVIRONMENT !== 'staging';
const zkEVMWeb3NodeUrl = isProduction ? process.env.ZKEVM_NODE_HTTP_URL: process.env.ZKEVM_CARDONA_HTTP_URL;
const zkEVMWeb3 = new Web3(zkEVMWeb3NodeUrl);

export const getLastNonceForWalletAddress = async (walletAddress: string, chain: 'gnosis' | 'optimism' | 'zkEVM'): Promise<number> => {
Expand Down Expand Up @@ -284,15 +284,17 @@ export const getNetworkNameById = (networkId: number): string => {
}
}

const ZKEVM_Network_ID = isProduction? 1101: 2442;

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

0 comments on commit 41e4754

Please sign in to comment.