MeshJS / mesh

TypeScript open-source library to advance Web3 development on Cardano
https://meshjs.dev
Apache License 2.0
221 stars 65 forks source link

Fix/tx builder fetcher logic #381

Closed twwu123 closed 2 weeks ago

twwu123 commented 2 weeks ago

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

Type of Change

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

Related Issues

Closes #374

Checklist

Please ensure that your pull request meets the following criteria:

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.

vercel[bot] commented 2 weeks ago

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