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 #1598

Merged
merged 3 commits into from
Jan 23, 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
4 changes: 2 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -449,9 +449,9 @@ Layout/InitialIndentation:
Enabled: false

Layout/LineLength:
Description: 'Limit lines to 80 characters.'
Description: 'Limit lines to 200 characters.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#80-character-limits'
Max: 80
Max: 200

# Lint

Expand Down
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ gem "with_advisory_lock"

gem "nokogiri", ">= 1.11.0.rc4"

gem "benchmark_methods", require: false
gem "sentry-ruby"
gem "sentry-rails"
gem "sentry-sidekiq"
Expand Down
2 changes: 0 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ GEM
awesome_print (1.9.2)
backport (1.2.0)
benchmark (0.2.1)
benchmark_methods (0.7)
bigdecimal (3.1.4)
bootsnap (1.13.0)
msgpack (~> 1.2)
Expand Down Expand Up @@ -479,7 +478,6 @@ DEPENDENCIES
annotate
async-websocket (~> 0.22.1)
awesome_print
benchmark_methods
bigdecimal
bootsnap
ckb-sdk-ruby!
Expand Down
32 changes: 26 additions & 6 deletions app/controllers/api/v1/omiga_inscriptions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,15 @@ class OmigaInscriptionsController < ApplicationController
only: :index

def index
udts = Udt.omiga_inscription
pre_udt_hashes = OmigaInscriptionInfo.where.not(pre_udt_hash: nil).pluck(:pre_udt_hash)
udts =
if pre_udt_hashes.present?
Udt.joins(:omiga_inscription_info).where.not(
"omiga_inscription_infos.mint_status = 1 and omiga_inscription_infos.udt_hash IN (?)", pre_udt_hashes
)
else
Udt.omiga_inscription
end

if stale?(udts)
udts = sort_udts(udts).page(@page).per(@page_size).fast_page
Expand All @@ -22,15 +30,27 @@ def index
end

def show
udt = Udt.find_by!(type_hash: params[:id])
render json: UdtSerializer.new(udt)
rescue ActiveRecord::RecordNotFound
raise Api::V1::Exceptions::UdtNotFoundError
udt =
if params[:status] == "closed"
Udt.joins(:omiga_inscription_info).where(
"omiga_inscription_infos.type_hash = ? and omiga_inscription_infos.mint_status = 1", params[:id]
).first
else
Udt.joins(:omiga_inscription_info).where(
"udts.type_hash = ? or omiga_inscription_infos.type_hash = ?", params[:id], params[:id]
).order("id DESC").first
end

if udt.nil?
raise Api::V1::Exceptions::UdtNotFoundError
else
render json: UdtSerializer.new(udt)
end
end

def download_csv
args = params.permit(:id, :start_date, :end_date, :start_number,
:end_number, udt: {})
:end_number, :status, udt: {})
file = CsvExportable::ExportOmigaInscriptionTransactionsJob.perform_now(args.to_h)

send_data file, type: "text/csv; charset=utf-8; header=present",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
module CsvExportable
class ExportOmigaInscriptionTransactionsJob < BaseExporter
def perform(args)
udt = Udt.find_by!(type_hash: args[:id], published: true)
udt =
if args[:status] == "closed"
Udt.joins(:omiga_inscription_info).where(
"omiga_inscription_infos.type_hash = ? and omiga_inscription_infos.mint_status = 1", args[:id]
).first
else
Udt.joins(:omiga_inscription_info).where(
"udts.type_hash = ? or omiga_inscription_infos.type_hash = ?", args[:id], args[:id]
).order("id DESC").first
end
ckb_transactions = udt.ckb_transactions

if args[:start_date].present?
Expand Down
Loading
Loading