An SDK to work with weiroll scripting to generate bytecode for automated workflows. The repo is built by taking inspiration from experimental version of optimisim drippie mentioned here at repo by KelvinFitcher
npm i --save-dev brah-weiroll-sdk
(or)
yarn add -D brah-weiroll-sdk
Setup primarily requires 2 config files that are defined to comply with their interfaces -
-
Main config
- File name:
brah-weiroll.config.json
- Location: Directory root
- Definition:
interface ConfigFile { abiKey?: string; /// key pointing to contract abi, if the JSON file containing ABI has other data as well contracts: string; /// string path to contracts Config useForge: boolean; /// true or false to use forge file structure (abi will be read from ./out folder) }
- File name:
-
Contracts Config
- File name: Can be arbitrary, but matching the
contracts
key onbrah-weiroll.config.json
- Location: Can be arbitrary, but matching the
contracts
key onbrah-weiroll.config.json
- Definition:
interface ContractsConfig { [key: string]: { /// name of contract address: string; /// contract address abi?: string; /// string path to file containing contract abi (not required if useForge: true) }; }
- NOTE: This must contain address and abi to a 'Helper.sol' contract
- File name: Can be arbitrary, but matching the
-
Instantiate VM object using
import {BrahVM} from "brah-weiroll-sdk"; const vm = new BrahVM();
-
Import contracts and add functions to planner as required. Refer to sample implementation
-
Compile VM using
vm.compile(true);
if the plan's bytecode is to be printed to STDOUT.
otherwise,
vm.compile();