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

Tx Builder wont select any inputs if withdrawal amount is enough to balance the transaction #186

Open
AngelCastilloB opened this issue Sep 25, 2024 · 0 comments

Comments

@AngelCastilloB
Copy link

AngelCastilloB commented Sep 25, 2024

Hi, I am building a transaction with the sole purpose of withdrawing rewards:

    const blaze = await getBlazeProvider();
    const tx = blaze.newTransaction();
    
    // Assume there is an assert to make sure there are rewards.
    tx.addWithdrawal(RewardAccount(account.rewardAddr), delegation.rewards);

    tx.setValidUntil(protocolParameters.slot + TX.invalid_hereafter);

    const changeAddress = Address.fromBech32(account.paymentAddr);

    tx.setChangeAddress(changeAddress);

    const result = await tx.complete();

This results in an error if rewards are enough to cover the fees + minUtxoValue for change output as the transaction doesn't have any inputs. It has an easy fix/workaround (manually specifying an input to be spent etc), but I would expect the tx builder to sort this kind of things for me automatically. I.E if no inputs are required to balance outputs + fee (and no extra inputs are manually specified), pick one input anyways either randomly or following some simple preference heuristic

micahkendall added a commit that referenced this issue Sep 26, 2024
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

No branches or pull requests

1 participant