Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Liquifier: A tool to parse Solidity.json contracts #82

Closed
wants to merge 12 commits into from
Closed

Liquifier: A tool to parse Solidity.json contracts #82

wants to merge 12 commits into from

Conversation

moshmage
Copy link
Contributor

@moshmage moshmage commented Jun 3, 2021

Bounty
#72 Integrate Automated Javascript Class creation based on Solidity Class

Describe the solution
Introduces a cli tool, liquifier, that parses the provided Abi object from the solidity json file, filters out the functions and creates the corresponding javascript class with dummy function body that calls __sendTx on the contract method, with the needed arguments.
A basic documentation of the entry params is also created, as well as a interface file.

Preview
image
image

more can be seen by cloning https://github.com/moshmage/bepro-js/tree/feat/liquifier and issuing

$ npm install
$ node liquifier -h

ETH Wallet
0x0e6B6ae33f345E1CbAc096a2644f7748F347d218

@moshmage moshmage marked this pull request as draft June 3, 2021 15:19
@moshmage moshmage marked this pull request as ready for review June 3, 2021 15:21
@moshmage moshmage marked this pull request as draft June 3, 2021 22:05
moshmage added 2 commits June 4, 2021 17:24
create new makeConstructorTypeDef
add optional|defaultValue to the docs
@moshmage moshmage marked this pull request as ready for review June 4, 2021 16:33
@moshmage moshmage marked this pull request as draft June 4, 2021 16:42
@moshmage moshmage marked this pull request as ready for review June 4, 2021 17:00
liquifier.js Outdated
.demandOption([`f`,])
.help(`h`)
.alias(`h`, `help`)
// .epilog('copyright bepro')
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can delete this line

liquifier.js Outdated
// .epilog('copyright bepro')
.argv;

// **
Copy link

@riaje riaje Jun 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused line (maybe it's volunteer, you have an other one line 34)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the help @riaje, great to have you here! :)

@Ruiub3i
Copy link
Contributor

Ruiub3i commented Jun 9, 2021

  1. @moshmage Please add a package.json command to run this
  2. Please let me know the expected result for functions already existent (does this overwrite? ) - as it shound´t overwrite
  3. Any action that should take in consideration to change in our "how to developer a feature" in gitbook?

@moshmage moshmage marked this pull request as draft June 9, 2021 13:54
@moshmage
Copy link
Contributor Author

moshmage commented Jun 9, 2021

@Ruiub3i

Please let me know the expected result for functions already existent (does this overwrite? ) - as it shound´t overwrite

This tool has a --override flag that will override THE ENTIRE FILE if the output file exists, this flag is false by default and the program will output something like could not output to [output/file] because no override flag was provided

more options,

Options:
      --version        Show version number                             [boolean]
  -f, --file           File to parse                                  [required]
  -d, --dir            Output dir                                [default: "./"]
  -i, --interface-dir  Folder to create the interface file on
                                                  [default: "./src/interfaces/"]
  -o, --override       Override existing output file on -d
                                                      [boolean] [default: false]
  -s, --showoff        Dry run                        [boolean] [default: false]
  -S, --SHOWOFF        Dry run with show source at the end
                                                      [boolean] [default: false]
  -v, --verbose        Blablabla blabla, bla blaa!    [boolean] [default: false]
  -h, --help           Show help                                       [boolean]

Please add a package.json command to run this

Will do, but calling this from npm will look like this: npm run liquifier -- [flags] (pex: npm run liquifier -- -f path/to/file)


Any action that should take in consideration to change in our "how to developer a feature" in gitbook?

Replace step 2 and 3 for something along the lines of

2 - Liquefy your solidity contract by issuing npm run liquifier -- -f ./build/contracts/X.json -d ./src/models/
3 - Edit the output of the file as needed

@Ruiub3i
Copy link
Contributor

Ruiub3i commented Jun 9, 2021

Memo (Add to Gitbook how to)

2 - Liquefy your solidity contract by issuing npm run liquifier -- -f ./build/contracts/X.json -d ./src/models/
3 - Edit the output of the file as needed

@Ruiub3i
Copy link
Contributor

Ruiub3i commented Jun 9, 2021

Add this information into the README.md also @moshmage in a section about what is the liquifier and how you should use it.

After that we are good

Also please confirm the "npm run build" command doesn't run the liquifier automatically

@Ruiub3i
Copy link
Contributor

Ruiub3i commented Jun 9, 2021

Also @moshmage can we add functionalities to the liquifier to do the steps 4,5 & 6 (unit tests setup) to speed up the skeleton of those files & imports

@moshmage
Copy link
Contributor Author

Also @moshmage can we add functionalities to the liquifier to do the steps 4,5 & 6 (unit tests setup) to speed up the skeleton of those files & imports

We can, but in a new issue as that goes outside of the scope of the bounty

Bounty
#72 Integrate Automated Javascript Class creation based on Solidity Class

Not only that, but some structural refactor must happen and I'd like to have that discussed before starting that work

Add this information into the README.md also @moshmage in a section about what is the liquifier and how you should use it.

Will do

Also please confirm the "npm run build" command doesn't run the liquifier automatically

It doesn't, there's isn't even a connection from npm run build to npm run liquifier

change -o description to match its usage
@moshmage moshmage marked this pull request as ready for review June 10, 2021 15:22
@moshmage moshmage requested a review from Ruiub3i June 10, 2021 15:22
Copy link
Contributor

@Ruiub3i Ruiub3i left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good

@Ruiub3i
Copy link
Contributor

Ruiub3i commented Jun 26, 2021

@moshmage just need to add this to our gitbook, but the rest is all ok

@moshmage moshmage closed this Jan 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants