diff --git a/api/v1/authenticate/authenticate.go b/api/v1/authenticate/authenticate.go index 6ed8684..3a5c0df 100644 --- a/api/v1/authenticate/authenticate.go +++ b/api/v1/authenticate/authenticate.go @@ -122,10 +122,14 @@ func authenticate(c *gin.Context) { } if isCorrect { // update wallet address for that user_id - err = db.Model(&models.User{}).Where("user_id = ?", userId).Update("wallet_address", walletAddr).Error + err = db.Model(&models.User{}).Where("user_id = ?", userId). + Updates(map[string]interface{}{ + "wallet_address": walletAddr, + "chain_name": req.ChainName, + }).Error if err != nil { - httpo.NewErrorResponse(http.StatusInternalServerError, "Unexpected error occured").SendD(c) - logwrapper.Errorf("failed to update wallet address, error %v", err.Error()) + httpo.NewErrorResponse(http.StatusInternalServerError, "Unexpected error occurred").SendD(c) + logwrapper.Errorf("failed to update wallet address and chain name, error %v", err.Error()) return } diff --git a/api/v1/authenticate/types.go b/api/v1/authenticate/types.go index aefcf65..461b8f1 100644 --- a/api/v1/authenticate/types.go +++ b/api/v1/authenticate/types.go @@ -8,6 +8,7 @@ type AuthenticateRequest struct { Message string `json:"message" binding:"omitempty"` AccessToken string `json:"accessToken" binding:"omitempty"` IdToken string `json:"idToken" binding:"omitempty"` // to be pass in bearer token [ AUTHORIZATION KEY ] + ChainName string `json:"chain_name" binding:"required"` } type AuthenticateRequestNoSign struct { FlowId string `json:"flowId" binding:"required"`