Skip to content

Commit

Permalink
Merge pull request #1462 from nervosnetwork/develop
Browse files Browse the repository at this point in the history
Deploy to testnet
  • Loading branch information
rabbitz committed Sep 22, 2023
2 parents 45e9e15 + 4650ca6 commit 3af1dbd
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
9 changes: 3 additions & 6 deletions app/controllers/api/v2/scripts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,21 @@ def ckb_transactions
head :not_found and return if @contract.blank?

expires_in 15.seconds, public: true, must_revalidate: true, stale_while_revalidate: 5.seconds
scope = CellDependency.where(contract_id: @contract.id).order(ckb_transaction_id: :desc)
tx_ids = scope.page(@page).per(@page_size).pluck(:ckb_transaction_id)
@ckb_transactions = CkbTransaction.find(tx_ids)
@total = scope.count
@ckb_transactions = @contract.ckb_transactions.order(id: :desc).page(@page).per(@page_size)
end

def deployed_cells
head :not_found and return if @contract.blank?

expires_in 15.seconds, public: true, must_revalidate: true, stale_while_revalidate: 5.seconds
@deployed_cells = @contract.deployed_cell_outputs.live.page(@page).per(@page_size).fast_page
@deployed_cells = @contract.deployed_cell_outputs.live.page(@page).per(@page_size)
end

def referring_cells
head :not_found and return if @contract.blank?

expires_in 15.seconds, public: true, must_revalidate: true, stale_while_revalidate: 5.seconds
@referring_cells = @contract.referring_cell_outputs.live.page(@page).per(@page_size).fast_page
@referring_cells = @contract.referring_cell_outputs.live.page(@page).per(@page_size)
end

private
Expand Down
2 changes: 1 addition & 1 deletion app/views/api/v2/scripts/ckb_transactions.json.jbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ json.data do
json.display_outputs tx.display_outputs
end
json.meta do
json.total @total
json.total @contract.ckb_transactions_count
json.page_size @page_size.to_i
end
end
2 changes: 1 addition & 1 deletion app/views/api/v2/scripts/deployed_cells.json.jbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ json.data do
json.type_script_id deployed_cell.type_script_id
end
json.meta do
json.total @deployed_cells.total_count
json.total @contract.deployed_cells_count
json.page_size @page_size.to_i
end
end
2 changes: 1 addition & 1 deletion app/views/api/v2/scripts/referring_cells.json.jbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ json.data do
json.type_script_id referring_cell.type_script_id
end
json.meta do
json.total @referring_cells.total_count
json.total @contract.referring_cells_count
json.page_size @page_size.to_i
end
end

0 comments on commit 3af1dbd

Please sign in to comment.