Skip to content

Commit

Permalink
Merge pull request #2287 from nervosnetwork/develop
Browse files Browse the repository at this point in the history
Deploy to testnet
  • Loading branch information
rabbitz authored Nov 15, 2024
2 parents f700cf8 + 7201ae8 commit 6c1ee81
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
4 changes: 4 additions & 0 deletions app/models/udt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ def type_script
hash_type:,
}
end

def holders_count
udt_holder_allocations.sum("ckb_holder_count + btc_holder_count")
end
end

# == Schema Information
Expand Down
5 changes: 4 additions & 1 deletion app/serializers/udt_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,12 @@ class UdtSerializer
attribute :h24_ckb_transactions_count do |object|
object.h24_ckb_transactions_count.to_s
end
attributes :created_at do |object|
attribute :created_at do |object|
object.block_timestamp.to_s
end
attribute :holders_count do |object|
object.holders_count.to_s
end

attribute :mint_status, if: Proc.new { |record, _params|
record.udt_type == "omiga_inscription"
Expand Down
4 changes: 2 additions & 2 deletions test/controllers/api/v1/omiga_inscriptions_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class OmigaInscriptionsControllerTest < ActionDispatch::IntegrationTest
assert_equal %w(
symbol full_name total_amount addresses_count
decimal icon_file h24_ckb_transactions_count created_at description
published type_hash type_script issuer_address mint_status mint_limit expected_supply
published type_hash type_script issuer_address mint_status mint_limit expected_supply holders_count
inscription_info_id udt_type pre_udt_hash info_type_hash operator_website email is_repeated_symbol
).sort,
response_udt["attributes"].keys.sort
Expand All @@ -86,7 +86,7 @@ class OmigaInscriptionsControllerTest < ActionDispatch::IntegrationTest
response_udt = json["data"]
assert_equal %w(
symbol full_name total_amount addresses_count
decimal icon_file h24_ckb_transactions_count created_at description
decimal icon_file h24_ckb_transactions_count created_at description holders_count
published type_hash type_script issuer_address mint_status mint_limit expected_supply inscription_info_id
udt_type pre_udt_hash info_type_hash operator_website email is_repeated_symbol
).sort,
Expand Down
2 changes: 1 addition & 1 deletion test/controllers/api/v1/udts_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class UdtsControllerTest < ActionDispatch::IntegrationTest

response_tx_transaction = json["data"]
assert_equal %w(
symbol full_name total_amount addresses_count
symbol full_name total_amount addresses_count holders_count
decimal icon_file h24_ckb_transactions_count created_at description
published type_hash type_script issuer_address udt_type operator_website email
).sort,
Expand Down

0 comments on commit 6c1ee81

Please sign in to comment.