Merge pull request #5884 from blockscout/dependabot/hex/nimble_csv-1.2.0

Bump nimble_csv from 1.1.0 to 1.2.0
pull/5977/head
Victor Baranov 2 years ago committed by GitHub
commit ae4ca9b50e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 20
      apps/explorer/lib/explorer/chain/address_internal_transaction_csv_exporter.ex
  2. 0
      apps/explorer/lib/explorer/chain/address_log_csv_exporter.ex
  3. 41
      apps/explorer/test/explorer/chain/address_internal_transaction_csv_exporter_test.exs
  4. 20
      apps/explorer/test/explorer/chain/address_log_csv_exporter_test.exs
  5. 24
      apps/explorer/test/explorer/chain/address_token_transfer_csv_exporter_test.exs
  6. 28
      apps/explorer/test/explorer/chain/address_transaction_csv_exporter_test.exs
  7. 2
      mix.lock

@ -16,11 +16,14 @@ defmodule Explorer.Chain.AddressInternalTransactionCsvExporter do
from_block = Chain.convert_date_to_min_block(from_period)
to_block = Chain.convert_date_to_max_block(to_period)
address.hash
|> fetch_all_internal_transactions(from_block, to_block, @paging_options)
|> Enum.sort_by(&{&1.block_number, &1.index, &1.transaction_index}, :desc)
|> to_csv_format()
|> dump_to_stream()
res =
address.hash
|> fetch_all_internal_transactions(from_block, to_block, @paging_options)
|> Enum.sort_by(&{&1.block_number, &1.index, &1.transaction_index}, :desc)
|> to_csv_format()
|> dump_to_stream()
res
end
defp fetch_all_internal_transactions(address_hash, from_block, to_block, paging_options, acc \\ []) do
@ -46,8 +49,11 @@ defmodule Explorer.Chain.AddressInternalTransactionCsvExporter do
end
defp dump_to_stream(internal_transactions) do
internal_transactions
|> RFC4180.dump_to_stream()
res =
internal_transactions
|> RFC4180.dump_to_stream()
res
end
defp to_csv_format(internal_transactions) do

@ -26,47 +26,50 @@ defmodule Explorer.Chain.AddressInternalTransactionCsvExporterTest do
from_period = Timex.format!(Timex.shift(Timex.now(), minutes: -1), "%Y-%m-%d", :strftime)
to_period = Timex.format!(Timex.now(), "%Y-%m-%d", :strftime)
[result] =
res =
address
|> AddressInternalTransactionCsvExporter.export(from_period, to_period)
|> Enum.to_list()
|> Enum.drop(1)
[result] =
res
|> Enum.map(fn [
transaction_hash,
[[], transaction_hash],
_,
index,
[[], index],
_,
block_number,
[[], block_number],
_,
block_hash,
[[], block_hash],
_,
block_index,
[[], block_index],
_,
transaction_index,
[[], transaction_index],
_,
timestamp,
[[], timestamp],
_,
from_address_hash,
[[], from_address_hash],
_,
to_address_hash,
[[], to_address_hash],
_,
created_contract_address_hash,
[[], created_contract_address_hash],
_,
type,
[[], type],
_,
call_type,
[[], call_type],
_,
gas,
[[], gas],
_,
gas_used,
[[], gas_used],
_,
value,
[[], value],
_,
input,
[[], input],
_,
output,
[[], output],
_,
error,
[[], error],
_
] ->
%{

@ -35,25 +35,25 @@ defmodule Explorer.Chain.AddressLogCsvExporterTest do
|> Enum.to_list()
|> Enum.drop(1)
|> Enum.map(fn [
transaction_hash,
[[], transaction_hash],
_,
index,
[[], index],
_,
block_number,
[[], block_number],
_,
block_hash,
[[], block_hash],
_,
address,
[[], address],
_,
data,
[[], data],
_,
first_topic,
[[], first_topic],
_,
second_topic,
[[], second_topic],
_,
third_topic,
[[], third_topic],
_,
fourth_topic,
[[], fourth_topic],
_
] ->
%{

@ -24,29 +24,29 @@ defmodule Explorer.Chain.AddressTokenTransferCsvExporterTest do
|> Enum.to_list()
|> Enum.drop(1)
|> Enum.map(fn [
tx_hash,
[[], tx_hash],
_,
block_number,
[[], block_number],
_,
timestamp,
[[], timestamp],
_,
from_address,
[[], from_address],
_,
to_address,
[[], to_address],
_,
token_contract_address,
[[], token_contract_address],
_,
type,
[[], type],
_,
token_symbol,
[[], token_symbol],
_,
tokens_transferred,
[[], tokens_transferred],
_,
transaction_fee,
[[], transaction_fee],
_,
status,
[[], status],
_,
err_code,
[[], err_code],
_
] ->
%{

@ -22,33 +22,33 @@ defmodule Explorer.Chain.AddressTransactionCsvExporterTest do
|> Enum.to_list()
|> Enum.drop(1)
|> Enum.map(fn [
hash,
[[], hash],
_,
block_number,
[[], block_number],
_,
timestamp,
[[], timestamp],
_,
from_address,
[[], from_address],
_,
to_address,
[[], to_address],
_,
created_address,
[[], created_address],
_,
type,
[[], type],
_,
value,
[[], value],
_,
fee,
[[], fee],
_,
status,
[[], status],
_,
error,
[[], error],
_,
cur_price,
[[], cur_price],
_,
op_price,
[[], op_price],
_,
cl_price,
[[], cl_price],
_
] ->
%{

@ -84,7 +84,7 @@
"mock": {:hex, :mock, "0.3.7", "75b3bbf1466d7e486ea2052a73c6e062c6256fb429d6797999ab02fa32f29e03", [:mix], [{:meck, "~> 0.9.2", [hex: :meck, repo: "hexpm", optional: false]}], "hexpm", "4da49a4609e41fd99b7836945c26f373623ea968cfb6282742bcb94440cf7e5c"},
"mox": {:hex, :mox, "1.0.2", "dc2057289ac478b35760ba74165b4b3f402f68803dd5aecd3bfd19c183815d64", [:mix], [], "hexpm", "f9864921b3aaf763c8741b5b8e6f908f44566f1e427b2630e89e9a73b981fef2"},
"msgpax": {:hex, :msgpax, "2.3.0", "14f52ad249a3f77b5e2d59f6143e6c18a6e74f34666989e22bac0a465f9835cc", [:mix], [{:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "65c36846a62ed5615baf7d7d47babb6541313a6c0b6d2ff19354bd518f52df7e"},
"nimble_csv": {:hex, :nimble_csv, "1.1.0", "b1dba4a86be9e03065c9de829050468e591f569100332db949e7ce71be0afc25", [:mix], [], "hexpm", "e986755bc302832cac429be6deda0fc9d82d3c82b47abefb68b3c17c9d949a3f"},
"nimble_csv": {:hex, :nimble_csv, "1.2.0", "4e26385d260c61eba9d4412c71cea34421f296d5353f914afe3f2e71cce97722", [:mix], [], "hexpm", "d0628117fcc2148178b034044c55359b26966c6eaa8e2ce15777be3bbc91b12a"},
"nimble_parsec": {:hex, :nimble_parsec, "1.2.3", "244836e6e3f1200c7f30cb56733fd808744eca61fd182f731eac4af635cc6d0b", [:mix], [], "hexpm", "c8d789e39b9131acf7b99291e93dae60ab48ef14a7ee9d58c6964f59efb570b0"},
"number": {:hex, :number, "1.0.3", "932c8a2d478a181c624138958ca88a78070332191b8061717270d939778c9857", [:mix], [{:decimal, "~> 1.5 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}], "hexpm", "dd397bbc096b2ca965a6a430126cc9cf7b9ef7421130def69bcf572232ca0f18"},
"numbers": {:hex, :numbers, "5.2.4", "f123d5bb7f6acc366f8f445e10a32bd403c8469bdbce8ce049e1f0972b607080", [:mix], [{:coerce, "~> 1.0", [hex: :coerce, repo: "hexpm", optional: false]}, {:decimal, "~> 1.9 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "eeccf5c61d5f4922198395bf87a465b6f980b8b862dd22d28198c5e6fab38582"},

Loading…
Cancel
Save