Multiline Arguments and Optionals
⭐ 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})
})()