diff --git a/app/controllers/api/v1/blocks_controller.rb b/app/controllers/api/v1/blocks_controller.rb index 233c70567..9f0844f70 100644 --- a/app/controllers/api/v1/blocks_controller.rb +++ b/app/controllers/api/v1/blocks_controller.rb @@ -13,7 +13,7 @@ def index options = FastJsonapi::PaginationMetaGenerator.new(request: request, records: blocks, page: @page, page_size: @page_size).call end - render json: BlockSerializer.new(blocks, options) + render json: BlockListSerializer.new(blocks, options) end def show diff --git a/app/serializers/block_list_serializer.rb b/app/serializers/block_list_serializer.rb new file mode 100644 index 000000000..96c5b7171 --- /dev/null +++ b/app/serializers/block_list_serializer.rb @@ -0,0 +1,18 @@ +class BlockListSerializer + include FastJsonapi::ObjectSerializer + + attributes :miner_hash + + attribute :number do |object| + object.number.to_s + end + attribute :timestamp do |object| + object.timestamp.to_s + end + attribute :reward do |object| + object.reward.to_s + end + attribute :transactions_count do |object| + object.ckb_transactions_count.to_s + end +end