/purescript-web3-generator

A code generation tool for purescript-web3

Primary LanguagePureScriptApache License 2.0Apache-2.0

purescript-web3-generator

Latest release purescript-web3-generator on Pursuit Build status

Generats purescript modules from Solidity ABIs

Requirements

  • npm

Getting Started

> git clone
> cd purescript-web3-generator
> npm install
> npm run build
> npm run test

How to use it

For a complete example that follows the steps below, see purescript-web3-example.

We use purescript-web3-generator in the absence of template-purescript. Suggested usage is as follows:

  1. Create a directory generator/ in your project with a file that looks like this
module Generator where

import Data.GeneratorMain (generatorMain)

main = generatorMain
  1. From there, add a build step
pulp run -m Generator --src-path generator -- --abis <abis> --dest src --module Contracts

(note that we specify both a different source directory than src and a different module Generator that purs is looking for main in)

Until this issue is fixed, we have to temporarily replace the step above with something like this

pulp build -m Generator --src-path generator --to generator.js
node generator.js --abis <abis> --dest src --module Contracts
rm generator.js
  1. Now you should have created contract modules for each contract into your src/Contracts directory that your code can depend on. you could use --module MyApp.Contracts for example too and it will result in modules created in src/MyApp/Contracts

Documentation

Module documentation is published on Pursuit.

Resources