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

(NOBIDS) Fix mainCurrencyPrices undefined error #2751

Merged
merged 4 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions services/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -1134,6 +1134,7 @@ func LatestSlotVizMetrics() []*types.SlotVizEpochs {
// LatestState returns statistics about the current eth2 state
func LatestState() *types.LatestState {
data := &types.LatestState{}
data.ChainID = utils.Config.Chain.Id
data.CurrentEpoch = LatestEpoch()
data.CurrentSlot = LatestSlot()
data.CurrentFinalizedEpoch = LatestFinalizedEpoch()
Expand Down
20 changes: 11 additions & 9 deletions static/js/banner.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,17 @@ function updateBanner() {
slotHandle.setAttribute("href", "/slot/" + data.currentSlot)
}

var ethPriceHandle = document.getElementById("banner-eth-price-data")

try {
let userCurrency = getCookie("currency")
if (userCurrency == data.rates.mainCurrency) userCurrency = data.rates.tickerCurrency
var price = data.rates.mainCurrencyPrices[userCurrency]
ethPriceHandle.innerHTML = `<span class='currency-symbol'>${price.symbol} </span><span class='k-formatted-price'>${price.truncPrice}</span><span class='price'>${addCommas(price.roundPrice)}</span>`
} catch (err) {
console.error("failed updating banner-price:", err)
if (data && data.chainID === 1) {
D13ce marked this conversation as resolved.
Show resolved Hide resolved
var ethPriceHandle = document.getElementById("banner-eth-price-data")
try {
let userCurrency = getCookie("currency")
if (!userCurrency) userCurrency = data.rates.tickerCurrency
else if (userCurrency == data.rates.mainCurrency) userCurrency = data.rates.tickerCurrency
recy21 marked this conversation as resolved.
Show resolved Hide resolved
var price = data.rates.mainCurrencyTickerPrices[userCurrency]
ethPriceHandle.innerHTML = `<span class='currency-symbol'>${price.symbol} </span><span class='k-formatted-price'>${price.truncPrice}</span><span class='price'>${addCommas(price.roundPrice)}</span>`
} catch (err) {
console.error("failed updating banner-price:", err)
}
}

var finDelayDataHandle = document.getElementById("banner-fin-data")
Expand Down
1 change: 1 addition & 0 deletions types/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ type Meta struct {

// LatestState is a struct to hold data for the banner
type LatestState struct {
ChainID uint64 `json:"chainID"`
LastProposedSlot uint64 `json:"lastProposedSlot"`
CurrentSlot uint64 `json:"currentSlot"`
CurrentEpoch uint64 `json:"currentEpoch"`
Expand Down
Loading