Skip to content

Commit

Permalink
fix: existing deposit error
Browse files Browse the repository at this point in the history
  • Loading branch information
Wagalidoom committed May 15, 2024
1 parent 21e6ffe commit 6eab2cf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 4 additions & 2 deletions hooks/use-deposit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,14 @@ function useDeposit() {

const events = await fetchDeposit(contractConfig.addresses.deposit, fromBlock, client);

let pks = events.map((e) => e.topics[1]);
let pks = events.map((e) => e.args.pubkey);
pks = pks.concat(existingDeposits);
console.log(pks);
console.log(`Found ${pks.length} existing deposits`);

for (const deposit of deposits) {
if (!pks.some((pk) => pk === "0x" + deposit.pubkey)) {
if (!pks.includes(`0x${deposit.pubkey}`)) {
console.log("new deposit", deposit.pubkey);
newDeposits.push(deposit);
}
}
Expand Down
2 changes: 0 additions & 2 deletions utils/fetchEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ export async function fetchDeposit(depositAddress: Address, fromBlock: bigint, c
allEvents.push(...events);
startBlock = nextBlock + BigInt(1);
}

console.log("RETURN");

return allEvents;
}

0 comments on commit 6eab2cf

Please sign in to comment.