flow-cadut icon indicating copy to clipboard operation
flow-cadut copied to clipboard

Add support of AnyStruct type as arguments

Open ObjectPlayer opened this issue 3 years ago • 1 comments

Support for AnyStruct as arg in transactions and scripts

Hey Team, I am working on flow testcases in js using flow-js-testing library. I am trying to pass AnyStruct as an argument for my transactions and scripts but I am unable to pass it and getting some errors.

I have passed AnyStruct as dictionary as: transaction(data:{String:AnyStruct})

than I got following error: image

Also I have passed AnyStruct as an argument directly as: transaction(data:AnyStruct)

than I got this error: image

After debugging the my code and node_modules libraries, I got that flow-js-testing is using flow-cadut.
flow-cadut has a resolveArguments method at args.js file which resolve and validate arguments, but it doesn't seem to support AnyStruct for now.

Issue To Be Solved

To solve this issue, we need to support AnyStruct as an argument of transaction and script.

Suggest A Solution

In type-checker.js we can add a new type-checker method for AnyStruct than we can use that method in args.js and relevant files to support AnyStruct. It is not complete solution but we can work on that and add support to AnyStruct as an argument.

Let me know if it is supported already or work in progress to support it.

Thanks

ObjectPlayer avatar Jun 07 '22 08:06 ObjectPlayer

Responded on the associated FCL Issue: https://github.com/onflow/fcl-js/issues/1237#issuecomment-1150238091

JeffreyDoyle avatar Jun 08 '22 18:06 JeffreyDoyle