Add BCH helper functions and non-spendable library imports#400
Add BCH helper functions and non-spendable library imports#400lightswarm124 wants to merge 11 commits intoCashScript:nextfrom
Conversation
# Conflicts: # packages/cashscript/src/libauth-template/LibauthTemplate.ts # packages/cashscript/src/network/ElectrumNetworkProvider.ts
|
Hey @lightswarm124, thank you for the PR. We have functions on the timeline for version 0.14.0, which we'll start working on after the upcoming 0.13.0 release (targeted for May 15th), which will mainly include loops. We briefly looked at some of the changes, and I wonder whether the new examples compile, since the syntax changes don't look reflected in the grammar files. Did you manage to run any of these examples yet? In any case, we'll start looking into this PR (and functions in general) after that upcoming 0.13.0 release in May. |
|
Hey @rkalis, I modified the grammar a bit to better support internal helper functions, adding in "public" and "internal" visibility tags to the functions. Also defined "library" for importing helper functions from external files - currently, only "contract" is allowed to have functions you can spend from. Tests should work once the grammar has been updated |
This PR adds BCH function support on top of current next by introducing contract-local helper functions and non-spendable imported helper libraries. It treats OP_DEFINE / OP_INVOKE as first-class compiler outputs, keeps spend surfaces explicit, and adds the debug/runtime metadata needed to make helper execution reviewable.
Main changes:
Why this matters:
Examples included:
Local internal helpers:
Imported helper libraries:
Testing-suite helper example:
Docs for review: