From 8bd274441963a42f5329776f4c4434c3a94be089 Mon Sep 17 00:00:00 2001 From: RamiRond Date: Mon, 2 Oct 2023 12:53:45 +0200 Subject: [PATCH] (BIDS-2504) use existing formatting function --- templates/validator/tables.html | 8 +------- utils/eth1.go | 4 ++-- utils/format.go | 6 ------ utils/utils.go | 1 - 4 files changed, 3 insertions(+), 16 deletions(-) diff --git a/templates/validator/tables.html b/templates/validator/tables.html index 83987582a8..f5e771487a 100644 --- a/templates/validator/tables.html +++ b/templates/validator/tables.html @@ -416,13 +416,7 @@
This table displays the deposits made to the Ethereum staking depos {{ range $i, $deposit := .Deposits.Eth1Deposits }} - - {{ if $deposit.FromName }} - {{ formatEth1Name $deposit.FromName }} - {{ else }} - {{ formatEth1Address $deposit.FromAddress }} - {{ end }} - + {{ formatAddressAsLink $deposit.FromAddress $deposit.FromName false false }} {{ formatEth1TxHash $deposit.TxHash }} {{ formatEth1Block $deposit.BlockNumber }} {{ formatTimestamp $deposit.BlockTs }} diff --git a/utils/eth1.go b/utils/eth1.go index fffe2cde24..84da618bb4 100644 --- a/utils/eth1.go +++ b/utils/eth1.go @@ -200,9 +200,9 @@ func FormatAddressAsLink(address []byte, name string, verified bool, isContract if len(name) > 0 { if verified { - ret = fmt.Sprintf("✔ %s (%s…%s) %v", addressString, name, addressString[:8], addressString[len(addressString)-6:], CopyButton(addressString)) + ret = fmt.Sprintf("✔ %s %v", addressString, name, CopyButton(addressString)) } else { - ret = fmt.Sprintf("%s %s…%s %v", addressString, name, addressString[:8], addressString[len(addressString)-6:], CopyButton(addressString)) + ret = fmt.Sprintf("%s %v", addressString, name, CopyButton(addressString)) } } else { ret = fmt.Sprintf("%s…%s %v", addressString, addressString[:8], addressString[len(addressString)-6:], CopyButton(addressString)) diff --git a/utils/format.go b/utils/format.go index 00de3df45e..1f40faaafc 100644 --- a/utils/format.go +++ b/utils/format.go @@ -339,12 +339,6 @@ func FormatEth1Address(addr []byte) template.HTML { return template.HTML(fmt.Sprintf("%s…%s", eth1Addr, eth1Addr[:8], copyBtn)) } -// FormatEth1Name will return the eth1-name formated as html -func FormatEth1Name(addr string) template.HTML { - copyBtn := CopyButton(addr) - return template.HTML(fmt.Sprintf("%s%s", addr, addr, copyBtn)) -} - // FormatEth1Block will return the eth1-block formated as html func FormatEth1Block(block uint64) template.HTML { return template.HTML(fmt.Sprintf("%[1]d", block)) diff --git a/utils/utils.go b/utils/utils.go index b6bb6d4b00..95d9892423 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -98,7 +98,6 @@ func GetTemplateFuncs() template.FuncMap { "formatEth1Block": FormatEth1Block, "formatEth1BlockHash": FormatEth1BlockHash, "formatEth1Address": FormatEth1Address, - "formatEth1Name": FormatEth1Name, "formatEth1AddressStringLowerCase": FormatEth1AddressStringLowerCase, "formatEth1TxHash": FormatEth1TxHash, "formatGraffiti": FormatGraffiti,