Skip to content

Commit

Permalink
(BIDS-2529) Add block column to tables on address page (#2619)
Browse files Browse the repository at this point in the history
  • Loading branch information
D13ce authored Nov 2, 2023
1 parent 1314747 commit d3173f7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 23 deletions.
6 changes: 5 additions & 1 deletion db/bigtable_eth1.go
Original file line number Diff line number Diff line change
Expand Up @@ -2440,6 +2440,7 @@ func (bigtable *Bigtable) GetAddressBlobTableData(address []byte, search string,

tableData[i] = []interface{}{
utils.FormatTransactionHash(t.Hash),
utils.FormatBlockNumber(t.BlockNumber),
utils.FormatTimestamp(t.Time.AsTime().Unix()),
from,
utils.FormatInOutSelf(address, t.From, t.To),
Expand Down Expand Up @@ -2562,6 +2563,7 @@ func (bigtable *Bigtable) GetAddressInternalTableData(address []byte, search str

tableData[i] = []interface{}{
utils.FormatTransactionHash(t.ParentHash),
utils.FormatBlockNumber(t.BlockNumber),
utils.FormatTimestamp(t.Time.AsTime().Unix()),
from,
utils.FormatInOutSelf(address, t.From, t.To),
Expand Down Expand Up @@ -2887,6 +2889,7 @@ func (bigtable *Bigtable) GetAddressErc20TableData(address []byte, search string

tableData[i] = []interface{}{
utils.FormatTransactionHash(t.ParentHash),
utils.FormatBlockNumber(t.BlockNumber),
utils.FormatTimestamp(t.Time.AsTime().Unix()),
from,
utils.FormatInOutSelf(address, t.From, t.To),
Expand Down Expand Up @@ -2978,7 +2981,6 @@ func (bigtable *Bigtable) GetAddressErc721TableData(address string, search strin

if pageToken == "" {
pageToken = fmt.Sprintf("%s:I:ERC721:%s:%s:", bigtable.chainId, address, FILTER_TIME)
// pageToken = fmt.Sprintf("%s:I:ERC721:%s:%s:9999999999999999999:9999:99999", bigtable.chainId, address, FILTER_TIME)
}

transactions, lastKey, err := bigtable.GetEth1ERC721ForAddress(pageToken, 25)
Expand All @@ -3005,6 +3007,7 @@ func (bigtable *Bigtable) GetAddressErc721TableData(address string, search strin

tableData[i] = []interface{}{
utils.FormatTransactionHash(t.ParentHash),
utils.FormatBlockNumber(t.BlockNumber),
utils.FormatTimestamp(t.Time.AsTime().Unix()),
from,
to,
Expand Down Expand Up @@ -3118,6 +3121,7 @@ func (bigtable *Bigtable) GetAddressErc1155TableData(address string, search stri

tableData[i] = []interface{}{
utils.FormatTransactionHash(t.ParentHash),
utils.FormatBlockNumber(t.BlockNumber),
utils.FormatTimestamp(t.Time.AsTime().Unix()),
from,
to,
Expand Down
18 changes: 1 addition & 17 deletions handlers/eth1Account.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func Eth1Address(w http.ResponseWriter, r *http.Request) {
})
g.Go(func() error {
var err error
erc1155, err = db.BigtableClient.GetAddressErc1155TableData(address, "", "") // DIECE
erc1155, err = db.BigtableClient.GetAddressErc1155TableData(address, "", "")
if err != nil {
return fmt.Errorf("GetAddressErc1155TableData: %w", err)
}
Expand Down Expand Up @@ -394,9 +394,6 @@ func Eth1AddressWithdrawals(w http.ResponseWriter, r *http.Request) {
}

data := &types.DataTableResponse{
// Draw: draw,
// RecordsTotal: ,
// RecordsFiltered: ,
Data: tableData,
PagingToken: nextPageToken,
}
Expand Down Expand Up @@ -428,8 +425,6 @@ func Eth1AddressBlobTransactions(w http.ResponseWriter, r *http.Request) {
utils.LogError(err, "error getting eth1 block table data", 0)
}

// logger.Infof("GOT TX: %+v", data)

err = json.NewEncoder(w).Encode(data)
if err != nil {
logger.Errorf("error enconding json response for %v route: %v", r.URL.String(), err)
Expand Down Expand Up @@ -457,8 +452,6 @@ func Eth1AddressInternalTransactions(w http.ResponseWriter, r *http.Request) {
utils.LogError(err, "error getting eth1 block table data", 0)
}

// logger.Infof("GOT TX: %+v", data)

err = json.NewEncoder(w).Encode(data)
if err != nil {
logger.Errorf("error enconding json response for %v route: %v", r.URL.String(), err)
Expand All @@ -480,14 +473,11 @@ func Eth1AddressErc20Transactions(w http.ResponseWriter, r *http.Request) {
pageToken := q.Get("pageToken")

search := ""
// logger.Infof("GETTING TRANSACTION table data for address: %v search: %v draw: %v start: %v length: %v", address, search, draw, start, length)
data, err := db.BigtableClient.GetAddressErc20TableData(addressBytes, search, pageToken)
if err != nil {
logger.WithError(err).Errorf("error getting eth1 internal transactions table data")
}

// logger.Infof("GOT TX: %+v", data)

err = json.NewEncoder(w).Encode(data)
if err != nil {
logger.Errorf("error enconding json response for %v route: %v", r.URL.String(), err)
Expand All @@ -507,14 +497,11 @@ func Eth1AddressErc721Transactions(w http.ResponseWriter, r *http.Request) {

pageToken := q.Get("pageToken")
search := ""
// logger.Infof("GETTING TRANSACTION table data for address: %v search: %v draw: %v start: %v length: %v", address, search, draw, start, length)
data, err := db.BigtableClient.GetAddressErc721TableData(address, search, pageToken)
if err != nil {
utils.LogError(err, "error getting eth1 block table data", 0)
}

// logger.Infof("GOT TX: %+v", data)

err = json.NewEncoder(w).Encode(data)
if err != nil {
logger.Errorf("error enconding json response for %v route: %v", r.URL.String(), err)
Expand All @@ -534,14 +521,11 @@ func Eth1AddressErc1155Transactions(w http.ResponseWriter, r *http.Request) {
pageToken := q.Get("pageToken")

search := ""
// logger.Infof("GETTING TRANSACTION table data for address: %v search: %v draw: %v start: %v length: %v", address, search, draw, start, length)
data, err := db.BigtableClient.GetAddressErc1155TableData(address, search, pageToken)
if err != nil {
logger.WithError(err).Errorf("error getting eth1 internal transactions table data")
}

// logger.Infof("GOT TX: %+v", data)

err = json.NewEncoder(w).Encode(data)
if err != nil {
logger.Errorf("error enconding json response for %v route: %v", r.URL.String(), err)
Expand Down
15 changes: 10 additions & 5 deletions templates/execution/address.html
Original file line number Diff line number Diff line change
Expand Up @@ -502,8 +502,9 @@ <h5>No entries found.</h5>
{{ end }}

{{ define "AddressBlobTransactionsGrid" }}
<div id="blobTxns-table" style="display: grid; grid-template-columns: repeat(3, minmax(min-content, 1fr)) max-content repeat(3, minmax(min-content, 1fr)); overflow-x: auto;">
<div id="blobTxns-table" style="display: grid; grid-template-columns: repeat(4, minmax(min-content, 1fr)) max-content repeat(4, minmax(min-content, 1fr)); overflow-x: auto;">
<div style="z-index: 99; top: 0;" class="h5 mb-0 p-2 header-col position-sticky">Hash</div>
<div style="z-index: 99; top: 0;" class="h5 mb-0 p-2 header-col position-sticky">Block</div>
<div style="z-index: 99; top: 0;" class="h5 mb-0 p-2 header-col position-sticky">Age</div>
<div style="z-index: 99; top: 0;" class="h5 mb-0 p-2 header-col position-sticky">From</div>
<div style="z-index: 99; top: 0;" class="h5 mb-0 p-2 header-col position-sticky"></div>
Expand Down Expand Up @@ -541,8 +542,9 @@ <h5>No entries found.</h5>
{{ end }}

{{ define "AddressInternalTransactionsGrid" }}
<div id="internalTxns-table" style="display: grid; grid-template-columns: repeat(3, minmax(min-content, 1fr)) max-content repeat(3, minmax(min-content, 1fr)); overflow-x: auto;">
<div id="internalTxns-table" style="display: grid; grid-template-columns: repeat(4, minmax(min-content, 1fr)) max-content repeat(3, minmax(min-content, 1fr)); overflow-x: auto;">
<div style="z-index: 99; top: 0;" class="h5 mb-0 p-2 header-col position-sticky">Hash</div>
<div style="z-index: 99; top: 0;" class="h5 mb-0 p-2 header-col position-sticky">Block</div>
<div style="z-index: 99; top: 0;" class="h5 mb-0 p-2 header-col position-sticky">Age</div>
<div style="z-index: 99; top: 0;" class="h5 mb-0 p-2 header-col position-sticky">From</div>
<div style="z-index: 99; top: 0;" class="h5 mb-0 p-2 header-col position-sticky"></div>
Expand Down Expand Up @@ -649,8 +651,9 @@ <h5>No entries found.</h5>
{{ end }}

{{ define "AddressErc20TransactionsGrid" }}
<div id="erc20-table" style="display: grid; grid-template-columns: repeat(3, minmax(min-content, 1fr)) max-content repeat(3, minmax(min-content, 1fr)); overflow-x: auto;">
<div id="erc20-table" style="display: grid; grid-template-columns: repeat(4, minmax(min-content, 1fr)) max-content repeat(3, minmax(min-content, 1fr)); overflow-x: auto;">
<div style="z-index: 99; top: 0;" class="h5 mb-0 p-2 header-col position-sticky">Hash</div>
<div style="z-index: 99; top: 0;" class="h5 mb-0 p-2 header-col position-sticky">Block</div>
<div style="z-index: 99; top: 0;" class="h5 mb-0 p-2 header-col position-sticky">Age</div>
<div style="z-index: 99; top: 0;" class="h5 mb-0 p-2 header-col position-sticky">From</div>
<div style="z-index: 99; top: 0;" class="h5 mb-0 p-2 header-col position-sticky"></div>
Expand Down Expand Up @@ -687,8 +690,9 @@ <h5>No entries found.</h5>
{{ end }}

{{ define "AddressErc721Grid" }}
<div id="erc721-table" style="display: grid; grid-template-columns: repeat(6, minmax(min-content, 1fr)); overflow-x: auto;">
<div id="erc721-table" style="display: grid; grid-template-columns: repeat(7, minmax(min-content, 1fr)); overflow-x: auto;">
<div style="z-index: 99; top: 0;" class="h5 mb-0 p-2 header-col position-sticky">Hash</div>
<div style="z-index: 99; top: 0;" class="h5 mb-0 p-2 header-col position-sticky">Block</div>
<div style="z-index: 99; top: 0;" class="h5 mb-0 p-2 header-col position-sticky">Age</div>
<div style="z-index: 99; top: 0;" class="h5 mb-0 p-2 header-col position-sticky">From</div>
<div style="z-index: 99; top: 0;" class="h5 mb-0 p-2 header-col position-sticky">To</div>
Expand Down Expand Up @@ -724,8 +728,9 @@ <h5>No entries found.</h5>
{{ end }}

{{ define "AddressErc1155Grid" }}
<div id="erc1155-table" style="display: grid; grid-template-columns: repeat(7, minmax(min-content, 1fr)); overflow-x: auto;">
<div id="erc1155-table" style="display: grid; grid-template-columns: repeat(8, minmax(min-content, 1fr)); overflow-x: auto;">
<div style="z-index: 99; top: 0;" class="h5 mb-0 p-2 header-col position-sticky">Hash</div>
<div style="z-index: 99; top: 0;" class="h5 mb-0 p-2 header-col position-sticky">Block</div>
<div style="z-index: 99; top: 0;" class="h5 mb-0 p-2 header-col position-sticky">Age</div>
<div style="z-index: 99; top: 0;" class="h5 mb-0 p-2 header-col position-sticky">From</div>
<div style="z-index: 99; top: 0;" class="h5 mb-0 p-2 header-col position-sticky">To</div>
Expand Down

0 comments on commit d3173f7

Please sign in to comment.