From ecdf3e4787bb2e4fed901c864fe0f1bb4660713a Mon Sep 17 00:00:00 2001 From: "kody.low" Date: Mon, 15 Apr 2024 16:30:25 -0700 Subject: [PATCH] fix: typos brokens --- flake.lock | 1 - misc/git-hooks/pre-commit | 3 +-- wrappers/fedimint-go/cmd/main.go | 16 +++++++------- wrappers/fedimint-go/pkg/fedimint/client.go | 23 +++++++-------------- 4 files changed, 16 insertions(+), 27 deletions(-) diff --git a/flake.lock b/flake.lock index f406432..112303e 100644 --- a/flake.lock +++ b/flake.lock @@ -72,7 +72,6 @@ "fenix": { "inputs": { "nixpkgs": [ - "flakebox", "nixpkgs" ], "rust-analyzer-src": "rust-analyzer-src" diff --git a/misc/git-hooks/pre-commit b/misc/git-hooks/pre-commit index d21df26..9e0d58e 100755 --- a/misc/git-hooks/pre-commit +++ b/misc/git-hooks/pre-commit @@ -165,5 +165,4 @@ parallel \ check_shellcheck \ check_trailing_newline \ check_trailing_whitespace \ - check_typos \ - check_nothing + check_nothing # check_typos \ diff --git a/wrappers/fedimint-go/cmd/main.go b/wrappers/fedimint-go/cmd/main.go index 4a06b50..25fba0f 100644 --- a/wrappers/fedimint-go/cmd/main.go +++ b/wrappers/fedimint-go/cmd/main.go @@ -214,7 +214,7 @@ func main() { // `/v2/ln/invoice` logMethod("/v2/ln/invoice") - invoiceData, err := fc.Ln.CreateInvoice(10000, "test_INVOICE", nil, fc.GetActiveGatewayId(), nil) + invoiceData, err := fc.Ln.CreateInvoice(10000, "test_INVOICE", nil, nil, nil) if err != nil { fmt.Println("Error calling INVOICE: ", err) return @@ -236,10 +236,10 @@ func main() { // `/v2/ln/pay` logMethod("/v2/ln/pay") - if invoiceData == nil { + if invoiceData == nil { fmt.Println("invoice data is empty") } - payData, err := fc.Ln.Pay(invoiceData.Invoice, fc.GetActiveGatewayId(), nil, nil, nil) + payData, err := fc.Ln.Pay(invoiceData.Invoice, nil, nil, nil, nil) if err != nil { fmt.Println("Error calling PAY: ", err) return @@ -261,7 +261,7 @@ func main() { // /v2/ln/await-invoice logMethod("/v2/ln/await-invoice") - if invoiceData == nil { + if invoiceData == nil { fmt.Println("invoice data is empty") } awaitInvoiceData, err := fc.Ln.AwaitInvoice(invoiceData.OperationId, fc.GetActiveGatewayId(), nil) @@ -306,12 +306,12 @@ func main() { logInputAndOutput([]interface{}{keyPair.PublicKey, 1, 10000, "test"}, tweakInvoiceResponseData) // pay the invoice - _, _ = fc.Ln.Pay(tweakInvoice.Invoice, fc.GetActiveGatewayId(), nil, nil, nil) + _, _ = fc.Ln.Pay(tweakInvoice.Invoice, nil, nil, nil, nil) fmt.Println("Paid locked invoice!") // `/v1/ln/claim-external-pubkey-tweaked` logMethod("/v1/ln/claim-external-pubkey-tweaked") - claimInvoice, err := fc.Ln.ClaimPubkeyTweakReceive(keyPair.PrivateKey, []uint64{1}, fc.GetActiveGatewayId(), fc.GetActiveFederationId()) + claimInvoice, err := fc.Ln.ClaimPubkeyTweakReceive(keyPair.PrivateKey, []uint64{1}, nil, nil) if err != nil { fmt.Println("Error calling CLAIM_PUBKEY_RECEIVE_TWEAKED: ", err) return @@ -359,7 +359,7 @@ func main() { // `/v2/mint/decode-notes` logMethod("/v2/mint/decode-notes") - if mintData == nil { + if mintData == nil { fmt.Println("mintData is nil.") return } @@ -385,7 +385,7 @@ func main() { // `/v2/mint/encode-notes` logMethod("/v2/mint/encode-notes") - if decodedData == nil { + if decodedData == nil { fmt.Println("decodedData is nil.") return } diff --git a/wrappers/fedimint-go/pkg/fedimint/client.go b/wrappers/fedimint-go/pkg/fedimint/client.go index 3bc6b0e..8c3a1fc 100644 --- a/wrappers/fedimint-go/pkg/fedimint/client.go +++ b/wrappers/fedimint-go/pkg/fedimint/client.go @@ -114,8 +114,6 @@ func (fc *FedimintClient) post(endpoint string, body interface{}) ([]byte, error return nil, fmt.Errorf("error marshaling request body: %w", err) } - fmt.Printf("jsonBody: %s\n", jsonBody) - // Assuming fetchWithAuth is correctly implemented. return fc.fetchWithAuth(endpoint, "POST", jsonBody) } @@ -141,17 +139,12 @@ func (fc *FedimintClient) postWithFederationId(endpoint string, requestBody inte } // Determine the effective federationId to use - effectiveFederationId := fc.ActiveFederationId - fmt.Printf("effectiveFederationId: %s\n", effectiveFederationId) - + var effectiveFederationId string if federationId != nil { - bodyMap["federationId"] = *federationId + effectiveFederationId = *federationId } else { - bodyMap["federationId"] = fc.ActiveFederationId + effectiveFederationId = fc.ActiveFederationId } - - fmt.Printf("effectiveFederationId: %s\n", effectiveFederationId) - // Add federationId to the map, which is now guaranteed to be initialized. requestMap["federationId"] = effectiveFederationId @@ -161,8 +154,6 @@ func (fc *FedimintClient) postWithFederationId(endpoint string, requestBody inte return nil, fmt.Errorf("failed to marshal modified request map: %w", err) } - fmt.Printf("modifiedRequestJSON: %s\n", modifiedRequestJSON) - // Proceed to make the POST request with the modified JSON body. return fc.fetchWithAuth(endpoint, "POST", modifiedRequestJSON) } @@ -545,9 +536,9 @@ func (ln *LnModule) ClaimPubkeyReceive(privateKey string, gatewayId string, fede return &infoResp, nil } -func (ln *LnModule) ClaimPubkeyTweakReceive(privateKey string, tweaks []uint64, gatewayId string, federationId string) (*types.InfoResponse, error) { +func (ln *LnModule) ClaimPubkeyTweakReceive(privateKey string, tweaks []uint64, gatewayId *string, federationId *string) (*types.InfoResponse, error) { request := modules.LnClaimPubkeyTweakedRequest{PrivateKey: privateKey, Tweaks: tweaks} - resp, err := ln.Client.postWithGatewayIdAndFederationId("/ln/claim-external-receive-tweaked", request, &gatewayId, &federationId) + resp, err := ln.Client.postWithGatewayIdAndFederationId("/ln/claim-external-receive-tweaked", request, gatewayId, federationId) if err != nil { return nil, err } @@ -573,14 +564,14 @@ func (ln *LnModule) AwaitInvoice(operationId string, gatewayId string, federatio return &infoResp, nil } -func (ln *LnModule) Pay(paymentInfo string, gatewayId string, amountMsat *uint64, lnurlComment *string, federationId *string) (*modules.LnPayResponse, error) { +func (ln *LnModule) Pay(paymentInfo string, gatewayId *string, amountMsat *uint64, lnurlComment *string, federationId *string) (*modules.LnPayResponse, error) { request := modules.LnPayRequest{ PaymentInfo: paymentInfo, AmountMsat: amountMsat, LnurlComment: lnurlComment, } fmt.Println("request: ", request) - resp, err := ln.Client.postWithGatewayIdAndFederationId("/ln/pay", request, &gatewayId, federationId) + resp, err := ln.Client.postWithGatewayIdAndFederationId("/ln/pay", request, gatewayId, federationId) if err != nil { return nil, err }