1 package relayinfo
2 3 // AddSupportedNIP appends a supported NIP number to a RelayInfo.
4 func (ri *T) AddSupportedNIP(n int) {
5 idx, exists := ri.Nips.HasNumber(n)
6 if exists {
7 return
8 }
9 ri.Nips = append(ri.Nips, -1)
10 copy(ri.Nips[idx+1:], ri.Nips[idx:])
11 ri.Nips[idx] = n
12 }
13 14 // Admission is the cost of opening an account with a relay.
15 type Admission struct {
16 Amount int `json:"amount"`
17 Unit string `json:"unit"`
18 }
19 20 // Subscription is the cost of keeping an account open for a specified period of time.
21 type Subscription struct {
22 Amount int `json:"amount"`
23 Unit string `json:"unit"`
24 Period int `json:"period"`
25 }
26 27 // Publication is the cost and restrictions on storing events on a relay.
28 type Publication []struct {
29 Kinds []int `json:"kinds"`
30 Amount int `json:"amount"`
31 Unit string `json:"unit"`
32 }
33 34 // Fees defines the fee structure used for a paid relay.
35 type Fees struct {
36 Admission []Admission `json:"admission,omitempty"`
37 Subscription []Subscription `json:"subscription,omitempty"`
38 Publication []Publication `json:"publication,omitempty"`
39 }
40