onflow / onflow/flow-cli

Support contract initializitation arguments with `flow dev`

Open
#964 3 comments 0 reactions 1 assignee View on GitHub

@devbugging is already working on this.

Since Apr 5, 2023.

Feature Feedback
Dominant language
Go
Stars
209
Forks
87
Avg merge
1d 17h
Merged PRs (30d)
3

Description

Currently, contract initialization parameters are not supported in flow.json. If you try to use flow dev with a contract that has init params, you'll get this error:

Deploying a contract failed because it requires initialization arguments. We currently don't support passing initialization arguments, so we suggest you hardcode the initialization arguments in the init function to be used during development.

There is a corresponding TODO item in the code:

https://github.com/onflow/flow-cli/blob/9cf919d34f6684c483fc68307753fcdb7401f5d2/internal/super/output.go#L120-L126

We probably need to change the syntax of deployments section to support arguments per contract deployed. Using deployments has the benefit of deploying multiple instances of the same contract using different param sets.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.