Skip to content

feat(pay): enforce minimum UTxO lovelace requirement in payToAddress operation#311

Open
Mavis2103 wants to merge 2 commits intoIntersectMBO:mainfrom
Mavis2103:feat/auto-calc-min-ada-output
Open

feat(pay): enforce minimum UTxO lovelace requirement in payToAddress operation#311
Mavis2103 wants to merge 2 commits intoIntersectMBO:mainfrom
Mavis2103:feat/auto-calc-min-ada-output

Conversation

@Mavis2103
Copy link
Copy Markdown
Contributor

This pull request introduces automatic enforcement of the minimum UTxO (ADA) requirement for the payToAddress operation in the transaction builder. Now, if the requested amount of lovelace is below the protocol's minimum (or omitted), the builder will silently increase it to the required minimum, preventing on-chain rejections due to dust outputs. The change is thoroughly tested with new and updated test cases to ensure correct behavior across various scenarios.

The most important changes are:

Minimum UTxO Enforcement

  • The createPayToAddressProgram function now calculates the minimum required lovelace for a payment output and ensures the output contains at least this amount, updating assets as needed. This prevents creation of outputs that would be rejected on-chain for not meeting the minimum ADA requirement.

New and Updated Tests

  • Added a comprehensive test suite (TxBuilder.PayMinUtxo.test.ts) to verify that payment outputs are automatically bumped to the protocol minimum when necessary, and remain unchanged when sufficient lovelace is provided.
  • Updated integration tests (TxBuilder.UnfrackChangeHandling.test.ts) to reflect the new minimum UTxO enforcement: expected output values are increased where appropriate, initial UTxO values are raised to allow for valid transactions, and test assertions are updated to match the new behavior. [1] [2] [3] [4] [5] [6] [7] [8] [9]

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