Skip to content

Commit 2bf7611

Browse files
authoredNov 24, 2023
(BIDS-2547) added ❗to failed transactions (#2671)
1 parent 0a85e82 commit 2bf7611

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed
 

‎db/bigtable_eth1.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -2026,7 +2026,7 @@ func (bigtable *Bigtable) GetAddressTransactionsTableData(address []byte, pageTo
20262026
method := bigtable.GetMethodLabel(t.MethodId, t.InvokesContract)
20272027

20282028
tableData[i] = []interface{}{
2029-
utils.FormatTransactionHash(t.Hash),
2029+
utils.FormatTransactionHash(t.Hash, t.ErrorMsg == ""),
20302030
utils.FormatMethod(method),
20312031
utils.FormatBlockNumber(t.BlockNumber),
20322032
utils.FormatTimestamp(t.Time.AsTime().Unix()),
@@ -2329,7 +2329,7 @@ func (bigtable *Bigtable) GetAddressBlobTableData(address []byte, pageToken stri
23292329
toName := names[string(t.To)]
23302330

23312331
tableData[i] = []interface{}{
2332-
utils.FormatTransactionHash(t.Hash),
2332+
utils.FormatTransactionHash(t.Hash, t.ErrorMsg == ""),
23332333
utils.FormatBlockNumber(t.BlockNumber),
23342334
utils.FormatTimestamp(t.Time.AsTime().Unix()),
23352335
utils.FormatAddressWithLimitsInAddressPageTable(address, t.From, fromName, false, digitLimitInAddressPagesTable, nameLimitInAddressPagesTable, true),
@@ -2448,7 +2448,7 @@ func (bigtable *Bigtable) GetAddressInternalTableData(address []byte, pageToken
24482448
toName := names[string(t.To)]
24492449

24502450
tableData[i] = []interface{}{
2451-
utils.FormatTransactionHash(t.ParentHash),
2451+
utils.FormatTransactionHash(t.ParentHash, true),
24522452
utils.FormatBlockNumber(t.BlockNumber),
24532453
utils.FormatTimestamp(t.Time.AsTime().Unix()),
24542454
utils.FormatAddressWithLimitsInAddressPageTable(address, t.From, fromName, false, digitLimitInAddressPagesTable, nameLimitInAddressPagesTable, true),
@@ -2771,7 +2771,7 @@ func (bigtable *Bigtable) GetAddressErc20TableData(address []byte, pageToken str
27712771
}
27722772

27732773
tableData[i] = []interface{}{
2774-
utils.FormatTransactionHash(t.ParentHash),
2774+
utils.FormatTransactionHash(t.ParentHash, true),
27752775
utils.FormatBlockNumber(t.BlockNumber),
27762776
utils.FormatTimestamp(t.Time.AsTime().Unix()),
27772777
utils.FormatAddressWithLimitsInAddressPageTable(address, t.From, fromName, false, digitLimitInAddressPagesTable, nameLimitInAddressPagesTable, true),
@@ -2886,7 +2886,7 @@ func (bigtable *Bigtable) GetAddressErc721TableData(address []byte, pageToken st
28862886
toName := names[string(t.To)]
28872887

28882888
tableData[i] = []interface{}{
2889-
utils.FormatTransactionHash(t.ParentHash),
2889+
utils.FormatTransactionHash(t.ParentHash, true),
28902890
utils.FormatBlockNumber(t.BlockNumber),
28912891
utils.FormatTimestamp(t.Time.AsTime().Unix()),
28922892
utils.FormatAddressWithLimitsInAddressPageTable(address, t.From, fromName, false, digitLimitInAddressPagesTable, nameLimitInAddressPagesTable, true),
@@ -2997,7 +2997,7 @@ func (bigtable *Bigtable) GetAddressErc1155TableData(address []byte, pageToken s
29972997
toName := names[string(t.To)]
29982998

29992999
tableData[i] = []interface{}{
3000-
utils.FormatTransactionHash(t.ParentHash),
3000+
utils.FormatTransactionHash(t.ParentHash, true),
30013001
utils.FormatBlockNumber(t.BlockNumber),
30023002
utils.FormatTimestamp(t.Time.AsTime().Unix()),
30033003
utils.FormatAddressWithLimitsInAddressPageTable(address, t.From, fromName, false, digitLimitInAddressPagesTable, nameLimitInAddressPagesTable, true),
@@ -3839,7 +3839,7 @@ func (bigtable *Bigtable) GetTokenTransactionsTableData(token []byte, address []
38393839
}
38403840

38413841
tableData[i] = []interface{}{
3842-
utils.FormatTransactionHash(t.ParentHash),
3842+
utils.FormatTransactionHash(t.ParentHash, true),
38433843
utils.FormatTimestamp(t.Time.AsTime().Unix()),
38443844
from,
38453845
utils.FormatInOutSelf(address, t.From, t.To),

‎handlers/eth1Block.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ func GetExecutionBlockPageData(number uint64, limit int) (*types.Eth1BlockPageDa
189189

190190
txs = append(txs, types.Eth1BlockPageTransaction{
191191
Hash: fmt.Sprintf("%#x", tx.Hash),
192-
HashFormatted: utils.FormatAddressWithLimits(tx.Hash, "", false, "tx", 15, 18, true),
192+
HashFormatted: utils.FormatTransactionHash(tx.Hash, tx.ErrorMsg == ""),
193193
From: fmt.Sprintf("%#x", tx.From),
194194
FromFormatted: utils.FormatAddressWithLimits(tx.From, names[string(tx.From)], false, "address", 15, 20, true),
195195
To: fmt.Sprintf("%#x", tx.To),

‎utils/eth1.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,15 @@ func FormatBlockHash(hash []byte) template.HTML {
8686
return template.HTML(fmt.Sprintf(`<a class="text-monospace" href="/block/0x%x">0x%x…%x</a> %v`, hash, hash[:2], hash[len(hash)-2:], CopyButton(hex.EncodeToString(hash))))
8787
}
8888

89-
func FormatTransactionHash(hash []byte) template.HTML {
89+
func FormatTransactionHash(hash []byte, successful bool) template.HTML {
9090
if len(hash) < 20 {
9191
return template.HTML("N/A")
9292
}
93-
return template.HTML(fmt.Sprintf(`<a class="text-monospace" href="/tx/0x%x">0x%x…%x</a>`, hash, hash[:3], hash[len(hash)-3:]))
93+
failedStr := ""
94+
if !successful {
95+
failedStr = `<span data-toggle="tooltip" title="Transaction failed">❗</span>`
96+
}
97+
return template.HTML(fmt.Sprintf(`<a class="text-monospace" href="/tx/0x%x">0x%x…%x</a>%s`, hash, hash[:3], hash[len(hash)-3:], failedStr))
9498
}
9599

96100
func FormatInOutSelf(address, from, to []byte) template.HTML {

0 commit comments

Comments
 (0)
Please sign in to comment.