Skip to content

Releases: onflow/flow-cadut

Improved Interactions

08 Oct 17:02
3564459
Compare
Choose a tag to compare

There are several improvements to interactions - specifically it's possible to return raw values from executeScript and wait for specific status on transaction.

Improved Argument Resolver and Code Splitting

05 Oct 14:18
Compare
Choose a tag to compare

⭐ Argument Resolver Updated

For this version we overhauled how complex arguments are being resolved. So now it's possible to pass an array of dictionaries and it will be properly resolved according to it's types.

⭐ Generator logic isolated

We isolated generator logic into a submodule, which should reduce amount of build errors, when flow-cadut is included as dependency.

Big thanks to @jciruolo for bringing his case and working on package improvements!

Contract Init Arguments

22 Sep 22:56
44b9432
Compare
Choose a tag to compare

Parser now support extraction of arguments for contract initializer:

  const code = `
      pub contract Hello{
          init(a: String, b: Int) {
              log(a)
              log(b)
          }
      }
   `
  const params = await extractContractParameters(code);
  
  /* params now contains object
      {
          contractName: "Hello",
          args: "a: String, b: Int"
      }
  */ 

Fixed Arguments Parser

22 Sep 11:27
Compare
Choose a tag to compare

Arguments Parser

There was a minor issue with arguments parser, due to which parser could incorrectly process template. This release includes fixes for this.

Multiline Arguments and Optionals

20 Sep 16:27
9c050e8
Compare
Choose a tag to compare

⭐ Multiline Arguments

Parser now supports multiline arguments for scripts and transactions. Code like this will work properly now:

transaction(
    a: UInt,
    b: UInt,
    sum: UInt){

   prepare(signer: AuthAccount){
       assert(a + b == sum, "wrong!")
   }
}

## ⭐ Added support for Optionals
Optional types are now supported with methods `mapArgument`, `mapArguments` and `mapValuesToCode`. 
```javascript
import { query } from "@onflow/fcl";
import { mapValuesToCode } from "flow-cadut";

(async ()=>{
   const cadence = `
       pub fun main(message: String?): String?{
           return message
       }
   `
   const args = () => mapValuesToCode(["Hello, Cadence"])
   // or you can pass "null" for empty value
   // const args = () => mapValuesToCode([null])

   const result = await query({ cadence, args})
   console.log({result})
})()

Improved Complex Type Support

26 Jul 19:05
57cfe79
Compare
Choose a tag to compare

This update fixes several issues with complex types - Dictionaries and Arrays - and provides better test coverage for methods, responsible for parsing and argument resolving.

Major Refactoring

26 Jun 22:55
a51bbf6
Compare
Choose a tag to compare

⭐️ GitHub Repositories

flow-generate now supports GitHub repositories. Grab a url from your browser, which points to your repo, branch and/or folder - for, example here's one for Flow core-contracts - pass it as first argument in CLI call (or specify -i / --input flag) and press enter!

flow-generate https://github.com/onflow/flow-core-contracts/tree/master/contracts ./src/generated

⭐️ Contract Templates Support

This version will also properly treat contract templates, creating deploy methods for you and properly exporting them.

⭐️ No Testing Dependency

We've cleaned up the code and removed dependency on flow-js-testing, making it's easier to maintain and import into your projects.

Update argument matchers

10 Jun 23:26
Compare
Choose a tag to compare

Fixed Arguments Matchers

In previous version it was possible that regexp matchers, adjusted to catch transaction and script arguments would report false positive result encountering transaction keyword in the comments. We have fixed them and now they shall behave properly.

Map Arguments

09 Jun 23:36
1e4344b
Compare
Choose a tag to compare

Added argument mappers

mapArgument, mapArguments and mapValuesToCode are added to a list of exported methods.

Unused imports

03 Jun 00:08
bc17249
Compare
Choose a tag to compare

Remove reportMissing method import from templates.
This was triggering linter to throw an error. Now it's fixed!