Generats purescript modules from Solidity ABIs
npm
psc-package
> git clone
> cd purescript-web3-generator
> npm install
> pulp build
> pulp test
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:
- Create a directory
generator/
in your project with a file that looks like this
module Generator where
import Data.GeneratorMain (generatorMain)
main = generatorMain
- From there, add a build step
pulp -m Generator --src-path generator run -- --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 -m Generator --src-path generator build --to generator.js
node generator.js --abis <abis> --dest src --module Contracts ...
rm generator.js
- 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 insrc/MyApp/Contracts
Module documentation is published on Pursuit.