aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--names/server.js7
-rw-r--r--src/features/names.js5
2 files changed, 10 insertions, 2 deletions
diff --git a/names/server.js b/names/server.js
index 9b57ce7..6cd82a1 100644
--- a/names/server.js
+++ b/names/server.js
@@ -938,7 +938,12 @@ Bun.serve({
return json({ ok: true, revoked: n });
}
const token = posMintToken(key, body.currency);
- return json({ token, name, domain, currency: posTokens()[token].currency });
+ // Currency is the merchant's, not the token's: a new token in CAD moves
+ // the terminals already paired to this name to CAD as well.
+ const { currency } = posTokens()[token];
+ for (const v of Object.values(posTokens())) if (v.key === key) v.currency = currency;
+ persist();
+ return json({ token, name, domain, currency });
}
// Operator bootstrap: mint a terminal token for any name.
if (url.pathname === '/admin/pos/token' && req.method === 'POST') {
diff --git a/src/features/names.js b/src/features/names.js
index 7e51c8c..43d4895 100644
--- a/src/features/names.js
+++ b/src/features/names.js
@@ -19,6 +19,7 @@ import { bech32 } from '@scure/base';
import { isArkAddress } from './ark.js';
import { getNetwork } from '../api.js';
import { t } from '../i18n.js';
+import { getCurrency } from '../rates.js';
const REGISTRAR = 'https://names.coinos.io';
// Claims are namespaced by network: staging's mutinynet wallets get
@@ -521,7 +522,9 @@ export function namesFeature(ctx) {
// token goes straight into the terminal's config at coinos.io/flash.
function posCard(st) {
const tok = ui.posToken;
- const body = () => ({ name: st.name, domain: st.domain || DOMAIN() });
+ // The terminal rings sales up in the owner's currency (the registrar retunes
+ // already-paired terminals to it on every new token, too).
+ const body = () => ({ name: st.name, domain: st.domain || DOMAIN(), currency: getCurrency() });
return h('div', { class: 'card col', 'data-key': 'pos' },
h('h3', {}, t('namesPos')),
h('p', { class: 'small muted', style: 'margin:0' }, t('namesPosHow')),