Skip to content

Commit

Permalink
Fix txlist RPC endpoint to use the token info for fee currencies
Browse files Browse the repository at this point in the history
The txlist RPC endpoint uses the CeloParams table to fetch names of stable
tokens used as gas currencies. It can take it from the Tokens table instead.
  • Loading branch information
carterqw2 committed May 8, 2024
1 parent 7318e03 commit 637a4df
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions apps/explorer/lib/explorer/etherscan.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ defmodule Explorer.Etherscan do
alias Explorer.Etherscan.Logs
alias Explorer.{Chain, Repo}
alias Explorer.Chain.Address.{CurrentTokenBalance, TokenBalance}
alias Explorer.Chain.{Address, Block, CeloParams, Hash, InternalTransaction, Log, TokenTransfer, Transaction}
alias Explorer.Chain.{Address, Block, CeloParams, Hash, InternalTransaction, Log, Token, TokenTransfer, Transaction}
alias Explorer.Chain.Transaction.History.TransactionStats

@default_options %{
Expand Down Expand Up @@ -490,16 +490,16 @@ defmodule Explorer.Etherscan do
t in Transaction,
join: a in ^addresses_wrapped_subquery,
on: t.hash == a.hash,
left_join: p in CeloParams,
on: t.gas_currency_hash == p.address_value,
left_join: k in Token,
on: t.gas_currency_hash == k.contract_address_hash,
inner_join: b in Block,
on: b.number == t.block_number,
order_by: [{^options.order_by_direction, t.block_number}],
limit: ^options.page_size,
offset: ^offset(options),
select:
merge(map(t, ^@transaction_fields), %{
fee_currency: p.name,
fee_currency: k.symbol,
block_timestamp: b.timestamp,
confirmations: fragment("? - ?", ^max_block_number, t.block_number)
})
Expand Down

0 comments on commit 637a4df

Please sign in to comment.