Skip to content

Commit

Permalink
feat: add new attributes to lock hash serializer
Browse files Browse the repository at this point in the history
  • Loading branch information
shaojunda committed Dec 19, 2019
1 parent 55eb569 commit e96d119
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions app/serializers/lock_hash_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,37 @@ class LockHashSerializer

attributes :address_hash, :lock_hash

attribute :lock_info do |object|
object.lock_script.lock_info
end
attribute :lock_script do |object|
object.lock_script.to_node_lock
end

attribute :balance do |object|
object.balance.to_s
end
attribute :transactions_count do |object|
object.ckb_transactions_count.to_s
end

attribute :balance do |object|
object.balance.to_s
attribute :pending_reward_blocks_count do |object|
object.pending_reward_blocks_count.to_s
end
attribute :dao_deposit do |object|
object.dao_deposit.to_s
end
attribute :interest do |object|
object.interest.to_s
end
attribute :is_special do |object|
object.special?.to_s
end
attribute :special_address, if: Proc.new { |record| record.special? } do |object|
Settings.special_addresses[object.address_hash]
end
attribute :live_cells_count do |object|
object.live_cells_count.to_s
end
attribute :mined_blocks_count do |object|
object.mined_blocks_count.to_s
end
end

0 comments on commit e96d119

Please sign in to comment.