From 1eaec43a1d08bd4f3e3840fa127fbe241c7745ca Mon Sep 17 00:00:00 2001 From: kompotkot Date: Fri, 16 Aug 2024 13:14:25 +0000 Subject: [PATCH] Register call requests with contract id --- server.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/server.go b/server.go index e304697..aaa13a9 100644 --- a/server.go +++ b/server.go @@ -534,7 +534,7 @@ func (server *Server) signDropperRoute(w http.ResponseWriter, r *http.Request, s // Run check of existing call_requests in database if !req.NoMetatx && !req.NoCheckMetatx { - checkStatusCode, existingRequests, checkStatus := server.MoonstreamEngineAPIClient.checkCallRequests(authorizationToken, "", req.Dropper, callRequestSpecifications) + checkStatusCode, existingRequests, checkStatus := server.MoonstreamEngineAPIClient.checkCallRequests(authorizationToken, req.RegisteredContractId, req.Dropper, callRequestSpecifications) if checkStatusCode == 0 { http.Error(w, "Internal server error", http.StatusInternalServerError) @@ -594,9 +594,13 @@ func (server *Server) signDropperRoute(w http.ResponseWriter, r *http.Request, s go func() { for i, batchSpecs := range callRequestBatches { requestBody := CreateCallRequestsRequest{ - TTLDays: req.TtlDays, - Specifications: batchSpecs, - ContractAddress: req.Dropper, + TTLDays: req.TtlDays, + Specifications: batchSpecs, + } + if req.RegisteredContractId != "" { + requestBody.ContractID = req.RegisteredContractId + } else { + requestBody.ContractAddress = req.Dropper } requestBodyBytes, requestBodyBytesErr := json.Marshal(requestBody)