Skip to content

Coin selection #482

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

Merged
merged 50 commits into from
Apr 10, 2025
Merged

Coin selection #482

merged 50 commits into from
Apr 10, 2025

Conversation

lisicky
Copy link
Contributor

@lisicky lisicky commented Jan 17, 2025

Summary

This PR simplifies and improves the UTxO selection process in MeshSDK by implementing a more robust coin selection algorithm using Cardano SDK's input selection library. The changes remove the need for explicit selection strategy parameters and replace the previous selection mechanism with a more sophisticated approach. Key improvements include better handling of token bundles, reference scripts, complex UTxO scenarios, and automated fee calculation.

Affect components

  • @meshsdk/common
  • @meshsdk/contract
  • @meshsdk/core
  • @meshsdk/core-csl
  • @meshsdk/core-cst
  • @meshsdk/hydra
  • @meshsdk/provider
  • @meshsdk/react
  • @meshsdk/svelte
  • @meshsdk/transaction
  • @meshsdk/wallet
  • Mesh playground (i.e. https://meshjs.dev/)
  • Mesh CLI

Type of Change

  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Bug fix (non-breaking change which fixes an issue)
  • Code refactoring (improving code quality without changing its behavior)
  • Documentation update (adding or updating documentation related to the project)

Related Issues

N/A

Checklist

  • My code is appropriately commented and includes relevant documentation, if necessary
  • I have added tests to cover my changes, if necessary
  • I have updated the documentation, if necessary
  • All new and existing tests pass (i.e. npm run test)
  • The build is pass (i.e. npm run build)

Additional Information

This PR introduces a significant improvement to the UTxO selection process in MeshSDK by implementing Cardano SDK's input selection algorithm. The main changes are:

  1. Simplified API: The .selectUtxosFrom() method no longer requires strategy, threshold, or includeTxFees parameters, making it easier to use.

  2. Breaking changes:

    • Removed strategy, threshold, and includeTxFees parameters from .selectUtxosFrom() method
    • Updated MeshTxBuilderBody type to include additional fields for transaction construction
  3. New features:

    • Improved token handling capabilities with automatic optimization
    • Better fee calculation using Cardano SDK algorithms
    • Support for complex, fragmented UTxO scenarios
  4. Bug fixes:

    • Fixed issues with token bundle size calculations

Copy link

vercel bot commented Jan 17, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
mesh-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 10, 2025 8:36am
mesh-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 10, 2025 8:36am

@lisicky lisicky changed the title Coin selection [WIP] Coin selection Jan 17, 2025
Base automatically changed from feature-update/core-cst-serializer to main January 27, 2025 08:22
# Conflicts:
#	package-lock.json
#	packages/mesh-common/src/types/transaction-builder/index.ts
#	packages/mesh-core-cst/src/types/cardano-sdk.ts
#	packages/mesh-transaction/package.json
lisicky added 4 commits March 9, 2025 18:54
# Conflicts:
#	package-lock.json
#	packages/mesh-core-csl/test/core/builder.test.ts
#	packages/mesh-core-cst/src/serializer/index.ts
#	packages/mesh-core-cst/src/utils/script-data-hash.ts
#	packages/mesh-transaction/package.json
#	packages/mesh-transaction/src/mesh-tx-builder/index.ts
@jinglescode jinglescode merged commit f26225d into main Apr 10, 2025
4 checks passed
@jinglescode jinglescode deleted the feature-update/coin-selection branch April 10, 2025 08:44
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.

3 participants