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

Broken flow.json when deploying contract with [String] as init arg #1352

Closed
sisyphusSmiling opened this issue Jan 18, 2024 · 1 comment
Closed
Assignees
Labels
Bug The issue represents a bug, malfunction, regression

Comments

@sisyphusSmiling
Copy link
Contributor

Problem

Whenever using CLI to deploy a contract with an array of String in init args - e.g. init(_ a: [String]) - deployment succeeds but the init args as defined in the flow.json break the config file.

Steps to Reproduce

Init project:

flow init

Add the contract

access(all) contract C {
    access(all) let arr: [String]
    init(arr: [String]) {
        self.arr = arr
    }
}

Run emulator and deploy the contract with

flow accounts add-contract ./contracts/C.cdc '["a", "b"]'

Try to run any other CLI command and get

❌ Config Error: failed to decode JSON-Cadence value: invalid type: [String]

Looking at the flow.json, we see

{
	"name": "C",
	"args": [
		{
			"type": "[String]",
			"value": "[a b]"
		}
	]
}

Which should be

{
	"name": "C",
	"args": [
		{
			"type": "Array",
			"value": [
				{
					"type": "String",
					"value": "a"
				},
				{
					"type": "String",
					"value": "b"
				}
			]
		}
	]
}
@chasefleming chasefleming added Bug The issue represents a bug, malfunction, regression and removed Feedback labels Feb 8, 2024
@chasefleming chasefleming moved this to 🔖 Ready for Pickup in 🌊 Flow 4D Feb 8, 2024
@jribbink jribbink assigned jribbink and unassigned ianthpun May 3, 2024
@jribbink jribbink moved this from 🔖 Ready for Pickup to 👀 In Review in 🌊 Flow 4D May 3, 2024
@jribbink
Copy link
Contributor

jribbink commented May 3, 2024

This will be fixed by updating to the next flowkit release.

@jribbink jribbink moved this from 👀 In Review to ✅ Done in 🌊 Flow 4D May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug The issue represents a bug, malfunction, regression
Projects
Archived in project
Development

No branches or pull requests

4 participants