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

Panic when parsing argument #121

Closed
bjartek opened this issue Jun 15, 2023 · 3 comments · Fixed by #162
Closed

Panic when parsing argument #121

bjartek opened this issue Jun 15, 2023 · 3 comments · Fixed by #162
Assignees

Comments

@bjartek
Copy link
Owner

bjartek commented Jun 15, 2023

The goal of this task is to make the following code in overflow more robust and tested.

[1]

func (o *OverflowState) parseArguments(fileName string, code []byte, inputArgs map[string]interface{}) ([]cadence.Value, CadenceArguments, error) {

Cadence is an interpreted language and a transactions head looks like this

transaction(numberArg:UInt64, anotherNumberArg:Int64, stringArgument:String, charArgument:Character)

When sending in arguments we collect them as a map of string to interface{}.

Some corner cases:

  • there are many numeric types in cadence (cadence-lang.org) but we would like a simple number in go to work for all of them. So in the above example if i send in 42 to either numberArg or anotherNumberArg i want them to both work.
  • atm we have to use overflow.WithAddress to handle sending in an address as a string resolving from flowkit.State

Bonus:

  • support sending in arguments as cadence argument json spec from the onflow/flow-cli repo as an alternative

DoD:
There is a method to parse arguments into a result object

@bjartek
Copy link
Owner Author

bjartek commented May 14, 2024

The end goal of this task is to be able to avoid having to use complicated logic/code to create input arguments to cadence transactions/scripts.

Stuff that should be handled is:

  • arrays of addresses
  • dictionaries with Address values

The code is also pretty complicated, can it be simplified? do we need to convert to sema type?

Atm the result is also 3 values, we want NamedArguments to make them easier to print out, could this be handled differently?

@bjartek bjartek self-assigned this Jun 11, 2024
@bjartek
Copy link
Owner Author

bjartek commented Jun 13, 2024

requires bjartek/underflow#10

@bjartek
Copy link
Owner Author

bjartek commented Jun 14, 2024

underflow merged.

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 a pull request may close this issue.

1 participant