Releases: onflow/flow-cli
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 28329914Read 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
--resultsis deprecated, results are displayed by default.
flow accounts get
- Flag
--codeis deprecated, use--contractsflag instead.
flow events get
- Flag
--verboseis deprecated.
flow keys generate
- Flag
--algois deprecated, use flag--sig-algo.
flow transactions send
- Flag
--codeis deprecated, use filename argument instead. - Flag
--argsis deprecated, use--argor--args-jsoninstead. - Flag
--resultsis deprecated, results are displayed by default.
flow scripts execute
- Flag
--codeis deprecated, use filename argument instead. - Flag
--argsis deprecated, use--argor--args-jsoninstead.
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:
--outputspecify the format of the command results (JSON, inline...), - Save:
--savespecify the filename where you want the result to be saved, - Log:
--logcontrol how much output you want to see during command execution, - Filter:
--filterSpecify 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 decodecommand to decode and validate Flow account keys (#75) @Kay-Zee - Build darwin/arm64 binaries (#113) @turbolent
🐞 Bug Fixes
- Update
flow accounts createto use thesig-algoargument specified by the user (#121) @joeabbey-anchor
Version 0.15.0
⬆️ Install or Upgrade
Follow the Flow CLI installation guide for instructions on how to install or upgrade the CLI.
💥 Breaking Changes
The API for flow scripts execute has changed.
Previous version (v0.14.0):
flow scripts execute script.cdcNew version (v0.15.0):
flow scripts execute --code=script.cdc⭐ Features
- Add support for transaction and script arguments (#51) @MaxStalker
- Add
flow accounts remove-contractcommand (#69, #90) @bjartek - Add support for environment variables in
flow.jsonfiles (#91) @bjartek (Documentation) - Add support for composable
flow.jsonfiles (#95, #101) @sideninja (Documentation) - Add support for loading accounts from separate JSON file (#95) @sideninja (Documentation)
- Add
flow events getcommand (#19) @Kay-Zee - Update
flow accounts getto include staking & delegating information (#21) @Kay-Zee
🛠 Improvements
- Update to Cadence v0.13.5-no-id-caching and Emulator v0.16.1 (#107) @turbolent
- Update Cadence Language Server to v0.13.1 (#89) @turbolent
- Update Cadence v0.13.0, Go SDK v0.15.0, and Emulator v0.15.0 (#85) @turbolent
- Update new account configuration format to be backwards compatible (#105) @sideninja
- Update max message size for results (#76) @Kay-Zee
- Fix
UFix64formatting (#94) @janezpodhostnik
🐞 Bug Fixes
- Update to Cadence v0.13.5-no-id-caching and Emulator v0.16.1 (#107) @turbolent
- Fix flaky non-deterministic test case (
ConfigDeploymentsSimple) (#108) @psiemens - Update Cadence Language Server to v0.13.1 (#89) @turbolent
- Remove unneeded
flow.json(#74) @sideninja
📖 Documentation
- README fixes (#73) @sideninja
🏠 Housekeeping
Version 0.14.0
⭐ Features
Project Commands
This update includes the flow project command group, a new experimental feature that makes it easier to develop Flow dapps with the CLI.
The initial release includes the following commands:
flow projects init- Documentation & Examplesflow projects deploy- Documentation & Examplesflow projects start-emulator
🛠 Improvements
- Added scripts to run the CLI using
go run(#53) @turbolent
📖 Documentation
- Added
docsdirectory linked to https://docs.onflow.org/flow-cli (#56) @psiemens - Added documentation for project commands (#57) @psiemens, @sideninja
v0.13.4
🛠 Improvements
- Update to Cadence v0.12.6, Go SDK v0.14.3, Flow Go v0.14.0, and Emulator v0.14.2 (#47) @turbolent
v0.13.3
v0.13.2
v0.13.1
💥 Breaking Changes
Update to Cadence v0.12 and Emulator v0.14
This release updates Cadence from version 0.10 to version 0.12 (v0.12.3), the Emulator to version 0.14.0, along with the Go SDK to version 0.14.1, and Flow Go to commit 79985711a957.
Cadence v0.11 contained breaking changes, so please read its release notes and the migration guide for hints on how to upgrade your code if needed.
The Testnet will be updated to Cadence v0.12 in an upcoming spork on Jan 27, 2021!
Storage Capacity
The emulator in this release also implements and enforces (by default) storage capacity and storage limits.
Please test deployment of your contracts and interactions with them when storage limits are enforced.
When the storage limit is exceeded, deposit more FLOW tokens into the account's FLOW vault.
It is not recommended, but you can disable storage limits using the command line option --storage-limit=false.
Storage capacity will start to be enforced in an upcoming spork of the Testnet on Jan 27, 2021!