Skip to content

Commit

Permalink
feat: rename tx_hash to source_tx_hash on claims/updates/transfers
Browse files Browse the repository at this point in the history
  • Loading branch information
sborrazas committed Jan 4, 2023
1 parent fc7a70b commit e36d4ac
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
15 changes: 9 additions & 6 deletions lib/ae_mdw/names.ex
Expand Up @@ -603,8 +603,9 @@ defmodule AeMdw.Names do
%{
height: height,
block_hash: Enc.encode(:micro_block_hash, block_hash),
tx_hash: Enc.encode(:tx_hash, tx_hash),
tx_type: Format.type_to_swagger_name(tx_type),
source_tx_hash: Enc.encode(:tx_hash, tx_hash),
source_tx_type: Format.type_to_swagger_name(tx_type),
internal_source: tx_type != :name_claim_tx,
tx: :aens_claim_tx.for_client(claim_aetx)
}
end
Expand All @@ -616,8 +617,9 @@ defmodule AeMdw.Names do
%{
height: height,
block_hash: Enc.encode(:micro_block_hash, block_hash),
tx_hash: Enc.encode(:tx_hash, tx_hash),
tx_type: Format.type_to_swagger_name(tx_type),
source_tx_hash: Enc.encode(:tx_hash, tx_hash),
source_tx_type: Format.type_to_swagger_name(tx_type),
internal_source: tx_type != :name_update_tx,
tx: :aens_update_tx.for_client(update_aetx)
}
end
Expand All @@ -629,8 +631,9 @@ defmodule AeMdw.Names do
%{
height: height,
block_hash: Enc.encode(:micro_block_hash, block_hash),
tx_hash: Enc.encode(:tx_hash, tx_hash),
tx_type: Format.type_to_swagger_name(tx_type),
source_tx_hash: Enc.encode(:tx_hash, tx_hash),
source_tx_type: Format.type_to_swagger_name(tx_type),
internal_source: tx_type != :name_transfer_tx,
tx: :aens_transfer_tx.for_client(transfer_aetx)
}
end
Expand Down
20 changes: 12 additions & 8 deletions test/ae_mdw_web/controllers/name_controller_test.exs
Expand Up @@ -1811,15 +1811,17 @@ defmodule AeMdwWeb.NameControllerTest do

assert %{
"height" => 124,
"tx_type" => "NameClaimTx",
"tx_hash" => ^tx3_hash_enc,
"source_tx_type" => "NameClaimTx",
"source_tx_hash" => ^tx3_hash_enc,
"internal_source" => false,
"tx" => %{"fee" => 333_333}
} = claim3

assert %{
"height" => 123,
"tx_type" => "NameClaimTx",
"tx_hash" => ^tx2_hash_enc,
"source_tx_type" => "NameClaimTx",
"source_tx_hash" => ^tx2_hash_enc,
"internal_source" => false,
"tx" => %{"fee" => 222_222}
} = claim2

Expand All @@ -1830,8 +1832,9 @@ defmodule AeMdwWeb.NameControllerTest do

assert %{
"height" => 123,
"tx_type" => "NameClaimTx",
"tx_hash" => ^tx1_hash_enc,
"source_tx_type" => "NameClaimTx",
"source_tx_hash" => ^tx1_hash_enc,
"internal_source" => false,
"tx" => %{"fee" => 111_111}
} = claim1

Expand Down Expand Up @@ -1995,8 +1998,9 @@ defmodule AeMdwWeb.NameControllerTest do

assert %{
"height" => 123,
"tx_hash" => ^tx1_hash_enc,
"tx_type" => "ContractCallTx",
"source_tx_hash" => ^tx1_hash_enc,
"source_tx_type" => "ContractCallTx",
"internal_source" => true,
"tx" => %{"fee" => 111_111, "name" => ^plain_name}
} = claim1
end
Expand Down

0 comments on commit e36d4ac

Please sign in to comment.