Skip to content

Commit

Permalink
Include empty asset_name case
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotr Stachyra committed Mar 31, 2022
1 parent 16d8d03 commit ba001b7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
22 changes: 12 additions & 10 deletions test/e2e/spec/e2e_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ def run_contract(contract_setup, scripts)

describe "Minting and Burning" do
def mint(asset_name, quantity, policy_script, address)
{
mint = {
'operation' => {
'mint' =>
{
Expand All @@ -615,22 +615,24 @@ def mint(asset_name, quantity, policy_script, address)
}
}
},
'policy_script_template' => policy_script,
'asset_name' => asset_name
}
'policy_script_template' => policy_script
}
mint['asset_name'] = asset_name unless asset_name == nil
mint
end

def burn(asset_name, quantity, policy_script)
{
burn = {
'operation' => {
'burn' => { 'quantity' => quantity,
'unit' => 'assets'
}

},
'policy_script_template' => policy_script,
'asset_name' => asset_name
'policy_script_template' => policy_script
}
burn['asset_name'] = asset_name unless asset_name == nil
burn
end

##
Expand Down Expand Up @@ -661,7 +663,7 @@ def get_policy_id_from_decode(tx_decoded_mint_or_burn)
# Minting:
mint = [mint(asset_name('Token1'), 1000, policy_script1, address),
mint(asset_name('Token2'), 1000, policy_script2, address),
mint(asset_name('Token3'), 1000, policy_script3, address)
mint('', 1000, policy_script3, address)
]
create_policy_key_if_not_exists(@wid)
tx_constructed, tx_signed, tx_submitted = construct_sign_submit(@wid,
Expand Down Expand Up @@ -692,7 +694,7 @@ def get_policy_id_from_decode(tx_decoded_mint_or_burn)
# Burn half:
burn = [burn(asset_name('Token1'), 500, policy_script1),
burn(asset_name('Token2'), 500, policy_script2),
burn(asset_name('Token3'), 500, policy_script3)
burn('', 500, policy_script3)
]
tx_constructed, tx_signed, tx_submitted = construct_sign_submit(@wid,
payments = nil,
Expand Down Expand Up @@ -722,7 +724,7 @@ def get_policy_id_from_decode(tx_decoded_mint_or_burn)
# Burn all the rest:
burn = [burn(asset_name('Token1'), 500, policy_script1),
burn(asset_name('Token2'), 500, policy_script2),
burn(asset_name('Token3'), 500, policy_script3)
burn('', 500, policy_script3)
]
tx_constructed, tx_signed, tx_submitted = construct_sign_submit(@wid,
payments = nil,
Expand Down
4 changes: 3 additions & 1 deletion test/e2e/spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -531,8 +531,10 @@ def create_policy_key_if_not_exists(wid)
if gpkey.code == 403 && gpkey['code'] == "missing_policy_public_key"
pkey = SHELLEY.keys.create_policy_key(wid, PASS)
expect(pkey).to be_correct_and_respond 202
pkey
else
gpkey
end
pkey || gpkey
end

##
Expand Down

0 comments on commit ba001b7

Please sign in to comment.