diff options
| author | Francisco Calderón <fjcalderon@gmail.com> | 2024-11-04 15:39:21 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-04 15:39:21 -0300 |
| commit | 03f3bc39678262ecbd5d870c9da44723023557ff (patch) | |
| tree | e75ecf32d3bc906a8b26314488a1ae90996169c1 /15.md | |
| parent | f72a2f69ed93cf442e83bf9e7e16f6c06da40384 (diff) | |
| parent | 6bcd89c097e97e65dbc95e7c6b7b8348e8dd6b5c (diff) | |
Merge branch 'master' into p2p-nip
Diffstat (limited to '15.md')
| -rw-r--r-- | 15.md | 35 |
1 files changed, 18 insertions, 17 deletions
| @@ -6,7 +6,7 @@ Nostr Marketplace | |||
| 6 | 6 | ||
| 7 | `draft` `optional` | 7 | `draft` `optional` |
| 8 | 8 | ||
| 9 | Based on https://github.com/lnbits/Diagon-Alley. | 9 | Based on [Diagon-Alley](https://github.com/lnbits/Diagon-Alley). |
| 10 | 10 | ||
| 11 | Implemented in [NostrMarket](https://github.com/lnbits/nostrmarket) and [Plebeian Market](https://github.com/PlebeianTech/plebeian-market). | 11 | Implemented in [NostrMarket](https://github.com/lnbits/nostrmarket) and [Plebeian Market](https://github.com/PlebeianTech/plebeian-market). |
| 12 | 12 | ||
| @@ -73,10 +73,10 @@ Fields that are not self-explanatory: | |||
| 73 | 73 | ||
| 74 | **Event Tags** | 74 | **Event Tags** |
| 75 | 75 | ||
| 76 | ```json | 76 | ```jsonc |
| 77 | { | 77 | { |
| 78 | "tags": [["d", <string, id of stall]], | 78 | "tags": [["d", <string, id of stall]], |
| 79 | ... | 79 | // other fields... |
| 80 | } | 80 | } |
| 81 | ``` | 81 | ``` |
| 82 | - the `d` tag is required, its value MUST be the same as the stall `id`. | 82 | - 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: | |||
| 124 | 124 | ||
| 125 | **Event Tags** | 125 | **Event Tags** |
| 126 | 126 | ||
| 127 | ```json | 127 | ```jsonc |
| 128 | "tags": [ | 128 | "tags": [ |
| 129 | ["d", <string, id of product], | 129 | ["d", <string, id of product], |
| 130 | ["t", <string (optional), product category], | 130 | ["t", <string (optional), product category], |
| 131 | ["t", <string (optional), product category], | 131 | ["t", <string (optional), product category], |
| 132 | ... | 132 | // other fields... |
| 133 | ], | 133 | ], |
| 134 | ... | 134 | ... |
| 135 | ``` | 135 | ``` |
| @@ -139,7 +139,7 @@ Fields that are not self-explanatory: | |||
| 139 | 139 | ||
| 140 | ## Checkout events | 140 | ## Checkout events |
| 141 | 141 | ||
| 142 | All checkout events are sent as JSON strings using ([NIP-04](https://github.com/nostr-protocol/nips/blob/master/04.md)). | 142 | All checkout events are sent as JSON strings using [NIP-04](04.md). |
| 143 | 143 | ||
| 144 | The `merchant` and the `customer` can exchange JSON messages that represent different actions. Each `JSON` message `MUST` have a `type` field indicating the what the JSON represents. Possible types: | 144 | The `merchant` and the `customer` can exchange JSON messages that represent different actions. Each `JSON` message `MUST` have a `type` field indicating the what the JSON represents. Possible types: |
| 145 | 145 | ||
| @@ -150,7 +150,7 @@ The `merchant` and the `customer` can exchange JSON messages that represent diff | |||
| 150 | | 2 | Merchant | Order Status Update | | 150 | | 2 | Merchant | Order Status Update | |
| 151 | 151 | ||
| 152 | ### Step 1: `customer` order (event) | 152 | ### Step 1: `customer` order (event) |
| 153 | The below JSON goes in content of [NIP-04](https://github.com/nostr-protocol/nips/blob/master/04.md). | 153 | The below JSON goes in content of [NIP-04](04.md). |
| 154 | 154 | ||
| 155 | ```json | 155 | ```json |
| 156 | { | 156 | { |
| @@ -158,7 +158,7 @@ The below JSON goes in content of [NIP-04](https://github.com/nostr-protocol/nip | |||
| 158 | "type": 0, | 158 | "type": 0, |
| 159 | "name": <string (optional), ???>, | 159 | "name": <string (optional), ???>, |
| 160 | "address": <string (optional), for physical goods an address should be provided>, | 160 | "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>, |
| 162 | "contact": { | 162 | "contact": { |
| 163 | "nostr": <32-bytes hex of a pubkey>, | 163 | "nostr": <32-bytes hex of a pubkey>, |
| 164 | "phone": <string (optional), if the customer wants to be contacted by phone>, | 164 | "phone": <string (optional), if the customer wants to be contacted by phone>, |
| @@ -182,7 +182,7 @@ _Open_: is `contact.nostr` required? | |||
| 182 | 182 | ||
| 183 | Sent back from the merchant for payment. Any payment option is valid that the merchant can check. | 183 | Sent back from the merchant for payment. Any payment option is valid that the merchant can check. |
| 184 | 184 | ||
| 185 | The below JSON goes in `content` of [NIP-04](https://github.com/nostr-protocol/nips/blob/master/04.md). | 185 | The below JSON goes in `content` of [NIP-04](04.md). |
| 186 | 186 | ||
| 187 | `payment_options`/`type` include: | 187 | `payment_options`/`type` include: |
| 188 | 188 | ||
| @@ -217,7 +217,7 @@ The below JSON goes in `content` of [NIP-04](https://github.com/nostr-protocol/n | |||
| 217 | 217 | ||
| 218 | Once payment has been received and processed. | 218 | Once payment has been received and processed. |
| 219 | 219 | ||
| 220 | The below JSON goes in `content` of [NIP-04](https://github.com/nostr-protocol/nips/blob/master/04.md). | 220 | The below JSON goes in `content` of [NIP-04](04.md). |
| 221 | 221 | ||
| 222 | ```json | 222 | ```json |
| 223 | { | 223 | { |
| @@ -231,13 +231,13 @@ The below JSON goes in `content` of [NIP-04](https://github.com/nostr-protocol/n | |||
| 231 | 231 | ||
| 232 | ## Customize Marketplace | 232 | ## Customize Marketplace |
| 233 | 233 | ||
| 234 | 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. | 234 | Create a customized user experience using the `naddr` from [NIP-19](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. |
| 235 | 235 | ||
| 236 | ### Event `30019`: Create or update marketplace UI/UX | 236 | ### Event `30019`: Create or update marketplace UI/UX |
| 237 | 237 | ||
| 238 | **Event Content** | 238 | **Event Content** |
| 239 | 239 | ||
| 240 | ```json | 240 | ```jsonc |
| 241 | { | 241 | { |
| 242 | "name": <string (optional), market name>, | 242 | "name": <string (optional), market name>, |
| 243 | "about": <string (optional), market description>, | 243 | "about": <string (optional), market description>, |
| @@ -248,7 +248,7 @@ Create a customized user experience using the `naddr` from [NIP-19](https://gith | |||
| 248 | "darkMode": <bool, true/false> | 248 | "darkMode": <bool, true/false> |
| 249 | }, | 249 | }, |
| 250 | "merchants": [array of pubkeys (optional)], | 250 | "merchants": [array of pubkeys (optional)], |
| 251 | ... | 251 | // other fields... |
| 252 | } | 252 | } |
| 253 | ``` | 253 | ``` |
| 254 | 254 | ||
| @@ -290,17 +290,18 @@ This event leverages naddr to enable comprehensive customization and sharing of | |||
| 290 | 290 | ||
| 291 | ### Event `1021`: Bid | 291 | ### Event `1021`: Bid |
| 292 | 292 | ||
| 293 | ```json | 293 | ```jsonc |
| 294 | { | 294 | { |
| 295 | "content": <int, amount of sats>, | 295 | "content": <int, amount of sats>, |
| 296 | "tags": [["e", <event ID of the auction to bid on>]], | 296 | "tags": [["e", <event ID of the auction to bid on>]], |
| 297 | // other fields... | ||
| 297 | } | 298 | } |
| 298 | ``` | 299 | ``` |
| 299 | 300 | ||
| 300 | Bids are simply events of kind `1021` with a `content` field specifying the amount, in the currency of the auction. Bids must reference an auction. | 301 | Bids are simply events of kind `1021` with a `content` field specifying the amount, in the currency of the auction. Bids must reference an auction. |
| 301 | 302 | ||
| 302 | > [!NOTE] | 303 | > [!NOTE] |
| 303 | > Auctions can be edited as many times as desired (they are "parameterized replaceable events") by the author - even after the start_date, but they cannot be edited after they have received the first bid! This is enforced by the fact that bids reference the event ID of the auction (rather than the product UUID), which changes with every new version of the auctioned product. So a bid is always attached to one "version". Editing the auction after a bid would result in the new product losing the bid! | 304 | > Auctions can be edited as many times as desired (they are "addressable events") by the author - even after the start_date, but they cannot be edited after they have received the first bid! This is enforced by the fact that bids reference the event ID of the auction (rather than the product UUID), which changes with every new version of the auctioned product. So a bid is always attached to one "version". Editing the auction after a bid would result in the new product losing the bid! |
| 304 | 305 | ||
| 305 | ### Event `1022`: Bid confirmation | 306 | ### Event `1022`: Bid confirmation |
| 306 | 307 | ||
| @@ -331,8 +332,8 @@ Another thing that can happen is - if bids happen very close to the end date of | |||
| 331 | 332 | ||
| 332 | ## Customer support events | 333 | ## Customer support events |
| 333 | 334 | ||
| 334 | Customer support is handled over whatever communication method was specified. If communicating via nostr, NIP-04 is used https://github.com/nostr-protocol/nips/blob/master/04.md. | 335 | Customer support is handled over whatever communication method was specified. If communicating via nostr, [NIP-04](04.md) is used. |
| 335 | 336 | ||
| 336 | ## Additional | 337 | ## Additional |
| 337 | 338 | ||
| 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) |