Skip to content

Commit

Permalink
wallet client call to get keyset by id
Browse files Browse the repository at this point in the history
  • Loading branch information
elnosh committed Jun 14, 2024
1 parent bde63cf commit 8510254
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
cmd/nutw/nutw
**/.env
*.txt
16 changes: 16 additions & 0 deletions wallet/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,22 @@ func GetAllKeysets(mintURL string) (*nut02.GetKeysetsResponse, error) {
return keysetsRes, nil
}

func GetKeysetById(mintURL, id string) (*nut01.GetKeysResponse, error) {
resp, err := get(mintURL + "/v1/keys/" + id)
if err != nil {
return nil, err
}
defer resp.Body.Close()

var keysetRes *nut01.GetKeysResponse
err = json.NewDecoder(resp.Body).Decode(&keysetRes)
if err != nil {
return nil, fmt.Errorf("json.Decode: %v", err)
}

return keysetRes, nil
}

func PostMintQuoteBolt11(mintURL string, mintQuoteRequest nut04.PostMintQuoteBolt11Request) (
*nut04.PostMintQuoteBolt11Response, error) {
requestBody, err := json.Marshal(mintQuoteRequest)
Expand Down

0 comments on commit 8510254

Please sign in to comment.