Skip to content

Commit

Permalink
refactor: rename slash event types
Browse files Browse the repository at this point in the history
Backend defined a different name for the slash events in a validator dashboard. This commit adapts API and FE types accordingly.
See: BEDS-94
  • Loading branch information
LuccaBitfly committed Oct 8, 2024
1 parent ec7d9a2 commit d33036f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion backend/pkg/api/types/notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type NotificationDashboardsTableRow struct {
GroupId uint64 `json:"group_id"`
GroupName string `json:"group_name"`
EntityCount uint64 `json:"entity_count"`
EventTypes []string `json:"event_types" tstype:"('validator_online' | 'validator_offline' | 'group_online' | 'group_offline' | 'attestation_missed' | 'proposal_success' | 'proposal_missed' | 'proposal_upcoming' | 'max_collateral' | 'min_collateral' | 'sync' | 'withdrawal' | 'got_slashed' | 'has_slashed' | 'incoming_tx' | 'outgoing_tx' | 'transfer_erc20' | 'transfer_erc721' | 'transfer_erc1155')[]" faker:"slice_len=2, oneof: validator_online, validator_offline, group_online, group_offline, attestation_missed, proposal_success, proposal_missed, proposal_upcoming, max_collateral, min_collateral, sync, withdrawal, got_slashed, has_slashed, incoming_tx, outgoing_tx, transfer_erc20, transfer_erc721, transfer_erc1155"`
EventTypes []string `json:"event_types" tstype:"('validator_online' | 'validator_offline' | 'group_online' | 'group_offline' | 'attestation_missed' | 'proposal_success' | 'proposal_missed' | 'proposal_upcoming' | 'max_collateral' | 'min_collateral' | 'sync' | 'withdrawal' | 'validator_got_slashed' | 'validator_has_slashed' | 'incoming_tx' | 'outgoing_tx' | 'transfer_erc20' | 'transfer_erc721' | 'transfer_erc1155')[]" faker:"slice_len=2, oneof: validator_online, validator_offline, group_online, group_offline, attestation_missed, proposal_success, proposal_missed, proposal_upcoming, max_collateral, min_collateral, sync, withdrawal, validator_got_slashed, validator_has_slashed, incoming_tx, outgoing_tx, transfer_erc20, transfer_erc721, transfer_erc1155"`
}

type InternalGetUserNotificationDashboardsResponse ApiPagingResponse[NotificationDashboardsTableRow]
Expand Down
8 changes: 4 additions & 4 deletions frontend/components/notifications/DashboardsTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,10 @@ const mapEventtypeToText = (eventType: NotificationDashboardsTableRow['event_typ
switch (eventType) {
case 'attestation_missed':
return $t('notifications.dashboards.event_type.attestation_missed')
case 'got_slashed':
return $t('notifications.dashboards.event_type.got_slashed')
case 'group_offline':
return $t('notifications.dashboards.event_type.group_offline')
case 'group_online':
return $t('notifications.dashboards.event_type.group_online')
case 'has_slashed':
return $t('notifications.dashboards.event_type.has_slashed')
case 'incoming_tx':
return $t('notifications.dashboards.event_type.incoming_tx')
case 'max_collateral':
Expand All @@ -81,6 +77,10 @@ const mapEventtypeToText = (eventType: NotificationDashboardsTableRow['event_typ
return $t('notifications.dashboards.event_type.transfer_erc721')
case 'transfer_erc1155':
return $t('notifications.dashboards.event_type.transfer_erc1155')
case 'validator_got_slashed':
return $t('notifications.dashboards.event_type.got_slashed')
case 'validator_has_slashed':
return $t('notifications.dashboards.event_type.has_slashed')
case 'validator_offline':
return $t('notifications.dashboards.event_type.validator_offline')
case 'validator_online':
Expand Down
2 changes: 1 addition & 1 deletion frontend/types/api/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export interface NotificationDashboardsTableRow {
group_id: number /* uint64 */;
group_name: string;
entity_count: number /* uint64 */;
event_types: ('validator_online' | 'validator_offline' | 'group_online' | 'group_offline' | 'attestation_missed' | 'proposal_success' | 'proposal_missed' | 'proposal_upcoming' | 'max_collateral' | 'min_collateral' | 'sync' | 'withdrawal' | 'got_slashed' | 'has_slashed' | 'incoming_tx' | 'outgoing_tx' | 'transfer_erc20' | 'transfer_erc721' | 'transfer_erc1155')[];
event_types: ('validator_online' | 'validator_offline' | 'group_online' | 'group_offline' | 'attestation_missed' | 'proposal_success' | 'proposal_missed' | 'proposal_upcoming' | 'max_collateral' | 'min_collateral' | 'sync' | 'withdrawal' | 'validator_got_slashed' | 'validator_has_slashed' | 'incoming_tx' | 'outgoing_tx' | 'transfer_erc20' | 'transfer_erc721' | 'transfer_erc1155')[];
}
export type InternalGetUserNotificationDashboardsResponse = ApiPagingResponse<NotificationDashboardsTableRow>;
export interface NotificationEventGroup {
Expand Down

0 comments on commit d33036f

Please sign in to comment.