Skip to content

Commit

Permalink
moved meta to RegistrationRequestData
Browse files Browse the repository at this point in the history
  • Loading branch information
2pa-arch committed Feb 19, 2025
1 parent 57b1a71 commit 68d4aa8
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 0 additions & 4 deletions docs/spec/components/schemas/RegistrationRequest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,5 @@ x-go-is-request: true
required:
- data
properties:
meta:
type: object
description: "Metadata if it is required"
example: {"source": "web", "user_id": 123}
data:
$ref: '#/components/schemas/RegistrationRequestData'
4 changes: 4 additions & 0 deletions docs/spec/components/schemas/RegistrationRequestData.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ required:
- tx_data
- no_send
properties:
meta:
type: object
description: "Metadata if it is required"
example: {"source": "web", "user_id": 123}
tx_data:
type: string
no_send:
Expand Down
4 changes: 2 additions & 2 deletions internal/service/handlers/registration.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ func Registration(w http.ResponseWriter, r *http.Request) {
"user-agent": r.Header.Get("User-Agent"),
"calldata": req.Data.TxData,
}
if req.Meta != nil {
logF = logF.Merge(*req.Meta)
if req.Data.Meta != nil {
logF = logF.Merge(*req.Data.Meta)
}

log := Log(r).WithFields(logF)
Expand Down
2 changes: 0 additions & 2 deletions resources/model_registration_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@ package resources

type RegistrationRequest struct {
Data RegistrationRequestData `json:"data"`
// Metadata if it is required
Meta *map[string]interface{} `json:"meta,omitempty"`
}
2 changes: 2 additions & 0 deletions resources/model_registration_request_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ package resources
type RegistrationRequestData struct {
// Address of registration smart contract
Destination *string `json:"destination,omitempty"`
// Metadata if it is required
Meta *map[string]interface{} `json:"meta,omitempty"`
// Flag indicates whether transaction should be sent on-chain
NoSend bool `json:"no_send"`
TxData string `json:"tx_data"`
Expand Down

0 comments on commit 68d4aa8

Please sign in to comment.