Update an existing contract deployed to a Flow account using the Flow CLI.
1flow accounts update-contract <filename> [<argument> <argument>...] [flags]
⚠️ Deprecation notice: using name argument in update contract command will be deprecated soon.
1flow accounts update-contract <name> <filename> [<argument> <argument>...] [flags]
1> flow accounts update-contract ./FungibleToken.cdc23Contract 'FungibleToken' updated on account '0xf8d6e0586b0a20c7'45Address 0xf8d6e0586b0a20c76Balance 99999999999.700000007Keys 189Key 0 Public Key 640a5a359bf3536d15192f18d872d57c98a96cb871b92b70cecb0739c2d5c37b4be12548d3526933c2cda9b0b9c69412f45ffb6b85b6840d8569d969fe84e5b710Weight 100011Signature Algorithm ECDSA_P25612Hash Algorithm SHA3_25613Revoked false14Sequence Number 615Index 01617Contracts Deployed: 118Contract: 'FungibleToken'
Testnet Example
1> flow accounts update-contract ./FungibleToken.cdc --signer alice --network testnet23Contract 'FungibleToken' updated on account '0xf8d6e0586b0a20c7'45Address 0xf8d6e0586b0a20c76Balance 99999999999.700000007Keys 189Key 0 Public Key 640a5a359bf3536d15192f18d872d57c98a96cb871b92b70cecb0739c2d5c37b4be12548d3526933c2cda9b0b9c69412f45ffb6b85b6840d8569d969fe84e5b710Weight 100011Signature Algorithm ECDSA_P25612Hash Algorithm SHA3_25613Revoked false14Sequence Number 615Index 01617Contracts Deployed: 118Contract: 'FungibleToken'
Make sure alice account is defined in flow.json
- Name:
name
- Valid inputs: Any string value
Name of the contract as it is defined in the contract source code.
⚠️ Deprecation notice: use filename argument only, no need to use name argument.
- Name:
filename
- Valid inputs: Any filename and path valid on the system.
Filename of the file containing contract source code.
- Name:
argument
- Valid inputs: valid cadence values matching argument type in transaction code.
Input arguments values matching corresponding types in the source code and passed in the same order.
Example:
1> flow accounts update-contract ./contract.cdc Hello 2
Transaction code:
1pub contract HelloWorld {2init(a:String, b:Int) {3}4}
- Flag:
--signer
- Valid inputs: the name of an account defined in the configuration (
flow.json
)
Specify the name of the account that will be used to sign the transaction.
- Flag:
--args-json
- Valid inputs: arguments in JSON-Cadence form.
- Example:
flow accounts update-contract ./tx.cdc '[{"type": "String", "value": "Hello"}]'
Arguments passed to the Cadence transaction in Cadence JSON format.
Cadence JSON format contains type
and value
keys and is
documented here.
- Flag:
--include
- Valid inputs:
contracts
Specify fields to include in the result output. Applies only to the text output.
- Flag:
--host
- Valid inputs: an IP address or hostname.
- Default:
127.0.0.1:3569
(Flow Emulator)
Specify the hostname of the Access API that will be
used to execute the command. This flag overrides
any host defined by the --network
flag.
- Flag:
--network-key
- Valid inputs: A valid network public key of the host in hex string format
Specify the network public key of the Access API that will be used to create a secure GRPC client when executing the command.
- Flag:
--network
- Short Flag:
-n
- Valid inputs: the name of a network defined in the configuration (
flow.json
) - Default:
emulator
Specify which network you want the command to use for execution.
- Flag:
--filter
- Short Flag:
-x
- Valid inputs: a case-sensitive name of the result property
Specify any property name from the result you want to return as the only value.
- Flag:
--output
- Short Flag:
-o
- Valid inputs:
json
,inline
Specify the format of the command results.
- Flag:
--save
- Short Flag:
-s
- Valid inputs: a path in the current filesystem
Specify the filename where you want the result to be saved
- Flag:
--log
- Short Flag:
-l
- Valid inputs:
none
,error
,debug
- Default:
info
Specify the log level. Control how much output you want to see during command execution.
- Flag:
--config-path
- Short Flag:
-f
- Valid inputs: a path in the current filesystem
- Default:
flow.json
Specify the path to the flow.json
configuration file.
You can use the -f
flag multiple times to merge
several configuration files.
- Flag:
--skip-version-check
- Default:
false
Skip version check during start up to speed up process for slow connections.