Skip to content

Commit

Permalink
feat: add chain id to contract schema
Browse files Browse the repository at this point in the history
  • Loading branch information
Wagalidoom committed Sep 30, 2024
1 parent 6fee609 commit 287aacf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions envio/schema.graphql
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
type SBCDepositContract_DepositEvent {
chainId: Int!
id: ID!
pubkey: String!
withdrawal_credentials: String!
Expand Down
1 change: 1 addition & 0 deletions envio/src/EventHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {

SBCDepositContract.DepositEvent.handler(async ({ event, context }) => {
const entity: SBCDepositContract_DepositEvent = {
chainId: event.chainId,
id: `${event.chainId}_${event.block.number}_${event.logIndex}`,
pubkey: event.params.pubkey,
withdrawal_credentials: event.params.withdrawal_credentials,
Expand Down
5 changes: 4 additions & 1 deletion hooks/use-deposit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ type DepositDataJson = {
};

const GET_DEPOSIT_EVENTS = gql`
query MyQuery($pubkeys: [String!]) {
query MyQuery($pubkeys: [String!], $chainId: Int!) {
SBCDepositContract_DepositEvent(
where: {
pubkey: {
_in: $pubkeys
},
chainId: {_eq: $chainId}
}
) {
id
Expand Down Expand Up @@ -103,8 +104,10 @@ function useDeposit(contractConfig: ContractNetwork | undefined, address: `0x${s
query: GET_DEPOSIT_EVENTS,
variables: {
pubkeys: pksFromFile,
chainId: chainId,
},
});
console.log(data);
const existingDeposits = data.SBCDepositContract_DepositEvent.map((d: { pubkey: string }) => d.pubkey);

for (const deposit of deposits) {
Expand Down

0 comments on commit 287aacf

Please sign in to comment.