Skip to content

Commit

Permalink
show number of expired bond on dex settings view
Browse files Browse the repository at this point in the history
Signed-off-by: Philemon Ukane <[email protected]>
  • Loading branch information
ukane-philemon committed Dec 4, 2023
1 parent f9289bd commit 8aae444
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 36 deletions.
1 change: 1 addition & 0 deletions client/core/bond.go
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ func (c *Core) bondStateOfDEX(dc *dexConnection, bondCfg *dexBondCfg) *dexAcctBo
state.WeakStrength = sumBondStrengths(weakBonds, bondCfg.bondAssets)
state.LiveStrength = sumBondStrengths(dc.acct.bonds, bondCfg.bondAssets) // for max bonded check
state.PendingBonds = dc.pendingBonds()
state.ExpiredBondsPendingRefund = int64(len(dc.acct.expiredBonds))
// Extract the expired bonds.
state.expiredBonds = make([]*db.Bond, len(dc.acct.expiredBonds))
copy(state.expiredBonds, dc.acct.expiredBonds)
Expand Down
2 changes: 2 additions & 0 deletions client/core/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,8 @@ type ExchangeAuth struct {
PenaltyComps uint16 `json:"penaltyComps"`
// PendingBonds are currently pending bonds and their confirmation count.
PendingBonds []*PendingBondState `json:"pendingBonds"`
// expiredBondsPendingRefund is the number of expired but unrefunded bonds.
ExpiredBondsPendingRefund int64 `json:"expiredBondsPendingRefund"`
// Compensation is the amount we have locked in bonds greater than what
// is needed to maintain our target tier. This could be from penalty
// compensation, or it could be due to the user lowering their target tier.
Expand Down
63 changes: 32 additions & 31 deletions client/webserver/locales/en-us.go
Original file line number Diff line number Diff line change
Expand Up @@ -466,35 +466,36 @@ var EnUS = map[string]string{
"Instructions:": "Instructions:",
"URL": "URL",
// Staking UI
"Price": "Price",
"Ticket": "Ticket",
"Staking": "Staking",
"Active tickets": "Active tickets",
"Tickets bought": "Tickets bought",
"Total rewards": "Total rewards",
"Votes cast": "Votes cast",
"VSP": "VSP",
"select_vsp_from_list": "Select a Voting Service Provider",
"Or add custom VSP URL:": "Or add custom VSP URL:",
"Custom VSP URL": "Custom VSP URL",
"Set Votes": "Set Votes",
"agendas": "agendas",
"Agendas": "Agendas",
"treasury spends": "treasury spends",
"staking_unavailable_for_rpc": "Staking unavailable for RPC wallets using SPV",
"Purchase Tickets": "Purchase Tickets",
"Tickets": "Tickets",
"Ticket Price": "Ticket Price",
"Vote Reward": "Vote Reward",
"fee_rate_percent": "Fee Rate (%)",
"Live Tickets": "Live Tickets",
"Current Price": "Current Price",
"Available Balance": "Available Balance",
"ticket_qty_label": "How Many?",
"Ticket History": "Ticket History",
"No tickets to show": "No tickets to show",
"Treasury Spends": "Treasury Spends",
"No": "No",
"Yes": "Yes",
"Treasury Keys": "Treasury Keys",
"Price": "Price",
"Ticket": "Ticket",
"Staking": "Staking",
"Active tickets": "Active tickets",
"Tickets bought": "Tickets bought",
"Total rewards": "Total rewards",
"Votes cast": "Votes cast",
"VSP": "VSP",
"select_vsp_from_list": "Select a Voting Service Provider",
"Or add custom VSP URL:": "Or add custom VSP URL:",
"Custom VSP URL": "Custom VSP URL",
"Set Votes": "Set Votes",
"agendas": "agendas",
"Agendas": "Agendas",
"treasury spends": "treasury spends",
"staking_unavailable_for_rpc": "Staking unavailable for RPC wallets using SPV",
"Purchase Tickets": "Purchase Tickets",
"Tickets": "Tickets",
"Ticket Price": "Ticket Price",
"Vote Reward": "Vote Reward",
"fee_rate_percent": "Fee Rate (%)",
"Live Tickets": "Live Tickets",
"Current Price": "Current Price",
"Available Balance": "Available Balance",
"ticket_qty_label": "How Many?",
"Ticket History": "Ticket History",
"No tickets to show": "No tickets to show",
"Treasury Spends": "Treasury Spends",
"No": "No",
"Yes": "Yes",
"Treasury Keys": "Treasury Keys",
"expired_bonds_pending_refund": "Expired Bonds Pending Refund",
}
4 changes: 4 additions & 0 deletions client/webserver/site/src/html/dexsettings.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
<span>[[[Penalties]]]</span>
<span id="penalties"></span>
</div>
<div class="d-flex justify-content-between align-items-center">
<span>[[[expired_bonds_pending_refund]]]</span>
<span id="expiredBondsPendingRefund"></span>
</div>
</div>
</div>
<div class="flex-center p-4 brdrleft">
Expand Down
3 changes: 2 additions & 1 deletion client/webserver/site/src/js/dexsettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,12 @@ export default class DexSettingsPage extends BasePage {
updateReputation () {
const page = this.page
const auth = app().exchanges[this.host].auth
const { rep: { penalties }, targetTier } = auth
const { rep: { penalties }, targetTier, expiredBondsPendingRefund } = auth
const displayTier = strongTier(auth)
page.targetTier.textContent = String(targetTier)
page.effectiveTier.textContent = String(displayTier)
page.penalties.textContent = String(penalties)
page.expiredBondsPendingRefund.textContent = `${expiredBondsPendingRefund}`
this.reputationMeter.update()
}

Expand Down
9 changes: 5 additions & 4 deletions client/webserver/site/src/js/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export interface ExchangeAuth {
maxBondedAmt: number
penaltyComps: number
pendingBonds: PendingBondState[]
expiredBondsPendingRefund: number
compensation: number
}

Expand Down Expand Up @@ -648,8 +649,8 @@ export interface OrderFilter {
}

export interface OrderPlacement {
lots : number
gapFactor : number
lots: number
gapFactor: number
}

export interface BasicMarketMakingCfg {
Expand Down Expand Up @@ -768,7 +769,7 @@ export interface Stances {
treasuryKeys: TKeyPolicyResult[]
}

export interface TicketStats{
export interface TicketStats {
totalRewards: number
ticketCount: number
votes: number
Expand Down Expand Up @@ -813,7 +814,7 @@ export interface Application {
fiatRatesMap: Record<number, number>
showPopups: boolean
commitHash: string
authed(): boolean
authed (): boolean
start (): Promise<void>
reconnected (): void
fetchUser (): Promise<User | void>
Expand Down

0 comments on commit 8aae444

Please sign in to comment.