GQL token_transfers token_id -> token_ids

pull/6391/head
Qwerty5Uiop 2 years ago committed by Viktor Baranov
parent 1e41a03db8
commit ee56422bb8
  1. 2
      apps/block_scout_web/lib/block_scout_web/schema/types.ex
  2. 6
      apps/block_scout_web/test/block_scout_web/schema/query/token_transfers_test.exs

@ -115,9 +115,11 @@ defmodule BlockScoutWeb.Schema.Types do
"""
node object(:token_transfer, id_fetcher: &token_transfer_id_fetcher/2) do
field(:amount, :decimal)
field(:amounts, list_of(:decimal))
field(:block_number, :integer)
field(:log_index, :integer)
field(:token_id, :decimal)
field(:token_ids, list_of(:decimal))
field(:from_address_hash, :address_hash)
field(:to_address_hash, :address_hash)
field(:token_contract_address_hash, :address_hash)

@ -4,7 +4,7 @@ defmodule BlockScoutWeb.Schema.Query.TokenTransfersTest do
describe "token_transfers field" do
test "with valid argument, returns all expected fields", %{conn: conn} do
transaction = insert(:transaction)
token_transfer = insert(:token_transfer, transaction: transaction)
token_transfer = insert(:token_transfer, transaction: transaction, token_ids: [5], amounts: [10])
address_hash = to_string(token_transfer.token_contract_address_hash)
query = """
@ -13,9 +13,11 @@ defmodule BlockScoutWeb.Schema.Query.TokenTransfersTest do
edges {
node {
amount
amounts
block_number
log_index
token_id
token_ids
from_address_hash
to_address_hash
token_contract_address_hash
@ -40,9 +42,11 @@ defmodule BlockScoutWeb.Schema.Query.TokenTransfersTest do
%{
"node" => %{
"amount" => to_string(token_transfer.amount),
"amounts" => Enum.map(token_transfer.amounts, &to_string/1),
"block_number" => token_transfer.block_number,
"log_index" => token_transfer.log_index,
"token_id" => token_transfer.token_id,
"token_ids" => Enum.map(token_transfer.token_ids, &to_string/1),
"from_address_hash" => to_string(token_transfer.from_address_hash),
"to_address_hash" => to_string(token_transfer.to_address_hash),
"token_contract_address_hash" => to_string(token_transfer.token_contract_address_hash),

Loading…
Cancel
Save