diff --git a/client/core/types.go b/client/core/types.go
index f05a9f806e..b61691c57e 100644
--- a/client/core/types.go
+++ b/client/core/types.go
@@ -844,6 +844,7 @@ func newDEXAccount(acctInfo *db.AccountInfo, viewOnly bool) *dexAccount {
targetTier: acctInfo.TargetTier,
maxBondedAmt: acctInfo.MaxBondedAmt,
bondAsset: acctInfo.BondAsset,
+ penaltyComps: acctInfo.PenaltyComps,
}
}
diff --git a/client/webserver/locales/en-us.go b/client/webserver/locales/en-us.go
index 0db0ae7c77..c4d03a3f5a 100644
--- a/client/webserver/locales/en-us.go
+++ b/client/webserver/locales/en-us.go
@@ -82,8 +82,10 @@ var EnUS = map[string]*intl.Translation{
"posting_bonds_shortly": {T: "Creating bonds..."},
"bond_creation_pending_msg": {T: `In order to trade at bond(s) will be created shortly.`},
"action_required_to_trade": {T: "ACTION REQUIRED TO TRADE"},
+ "set_penalty_comps": {T: `Your account has penalties but is only authorized for penalty comps.`},
"acct_tier_post_bond": {T: `Your account tier is . You need to post new bonds to trade.`},
"enable_bond_maintenance": {T: "Enable bond maintenance from DEX Settings page."},
+ "update_penalty_comps": {T: "Update penalty comps from DEX Settings page."},
"Buy": {T: "Buy"},
"Sell": {T: "Sell"},
"lot_size": {T: "Lot Size"},
diff --git a/client/webserver/site/src/html/dexsettings.tmpl b/client/webserver/site/src/html/dexsettings.tmpl
index acb38bc92d..6b2e3b40a6 100644
--- a/client/webserver/site/src/html/dexsettings.tmpl
+++ b/client/webserver/site/src/html/dexsettings.tmpl
@@ -63,7 +63,7 @@
-
+
diff --git a/client/webserver/site/src/html/markets.tmpl b/client/webserver/site/src/html/markets.tmpl
index 78915a9629..0fb2b1d0ec 100644
--- a/client/webserver/site/src/html/markets.tmpl
+++ b/client/webserver/site/src/html/markets.tmpl
@@ -240,6 +240,17 @@
+ {{- /* PENALTY COMPS REQUIRED TO TRADE */ -}}
+
+
[[[action_required_to_trade]]]
+
+
+
{{- /* BOND REQUIRED TO TRADE */ -}}
[[[action_required_to_trade]]]
diff --git a/client/webserver/site/src/js/dexsettings.ts b/client/webserver/site/src/js/dexsettings.ts
index 8151c5ef4d..8d2d59ea47 100644
--- a/client/webserver/site/src/js/dexsettings.ts
+++ b/client/webserver/site/src/js/dexsettings.ts
@@ -129,30 +129,17 @@ export default class DexSettingsPage extends BasePage {
if (!this.accountDisabled) page.toggleAutoRenew.click()
})
- page.penaltyComps.textContent = String(xc.auth.penaltyComps)
- const hideCompInput = () => {
- Doc.hide(page.penaltyCompInput)
- Doc.show(page.penaltyComps)
- }
+ page.penaltyCompInput.value = String(xc.auth.penaltyComps)
Doc.bind(page.penaltyCompBox, 'click', (e: MouseEvent) => {
e.stopPropagation()
const xc = app().exchanges[this.host]
page.penaltyCompInput.value = String(xc.auth.penaltyComps)
- Doc.hide(page.penaltyComps)
- Doc.show(page.penaltyCompInput)
page.penaltyCompInput.focus()
- const checkClick = (e: MouseEvent) => {
- if (Doc.mouseInElement(e, page.penaltyCompBox)) return
- hideCompInput()
- Doc.unbind(document, 'click', checkClick)
- }
- Doc.bind(document, 'click', checkClick)
})
Doc.bind(page.penaltyCompInput, 'keyup', async (e: KeyboardEvent) => {
Doc.hide(page.penaltyCompsErr)
if (e.key === 'Escape') {
- hideCompInput()
return
}
if (!(e.key === 'Enter')) return
@@ -166,13 +153,11 @@ export default class DexSettingsPage extends BasePage {
try {
await this.updateBondOptions({ penaltyComps })
loaded()
- page.penaltyComps.textContent = String(penaltyComps)
} catch (e) {
loaded()
Doc.show(page.penaltyCompsErr)
page.penaltyCompsErr.textContent = intl.prep(intl.ID_API_ERROR, { msg: e.msg })
}
- hideCompInput()
})
this.dexAddrForm = new forms.DEXAddressForm(page.dexAddrForm, async (xc: Exchange) => {
diff --git a/client/webserver/site/src/js/markets.ts b/client/webserver/site/src/js/markets.ts
index 58dbfe9b37..a66b92d671 100644
--- a/client/webserver/site/src/js/markets.ts
+++ b/client/webserver/site/src/js/markets.ts
@@ -979,7 +979,7 @@ export default class MarketsPage extends BasePage {
this.updateRegistrationStatusView()
const showSection = (section: PageElement | undefined) => {
- const elements = [page.registrationStatus, page.bondRequired, page.bondCreationPending, page.notRegistered]
+ const elements = [page.registrationStatus, page.bondRequired, page.bondCreationPending, page.notRegistered, page.penaltyCompsRequired]
for (const el of elements) {
Doc.setVis(el === section, el)
}
@@ -1000,6 +1000,11 @@ export default class MarketsPage extends BasePage {
} else if (market.dex.viewOnly) {
page.unregisteredDex.textContent = market.dex.host
showSection(page.notRegistered)
+ } else if (market.dex.auth.targetTier > 0 && market.dex.auth.rep.penalties > market.dex.auth.penaltyComps) {
+ page.acctPenalties.textContent = `${market.dex.auth.rep.penalties}`
+ page.acctPenaltyComps.textContent = `${market.dex.auth.penaltyComps}`
+ page.compsDexSettingsLink.href = `/dexsettings/${market.dex.host}`
+ showSection(page.penaltyCompsRequired)
} else if (this.hasPendingBonds()) {
showSection(page.registrationStatus)
} else if (market.dex.auth.targetTier > 0) {
@@ -1121,7 +1126,7 @@ export default class MarketsPage extends BasePage {
// Hide the balance widget
this.balanceWgt.setBalanceVisibility(false)
- Doc.hide(page.notRegistered, page.bondRequired, page.noWallet)
+ Doc.hide(page.notRegistered, page.bondRequired, page.noWallet, page.penaltyCompsRequired)
// If we have not yet connected, there is no dex.assets or any other
// exchange data, so just put up a message and wait for the connection to be