Skip to content

Commit

Permalink
mint - update contact info
Browse files Browse the repository at this point in the history
  • Loading branch information
elnosh committed Jun 18, 2024
1 parent fbe3e20 commit 2dc92ae
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
21 changes: 13 additions & 8 deletions cashu/nuts/nut06/nut06.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,19 @@ import (
)

type MintInfo struct {
Name string `json:"name"`
Pubkey string `json:"pubkey"`
Version string `json:"version"`
Description string `json:"description"`
LongDescription string `json:"description_long,omitempty"`
Contact [][]string `json:"contact,omitempty"`
Motd string `json:"motd,omitempty"`
Nuts NutsMap `json:"nuts"`
Name string `json:"name"`
Pubkey string `json:"pubkey"`
Version string `json:"version"`
Description string `json:"description"`
LongDescription string `json:"description_long,omitempty"`
Contact []ContactInfo `json:"contact,omitempty"`
Motd string `json:"motd,omitempty"`
Nuts NutsMap `json:"nuts"`
}

type ContactInfo struct {
Method string `json:"method"`
Info string `json:"info"`
}

type NutSetting struct {
Expand Down
10 changes: 8 additions & 2 deletions mint/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,18 @@ func getMintInfo() (*nut06.MintInfo, error) {
mintInfo.Pubkey = hex.EncodeToString(privateKey.PubKey().SerializeCompressed())

contact := os.Getenv("MINT_CONTACT_INFO")
var mintContactInfo [][]string
var mintContactInfo []nut06.ContactInfo
if len(contact) > 0 {
err := json.Unmarshal([]byte(contact), &mintContactInfo)
var infoArr [][]string
err := json.Unmarshal([]byte(contact), &infoArr)
if err != nil {
return nil, fmt.Errorf("error parsing contact info: %v", err)
}

for _, info := range infoArr {
contactInfo := nut06.ContactInfo{Method: info[0], Info: info[1]}
mintContactInfo = append(mintContactInfo, contactInfo)
}
}
mintInfo.Contact = mintContactInfo

Expand Down

0 comments on commit 2dc92ae

Please sign in to comment.