Skip to content

Commit

Permalink
feat: transaction detail info add m_nft_info
Browse files Browse the repository at this point in the history
  • Loading branch information
rabbitz committed Sep 26, 2023
1 parent 9bc618e commit ac4fa81
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/controllers/api/v2/ckb_transactions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ def build_cell_capacities(outputs)
published: !!udt_info&.published,
display_name: udt_info&.display_name,
uan: udt_info&.uan
}
},
m_nft_info: parsed_output.m_nft_info.to_h
}
elsif unit == "CKB"
cell_capacity[:capacity] += parsed_output.capacity.to_f
Expand All @@ -65,8 +66,11 @@ def build_transfers(input_capacities, output_capacities)
# There may be keys in both input_capacities and output_capacities that do not exist
cell_type = output[:cell_type] || input[:cell_type]
capacity_change = output[:capacity].to_f - input[:capacity].to_f
m_nft_info = output[:m_nft_info] || input[:m_nft_info]

transfer = { capacity: capacity_change, cell_type: cell_type }
transfer[:m_nft_info] = m_nft_info if m_nft_info.present?

if unit != "CKB"
output_amount = output[:udt_info] ? output[:udt_info][:amount] : 0.0
input_amount = input[:udt_info] ? input[:udt_info][:amount] : 0.0
Expand Down

0 comments on commit ac4fa81

Please sign in to comment.