Refactor make_transfer_inputs and make_transfer_outputs function.
if blueprint_builder.ft_atomicals and atomicals_spent_at_inputs:
if not operation_type and not op_raw:
op_raw = "transfer"
for atomical_id, input_ft in blueprint_builder.ft_atomicals.items():
compact_atomical_id = location_id_bytes_to_compact(atomical_id)
res["transfers"]["inputs"] = await make_transfer_inputs(tx.inputs, compact_atomical_id, input_ft, "FT")
for k, v in blueprint_builder.ft_output_blueprint.outputs.items():
res["transfers"]["outputs"] = make_transfer_outputs(k, v)
if blueprint_builder.nft_atomicals and atomicals_spent_at_inputs:
if not operation_type and not op_raw:
op_raw = "transfer"
for atomical_id, input_nft in blueprint_builder.nft_atomicals.items():
compact_atomical_id = location_id_bytes_to_compact(atomical_id)
res["transfers"]["inputs"] = await make_transfer_inputs(
tx.inputs, compact_atomical_id, input_nft, "NFT"
)
for k, v in blueprint_builder.nft_output_blueprint.outputs.items():
res["transfers"]["outputs"] = make_transfer_outputs(k, v)
res["transfers"]["outputs"] need append, Direct assignment is not possible as it will cause overwriting. If the output contains both FT and NFT, the result will be overwritten, leading to errors.
Refactor
make_transfer_inputs
andmake_transfer_outputs
function.res["transfers"]["outputs"] need append, Direct assignment is not possible as it will cause overwriting. If the output contains both FT and NFT, the result will be overwritten, leading to errors.