Skip to content

Commit

Permalink
feat: add PostValidatorDashboardValidatorsRequest for frontend
Browse files Browse the repository at this point in the history
See: BEDS-94
  • Loading branch information
LuccaBitfly committed Jan 14, 2025
1 parent 583446b commit a6c4938
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion backend/pkg/api/handlers/public.go
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ func (h *HandlerService) PublicDeleteValidatorDashboardGroupValidators(w http.Re
func (h *HandlerService) PublicPostValidatorDashboardValidators(w http.ResponseWriter, r *http.Request) {
var v validationError
dashboardId := v.checkPrimaryDashboardId(mux.Vars(r)["dashboard_id"])
type request struct {
type request struct { // this must align with PostValidatorDashboardValidatorsRequest
GroupId uint64 `json:"group_id,omitempty" x-nullable:"true"`
Validators []intOrString `json:"validators,omitempty"`
DepositAddress string `json:"deposit_address,omitempty"`
Expand Down
9 changes: 9 additions & 0 deletions backend/pkg/api/types/validator_dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,3 +365,12 @@ type VDBPostValidatorsData struct {
Index uint64 `json:"index"`
GroupId uint64 `json:"group_id"`
}

// helper for frontend
type PostValidatorDashboardValidatorsRequest struct {
GroupId uint64 `json:"group_id,omitempty" x-nullable:"true"`
Validators []interface{} `json:"validators,omitempty" tstype:"(number | string)[]"`
DepositAddress string `json:"deposit_address,omitempty"`
WithdrawalCredential string `json:"withdrawal_credential,omitempty"`
Graffiti string `json:"graffiti,omitempty"`
}
10 changes: 10 additions & 0 deletions frontend/types/api/validator_dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,3 +321,13 @@ export interface VDBPostValidatorsData {
index: number /* uint64 */;
group_id: number /* uint64 */;
}
/**
* helper for frontend
*/
export interface PostValidatorDashboardValidatorsRequest {
group_id?: number /* uint64 */;
validators?: (number | string)[];
deposit_address?: string;
withdrawal_credential?: string;
graffiti?: string;
}

0 comments on commit a6c4938

Please sign in to comment.