generated from mrz1836/go-template
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #443 from BuxOrg/rc-v1.1
Release candidate v1.1.0
- Loading branch information
Showing
28 changed files
with
672 additions
and
195 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,3 +38,9 @@ data/ | |
|
||
# Configuration files | ||
.env.config | ||
|
||
# VSCode | ||
.vscode/ | ||
|
||
# Ignore config file | ||
config.yaml |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package transactions | ||
|
||
import ( | ||
"encoding/json" | ||
"net/http" | ||
|
||
"github.com/bitcoin-sv/go-broadcast-client/broadcast" | ||
"github.com/julienschmidt/httprouter" | ||
apirouter "github.com/mrz1836/go-api-router" | ||
) | ||
|
||
// broadcastCallback will handle a broadcastCallback call from the broadcast api | ||
// Broadcast Callback godoc | ||
// @Summary Broadcast Callback | ||
// @Tags Transactions | ||
// @Param transaction body broadcast.SubmittedTx true "transaction" | ||
// @Success 200 | ||
// @Router /transaction/broadcast/callback [post] | ||
// @Security callback-auth | ||
func (a *Action) broadcastCallback(w http.ResponseWriter, req *http.Request, _ httprouter.Params) { | ||
var resp *broadcast.SubmittedTx | ||
|
||
err := json.NewDecoder(req.Body).Decode(&resp) | ||
if err != nil { | ||
apirouter.ReturnResponse(w, req, http.StatusExpectationFailed, err.Error()) | ||
return | ||
} | ||
|
||
defer func() { | ||
if err = req.Body.Close(); err != nil { | ||
a.Services.Logger.Err(err).Msg("failed to close request body") | ||
} | ||
}() | ||
|
||
err = a.Services.Bux.UpdateTransaction(req.Context(), resp) | ||
if err != nil { | ||
a.Services.Logger.Err(err).Msgf("failed to update transaction - tx: %v", resp) | ||
apirouter.ReturnResponse(w, req, http.StatusInternalServerError, "") | ||
return | ||
} | ||
|
||
// Return response | ||
apirouter.ReturnResponse(w, req, http.StatusOK, "") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.