Skip to content

Commit

Permalink
reformat a bunch of json things and small nitpicks.
Browse files Browse the repository at this point in the history
  • Loading branch information
fiatjaf committed Nov 18, 2023
1 parent b0df718 commit 5dcfe85
Show file tree
Hide file tree
Showing 21 changed files with 385 additions and 365 deletions.
18 changes: 9 additions & 9 deletions 11.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ are rejected or fail immediately.

```json
{
...
"limitation": {
"max_message_length": 16384,
"max_subscriptions": 20,
Expand All @@ -82,7 +81,8 @@ are rejected or fail immediately.
"payment_required": true,
"created_at_lower_limit": 31536000,
"created_at_upper_limit": 3
}
},
...
}
```

Expand Down Expand Up @@ -181,8 +181,8 @@ flexibility is up to the client software.

```json
{
"relay_countries": [ "CA", "US" ],
...
"relay_countries": [ "CA", "US" ]
}
```

Expand All @@ -203,10 +203,10 @@ To support this goal, relays MAY specify some of the following values.

```json
{
"language_tags": ["en", "en-419"],
"tags": ["sfw-only", "bitcoin-only", "anime"],
"posting_policy": "https://example.com/posting-policy.html",
...
"language_tags": [ "en", "en-419" ],
"tags": [ "sfw-only", "bitcoin-only", "anime" ],
"posting_policy": "https://example.com/posting-policy.html"
}
```

Expand Down Expand Up @@ -239,13 +239,13 @@ Relays that require payments may want to expose their fee schedules.

```json
{
...
"payments_url": "https://my-relay/payments",
"fees": {
"admission": [{ "amount": 1000000, "unit": "msats" }],
"subscription": [{ "amount": 5000000, "unit": "msats", "period": 2592000 }],
"publication": [{ "kinds": [4], "amount": 100, "unit": "msats" }],
}
},
...
}
```

Expand All @@ -255,8 +255,8 @@ A URL pointing to an image to be used as an icon for the relay. Recommended to b

```json
{
...
"icon": "https://nostr.build/i/53866b44135a27d624e99c6165cabd76ac8f72797209700acb189fce75021f47.jpg",
...
}
```

Expand Down
6 changes: 1 addition & 5 deletions 13.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,7 @@ Example mined note
"created_at": 1651794653,
"kind": 1,
"tags": [
[
"nonce",
"776797",
"21"
]
["nonce", "776797", "21"]
],
"content": "It's just me mining my own business",
"sig": "284622fc0a3f4f1303455d5175f7ba962a3300d136085b9566801bc2e0699de0c7e31e44c81fb40ad9049173742e904713c3594a1da0fc5d2382a25c11aba977"
Expand Down
8 changes: 5 additions & 3 deletions 14.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ Subject tag in Text events

`draft` `optional`

This NIP defines the use of the "subject" tag in text (kind: 1) events.
This NIP defines the use of the "subject" tag in text (kind: 1) events.
(implemented in more-speech)

`["subject": <string>]`
```json
["subject": <string>]
```

Browsers often display threaded lists of messages. The contents of the subject tag can be used in such lists, instead of the more ad hoc approach of using the first few words of the message. This is very similar to the way email browsers display lists of incoming emails by subject rather than by contents.

When replying to a message with a subject, clients SHOULD replicate the subject tag. Clients MAY adorn the subject to denote
that it is a reply. e.g. by prepending "Re:".
that it is a reply. e.g. by prepending "Re:".

Subjects should generally be shorter than 80 chars. Long subjects will likely be trimmed by clients.
205 changes: 107 additions & 98 deletions 15.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
NIP-15
======

Nostr Marketplace (for resilient marketplaces)
-----------------------------------
Nostr Marketplace
-----------------

`draft` `optional`
`draft` `optional`

> Based on https://github.com/lnbits/Diagon-Alley
Based on https://github.com/lnbits/Diagon-Alley.

> Implemented in [NostrMarket](https://github.com/lnbits/nostrmarket) and [Plebeian Market](https://github.com/PlebeianTech/plebeian-market)
Implemented in [NostrMarket](https://github.com/lnbits/nostrmarket) and [Plebeian Market](https://github.com/PlebeianTech/plebeian-market).

## Terms

Expand All @@ -35,29 +35,30 @@ The `merchant` admin software can be purely clientside, but for `convenience` an
A merchant can publish these events:
| Kind | | Description |
| --------- | ------------------ | --------------------------------------------------------------------------------------------------------------- |
| `0 ` | `set_meta` | The merchant description (similar with any `nostr` public key). |
| `0` | `set_meta` | The merchant description (similar with any `nostr` public key). |
| `30017` | `set_stall` | Create or update a stall. |
| `30018` | `set_product` | Create or update a product. |
| `4 ` | `direct_message` | Communicate with the customer. The messages can be plain-text or JSON. |
| `5 ` | `delete` | Delete a product or a stall. |
| `4` | `direct_message` | Communicate with the customer. The messages can be plain-text or JSON. |
| `5` | `delete` | Delete a product or a stall. |

### Event `30017`: Create or update a stall.

**Event Content**:
**Event Content**

```json
{
"id": <String, UUID generated by the merchant. Sequential IDs (`0`, `1`, `2`...) are discouraged>,
"name": <String, stall name>,
"description": <String (optional), stall description>,
"currency": <String, currency used>,
"shipping": [
{
"id": <String, UUID of the shipping zone, generated by the merchant>,
"name": <String (optional), zone name>,
"cost": <float, base cost for shipping. The currency is defined at the stall level>,
"regions": [<String, regions included in this zone>],
}
]
"id": <string, id generated by the merchant. Sequential IDs (`0`, `1`, `2`...) are discouraged>,
"name": <string, stall name>,
"description": <string (optional), stall description>,
"currency": <string, currency used>,
"shipping": [
{
"id": <string, id of the shipping zone, generated by the merchant>,
"name": <string (optional), zone name>,
"cost": <float, base cost for shipping. The currency is defined at the stall level>,
"regions": [<string, regions included in this zone>],
}
]
}
```

Expand All @@ -70,34 +71,39 @@ Fields that are not self-explanatory:
- each shipping zone contains the base cost for orders made to that shipping zone, but a specific shipping cost per
product can also be specified if the shipping cost for that product is higher than what's specified by the base cost.

**Event Tags**:
**Event Tags**

```json
"tags": [["d", <String, id of stall]]
{
"tags": [["d", <string, id of stall]],
...
}
```
- the `d` tag is required, its value MUST be the same as the stall `id`.

### Event `30018`: Create or update a product

**Event Content**:
**Event Content**

```json
{
"id": <String, UUID generated by the merchant.Sequential IDs (`0`, `1`, `2`...) are discouraged>,
"stall_id": <String, UUID of the stall to which this product belong to>,
"name": <String, product name>,
"description": <String (optional), product description>,
"images": <[String], array of image URLs, optional>,
"currency": <String, currency used>,
"price": <float, cost of product>,
"quantity": <int or null, available items>,
"specs": [
[<String, spec key>, <String, spec value>]
],
"shipping": [
{
"id": <String, UUID of the shipping zone. Must match one of the zones defined for the stall>,
"cost": <float, extra cost for shipping. The currency is defined at the stall level>,
}
]
"id": <string, id generated by the merchant (sequential ids are discouraged)>,
"stall_id": <string, id of the stall to which this product belong to>,
"name": <string, product name>,
"description": <string (optional), product description>,
"images": <[string], array of image URLs, optional>,
"currency": <string, currency used>,
"price": <float, cost of product>,
"quantity": <int or null, available items>,
"specs": [
[<string, spec key>, <string, spec value>]
],
"shipping": [
{
"id": <string, id of the shipping zone (must match one of the zones defined for the stall)>,
"cost": <float, extra cost for shipping. The currency is defined at the stall level>,
}
]
}
```

Expand All @@ -114,16 +120,18 @@ Fields that are not self-explanatory:
- the `id` should match the id of the shipping zone, as defined in the `shipping` field of the stall
- to calculate the total cost of shipping for an order, the user will choose a shipping option during checkout, and then the client must consider this costs:
- the `base cost from the stall` for the chosen shipping option
- the result of multiplying the product units by the `shipping costs specified in the product`, if any.
- the result of multiplying the product units by the `shipping costs specified in the product`, if any.

**Event Tags**

**Event Tags**:
```json
"tags": [
["d", <String, id of product],
["t", <String (optional), product category],
["t", <String (optional), product category],
...
]
["d", <string, id of product],
["t", <string (optional), product category],
["t", <string (optional), product category],
...
],
...
```

- the `d` tag is required, its value MUST be the same as the product `id`.
Expand All @@ -147,23 +155,23 @@ The below json goes in content of [NIP04](https://github.com/nostr-protocol/nips

```json
{
"id": <String, UUID generated by the customer>,
"type": 0,
"name": <String (optional), ???>,
"address": <String (optional), for physical goods an address should be provided>
"message": "<String (optional), message for merchant>,
"contact": {
"nostr": <32-bytes hex of a pubkey>,
"phone": <String (optional), if the customer wants to be contacted by phone>,
"email": <String (optional), if the customer wants to be contacted by email>,
},
"items": [
{
"product_id": <String, UUID of the product>,
"quantity": <int, how many products the customer is ordering>
}
],
"shipping_id": <String, UUID of the shipping zone>
"id": <string, id generated by the customer>,
"type": 0,
"name": <string (optional), ???>,
"address": <string (optional), for physical goods an address should be provided>
"message": "<string (optional), message for merchant>,
"contact": {
"nostr": <32-bytes hex of a pubkey>,
"phone": <string (optional), if the customer wants to be contacted by phone>,
"email": <string (optional), if the customer wants to be contacted by email>,
},
"items": [
{
"product_id": <string, id of the product>,
"quantity": <int, how many products the customer is ordering>
}
],
"shipping_id": <string, id of the shipping zone>
}

```
Expand All @@ -186,23 +194,23 @@ The below json goes in `content` of [NIP04](https://github.com/nostr-protocol/ni

```json
{
"id": <String, UUID of the order>,
"type": 1,
"message": <String, message to customer, optional>,
"payment_options": [
{
"type": <String, option type>,
"link": <String, url, btc address, ln invoice, etc>
},
{
"type": <String, option type>,
"link": <String, url, btc address, ln invoice, etc>
},
{
"type": <String, option type>,
"link": <String, url, btc address, ln invoice, etc>
}
]
"id": <string, id of the order>,
"type": 1,
"message": <string, message to customer, optional>,
"payment_options": [
{
"type": <string, option type>,
"link": <string, url, btc address, ln invoice, etc>
},
{
"type": <string, option type>,
"link": <string, url, btc address, ln invoice, etc>
},
{
"type": <string, option type>,
"link": <string, url, btc address, ln invoice, etc>
}
]
}
```

Expand All @@ -214,31 +222,32 @@ The below json goes in `content` of [NIP04](https://github.com/nostr-protocol/ni

```json
{
"id": <String, UUID of the order>,
"type": 2,
"message": <String, message to customer>,
"paid": <Bool, true/false has received payment>,
"shipped": <Bool, true/false has been shipped>,
"id": <string, id of the order>,
"type": 2,
"message": <string, message to customer>,
"paid": <bool: has received payment>,
"shipped": <bool: has been shipped>,
}
```
## Customize Marketplace
Create a customized user experience using the `naddr` from [NIP-19](https://github.com/nostr-protocol/nips/blob/master/19.md#shareable-identifiers-with-extra-metadata). The use of `naddr` enables easy sharing of marketplace events while incorporating a rich set of metadata. This metadata can include relays, merchant profiles, and more. Subsequently, it allows merchants to be grouped into a market, empowering the market creator to configure the marketplace's user interface and user experience, and share that marketplace. This customization can encompass elements such as market name, description, logo, banner, themes, and even color schemes, offering a tailored and unique marketplace experience.

### Event `30019`: Create or update marketplace UI/UX

**Event Content**:
**Event Content**

```json
{
"name": <String (optional), market name>,
"about": <String (optional), market description>,
"ui": {
"picture": <String (optional), market logo image URL>,
"banner": <String (optional), market logo banner URL>,
"theme": <String (optional), market theme>,
"darkMode": <Bool, true/false>
},
"merchants": <[String] (optional), array of pubkeys>,
...
"name": <string (optional), market name>,
"about": <string (optional), market description>,
"ui": {
"picture": <string (optional), market logo image URL>,
"banner": <string (optional), market logo banner URL>,
"theme": <string (optional), market theme>,
"darkMode": <bool, true/false>
},
"merchants": [array of pubkeys (optional)],
...
}
```

Expand Down
Loading

0 comments on commit 5dcfe85

Please sign in to comment.