diff --git a/static/transaction.js b/static/transaction.js index 105a67b..04c3912 100644 --- a/static/transaction.js +++ b/static/transaction.js @@ -8,13 +8,14 @@ (function () { "use strict"; - /* What each type shows. Currencies not listed are hidden and fixed; `market` - and `fee` say whether those two sections belong to the type (docs/spec.md - sections 3.2 and 7.3). */ + /* What each type shows, exactly the list of docs/spec.md section 7.3. A slot + with one currency shows that unit as plain text; `default` is the currency a + slot with a choice opens with. `market` and `fee` say whether those two + sections belong to the type. */ var TYPE_FIELDS = { trade: { - in: {label: "Kjøp", currencies: ["sats", "nok"]}, - out: {label: "Salg/kostnad", currencies: ["sats", "nok"]}, + in: {label: "Kjøp", currencies: ["sats", "nok"], default: "sats"}, + out: {label: "Salg/kostnad", currencies: ["sats", "nok"], default: "nok"}, consumes: true, market: true, fee: true @@ -35,7 +36,7 @@ }, loss: { out: {label: "Tap", currencies: ["sats"]}, - value: {label: "Pris", optional: true}, + value: {label: "Pris"}, consumes: true, market: true, fee: true @@ -47,6 +48,12 @@ market: true, fee: true }, + transfer_in: { + in: {label: "Motteke", currencies: ["sats"]}, + consumes: false, + market: true, + fee: false + }, gift_received: { in: {label: "Motteke gåve", currencies: ["sats"]}, value: {label: "Pris"}, @@ -61,15 +68,18 @@ fee: true }, admin_cost: { - out: {label: "Kostnad", currencies: ["sats"]}, + out: {label: "Kostnad", currencies: ["nok"]}, consumes: false, market: 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. */ - var FEE_TAKEN_ON_TOP = ["trade", "spend"]; + var FEE_TAKEN_ON_TOP = ["trade", "spend", "transfer_out"]; var form = document.querySelector("[data-form]"); var title = document.querySelector("[data-title]");