Skip to content

Commit

Permalink
feat: add consumed_tx_hash and generated_tx_hash to display_output
Browse files Browse the repository at this point in the history
  • Loading branch information
shaojunda committed Sep 10, 2019
1 parent 6754b25 commit 80964de
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/models/ckb_transaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,18 @@ def income(address)
def normal_tx_display_outputs(previews)
cell_outputs_for_display = previews ? cell_outputs.limit(10) : cell_outputs
cell_outputs_for_display.order(:id).map do |output|
{ id: output.id, capacity: output.capacity, address_hash: output.address_hash }
consumed_tx_hash = output.live? ? nil : output.consumed_by.tx_hash
{ id: output.id, capacity: output.capacity, address_hash: output.address_hash, status: output.status, consumed_tx_hash: consumed_tx_hash}
end
end

def cellbase_display_outputs
outputs = cell_outputs.order(:id)
cellbase = Cellbase.new(block)
outputs.map { |output| { id: output.id, capacity: output.capacity, address_hash: output.address_hash, target_block_number: cellbase.target_block_number, base_reward: cellbase.base_reward, commit_reward: cellbase.commit_reward, proposal_reward: cellbase.proposal_reward, secondary_reward: cellbase.secondary_reward } }
outputs.map do |output|
consumed_tx_hash = output.live? ? nil : output.consumed_by.tx_hash
{ id: output.id, capacity: output.capacity, address_hash: output.address_hash, target_block_number: cellbase.target_block_number, base_reward: cellbase.base_reward, commit_reward: cellbase.commit_reward, proposal_reward: cellbase.proposal_reward, secondary_reward: cellbase.secondary_reward, status: output.status, consumed_tx_hash: consumed_tx_hash }
end
end

def normal_tx_display_inputs(previews)
Expand Down

0 comments on commit 80964de

Please sign in to comment.