Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy to testnet #2329

Merged
merged 2 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions app/interactions/addresses/ckb_transactions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,10 @@ def execute
raise AddressNotFoundError if address.is_a?(NullAddress)

address_id = address.map(&:id)
account_books = AccountBook.joins(:ckb_transaction).
where(account_books: { address_id: }, ckb_transactions: { tx_status: :committed }).
order(transactions_ordering).
select("DISTINCT account_books.ckb_transaction_id, ckb_transactions.block_timestamp, ckb_transactions.tx_index").
page(page).per(page_size)
records = CkbTransaction.where(id: account_books.map(&:ckb_transaction_id)).order(transactions_ordering)
account_books = AccountBook.where(address_id:).order("ckb_transaction_id desc").select(:ckb_transaction_id).distinct.limit(5000)
records = CkbTransaction.where(tx_status: :committed, id: account_books.map(&:ckb_transaction_id)).order(transactions_ordering).page(page).per(page_size)
options = paginate_options(records, address_id)
options.merge!(params: { previews: true, address: })
options.merge!(params: { previews: false, address: })

result = CkbTransactionsSerializer.new(records, options)
wrap_result(result, address)
Expand All @@ -37,10 +33,7 @@ def transactions_ordering
end

def paginate_options(records, address_id)
total_count = AccountBook.includes(:ckb_transaction).where(
account_books: { address_id: },
ckb_transactions: { tx_status: :committed },
).distinct.count(:ckb_transaction_id)
total_count = AccountBook.where(address_id:).distinct.count
FastJsonapi::PaginationMetaGenerator.new(
request:, records:, page:, page_size:, total_count:,
).call
Expand Down
11 changes: 1 addition & 10 deletions app/interactions/addresses/pending_transactions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,8 @@ def execute
address = Explore.run!(key:)
raise AddressNotFoundError if address.is_a?(NullAddress)

account_books =
AccountBook.joins(:ckb_transaction).where(
account_books: { address_id: address.map(&:id) },
ckb_transactions: { tx_status: "pending" },
)
ckb_transaction_ids =
CellInput.where(ckb_transaction_id: account_books.map(&:ckb_transaction_id)).
where.not(previous_cell_output_id: nil, from_cell_base: false).
distinct.pluck(:ckb_transaction_id)
records =
CkbTransaction.where(id: ckb_transaction_ids).
CkbTransaction.joins(:account_books).where(ckb_transactions: { tx_status: :pending }, account_books: { address_id: address.map(&:id) }).
select(select_fields).
order(transactions_ordering).
page(page).per(page_size)
Expand Down
Loading