From 3d7a6f8c3354c5d9f975b47502443904fad11f79 Mon Sep 17 00:00:00 2001 From: Jakub Kowalski <155538368+jakubmkowalski@users.noreply.github.com> Date: Wed, 11 Dec 2024 13:31:48 +0100 Subject: [PATCH] feat(SPV-1225): add admin confirmation for contacts (#301) --- http.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/http.go b/http.go index 29c8c1a..bcb4d87 100644 --- a/http.go +++ b/http.go @@ -1106,6 +1106,20 @@ func (wc *WalletClient) AdminRejectContact(ctx context.Context, id string) (*mod return &contact, WrapError(err) } +// AdminConfirmContacts executes an HTTP POST request to confirm a contact using their xPubs IDs and paymails. +func (wc *WalletClient) AdminConfirmContacts(ctx context.Context, paymailA, paymailB string) error { + jsonStr, err := json.Marshal(map[string]interface{}{ + "paymailA": paymailA, + "paymailB": paymailB, + }) + if err != nil { + return WrapError(err) + } + + err = wc.doHTTPRequest(ctx, http.MethodPost, "/admin/contacts/confirmations", jsonStr, wc.adminXPriv, true, nil) + return WrapError(err) +} + // FinalizeTransaction will finalize the transaction func (wc *WalletClient) FinalizeTransaction(draft *models.DraftTransaction) (string, error) { res, err := GetSignedHex(draft, wc.xPriv)