Releases: onflow/flow-cli
Version 0.24.1
⬆️ Install or Upgrade
Follow the Flow CLI installation guide for instructions on how to install or upgrade the CLI.
🐞 Bug Fixes
VSCode Update (#304) @sideninja
Version 0.24.0
⬆️ Install or Upgrade
Follow the Flow CLI installation guide for instructions on how to install or upgrade the CLI.
💥 Breaking Changes
Cadence and Language Server Update
Cadence was updated to version 0.18.0 and the language server to version 0.18.2 which implements the breaking changes from flowkit library.
FlowKit API Changes
CLI implements a flowkit utility library that can be reused in other services. This is early-stage development and the API for this library was refactored and improved.
⭐ Features
Decode PEM Public Key
New command for decoding PEM encoded public key. You can use the decoding command like so:
flow keys decode pem --from-file key.pem
Public Key d479b3cdc9edbddb195cb12b35161ade826b032a64bdd4062cc87fb3ba7e71c9cf646ff23990bb4532ca45c445c7e908cef278b2c4615360039a6660a366a95f
Signature algorithm ECDSA_P256
Revoked false
🎉 Improvements
Validate Configuration
Configuration validation has been improved and will provide better feedback when there are wrong values set in the flow.json
.
Updated Cobra
Cobra library was updated to the latest version.
Refactored Testing
The testing suite was completely refactored and improved which will provide better code coverage and more reliable codebase.
🐞 Bug Fixes
Refactored Event Display
Events output on the transaction command was refactored, so it better handles special values in the events.
Flow Init Warning
Flow init command incorrectly displayed a warning which is now removed.
Transaction IDs Output
All commands that send transactions to the network now display that transaction ID for better visibility.
Version 0.23.0
⬆️ Install or Upgrade
Follow the Flow CLI installation guide for instructions on how to install or upgrade the CLI.
💥 Breaking Changes
Update Emulator Version
The emulator version was updated to v0.23.0 with Cadence v0.18.0
Version 0.22.0
⬆️ Install or Upgrade
Follow the Flow CLI installation guide for instructions on how to install or upgrade the CLI.
💥 Breaking Changes
Update Emulator Version
The emulator version was updated to v0.20.3 with Cadence v0.17.0. The latest emulator version requires transaction domain tags.
🛠 Improvements
Log Transaction ID
All commands that send transactions now include the transaction ID in the log.
Version 0.21.0
⬆️ Install or Upgrade
Follow the Flow CLI installation guide for instructions on how to install or upgrade the CLI.
💥 Breaking Changes
Flow Go SDK Update
Update Flow Go SDK version from v0.19.0 to v0.20.0.
Read more about the new version in the release notes.
⭐ Features
New Command To Manage Configuration
Add or remove resources from the configuration using the new flow config
command.
Usage is possible via interactive prompt or by using flags. Command syntax is as follows:
flow config <add|remove> <account|contract|deployment|network>
Example for adding an account to the config via interactive prompt:
Name: Foo
Address: f8d6e0586b0a20c7
✔ ECDSA_P256
✔ SHA3_256
Private key: 1286...01afc
Key index (Default: 0): 0
Account Foo added to the configuration
Example for adding an account to the config without interactive prompt:
./main config add account --address f8d6e0586b0a20c7 --name Foo --private-key 1286...01afc
Account Foo added to the configuration
We recommend using manage command to do any changes in the configuration as it will also
validate input values for you and will abstract any changes in the configuration format.
Decode Keys
Command for decoding public keys in the RLP encoded format.
Example of using the command:
> flow keys decode f847b84084d716c14b051ad6b001624f738f5d302636e6b07cc75e4530af7776a4368a2b586dbefc0564ee28384c2696f178cbed52e62811bcc9ecb59568c996d342db2402038203e8
Public Key 84d716c14b051ad6b001624f738f5d302636e6b07cc75e4530af7776a4368a2b586dbefc0564ee28384c2696f178cbed52e62811bcc9ecb59568c996d342db24
Signature algorithm ECDSA_P256
Hash algorithm SHA3_256
Weight 1000
Revoked false
🎉 Improvements
Include And Exclude Flags
Include and Exclude flags were added to the transaction and account resource thus
allowing you to further specify verbosity of the output.
Documentation Changes
Multiple reported documentation fixes.
🐞 Bug Fixes
Import Detection Fix
Fix for a reported bug: An error occurs when executing a script that imports a built-in contract (Crypto contract) with Flow CLI command.
Version 0.20.2
⬆️ Install or Upgrade
Follow the Flow CLI installation guide for instructions on how to install or upgrade the CLI.
⭐ Features
New Gas Limit Flag
Gas limit flag --gas-limit
was added to flow transactions send
and flow transactions build
. You can now use this flag to specify a non-default value for transaction gas.
🐞 Bug Fixes
JSON output format
Fixes invalid JSON outputs for Cadence values. Cadence values are now being serialized using Cadence serializer and results look like this:
{
"type":"Array",
"value":[
{
"type":"Struct",
"value":{
"id":"s.1cdf99881a58658ba683b6a52fee13cfdfddf61b9ff1d25d2109a5c7628642e4.SomeStruct",
"fields":[{
"name":"value",
"value":{
"type":"Int",
"value":"2"
}
},{
"name":"name",
"value":{
"type":"String",
"value":"Foo"
}
},{
"name":"owner",
"value":{
"type":"Address",
"value":"0x0000000000000001"
}
}
]
}
}
]
}
or for simple case:
{"type":"Address","value":"0x0000000000000001"}
CLI Library bugfix
CLI library "send with address and code" function was fixed.
Documentation Updates
Minor documentation fixes.
🛠 Improvements
- Update cadence/languageserver to v0.15.2
- Update to Go SDK v0.19.0
- Increase grpc max message size to 16MB
Version 0.19.0
⬆️ Install or Upgrade
Follow the Flow CLI installation guide for instructions on how to install or upgrade the CLI.
⭐ Features
Project Deployment with Contract Initialization Arguments
Project deployment was improved, and it now supports providing initialization arguments during the deployment of contracts. It is easy to specify all the arguments in the configuration like so:
// flow.json
{
// ...
"contracts": {
"Foo": "./Foo.cdc",
"Bar": "./Bar.cdc"
},
"deployments": {
"testnet": {
"my-testnet-account": [
"Foo", // deploy with no arguments
{
"name": "Bar",
"args": [
{ "type": "String", "value": "Hello World" },
{ "type": "UInt32", "value": "10" }
]
}
]
}
}
// ...
}
Network Status Command
The network status command allows you to query the status of each network and see if the network is available.
Example:
> flow status --network testnet
Status: 🟢 ONLINE
Network: testnet
Access Node: access.devnet.nodes.onflow.org:9000
Global Configuration
Flow CLI now supports global configuration which is a flow.json
file saved in your home directory and loaded as the first configuration file wherever you execute the CLI command.
You can generate a global configuration using the --global
flag.
Command example: flow init --global
.
Global flow configuration is saved as:
- macOS:
~/flow.json
- Linux:
~/flow.json
- Windows:
C:\Users\$USER\flow.json
You can read more about it in the docs.
Environment File Support
The CLI will load environment variables defined in the .env
file in the active directory, if one exists. These variables can be substituted inside the flow.json
, just like any other environment variable.
Example .env
file:
PRIVATE_KEY=123
// flow.json
{
// ...
"accounts": {
"my-testnet-account": {
"address": "3ae53cb6e3f42a79",
"keys": "${PRIVATE_KEY}"
}
}
// ...
}
🎉 Improvements
Default Network Without Configuration
Default network is provided even if no configuration is present which allows you to use the CLI on even more commands without the requirement of having a configuration pre-initialized.
Chain ID Removed
Chain ID property was removed from the configuration as it is not needed anymore.
With this improvement, the new configuration is less complex and shorter.
Send Signed Progress
Send signed transaction now includes progress output the same way as sending transaction command does.
🐞 Bug Fixes
Keys Generate JSON output
Keys generation output in JSON format was fixed and it now shows correctly private and public keys.
Account Key Index When Sending Transactions
Account key index is now fetched from the configuration and it doesn't default to 0 anymore.
Transaction Boolean Argument
The transaction boolean argument wasn't parsed correctly when passed in comma split format.
JSON Outputs Fixes
JSON output format was not working properly for some commands.
Version 0.18.0
⬆️ Install or Upgrade
Follow the Flow CLI installation guide for instructions on how to install or upgrade the CLI.
⭐ Features
Resolve Contract Imports in Scripts and Transactions
This is a new feature that allows you to send transactions and scripts that reference
contracts deployed using the project deploy
command. Imports are resolved
by matching contract source paths to their declarations in flow.json
.
For example:
Example script: get_supply.cdc
import Kibble from "../../contracts/Kibble.cdc"
pub fun main(): UFix64 {
let supply = Kibble.totalSupply
return supply
}
Example command:
flow scripts execute ./get_supply.cdc
Note: Please make sure you first deploy the contract using flow project deploy
command and that contracts are correctly added to the flow configuration.
Build, Sign and Send Transactions
New functionality allows you to build a transaction, sign it
and send signed to the network in separated steps.
Build Transaction
Build new transaction and specify who will be the proposer, signer and payer account
or address. Example:
flow transactions build ./transaction.cdc --proposer alice --payer bob --authorizer bob --filter payload --save payload1.rlp
Check more about this functionality in docs.
Sign Transaction
After using build command and saving payload to a file you should sign the transaction
with each account. Example:
flow transactions sign ./payload1.rlp --signer alice --filter payload --save payload2.rlp
Send Signed Transaction
When authorizer, payer and proposer sign the transaction it is ready to be
sent to the network. Anyone can execute the send-signed
command. Example:
flow transactions send-signed ./payload3.rlp
Version Check
Automatically checks if a new version exists and outputs a warning in case there
is a newer version. Example:
⚠️ Version Warning: New version v0.18.0 of Flow CLI is available.
Follow the Flow CLI installation guide for instructions on how to install or upgrade the CLI: https://docs.onflow.org/flow-cli/install
Create Account With Multiple Keys and Weights
Account creation can be done using multiple keys (--key
) and new --key-weight
flag. Flag enables you to set key weight for each of the keys. Command example:
accounts create \
--key ca8cc7...76f67 --key-weight 500 \
--key da8123...043ce --key-weight 500
Address 0x179b6b1cb6755e31
Balance 0.10000000
Keys 2
Key 0 Public Key ca8cc7...76f67
Weight 500
Signature Algorithm ECDSA_P256
Hash Algorithm SHA3_256
Revoked false
Sequence Number 0
Index 0
Key 1 Public Key da8123...043ce
Weight 500
Signature Algorithm ECDSA_P256
Hash Algorithm SHA3_256
Revoked false
Sequence Number 0
Index 1
🎉 Improvements
Account Response Improved
Account response includes two new fields in key section: Sequence Number
and Index
.
Transaction Result Improved
Transaction result displays more information about the transaction. New format example:
Status ✅ SEALED
ID b6430b35ba23849a8acb4fa1a4a1d5cce3ed4589111ecbb3984de1b6bd1ba39e
Payer a2c4941b5f3c7151
Authorizers [a2c4941b5f3c7151]
Proposal Key:
Address a2c4941b5f3c7151
Index 0
Sequence 9
No Payload Signatures
Envelope Signature 0:
Address a2c4941b5f3c7151
Signature 5391a6fed0fe...2742048166f9d5c925a8dcb78a6d8c710921d67
Key Index 0
Events: None
Arguments (1):
- Argument 0: {"type":"String","value":"Meow"}
Code
transaction(greeting: String) {
let guest: Address
prepare(authorizer: AuthAccount) {
self.guest = authorizer.address
}
execute {
log(greeting.concat(",").concat(self.guest.toString()))
}
}
Payload:
f90184f90138...8a9462751237da2742048166f9d5c925a8dcb78a6d8c710921d67
Transaction error is now shown at the top of the result.
Transaction 0dd6294a7614bc0fbeb39b44a6e9f68e821225caa4baf4104a17dc1193d4f011 sealed
Status: SEALED
Execution Error: Execution failed:
error: invalid move operation for non-resource
--> 0dd6294a7614bc0fbeb39b44a6e9f68e821225caa4baf4104a17dc1193d4f011:15:15
|
15 | useRes(<-result)
| ^^^ unexpected `<-`
error: mismatched types
--> 0dd6294a7614bc0fbeb39b44a6e9f68e821225caa4baf4104a17dc1193d4f011:15:15
|
15 | useRes(<-result)
| ^^^^^^^^ expected `AnyResource`, got `&AnyResource`
Events:
None
🐞 Bug Fixes
New Transaction ID Log
While sending transaction was in progress output displayed wrong transaction ID.
Init Reset Fix
Old configuration format caused an error saying to reset the
configuration using reset flag, but when ran it produced the same error again.
This bug was fixed.
Emulator Config Path
When running emulator command flow emulator
config flag -f
was ignored.
This has been fixed, so you can provide a custom path to the config while running
the start emulator command.
Version 0.17.0
⬆️ Install or Upgrade
Follow the Flow CLI installation guide for instructions on how to install or upgrade the CLI.
💥 Breaking Changes
Configuration Format
The default configuration format (i.e. the contents of flow.json
) has been updated. It is now unified to work with all CLI commands. The new format is not backwards compatible with the old format.
If needed, you can generate a new configuration file with the flow init
command.
Read more about the new configuration format in the documentation.
Cadence Update
Cadence version updated to v0.14.0 - see release notes here
Updated: flow blocks get
The --latest
, --id
and --height
have been removed.
Instead, use the new argument syntax:
# get latest block
flow blocks get latest
# get a block by ID
flow blocks get 6bb0e0fceef9225a3cf9ceb6df9a31bd0063e6ee8e8dd7fdd93b831783243cd3
# get a block by height
flow blocks get 28329914
Read more about this change in the documentation.
Removed: flow keys decode
The flow keys decode
command has been temporarily removed due to a bug that requires further investigation.
Removed: flow keys save
The flow keys save
command has been removed in favour of an upcoming flow accounts add
command.
⚠️ Deprecation Warnings
The following functionality has been deprecated and will be removed in an upcoming release.
flow accounts create
, flow accounts add-contract
, flow accounts remove-contract
, flow accounts update-contract
- Flag
--results
is deprecated, results are displayed by default.
flow accounts get
- Flag
--code
is deprecated, use--contracts
flag instead.
flow events get
- Flag
--verbose
is deprecated.
flow keys generate
- Flag
--algo
is deprecated, use flag--sig-algo
.
flow transactions send
- Flag
--code
is deprecated, use filename argument instead. - Flag
--args
is deprecated, use--arg
or--args-json
instead. - Flag
--results
is deprecated, results are displayed by default.
flow scripts execute
- Flag
--code
is deprecated, use filename argument instead. - Flag
--args
is deprecated, use--arg
or--args-json
instead.
flow transactions status
- This command has been deprecated in favour of
flow transactions get
.
flow project init
- This command has been deprecated in favour of
flow init
.
flow project start-emulator
- This command has been deprecated in favour of
flow emulator
.
flow emulator start
- This command has been deprecated in favour of
flow emulator
.
⭐ Features
Output
Output format was changed, so it stays consistent between commands. New flags were introduced that control the output. Let's take a quick look at the new flags, but make sure to read more about them in the documentation on each command:
- Output:
--output
specify the format of the command results (JSON, inline...), - Save:
--save
specify the filename where you want the result to be saved, - Log:
--log
control how much output you want to see during command execution, - Filter:
--filter
Specify any property name from the result you want to return as the only value.
All the flags and their allowed values are specified for each command in the documentation.
Changed output for fetching account.
Address 179b6b1cb6755e31
Balance 0
Keys 2
Key 0 Public Key c8a2a318b9099cc6...a0fe320dba7
Weight 1000
Signature Algorithm ECDSA_P256
Hash Algorithm SHA3_256
Code
pub contract Foo {
pub var bar: String
init() {
self.bar = "Hello, World!"
}
}
Output account result as JSON.
{"address":"179b6b1cb6755e31","balance":0,"code":"CnB1YiBj...SIKCX0KfQo=","keys":[{"index":0,"publicKey":{},"sigAlgo":2,"hashAlgo":3,"weight":1000,"sequenceNumber":0,"revoked":false}],"Contracts":null}
Improved progress feedback with loaders.
Loading 0x1fd892083b3e2a4c...⠼
Shared Library
You can import Flow CLI shared library from the flowcli
package and use the functionality
from the service layer in your own software. Codebase was divided into two components, first
is the CLI interaction layer, and the second is the shared library component which is meant
to be reused.
Account Staking Info Command
New command to fetch staking info from the account was added. Read more about it in the
documentation.
> accounts staking-info 535b975637fb6bee --host access.testnet.nodes.onflow.org:9000
Account Staking Info:
ID: "ca00101101010100001011010101010101010101010101011010101010101010"
Initial Weight: 100
Networking Address: "ca00101101010100001011010101010101010101010101011010101010101010"
Networking Key: "ca00101101010100001011010101010101010101010101011010101010101010ca00101101010100001011010101010101010101010101011010101010101010"
Role: 1
Staking Key: "ca00101101010100001011010101010101010101010101011010101010101010ca00101101010100001011010101010101010101010101011010101010101010ca00101101010100001011010101010101010101010101011010101010101010"
Tokens Committed: 0.00000000
Tokens To Unstake: 0.00000000
Tokens Rewarded: 82627.77000000
Tokens Staked: 250000.00000000
Tokens Unstaked: 0.00000000
Tokens Unstaking: 0.00000000
Total Tokens Staked: 250000.00000000
Account Delegation Info:
ID: 7
Tokens Committed: 0.00000000
Tokens To Unstake: 0.00000000
Tokens Rewarded: 30397.81936000
Tokens Staked: 100000.00000000
Tokens Unstaked: 0.00000000
Tokens Unstaking: 0.00000000
🐞 Bug Fixes
Address 0x prefix
Addresses are not required to be prefixed with 0x
anymore. You can use either format, but due to consistency we advise using 0x
prefix with addresses represented in hex
format.
Project deploy error
Deploying contract provides improved error handling in case something goes wrong you can now read what the error was right from the command line.
Example of error output:
Deploying 2 contracts for accounts: emulator-account
❌ contract Kibble is already deployed to this account. Use the --update flag to force update
❌ contract KittyItemsMarket is already deployed to this account. Use the --update flag to force update
❌ failed to deploy contracts
❌ Command Error: failed to deploy contracts
📖 Documentation
- Improved documentation to cover all the commands and flags.
Version 0.16.0
⬆️ Install or Upgrade
Follow the Flow CLI installation guide for instructions on how to install or upgrade the CLI.
⭐ Features
- Add
flow keys decode
command to decode and validate Flow account keys (#75) @Kay-Zee - Build darwin/arm64 binaries (#113) @turbolent
🐞 Bug Fixes
- Update
flow accounts create
to use thesig-algo
argument specified by the user (#121) @joeabbey-anchor