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/tx builder fetcher logic #381

Merged
merged 7 commits into from
Nov 12, 2024
Merged

Fix/tx builder fetcher logic #381

merged 7 commits into from
Nov 12, 2024

Conversation

twwu123
Copy link
Collaborator

@twwu123 twwu123 commented Nov 12, 2024

Summary

Currently it is practically impossible to build a transaction completely offline, because there is no API to provide script ref size for inputs. I have added this in the txIn type, and added logic to get rid of the need for a fetcher. The current txBuilder will add any inputs with refScriptSize also to the refTxIn so that the txBuilder correctly accounts for these script sizes when calculating fees. It is somewhat of a hacky fix, but will work until we figure out a better method.

Affect components

Please indicate which part of the Mesh Repo

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

Type of Change

Please mark the relevant option(s) for your pull request:

  • 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

Closes #374

Checklist

Please ensure that your pull request meets the following criteria:

  • 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 context

Now offline transaction building requires an extra input for scriptRefSize, if there is no scriptRef at the input, please explicitly put 0 as scriptRefSize. If it is left undefined, it is assumed to be an incomplete input info, and will require a fetcher instance.

@twwu123 twwu123 linked an issue Nov 12, 2024 that may be closed by this pull request
Copy link

vercel bot commented Nov 12, 2024

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 Nov 12, 2024 1:37pm
mesh-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 12, 2024 1:37pm

@twwu123 twwu123 merged commit da8dc81 into main Nov 12, 2024
4 checks passed
@twwu123 twwu123 deleted the fix/tx-builder-fetcher-logic branch November 12, 2024 13:38
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.

Fetcher now required with all transaction building (it shouldn't)
2 participants