This CLI app will autogenerate the files required by the Go backend to interact with the Garnet indexer.
- Go >= 1.20
go install github.com/bocha-io/garnetutils@latestgarnetutils generate -i ./mud.config.ts -o /tmp/garnetgenerated/Params:
-i: mud config path-o: destination folder
The autogenerated files must be in a folder named garnethelpers inside your go project.
- The
gettersfile has all the helpers needed to read the blockchain information using theGarnetlib. - The
eventsfile has all the functions to createMudEvents, events used to predict the result of a transaction. - The
typesfile has the common types, you need to callNewGameObjectin your go project with a reference to theGarnetdb, so thegettersfile has all the dependencies set to read the game status.
git clone https://github.com/bocha-io/garnetutils
cd garnetutils
make buildThe garnetutils binary will be located at garnetutils/build.
- Add all the possible mud types. (Right now it only supports the types that we are using in our games).
- Add support for MUD modules.
- WIP: Add a solidity transpiler for the validation and prediction of the systems implemented by the user in MUD.
It generates helpers and predictions for your MUD contracts
There are some limitations:
- You can not use Conditionals in solidity, you must use If statements.
- You can not use init an array in the same line, you need to declare it and set position by position.
- Your functions must have unique names.
- Your structs must be declared inside the contract definition.
- The first character of every function that you want to optimistically predict must be uppercased.
garnetutils alpha -i ../eternal-legends-garnet/contracts-builder/contracts -o /tmp/garnetgenerated/