fix: gofmt -s across repo (CI format check)

This commit is contained in:
2026-06-02 11:40:11 -07:00
parent f9f573e4e4
commit bda50ca355
5 changed files with 40 additions and 33 deletions
+6 -6
View File
@@ -514,12 +514,12 @@ func (a *Adapter) GetTransactionReceipt(ctx context.Context, txHash string) (*Tr
// summary. Combine both responses into the single Transaction shape.
if byHash, err := a.call(ctx, "eth_getTransactionByHash", []interface{}{txHash}); err == nil {
var t2 struct {
Input string `json:"input"`
Value string `json:"value"`
GasPrice string `json:"gasPrice"`
Gas string `json:"gas"`
Nonce string `json:"nonce"`
Type string `json:"type"`
Input string `json:"input"`
Value string `json:"value"`
GasPrice string `json:"gasPrice"`
Gas string `json:"gas"`
Nonce string `json:"nonce"`
Type string `json:"type"`
MaxFeePerGas string `json:"maxFeePerGas"`
MaxPriorityFeePerGas string `json:"maxPriorityFeePerGas"`
}
+3 -3
View File
@@ -78,9 +78,9 @@ func DefaultBridgeChainSeed() []Chain {
// staticBridgeChainRegistry is an immutable ChainRegistry implementation.
type staticBridgeChainRegistry struct {
chains []Chain
byID map[ChainID]Chain
byEVMID map[uint64]Chain
chains []Chain
byID map[ChainID]Chain
byEVMID map[uint64]Chain
}
// NewStaticBridgeChainRegistry returns a ChainRegistry over an immutable list.
+9 -6
View File
@@ -566,8 +566,8 @@ func (idx *Indexer) backfillAddresses(ctx context.Context) (int, error) {
}
// upsertAddrSQL returns an INSERT … ON CONFLICT … DO UPDATE that:
// • on first sight: writes hash, is_contract, tx_count delta, timestamps.
// • on subsequent sight: increments tx_count by the delta and OR-merges
// - on first sight: writes hash, is_contract, tx_count delta, timestamps.
// - on subsequent sight: increments tx_count by the delta and OR-merges
// is_contract (once true, stays true).
//
// The legacy form was INSERT OR IGNORE / ON CONFLICT DO NOTHING, which
@@ -1016,7 +1016,8 @@ func (s *Subscriber) BroadcastBlock(block *EVMBlock) {
// upsertLogSQL returns the correct upsert SQL for evm_logs.
// Param order: (id, tx_hash, log_index, block_number, address,
// topic0, topic1, topic2, topic3, data, timestamp, created_at)
//
// topic0, topic1, topic2, topic3, data, timestamp, created_at)
func (idx *Indexer) upsertLogSQL() string {
switch idx.store.Backend() {
case storage.BackendPostgres:
@@ -1033,7 +1034,8 @@ func (idx *Indexer) upsertLogSQL() string {
// upsertTokenTransferSQL returns the correct upsert SQL for evm_token_transfers.
// Param order: (id, tx_hash, log_index, block_number, token_address, token_type,
// from_addr, to_addr, value, token_id, timestamp, created_at)
//
// from_addr, to_addr, value, token_id, timestamp, created_at)
func (idx *Indexer) upsertTokenTransferSQL() string {
switch idx.store.Backend() {
case storage.BackendPostgres:
@@ -1050,8 +1052,9 @@ func (idx *Indexer) upsertTokenTransferSQL() string {
// upsertTokenSQL returns the correct upsert SQL for evm_tokens.
// Param order: (address, name, symbol, decimals, total_supply, token_type,
// created_at, updated_at). tx_count + holder_count are
// maintained separately and default to 0 on first insert.
//
// created_at, updated_at). tx_count + holder_count are
// maintained separately and default to 0 on first insert.
func (idx *Indexer) upsertTokenSQL() string {
switch idx.store.Backend() {
case storage.BackendPostgres:
+14 -12
View File
@@ -244,6 +244,7 @@ func formatInternalTx(t map[string]any) map[string]any {
// Column-spelling variants:
// - luxfi/indexer evm_logs: topic0/topic1/topic2/topic3, log_index, tx_hash
// - Blockscout-legacy logs: first_topic/.../fourth_topic, index, transaction_hash
//
// Fall through both sets so the response shape works against either.
func formatLog(l map[string]any) map[string]any {
topics := []string{}
@@ -351,10 +352,11 @@ func formatContract(c map[string]any) map[string]any {
// `transactions_count.toLocaleString()` without a guard and crashes on null.
//
// is_contract resolution order, most authoritative first:
// 1. boolean column `is_contract` (the indexer's address upsert
// populates this via the per-block eth_getCode resolve loop in
// luxfi/indexer#10).
// 2. non-empty contract_code / code column (legacy Postgres shape).
// 1. boolean column `is_contract` (the indexer's address upsert
// populates this via the per-block eth_getCode resolve loop in
// luxfi/indexer#10).
// 2. non-empty contract_code / code column (legacy Postgres shape).
//
// EOAs end up as false in both — no false positives.
func formatAddress(a map[string]any) map[string]any {
txCount := firstNonNil(a, "transactions_count", "tx_count")
@@ -378,8 +380,8 @@ func formatAddress(a map[string]any) map[string]any {
}
balance := fmtNum(firstNonNil(a, "fetched_coin_balance", "balance"))
return map[string]any{
"hash": bytesToHex(a["hash"]),
"coin_balance": balance,
"hash": bytesToHex(a["hash"]),
"coin_balance": balance,
// SPA reads `balance` directly in `Number(i.balance)/1e18`; alias to
// `coin_balance` so the Blockscout-derived `coin_balance` and the
// downstream-tenant SPA's `balance` both work without a SPA rebuild.
@@ -388,12 +390,12 @@ func formatAddress(a map[string]any) map[string]any {
"transactions_count": txCount,
// SPA reads `tx_count` directly (the field on block rows). Alias so the
// SPA's `i.tx_count.toLocaleString()` on the address-detail page works.
"tx_count": txCount,
"token_transfers_count": ttCount,
"is_contract": isContract,
"is_verified": firstNonNil(a, "verified"),
"has_token_balances": false,
"exchange_rate": nil,
"tx_count": txCount,
"token_transfers_count": ttCount,
"is_contract": isContract,
"is_verified": firstNonNil(a, "verified"),
"has_token_balances": false,
"exchange_rate": nil,
}
}
+8 -6
View File
@@ -761,7 +761,7 @@ func (s *StandaloneServer) getContract(r *http.Request) (any, int) {
// case (no contract panel is rendered) but keeps the network log
// clean.
return map[string]any{
"is_verified": false,
"is_verified": false,
"is_self_destructed": false,
}, 200
}
@@ -1019,7 +1019,9 @@ func (s *StandaloneServer) stats(r *http.Request) (any, int) {
slowGas = fees[0]
fastGas = fees[len(fees)-1]
var sum float64
for _, f := range fees { sum += f }
for _, f := range fees {
sum += f
}
avgGas = sum / float64(len(fees))
}
}
@@ -1098,10 +1100,10 @@ func (s *StandaloneServer) mainPageTxs(r *http.Request) (any, int) {
func (s *StandaloneServer) indexingStatus(r *http.Request) (any, int) {
return map[string]any{
"finished_indexing": true,
"finished_indexing_blocks": true,
"indexed_blocks_ratio": "1.00",
"indexed_internal_transactions_ratio": "1.00",
"finished_indexing": true,
"finished_indexing_blocks": true,
"indexed_blocks_ratio": "1.00",
"indexed_internal_transactions_ratio": "1.00",
}, 200
}