diff --git a/app/utils/ckb_utils.rb b/app/utils/ckb_utils.rb index 74b70b970..2d7dda544 100644 --- a/app/utils/ckb_utils.rb +++ b/app/utils/ckb_utils.rb @@ -634,8 +634,8 @@ def self.parse_omiga_inscription_info(hex_data) symbol_len = "0x#{data.slice!(0, 2)}".to_i(16) symbol = [data.slice!(0, symbol_len * 2)].pack("H*") udt_hash = "0x#{data.slice!(0, 64)}" - expected_supply = [data.slice!(0, 32)].pack("H*").unpack1("Q<2") - mint_limit = [data.slice!(0, 32)].pack("H*").unpack1("Q<2") + expected_supply = [data.slice!(0, 32)].pack("H*").bytes.reverse.pack("C*").unpack1("H*").hex + mint_limit = [data.slice!(0, 32)].pack("H*").bytes.reverse.pack("C*").unpack1("H*").hex mint_status = "0x#{data.slice!(0, 2)}".to_i(16) { decimal:, name: name.presence, symbol: symbol.presence, udt_hash:, expected_supply:, mint_limit:, mint_status: } @@ -643,7 +643,7 @@ def self.parse_omiga_inscription_info(hex_data) def self.parse_omiga_inscription_data(hex_data) data = hex_data.delete_prefix("0x") - mint_limit = [data].pack("H*").unpack1("Q<2") + mint_limit = [data].pack("H*").bytes.reverse.pack("C*").unpack1("H*").hex { mint_limit: } end diff --git a/test/utils/ckb_utils_test.rb b/test/utils/ckb_utils_test.rb index baeb86589..dba14ccae 100644 --- a/test/utils/ckb_utils_test.rb +++ b/test/utils/ckb_utils_test.rb @@ -456,6 +456,12 @@ class CkbUtilsTest < ActiveSupport::TestCase assert_equal info[:mint_limit], 100000000000 end + test "parse another omiga inscrpition data" do + data = "0x000000357ecff647ec5e110000000000 " + info = CkbUtils.parse_omiga_inscription_data(data) + assert_equal info[:mint_limit], 21000000000000000000000000 + end + test "parse unique cell" do data = "0x080a556e697175652042425100" info = CkbUtils.parse_unique_cell(data)