Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bids 2613/add tooltips to withdrawals for full amount #2738

Merged
merged 5 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion handlers/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ func GetValidatorEarnings(validators []uint64, currency string) (*types.Validato
earnings.LastWeekFormatted = utils.FormatIncomeClEl(earnings.Income7d, currency)
earnings.LastMonthFormatted = utils.FormatIncomeClEl(earnings.Income31d, currency)
earnings.TotalFormatted = utils.FormatIncomeClEl(earnings.IncomeTotal, currency)
earnings.TotalBalance = "<b>" + utils.FormatClCurrency(totalBalance, currency, 5, true, false, false) + "</b>"
earnings.TotalBalance = "<b>" + utils.FormatClCurrency(totalBalance, currency, 5, true, false, false, false) + "</b>"
return earnings, balancesMap, nil
}

Expand Down
5 changes: 2 additions & 3 deletions handlers/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ func getNextWithdrawalRow(queryValidators []uint64, currency string) ([][]interf
template.HTML(fmt.Sprintf(`<span class="text-muted">~ %s</span>`, utils.FormatBlockSlot(utils.TimeToSlot(uint64(timeToWithdrawal.Unix()))))),
template.HTML(fmt.Sprintf(`<span class="">~ %s</span>`, utils.FormatTimestamp(timeToWithdrawal.Unix()))),
withdrawalCredentialsTemplate,
template.HTML(fmt.Sprintf(`<span class="text-muted"><span data-toggle="tooltip" title="If the withdrawal were to be processed at this very moment, this amount would be withdrawn"><i class="far ml-1 fa-question-circle" style="margin-left: 0px !important;"></i></span> %s</span>`, utils.FormatClCurrency(withdrawalAmount, currency, 6, true, false, false))),
template.HTML(fmt.Sprintf(`<span class="text-muted"><span data-toggle="tooltip" title="If the withdrawal were to be processed at this very moment, this amount would be withdrawn"><i class="far ml-1 fa-question-circle" style="margin-left: 0px !important;"></i></span> %s</span>`, utils.FormatClCurrency(withdrawalAmount, currency, 6, true, false, false, true))),
})

return nextData, nil
Expand Down Expand Up @@ -681,8 +681,7 @@ func DashboardDataWithdrawals(w http.ResponseWriter, r *http.Request) {
template.HTML(fmt.Sprintf("%v", utils.FormatBlockSlot(w.Slot))),
template.HTML(fmt.Sprintf("%v", utils.FormatTimestamp(utils.SlotToTime(w.Slot).Unix()))),
template.HTML(fmt.Sprintf("%v", utils.FormatAddress(w.Address, nil, "", false, false, true))),
template.HTML(utils.FormatClCurrency(w.Amount, reqCurrency, 6, true, false, false)),
// template.HTML(fmt.Sprintf("%v", utils.FormatAmount(new(big.Int).Mul(new(big.Int).SetUint64(w.Amount), big.NewInt(1e9)), utils.Config.Frontend.ElCurrency, 6))),
template.HTML(utils.FormatClCurrency(w.Amount, reqCurrency, 6, true, false, false, true)),
})
}

Expand Down
6 changes: 3 additions & 3 deletions handlers/eth1Account.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func Eth1Address(w http.ResponseWriter, r *http.Request) {
template.HTML(fmt.Sprintf("%v", utils.FormatBlockSlot(w.Slot))),
template.HTML(fmt.Sprintf("%v", utils.FormatTimestamp(utils.SlotToTime(w.Slot).Unix()))),
template.HTML(fmt.Sprintf("%v", utils.FormatValidator(w.ValidatorIndex))),
template.HTML(utils.FormatClCurrency(w.Amount, currency, 6, true, false, false)),
template.HTML(utils.FormatClCurrency(w.Amount, currency, 6, true, false, false, true)),
})
}

Expand All @@ -177,7 +177,7 @@ func Eth1Address(w http.ResponseWriter, r *http.Request) {
if err != nil {
return fmt.Errorf("GetAddressWithdrawalsTotal: %w", err)
}
withdrawalSummary = template.HTML(utils.FormatClCurrency(sumWithdrawals, currency, 6, true, false, false))
withdrawalSummary = template.HTML(utils.FormatClCurrency(sumWithdrawals, currency, 6, true, false, false, true))
return nil
})

Expand Down Expand Up @@ -396,7 +396,7 @@ func Eth1AddressWithdrawals(w http.ResponseWriter, r *http.Request) {
template.HTML(fmt.Sprintf("%v", utils.FormatBlockSlot(w.Slot))),
template.HTML(fmt.Sprintf("%v", utils.FormatTimestamp(utils.SlotToTime(w.Slot).Unix()))),
template.HTML(fmt.Sprintf("%v", utils.FormatValidator(w.ValidatorIndex))),
template.HTML(utils.FormatClCurrency(w.Amount, currency, 6, true, false, false)),
template.HTML(utils.FormatClCurrency(w.Amount, currency, 6, true, false, false, true)),
}
}

Expand Down
6 changes: 2 additions & 4 deletions handlers/slot.go
Original file line number Diff line number Diff line change
Expand Up @@ -781,20 +781,18 @@ func SlotWithdrawalData(w http.ResponseWriter, r *http.Request) {

tableData := make([][]interface{}, 0, len(withdrawals))
for _, w := range withdrawals {
// logger.Infof("w: %+v", w)
tableData = append(tableData, []interface{}{
template.HTML(fmt.Sprintf("%v", w.Index)),
template.HTML(fmt.Sprintf("%v", utils.FormatValidator(w.ValidatorIndex))),
template.HTML(fmt.Sprintf("%v", utils.FormatAddress(w.Address, nil, "", false, false, true))),
template.HTML(utils.FormatClCurrency(w.Amount, currency, 6, true, false, false)),
template.HTML(utils.FormatClCurrency(w.Amount, currency, 6, true, false, false, true)),
})
}

data := &types.DataTableResponse{
Draw: 1,
RecordsTotal: uint64(len(withdrawals)),
// RecordsFiltered: uint64(len(withdrawals)),
Data: tableData,
Data: tableData,
}

err = json.NewEncoder(w).Encode(data)
Expand Down
4 changes: 2 additions & 2 deletions handlers/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ func Validator(w http.ResponseWriter, r *http.Request) {
template.HTML(fmt.Sprintf(`<span class="text-muted">~ %s</span>`, utils.FormatBlockSlot(utils.TimeToSlot(uint64(timeToWithdrawal.Unix()))))),
template.HTML(fmt.Sprintf(`<span class="">~ %s</span>`, utils.FormatTimestamp(timeToWithdrawal.Unix()))),
withdrawalCredentialsTemplate,
template.HTML(fmt.Sprintf(`<span class="text-muted"><span data-toggle="tooltip" title="If the withdrawal were to be processed at this very moment, this amount would be withdrawn"><i class="far ml-1 fa-question-circle" style="margin-left: 0px !important;"></i></span> %s</span>`, utils.FormatClCurrency(withdrawalAmount, currency, 6, true, false, false))),
template.HTML(fmt.Sprintf(`<span class="text-muted"><span data-toggle="tooltip" title="If the withdrawal were to be processed at this very moment, this amount would be withdrawn"><i class="far ml-1 fa-question-circle" style="margin-left: 0px !important;"></i></span> %s</span>`, utils.FormatClCurrency(withdrawalAmount, currency, 6, true, false, false, true))),
})

validatorPageData.NextWithdrawalRow = tableData
Expand Down Expand Up @@ -1292,7 +1292,7 @@ func ValidatorWithdrawals(w http.ResponseWriter, r *http.Request) {
template.HTML(fmt.Sprintf("%v", utils.FormatBlockSlot(w.Slot))),
template.HTML(fmt.Sprintf("%v", utils.FormatTimestamp(utils.SlotToTime(w.Slot).Unix()))),
template.HTML(fmt.Sprintf("%v", utils.FormatAddress(w.Address, nil, "", false, false, true))),
template.HTML(utils.FormatClCurrency(w.Amount, reqCurrency, 6, true, false, false)),
template.HTML(utils.FormatClCurrency(w.Amount, reqCurrency, 6, true, false, false, true)),
})
}

Expand Down
8 changes: 4 additions & 4 deletions handlers/validators_leaderboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,10 @@ func ValidatorsLeaderboardData(w http.ResponseWriter, r *http.Request) {
utils.FormatValidatorWithName(b.Index, b.Name),
utils.FormatPublicKey(b.PublicKey),
fmt.Sprintf("%v", b.Balance),
utils.FormatClCurrency(b.Performance1d, currency, 5, true, true, true),
utils.FormatClCurrency(b.Performance7d, currency, 5, true, true, true),
utils.FormatClCurrency(b.Performance31d, currency, 5, true, true, true),
utils.FormatClCurrency(b.Performance365d, currency, 5, true, true, true),
utils.FormatClCurrency(b.Performance1d, currency, 5, true, true, true, false),
utils.FormatClCurrency(b.Performance7d, currency, 5, true, true, true, false),
utils.FormatClCurrency(b.Performance31d, currency, 5, true, true, true, false),
utils.FormatClCurrency(b.Performance365d, currency, 5, true, true, true, false),
}
}

Expand Down
4 changes: 2 additions & 2 deletions services/notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -1956,7 +1956,7 @@ func (n *validatorWithdrawalNotification) GetEventName() types.EventName {
}

func (n *validatorWithdrawalNotification) GetInfo(includeUrl bool) string {
generalPart := fmt.Sprintf(`An automatic withdrawal of %v has been processed for validator %v.`, utils.FormatClCurrencyString(n.Amount, utils.Config.Frontend.MainCurrency, 6, true, false), n.ValidatorIndex)
generalPart := fmt.Sprintf(`An automatic withdrawal of %v has been processed for validator %v.`, utils.FormatClCurrencyString(n.Amount, utils.Config.Frontend.MainCurrency, 6, true, false, false), n.ValidatorIndex)
if includeUrl {
return generalPart + getUrlPart(n.ValidatorIndex)
}
Expand All @@ -1972,7 +1972,7 @@ func (n *validatorWithdrawalNotification) GetEventFilter() string {
}

func (n *validatorWithdrawalNotification) GetInfoMarkdown() string {
generalPart := fmt.Sprintf(`An automatic withdrawal of %[2]v has been processed for validator [%[1]v](https://%[6]v/validator/%[1]v) during slot [%[3]v](https://%[6]v/slot/%[3]v). The funds have been sent to: [%[4]v](https://%[6]v/address/0x%[5]x).`, n.ValidatorIndex, utils.FormatClCurrencyString(n.Amount, utils.Config.Frontend.MainCurrency, 6, true, false), n.Slot, utils.FormatHashRaw(n.Address), n.Address, utils.Config.Frontend.SiteDomain)
generalPart := fmt.Sprintf(`An automatic withdrawal of %[2]v has been processed for validator [%[1]v](https://%[6]v/validator/%[1]v) during slot [%[3]v](https://%[6]v/slot/%[3]v). The funds have been sent to: [%[4]v](https://%[6]v/address/0x%[5]x).`, n.ValidatorIndex, utils.FormatClCurrencyString(n.Amount, utils.Config.Frontend.MainCurrency, 6, true, false, false), n.Slot, utils.FormatHashRaw(n.Address), n.Address, utils.Config.Frontend.SiteDomain)
return generalPart
}

Expand Down
4 changes: 2 additions & 2 deletions templates/eth1tx.html
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ <h1 class="h4 mb-1 mb-md-0">
<div class="col-md-9">
{{ formatBytesAmount .Value config.Frontend.ElCurrency 8 }}
<span id="valuePriceButton" class="badge badge-pill align-middle bg-dark text-white" data-html="true" data-toggle="tooltip" data-placement="bottom" data-original-title="Current Value" {{ if .HistoricalEtherPrice }}onclick="togglePriceContent('{{ .CurrentEtherPrice }}','{{ .HistoricalEtherPrice }}')" style="cursor: pointer;"{{ end }}>
{{ formatElCurrency .Value $.Rates.SelectedCurrency 2 true false false }}
{{ formatElCurrency .Value $.Rates.SelectedCurrency 2 true false false false }}
</span>
</div>
</div>
Expand All @@ -235,7 +235,7 @@ <h1 class="h4 mb-1 mb-md-0">
<div class="col-md-9">
{{ formatBytesAmount .Gas.TxFee config.Frontend.ElCurrency 8 }}
<span id="valuePriceButton" class="badge badge-pill align-middle bg-dark text-white" data-html="true" data-toggle="tooltip" data-placement="bottom" data-original-title="Current Value">
{{ formatElCurrency .Gas.TxFee $.Rates.SelectedCurrency 2 true false false }}
{{ formatElCurrency .Gas.TxFee $.Rates.SelectedCurrency 2 true false false false }}
</span>
</div>
</div>
Expand Down
8 changes: 4 additions & 4 deletions templates/validator/overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@
<div class="px-2 mx-auto" style="max-width: 50rem;">
<span>
{{ if eq .InclusionDelay 0 }}
A deposit has been made, and your validator will be voted into the activation queue once the deposited amount sums up to {{ formatClCurrency config.Chain.ClConfig.MaxEffectiveBalance $.Rates.ClCurrency 0 true false false }}.
A deposit has been made, and your validator will be voted into the activation queue once the deposited amount sums up to {{ formatClCurrency config.Chain.ClConfig.MaxEffectiveBalance $.Rates.ClCurrency 0 true false false false }}.
{{ else }}
The last deposit to the Deposit contract was made {{ if gt .Deposits.LastEth1DepositTs 0 }}<span aria-ethereum-date-format="FROMNOW" aria-ethereum-date="{{ .Deposits.LastEth1DepositTs }}"></span>{{ end }}, it will take <a href="https://kb.beaconcha.in/ethereum-2.0-and-depositing-process">around 16-24 hours</a> until your deposit is processed by the beacon chain. This validator will be eligible for activation once the deposited amount sums up to {{ formatClCurrency config.Chain.ClConfig.MaxEffectiveBalance $.Rates.ClCurrency 0 true false false }}.
The last deposit to the Deposit contract was made {{ if gt .Deposits.LastEth1DepositTs 0 }}<span aria-ethereum-date-format="FROMNOW" aria-ethereum-date="{{ .Deposits.LastEth1DepositTs }}"></span>{{ end }}, it will take <a href="https://kb.beaconcha.in/ethereum-2.0-and-depositing-process">around 16-24 hours</a> until your deposit is processed by the beacon chain. This validator will be eligible for activation once the deposited amount sums up to {{ formatClCurrency config.Chain.ClConfig.MaxEffectiveBalance $.Rates.ClCurrency 0 true false false false }}.
{{ end }}
<br />
Join our <a href="https://dsc.gg/beaconchain">Discord server</a> for support, questions and suggestions.
Expand Down Expand Up @@ -153,7 +153,7 @@
<div class="m-3 position-relative" style="flex-basis: 4rem; white-space: nowrap;">
<span style="top:-1.2rem; white-space: nowrap;" class="text-muted font-weight-lighter position-absolute"><small>Balance</small></span>
<div class="d-flex flex-column">
<span style="font-weight: bold; font-size:18px;">{{ formatClCurrency .CurrentBalance $.Rates.SelectedCurrency 5 true false false }}</span>
<span style="font-weight: bold; font-size:18px;">{{ formatClCurrency .CurrentBalance $.Rates.SelectedCurrency 5 true false false false }}</span>
<span style="font-size: 0.8rem; color: gray"
>{{ formatEffectiveBalance .EffectiveBalance config.Frontend.MainCurrency }}
<span data-toggle="tooltip" title="The effective balance is used to calculate the base rewards of a validator"
Expand Down Expand Up @@ -183,7 +183,7 @@
<div class="m-3 position-relative">
<span style="top:-1.2rem;" class="text-muted font-weight-lighter position-absolute"><small>Balance</small></span>
<div style="width: 8.32rem" class="d-flex flex-column">
<span style="font-weight: bold; font-size:18px;">{{ formatClCurrency .CurrentBalance $.Rates.SelectedCurrency 5 true false false }}</span>
<span style="font-weight: bold; font-size:18px;">{{ formatClCurrency .CurrentBalance $.Rates.SelectedCurrency 5 true false false false }}</span>
<span
>{{ formatEffectiveBalance .EffectiveBalance config.Frontend.MainCurrency }}
<span style="font-size:0.8rem; color:gray" data-toggle="tooltip" title="The effective balance is used to calculate the base rewards of a validator"
Expand Down
Loading