Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix transaction inputs outputs calculation error. #195

Merged
merged 5 commits into from
Jun 4, 2024

Conversation

shadowv0vshadow
Copy link
Collaborator

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.

@shadowv0vshadow shadowv0vshadow merged commit d6eaaf1 into develop Jun 4, 2024
4 checks passed
@wizz-wallet-dev wizz-wallet-dev deleted the fix-transaction branch June 4, 2024 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant