-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle
*_DELEGATE
Transaction Service events (#2106)
* Handle `*_DELEGATE` Transaction Service events * Add E2E tests * Rename address field * Rename remaining fields * Make `safeAddress` optional * Add payload
- Loading branch information
Showing
17 changed files
with
368 additions
and
6 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
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
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
45 changes: 45 additions & 0 deletions
45
src/routes/hooks/entities/__tests__/delegate-events.builder.ts
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,45 @@ | ||
import { faker } from '@faker-js/faker'; | ||
import { getAddress } from 'viem'; | ||
import type { z } from 'zod'; | ||
import { TransactionEventType } from '@/routes/hooks/entities/event-type.entity'; | ||
import { Builder } from '@/__tests__/builder'; | ||
import type { IBuilder } from '@/__tests__/builder'; | ||
import type { | ||
DelegateEventPayloadSchema, | ||
DeletedDelegateEvent, | ||
NewDelegateEvent, | ||
UpdatedDelegateEvent, | ||
} from '@/routes/hooks/entities/schemas/delegate-events.schema'; | ||
|
||
type DelegateEventPayload = z.infer<typeof DelegateEventPayloadSchema>; | ||
|
||
function delegateEventBuilder(): IBuilder<DelegateEventPayload> { | ||
return new Builder<DelegateEventPayload>() | ||
.with('chainId', faker.string.numeric()) | ||
.with('address', getAddress(faker.finance.ethereumAddress())) | ||
.with('delegate', getAddress(faker.finance.ethereumAddress())) | ||
.with('delegator', getAddress(faker.finance.ethereumAddress())) | ||
.with('label', faker.lorem.word()) | ||
.with('expiryDateSeconds', faker.number.int()); | ||
} | ||
|
||
export function newDelegateEventBuilder(): IBuilder<NewDelegateEvent> { | ||
return (delegateEventBuilder() as IBuilder<NewDelegateEvent>).with( | ||
'type', | ||
TransactionEventType.NEW_DELEGATE, | ||
); | ||
} | ||
|
||
export function updatedDelegateEventBuilder(): IBuilder<UpdatedDelegateEvent> { | ||
return (delegateEventBuilder() as IBuilder<UpdatedDelegateEvent>).with( | ||
'type', | ||
TransactionEventType.UPDATED_DELEGATE, | ||
); | ||
} | ||
|
||
export function deletedDelegateEventBuilder(): IBuilder<DeletedDelegateEvent> { | ||
return (delegateEventBuilder() as IBuilder<DeletedDelegateEvent>).with( | ||
'type', | ||
TransactionEventType.DELETED_DELEGATE, | ||
); | ||
} |
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
Oops, something went wrong.