Skip to content

Commit e655247

Browse files
committed
format(all): json formatting
1 parent b4a2561 commit e655247

36 files changed

+206
-194
lines changed

02.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The `.content` is not used.
1414

1515
For example:
1616

17-
```json
17+
```jsonc
1818
{
1919
"kind": 3,
2020
"tags": [
@@ -23,7 +23,7 @@ For example:
2323
["p", "612ae..e610f", "ws://carolrelay.com/ws", "carol"]
2424
],
2525
"content": "",
26-
...other fields
26+
// other fields...
2727
}
2828
```
2929

05.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ The result should be a JSON document object with a key `"names"` that should the
1616

1717
If a client sees an event like this:
1818

19-
```json
19+
```jsonc
2020
{
2121
"pubkey": "b0635d6a9851d3aed0cd6c495b282167acf761729078d975fc341b22650b07b9",
2222
"kind": 0,
2323
"content": "{\"name\": \"bob\", \"nip05\": \"[email protected]\"}"
24-
...
24+
// other fields...
2525
}
2626
```
2727

09.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The event's `content` field MAY contain a text note describing the reason for th
1212

1313
For example:
1414

15-
```
15+
```jsonc
1616
{
1717
"kind": 5,
1818
"pubkey": <32-bytes hex-encoded public key of the event creator>,
@@ -24,7 +24,7 @@ For example:
2424
["k", "30023"]
2525
],
2626
"content": "these posts were published by accident",
27-
...other fields
27+
// other fields...
2828
}
2929
```
3030

11.md

+15-11
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ These are limitations imposed by the relay on clients. Your client
6666
should expect that requests which exceed these *practical* limitations
6767
are rejected or fail immediately.
6868

69-
```json
69+
```jsonc
7070
{
7171
"limitation": {
7272
"max_message_length": 16384,
@@ -83,7 +83,7 @@ are rejected or fail immediately.
8383
"created_at_lower_limit": 31536000,
8484
"created_at_upper_limit": 3
8585
},
86-
...
86+
// other fields...
8787
}
8888
```
8989

@@ -146,14 +146,15 @@ Retention times are given in seconds, with `null` indicating infinity.
146146
If zero is provided, this means the event will not be stored at
147147
all, and preferably an error will be provided when those are received.
148148

149-
```json
149+
```jsonc
150150
{
151151
"retention": [
152152
{"kinds": [0, 1, [5, 7], [40, 49]], "time": 3600},
153153
{"kinds": [[40000, 49999]], "time": 100},
154154
{"kinds": [[30000, 39999]], "count": 1000},
155155
{"time": 3600, "count": 10000}
156-
]
156+
],
157+
// other fields...
157158
}
158159
```
159160

@@ -186,10 +187,10 @@ Users should be able to avoid relays in countries they don't like,
186187
and/or select relays in more favorable zones. Exposing this
187188
flexibility is up to the client software.
188189

189-
```json
190+
```jsonc
190191
{
191192
"relay_countries": [ "CA", "US" ],
192-
...
193+
// other fields...
193194
}
194195
```
195196

@@ -208,12 +209,12 @@ local community. This would encourage users to follow the global
208209
feed on that relay, in addition to their usual individual follows.
209210
To support this goal, relays MAY specify some of the following values.
210211

211-
```json
212+
```jsonc
212213
{
213214
"language_tags": ["en", "en-419"],
214215
"tags": ["sfw-only", "bitcoin-only", "anime"],
215216
"posting_policy": "https://example.com/posting-policy.html",
216-
...
217+
// other fields...
217218
}
218219
```
219220

@@ -260,20 +261,22 @@ Relays that require payments may want to expose their fee schedules.
260261

261262
A URL pointing to an image to be used as an icon for the relay. Recommended to be squared in shape.
262263

263-
```json
264+
```jsonc
264265
{
265266
"icon": "https://nostr.build/i/53866b44135a27d624e99c6165cabd76ac8f72797209700acb189fce75021f47.jpg",
266-
...
267+
// other fields...
267268
}
268269
```
269270

270271
### Examples
271272

272273
As of 2 May 2023 the following command provided these results:
273274

275+
```bash
276+
$ curl -H "Accept: application/nostr+json" https://eden.nostr.land | jq
274277
```
275-
~> curl -H "Accept: application/nostr+json" https://eden.nostr.land | jq
276278

279+
```json
277280
{
278281
"description": "nostr.land family of relays (us-or-01)",
279282
"name": "nostr.land",
@@ -312,3 +315,4 @@ As of 2 May 2023 the following command provided these results:
312315
]
313316
},
314317
}
318+
```

15.md

+10-9
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ Fields that are not self-explanatory:
7373

7474
**Event Tags**
7575

76-
```json
76+
```jsonc
7777
{
7878
"tags": [["d", <string, id of stall]],
79-
...
79+
// other fields...
8080
}
8181
```
8282
- the `d` tag is required, its value MUST be the same as the stall `id`.
@@ -124,12 +124,12 @@ Fields that are not self-explanatory:
124124

125125
**Event Tags**
126126

127-
```json
127+
```jsonc
128128
"tags": [
129129
["d", <string, id of product],
130130
["t", <string (optional), product category],
131131
["t", <string (optional), product category],
132-
...
132+
// other fields...
133133
],
134134
...
135135
```
@@ -158,7 +158,7 @@ The below JSON goes in content of [NIP-04](04.md).
158158
"type": 0,
159159
"name": <string (optional), ???>,
160160
"address": <string (optional), for physical goods an address should be provided>,
161-
"message": "<string (optional), message for merchant>,
161+
"message": <string (optional), message for merchant>,
162162
"contact": {
163163
"nostr": <32-bytes hex of a pubkey>,
164164
"phone": <string (optional), if the customer wants to be contacted by phone>,
@@ -237,7 +237,7 @@ Create a customized user experience using the `naddr` from [NIP-19](19.md#sharea
237237

238238
**Event Content**
239239

240-
```json
240+
```jsonc
241241
{
242242
"name": <string (optional), market name>,
243243
"about": <string (optional), market description>,
@@ -248,7 +248,7 @@ Create a customized user experience using the `naddr` from [NIP-19](19.md#sharea
248248
"darkMode": <bool, true/false>
249249
},
250250
"merchants": [array of pubkeys (optional)],
251-
...
251+
// other fields...
252252
}
253253
```
254254

@@ -290,10 +290,11 @@ This event leverages naddr to enable comprehensive customization and sharing of
290290

291291
### Event `1021`: Bid
292292

293-
```json
293+
```jsonc
294294
{
295295
"content": <int, amount of sats>,
296296
"tags": [["e", <event ID of the auction to bid on>]],
297+
// other fields...
297298
}
298299
```
299300

@@ -335,4 +336,4 @@ Customer support is handled over whatever communication method was specified. If
335336

336337
## Additional
337338

338-
Standard data models can be found <a href="https://raw.githubusercontent.com/lnbits/nostrmarket/main/models.py">here</a>
339+
Standard data models can be found [here](https://raw.githubusercontent.com/lnbits/nostrmarket/main/models.py)

17.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@ This NIP defines an encrypted direct messaging scheme using [NIP-44](44.md) encr
1212

1313
Kind `14` is a chat message. `p` tags identify one or more receivers of the message.
1414

15-
```js
15+
```jsonc
1616
{
1717
"id": "<usual hash>",
1818
  "pubkey": "<sender-pubkey>",
19-
"created_at": now(),
19+
"created_at": "<current-time>",
2020
  "kind": 14,
2121
  "tags": [
2222
    ["p", "<receiver-1-pubkey>", "<relay-url>"],
2323
    ["p", "<receiver-2-pubkey>", "<relay-url>"],
2424
    ["e", "<kind-14-id>", "<relay-url>", "reply"] // if this is a reply
2525
["subject", "<conversation-title>"],
26-
    ...
26+
    // rest of tags...
2727
  ],
2828
  "content": "<message-in-plain-text>",
2929
}
@@ -86,15 +86,15 @@ Clients CAN offer disappearing messages by setting an `expiration` tag in the gi
8686

8787
Kind `10050` indicates the user's preferred relays to receive DMs. The event MUST include a list of `relay` tags with relay URIs.
8888

89-
```js
89+
```jsonc
9090
{
9191
"kind": 10050,
9292
"tags": [
9393
["relay", "wss://inbox.nostr.wine"],
9494
["relay", "wss://myrelay.nostr1.com"],
9595
],
9696
"content": "",
97-
//...other fields
97+
// other fields...
9898
}
9999
```
100100

25.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ Reactions to a website
5757

5858
If the target of the reaction is a website, the reaction MUST be a `kind 17` event and MUST include an `r` tag with the website's URL.
5959

60-
```json
60+
```jsonc
6161
{
6262
"kind": 17,
6363
"content": "",
6464
"tags": [
6565
["r", "https://example.com/"]
6666
],
67-
...other fields
67+
// other fields...
6868
}
6969
```
7070

@@ -79,14 +79,14 @@ The client may specify a custom emoji ([NIP-30](30.md)) `:shortcode:` in the
7979
reaction content. The client should refer to the emoji tag and render the
8080
content as an emoji if shortcode is specified.
8181

82-
```json
82+
```jsonc
8383
{
8484
"kind": 7,
8585
"content": ":soapbox:",
8686
"tags": [
8787
["emoji", "soapbox", "https://gleasonator.com/emoji/Gleasonator/soapbox.png"]
8888
],
89-
...other fields
89+
// other fields...
9090
}
9191
```
9292

28.md

+13-13
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ Create a public chat channel.
2525

2626
In the channel creation `content` field, Client SHOULD include basic channel metadata (`name`, `about`, `picture` and `relays` as specified in kind 41).
2727

28-
```json
28+
```jsonc
2929
{
3030
"content": "{\"name\": \"Demo Channel\", \"about\": \"A test channel.\", \"picture\": \"https://placekitten.com/200/200\", \"relays\": [\"wss://nos.lol\", \"wss://nostr.mom\"]}",
31-
...
31+
// other fields...
3232
}
3333
```
3434

@@ -52,11 +52,11 @@ Clients MAY add additional metadata fields.
5252

5353
Clients SHOULD use [NIP-10](10.md) marked "e" tags to recommend a relay.
5454

55-
```json
55+
```jsonc
5656
{
5757
"content": "{\"name\": \"Updated Demo Channel\", \"about\": \"Updating a test channel.\", \"picture\": \"https://placekitten.com/201/201\", \"relays\": [\"wss://nos.lol\", \"wss://nostr.mom\"]}",
5858
"tags": [["e", <channel_create_event_id>, <relay-url>]],
59-
...
59+
// other fields...
6060
}
6161
```
6262

@@ -71,26 +71,26 @@ Clients SHOULD append [NIP-10](10.md) "p" tags to replies.
7171

7272
Root message:
7373

74-
```json
74+
```jsonc
7575
{
7676
"content": <string>,
7777
"tags": [["e", <kind_40_event_id>, <relay-url>, "root"]],
78-
...
78+
// other fields...
7979
}
8080
```
8181

8282
Reply to another message:
8383

84-
```json
84+
```jsonc
8585
{
8686
"content": <string>,
8787
"tags": [
8888
["e", <kind_40_event_id>, <relay-url>, "root"],
8989
["e", <kind_42_event_id>, <relay-url>, "reply"],
9090
["p", <pubkey>, <relay-url>],
91-
...
91+
// rest of tags...
9292
],
93-
...
93+
// other fields...
9494
}
9595
```
9696

@@ -107,11 +107,11 @@ Clients MAY hide event 42s for other users other than the user who sent the even
107107

108108
(For example, if three users 'hide' an event giving a reason that includes the word 'pornography', a Nostr client that is an iOS app may choose to hide that message for all iOS clients.)
109109

110-
```json
110+
```jsonc
111111
{
112112
"content": "{\"reason\": \"Dick pic\"}",
113113
"tags": [["e", <kind_42_event_id>]],
114-
...
114+
// other fields...
115115
}
116116
```
117117

@@ -125,11 +125,11 @@ Clients SHOULD hide event 42s shown to a given user, if there is an event 44 fro
125125

126126
Clients MAY hide event 42s for users other than the user who sent the event 44.
127127

128-
```json
128+
```jsonc
129129
{
130130
"content": "{\"reason\": \"Posting dick pics\"}",
131131
"tags": [["p", <pubkey>]],
132-
...
132+
// other fields...
133133
}
134134
```
135135

0 commit comments

Comments
 (0)