go-with-the-flow icon indicating copy to clipboard operation
go-with-the-flow copied to clipboard

v3

Open bjartek opened this issue 3 years ago • 3 comments

Plans for v3 are:

Refactors:

  • control what env to deploy to using an ENV var if you use gwtf.NewGoWithTHeFlowFromEnv
  • read in transactions/script and parse them so that we know the name of the arguments
  • create a subbuilder under Script/Transaction Arguments that unite all the arguments code
  • make Arguments Key Value pair to make it easier to avoid mistakes. (order the arguments in the correct order based on what is in the script/transaction)

New Features:

  • create code to generate this https://github.com/portto/flow-transactions
  • create code to generate the same as https://www.npmjs.com/package/cadence-to-json
  • create code that generate a folder that will make it easier to deploy to mainnet with build/user-sign/finalize scripts
  • twitter bot in adition to discord
  • integrate with profile contract to fetch discord handle/twitter handle

Maybe:

  • generate go code from transactions/scripts that are typed correctly.

Integrate as much as gwtf into flowkit

bjartek avatar Oct 17 '21 19:10 bjartek

Really exciting stuff here. Here are three things that threw me off a little with v2 which maybe could be easy fixes as part of v3 (bare with me as go is not my main language):

Refactors:

  • don't hard code ./transactions/%s (in https://github.com/bjartek/go-with-the-flow/blob/main/gwtf/transaction.go#L271) and ./scripts/%s (in https://github.com/bjartek/go-with-the-flow/blob/main/gwtf/script.go#L200) to allow for other folder structures (e.g. this one :
    .
    ├── cadence
    │   ├── contracts
    │   ├── transactions
    │   ├── scripts
    └── tasks
    
  • don't hardcode "emulator-account" in https://github.com/bjartek/go-with-the-flow/blob/main/gwtf/setup.go#L26-L28 to allow for users that rename their "emulator-account" as "0x01" or any other name
  • also I'm not sure I understood why we have to put the tests at the same level than flow.json (see https://github.com/bjartek/go-with-the-flow/blob/main/examples/transaction_integration_test.go#L15 ), is that something that comes from the testing library?

louisguitton avatar Nov 30 '21 19:11 louisguitton

Really good points!

The plan for setting up GWTF is to use a builder style pattern and I can include options to override the hardcoded paths.

The reason the test files have to be in the root folder is also in order to have access to a flow.json file that is in that same folder, but if we add a builder option for that it would solve that issue as well.

bjartek avatar Nov 30 '21 19:11 bjartek

Thanks for this awesome tool Bjartek, the key value pairs would be a great addition. I was imagining something like this, (I'm from JS land), or some variation of this...

output := flow.TransationFromFile = {
   UFix64 : 100.00,
   SignProposeAs: "first",
   AccountArgument: "second"
}

I think it would perhaps be more intuitive if when passing arguments for transactions or scripts, the type matches the type in cadence whereas currently it always requires a string. For example:

UFix64Argument("100.00") could instead be UFix64Argument(100.00) this means the code will be more understandable at a glance as the go syntax highlighting will be in full force. This would also be nice as you could pass in dynamic variables of types other than a string. If they do not match the type required, an error for this case.

Another awesome thing would for the emulator in memory to output what is inlog() in a transaction or script file. currently it does not, this would be helpful for more granular debugging.

0xmovses avatar Nov 30 '21 20:11 0xmovses