upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/15.md
diff options
context:
space:
mode:
authorIoan Bizău <i@ibz.me>2024-01-09 13:35:40 +0200
committerGitHub <noreply@github.com>2024-01-09 08:35:40 -0300
commit56610771b6b0c61b2269fc16f163a004b585f726 (patch)
treeec973f0318e67b757b4890ec661659f67dbab3f5 /15.md
parentb90ddd2dae28cda13a6dd2e823a8a543165c9494 (diff)
Add auctions to NIP-15. (#859)
* Add auctions to NIP-15. * Update 15.md Co-authored-by: Vlad Stan <stan.v.vlad@gmail.com> * Address comments from @motorina0. * Remove reference to removed type=10. --------- Co-authored-by: Vlad Stan <stan.v.vlad@gmail.com>
Diffstat (limited to '15.md')
-rw-r--r--15.md78
1 files changed, 77 insertions, 1 deletions
diff --git a/15.md b/15.md
index 1c3154a..e2ba639 100644
--- a/15.md
+++ b/15.md
@@ -149,7 +149,6 @@ The `merchant` and the `customer` can exchange JSON messages that represent diff
149| 1 | Merchant | Payment Request | 149| 1 | Merchant | Payment Request |
150| 2 | Merchant | Order Status Update | 150| 2 | Merchant | Order Status Update |
151 151
152
153### Step 1: `customer` order (event) 152### Step 1: `customer` order (event)
154The below json goes in content of [NIP04](https://github.com/nostr-protocol/nips/blob/master/04.md). 153The below json goes in content of [NIP04](https://github.com/nostr-protocol/nips/blob/master/04.md).
155 154
@@ -229,7 +228,9 @@ The below json goes in `content` of [NIP04](https://github.com/nostr-protocol/ni
229 "shipped": <bool: has been shipped>, 228 "shipped": <bool: has been shipped>,
230} 229}
231``` 230```
231
232## Customize Marketplace 232## Customize Marketplace
233
233Create 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. 234Create 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 235
235### Event `30019`: Create or update marketplace UI/UX 236### Event `30019`: Create or update marketplace UI/UX
@@ -253,6 +254,81 @@ Create a customized user experience using the `naddr` from [NIP-19](https://gith
253 254
254This event leverages naddr to enable comprehensive customization and sharing of marketplace configurations, fostering a unique and engaging marketplace environment. 255This event leverages naddr to enable comprehensive customization and sharing of marketplace configurations, fostering a unique and engaging marketplace environment.
255 256
257## Auctions
258
259### Event `30020`: Create or update a product sold as an auction
260
261**Event Content**:
262```json
263{
264 "id": <String, UUID generated by the merchant. Sequential IDs (`0`, `1`, `2`...) are discouraged>,
265 "stall_id": <String, UUID of the stall to which this product belong to>,
266 "name": <String, product name>,
267 "description": <String (optional), product description>,
268 "images": <[String], array of image URLs, optional>,
269 "starting_bid": <int>,
270 "start_date": <int (optional) UNIX timestamp, date the auction started / will start>,
271 "duration": <int, number of seconds the auction will run for, excluding eventual time extensions that might happen>,
272 "specs": [
273 [<String, spec key>, <String, spec value>]
274 ],
275 "shipping": [
276 {
277 "id": <String, UUID of the shipping zone. Must match one of the zones defined for the stall>,
278 "cost": <float, extra cost for shipping. The currency is defined at the stall level>,
279 }
280 ]
281}
282```
283
284> [!NOTE]
285> Items sold as an auction are very similar in structure to fixed-price items, with some important differences worth noting.
286
287* The `start_date` can be set to a date in the future if the auction is scheduled to start on that date, or can be omitted if the start date is unknown/hidden. If the start date is not specified, the auction will have to be edited later to set an actual date.
288
289* The auction runs for an initial number of seconds after the `start_date`, specified by `duration`.
290
291### Event `1021`: Bid
292
293```json
294{
295 "content": <int, amount of sats>,
296 "tags": [["e", <event ID of the auction to bid on>]],
297}
298```
299
300Bids 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> [!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
305### Event `1022`: Bid confirmation
306
307**Event Content**:
308
309```json
310{
311 "status": <String, "accepted" | "rejected" | "pending" | "winner">,
312 "message": <String (optional)>,
313 "duration_extended": <int (optional), number of seconds>,
314}
315```
316
317**Event Tags**:
318```json
319 "tags": [["e" <event ID of the bid being confirmed>], ["e", <event ID of the auction>]],
320```
321
322Bids should be confirmed by the merchant before being considered as valid by other clients. So clients should subscribe to *bid confirmation* events (kind `1022`) for every auction that they follow, in addition to the actual bids and should check that the pubkey of the bid confirmation matches the pubkey of the merchant (in addition to checking the signature).
323
324The `content` field is a JSON which includes *at least* a `status`. `winner` is how the *winning bid* is replied to after the auction ends and the winning bid is picked by the merchant.
325
326The reasons for which a bid can be marked as `rejected` or `pending` are up to the merchant's implementation and configuration - they could be anything from basic validation errors (amount too low) to the bidder being blacklisted or to the bidder lacking sufficient *trust*, which could lead to the bid being marked as `pending` until sufficient verification is performed. The difference between the two is that `pending` bids *might* get approved after additional steps are taken by the bidder, whereas `rejected` bids can not be later approved.
327
328An additional `message` field can appear in the `content` JSON to give further context as of why a bid is `rejected` or `pending`.
329
330Another thing that can happen is - if bids happen very close to the end date of the auction - for the merchant to decide to extend the auction duration for a few more minutes. This is done by passing a `duration_extended` field as part of a bid confirmation, which would contain a number of seconds by which the initial duration is extended. So the actual end date of an auction is always `start_date + duration + (SUM(c.duration_extended) FOR c in all confirmations`.
331
256## Customer support events 332## Customer support events
257 333
258Customer 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. 334Customer 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.