Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add cargo stylus script subcommand #30

Open
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

reo101
Copy link

@reo101 reo101 commented Mar 21, 2024

Description

Context

Introduce a new cargo stylus subcommand script that enables executing Stylus program scripts that interact with the network.

Changes

  • add script subcommand with 2 subcommands:
    • script run ${NAME} to run a script at ./scripts/${NAME}
      Currently runs make, i.e. scripts can be semi-trivially extended to support multiple languages, given one can write a Makefile with a "run" target
    • script new ${NAME} to create a blank script at ./scripts/${NAME}
      Includes some small utilities to aid the creation and application/realisation of templates
      Can be further extended to create more complete scripts, similar to the one in stylus-hello-world
  • add two utility functions related to finding the Stylus project root
  • cargo-stylus was previously a binary crate, now is a library + binary, where the binary just wraps the main_impl function from the library
    • expose all functions as a library (to be used in scripts, see NOTE)
  • modify export-abi --json to filter the non-JSON parts of the output (deemed to be the first 3 lines, see NOTE in code)

Checklist

  • I have documented these changes where necessary.
  • I have read the DCO and ensured that these changes comply.
  • I assign this work under its open source licensing.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant