aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/features/ark.js5
-rw-r--r--tools/ark/custody-ui-test.js5
2 files changed, 8 insertions, 2 deletions
diff --git a/src/features/ark.js b/src/features/ark.js
index 3c23766..771fa45 100644
--- a/src/features/ark.js
+++ b/src/features/ark.js
@@ -2692,7 +2692,10 @@ export function arkFeature(ctx) {
h('h4', { style: 'margin:0' }, t('arkCustodyTitle')),
h('p', { class: 'small muted', style: 'margin:0' }, t('arkCustodyDesc', { days: lifeDays })),
h('select', { id: 'ark-custody-select', disabled: !honors, onChange: (e) => applyCustody(e.target.value) },
- ...tiers.map((x) => h('option', { value: x.id, selected: x.id === cur }, x.label + ' · ' + x.cost))),
+ ...tiers.map((x) => h('option', { value: x.id, selected: x.id === cur }, x.label))),
+ // the price under the choice, not in the option (a long option text
+ // overflows the select on a phone)
+ h('div', { class: 'small ark-custody-cost' }, chosen.cost),
h('p', { class: 'small muted ark-custody-desc', style: 'margin:0' }, chosen.desc),
honors ? null : h('p', { class: 'small faint', style: 'margin:0' }, t('arkCustodyNotHere')));
}
diff --git a/tools/ark/custody-ui-test.js b/tools/ark/custody-ui-test.js
index 5eabbfa..9c238f5 100644
--- a/tools/ark/custody-ui-test.js
+++ b/tools/ark/custody-ui-test.js
@@ -78,7 +78,8 @@ try {
let tx = await text();
assert.match(tx, /Custody/);
const opts = await page.$$eval('.ark-custody option', (es) => es.map((e) => e.value + '=' + e.textContent));
- assert.deepEqual(opts, ['custodial=Allow coins to expire · no fees', 'self=Minimize renewal cost · 300 sats per renewal', 'exit=Minimize exit cost · 300 sats near expiry, 0.2% + 300 sats when early']);
+ assert.deepEqual(opts, ['custodial=Allow coins to expire', 'self=Minimize renewal cost', 'exit=Minimize exit cost']);
+ assert.equal(await page.$eval('.ark-custody-cost', (e) => e.textContent), 'no fees');
assert.equal(await page.$eval('#ark-custody-select', (e) => e.value), 'custodial', 'coins expire by default');
assert.equal(await page.evaluate(() => coopFeature.getCustody()), 'custodial');
assert.match(await page.$eval('.ark-custody-desc', (e) => e.textContent), /keeps its own exit until it expires/);
@@ -112,6 +113,7 @@ try {
assert.match(tx, /Custody choice saved/);
assert.match(await renewSheet(), /renews coins automatically once they are close to expiring/);
assert.match(await page.$eval('.ark-custody-desc', (e) => e.textContent), /Coins renew in the last hours/);
+ assert.equal(await page.$eval('.ark-custody-cost', (e) => e.textContent), '300 sats per renewal');
const calls = await page.evaluate(() => coopFeature.autoRefreshCalls);
assert.deepEqual(calls[0], ['ensure', 6, 8, 1], 'backstop orders registered at once (regtest margin 6)');
assert.deepEqual(calls[1], ['refresh', ['coin-1', 'coin-2']], 'the coin past its timelock is renewed now with the small change; the deep healthy one is left alone');
@@ -121,6 +123,7 @@ try {
await page.evaluate(() => { coopFeature.autoRefreshCalls.length = 0; });
await page.select('#ark-custody-select', 'exit'); await sleep(400);
assert.equal(await page.evaluate(() => coopFeature.getCustody()), 'exit');
+ assert.equal(await page.$eval('.ark-custody-cost', (e) => e.textContent), '300 sats near expiry, 0.2% + 300 sats when early');
const calls2 = await page.evaluate(() => coopFeature.autoRefreshCalls);
assert.deepEqual(calls2[1], ['refresh', ['coin-1', 'coin-0', 'coin-2']], 'expired + deep (worth it) + small change ride one round');
console.log('✓ "Keep my exit cheap" renews the deep coin too, when the fee is under a tenth of it');