Skip to content

Commit

Permalink
feat: omiga inscription name and symbol can't be null string (#1560)
Browse files Browse the repository at this point in the history
Signed-off-by: Miles Zhang <[email protected]>
  • Loading branch information
zmcNotafraid authored Jan 9, 2024
1 parent 161b02d commit 623f8f1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/utils/ckb_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ def self.parse_omiga_inscription_info(hex_data)
expected_supply = [data.slice!(0, 32)].pack("H*").unpack1("Q<2")
mint_limit = [data.slice!(0, 32)].pack("H*").unpack1("Q<2")
mint_status = "0x#{data.slice!(0, 2)}".to_i(16)
{ decimal:, name:, symbol:, udt_hash:, expected_supply:,
{ decimal:, name: name.presence, symbol: symbol.presence, udt_hash:, expected_supply:,
mint_limit:, mint_status: }
end
end
6 changes: 6 additions & 0 deletions test/utils/ckb_utils_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,12 @@ class CkbUtilsTest < ActiveSupport::TestCase
udt_hash: "0xe0f8e095d975e21e1b451b582c9d0685104471d377c6589339b723f76c035c74", expected_supply: 2100000000000000, mint_limit: 100000000000, mint_status: 0 }
end

test "parse omiga inscription info data when name is null" do
data = "0x08004b42204669737420496e736372697074696f6e04434b4249e0f8e095d975e21e1b451b582c9d0685104471d377c6589339b723f76c035c740040075af0750700000000000000000000e8764817000000000000000000000000"
info = CkbUtils.parse_omiga_inscription_info(data)
assert_equal info[:name], nil
end

private

def node_data_processor
Expand Down

0 comments on commit 623f8f1

Please sign in to comment.