Skip to content

Commit

Permalink
fix create personal vault
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasmagnus committed Dec 6, 2023
1 parent c5a9007 commit 4512b93
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions backend/internal/controller/http/v1/vault.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,23 +158,27 @@ func (r *vaultRoutes) createVault(c *gin.Context) {
})
}

Id := generateID()
res, err = r.m.SendMessage(entity.EnvelopeChannel, entity.EnvelopeRequest{
Id: Id,
MainSource: sponsor.Key.PublicKey,
PublicKeys: []string{sponsor.Key.PublicKey, walletPk},
Operations: ops,
})
if err != nil {
r.l.Error(err, fmt.Sprintf("http - v1 - create vault - send message %d", Id))
errorResponse(c, http.StatusInternalServerError, "starlabs messaging problems", err)
return
}
_, ok = res.Message.(entity.EnvelopeResponse)
if !ok {
r.l.Error(err, "http - v1 - create vault - Parse Envelope Response")
errorResponse(c, http.StatusInternalServerError, "unexpected starlabs response", err)
return
if len(ops) > 0 {
Id := generateID()
res, err = r.m.SendMessage(entity.EnvelopeChannel, entity.EnvelopeRequest{
Id: Id,
MainSource: sponsor.Key.PublicKey,
PublicKeys: []string{sponsor.Key.PublicKey, walletPk},
Operations: ops,
})

if err != nil {
r.l.Error(err, fmt.Sprintf("http - v1 - create vault - send message %d", Id))
errorResponse(c, http.StatusInternalServerError, "starlabs messaging problems", err)
return
}

_, ok = res.Message.(entity.EnvelopeResponse)
if !ok {
r.l.Error(err, "http - v1 - create vault - Parse Envelope Response")
errorResponse(c, http.StatusInternalServerError, "unexpected starlabs response", err)
return
}
}

vault := entity.Vault{
Expand Down

0 comments on commit 4512b93

Please sign in to comment.