diff --git a/cashu/nuts/nut06/nut06.go b/cashu/nuts/nut06/nut06.go index 0c96da0..6533021 100644 --- a/cashu/nuts/nut06/nut06.go +++ b/cashu/nuts/nut06/nut06.go @@ -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 { diff --git a/mint/config.go b/mint/config.go index 024ba0d..3e353d5 100644 --- a/mint/config.go +++ b/mint/config.go @@ -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