|
|
|
@ -4802,7 +4802,7 @@ defmodule Explorer.ChainTest do |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
describe "stream_unfetched_token_instances/2" do |
|
|
|
|
test "reduces wuth given reducer and accumulator" do |
|
|
|
|
test "reduces with given reducer and accumulator for ERC-721 token" do |
|
|
|
|
token_contract_address = insert(:contract_address) |
|
|
|
|
token = insert(:token, contract_address: token_contract_address, type: "ERC-721") |
|
|
|
|
|
|
|
|
@ -4827,7 +4827,33 @@ defmodule Explorer.ChainTest do |
|
|
|
|
assert result.contract_address_hash == token_transfer.token_contract_address_hash |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
test "does not fetch token transfers without token id" do |
|
|
|
|
test "reduces with given reducer and accumulator for ERC-1155 token" do |
|
|
|
|
token_contract_address = insert(:contract_address) |
|
|
|
|
token = insert(:token, contract_address: token_contract_address, type: "ERC-1155") |
|
|
|
|
|
|
|
|
|
transaction = |
|
|
|
|
:transaction |
|
|
|
|
|> insert() |
|
|
|
|
|> with_block(insert(:block, number: 1)) |
|
|
|
|
|
|
|
|
|
token_transfer = |
|
|
|
|
insert( |
|
|
|
|
:token_transfer, |
|
|
|
|
block_number: 1000, |
|
|
|
|
to_address: build(:address), |
|
|
|
|
transaction: transaction, |
|
|
|
|
token_contract_address: token_contract_address, |
|
|
|
|
token: token, |
|
|
|
|
token_id: nil, |
|
|
|
|
token_ids: [11] |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
assert {:ok, [result]} = Chain.stream_unfetched_token_instances([], &[&1 | &2]) |
|
|
|
|
assert result.token_ids == token_transfer.token_ids |
|
|
|
|
assert result.contract_address_hash == token_transfer.token_contract_address_hash |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
test "does not fetch token transfers without token id or token_ids" do |
|
|
|
|
token_contract_address = insert(:contract_address) |
|
|
|
|
token = insert(:token, contract_address: token_contract_address, type: "ERC-721") |
|
|
|
|
|
|
|
|
@ -4843,7 +4869,8 @@ defmodule Explorer.ChainTest do |
|
|
|
|
transaction: transaction, |
|
|
|
|
token_contract_address: token_contract_address, |
|
|
|
|
token: token, |
|
|
|
|
token_id: nil |
|
|
|
|
token_id: nil, |
|
|
|
|
token_ids: nil |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
assert {:ok, []} = Chain.stream_unfetched_token_instances([], &[&1 | &2]) |
|
|
|
|