Match the field list of spec section 7.3 exactly

This commit is contained in:
ai-bot committed 2026-11-15 11:23:51 +00:00
1 parent 093b17d9f8
commit 8f345127e8
1 file changed
+18 -8
+18 -8
View File
@@ -8,13 +8,14 @@
(function () { (function () {
"use strict"; "use strict";
/* What each type shows. Currencies not listed are hidden and fixed; `market` /* What each type shows, exactly the list of docs/spec.md section 7.3. A slot
and `fee` say whether those two sections belong to the type (docs/spec.md with one currency shows that unit as plain text; `default` is the currency a
sections 3.2 and 7.3). */ slot with a choice opens with. `market` and `fee` say whether those two
sections belong to the type. */
var TYPE_FIELDS = { var TYPE_FIELDS = {
trade: { trade: {
in: {label: "Kjøp", currencies: ["sats", "nok"]}, in: {label: "Kjøp", currencies: ["sats", "nok"], default: "sats"},
out: {label: "Salg/kostnad", currencies: ["sats", "nok"]}, out: {label: "Salg/kostnad", currencies: ["sats", "nok"], default: "nok"},
consumes: true, consumes: true,
market: true, market: true,
fee: true fee: true
@@ -35,7 +36,7 @@
}, },
loss: { loss: {
out: {label: "Tap", currencies: ["sats"]}, out: {label: "Tap", currencies: ["sats"]},
value: {label: "Pris", optional: true}, value: {label: "Pris"},
consumes: true, consumes: true,
market: true, market: true,
fee: true fee: true
@@ -47,6 +48,12 @@
market: true, market: true,
fee: true fee: true
}, },
transfer_in: {
in: {label: "Motteke", currencies: ["sats"]},
consumes: false,
market: true,
fee: false
},
gift_received: { gift_received: {
in: {label: "Motteke gåve", currencies: ["sats"]}, in: {label: "Motteke gåve", currencies: ["sats"]},
value: {label: "Pris"}, value: {label: "Pris"},
@@ -61,15 +68,18 @@
fee: true fee: true
}, },
admin_cost: { admin_cost: {
out: {label: "Kostnad", currencies: ["sats"]}, out: {label: "Kostnad", currencies: ["nok"]},
consumes: false, consumes: false,
market: false, market: false,
fee: false fee: false
} }
}; };
/* What the owner sees for a currency: sats and whole kroner (section 2). */
var UNIT_LABELS = {sats: "sats", nok: "kr"};
/* Types where a sats fee is taken on top of the amount given away, §3.2. */ /* Types where a sats fee is taken on top of the amount given away, §3.2. */
var FEE_TAKEN_ON_TOP = ["trade", "spend"]; var FEE_TAKEN_ON_TOP = ["trade", "spend", "transfer_out"];
var form = document.querySelector("[data-form]"); var form = document.querySelector("[data-form]");
var title = document.querySelector("[data-title]"); var title = document.querySelector("[data-title]");