Skip to content

Commit

Permalink
feat(SPV-848): adjust to the review
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-4chain committed Jul 9, 2024
1 parent 87c454e commit 216e65c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
4 changes: 1 addition & 3 deletions examples/list_transactions/list_transactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ func main() {
client := walletclient.NewWithXPriv(server, examples.ExampleXPriv)
ctx := context.Background()

metadata := map[string]any{
"note": "user-id-123",
}
metadata := map[string]any{}

conditions := filter.TransactionFilter{}
queryParams := filter.QueryParams{}
Expand Down
4 changes: 2 additions & 2 deletions http.go
Original file line number Diff line number Diff line change
Expand Up @@ -1144,7 +1144,7 @@ func (wc *WalletClient) AdminSubscribeWebhook(ctx context.Context, webhookURL, t
if err != nil {
return WrapError(err)
}
err = wc.doHTTPRequest(ctx, http.MethodPost, "/admin/webhooks/subscribe", rawJSON, wc.adminXPriv, true, nil)
err = wc.doHTTPRequest(ctx, http.MethodPost, "/admin/webhooks/subscribtion", rawJSON, wc.adminXPriv, true, nil)
return WrapError(err)
}

Expand All @@ -1157,6 +1157,6 @@ func (wc *WalletClient) AdminUnsubscribeWebhook(ctx context.Context, webhookURL
if err != nil {
return WrapError(err)
}
err = wc.doHTTPRequest(ctx, http.MethodPost, "/admin/webhooks/unsubscribe", rawJSON, wc.adminXPriv, true, nil)
err = wc.doHTTPRequest(ctx, http.MethodDelete, "/admin/webhooks/subscribtion", rawJSON, wc.adminXPriv, true, nil)
return err
}
9 changes: 1 addition & 8 deletions notifications/registerer.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package notifications

import (
"errors"
"reflect"

"github.com/bitcoin-sv/spv-wallet/models"
Expand All @@ -15,14 +14,8 @@ type eventHandler struct {
// RegisterHandler - registers a handler for a specific event type
func RegisterHandler[EventType models.Events](nd *Webhook, handlerFunction func(event *EventType)) error {
handlerValue := reflect.ValueOf(handlerFunction)
if handlerValue.Kind() != reflect.Func {
return errors.New("handlerFunction must be a function")
}

modelType := handlerValue.Type().In(0)
if modelType.Kind() == reflect.Ptr {
modelType = modelType.Elem()
}
modelType := handlerValue.Type().In(0).Elem()
name := modelType.Name()

nd.handlers.store(name, &eventHandler{
Expand Down

0 comments on commit 216e65c

Please sign in to comment.