Skip to content

Releases: onflow/cadence

v0.9.3

19 Nov 17:27
Compare
Choose a tag to compare

⭐ Features

  • Wrap errors to provide additional information (#451)

v0.11.1

09 Nov 18:18
Compare
Choose a tag to compare

🐞 Bug Fixes

  • Don't use the cache when deploying or updating account code (#447)

v0.10.1

06 Nov 18:14
Compare
Choose a tag to compare

🐞 Bug Fixes

  • Don't use the cache when deploying or updating account code (#447)

v0.11.0

13 Oct 23:10
Compare
Choose a tag to compare

πŸ’₯ Breaking Changes

Typed Paths (#403)

Paths are now typed. Paths in the storage domain have type StoragePath, in the private domain PrivatePath, and in the public domain PublicPath. PrivatePath and PublicPath are subtypes of CapabilityPath. Both StoragePath and CapabilityPath are subtypes of Path.

Path
CapabilityPath StoragePath
PrivatePath PublicPath

Storage API (#403)

With paths being typed, it was possible to make the Storage API type-safer and easier to use: It is now statically checked if the correct type of path is given to a function, instead of at run-time, and therefore capability return types can now be non-optional.

The changes are as follows:

For PublicAccount:

  • old: fun getCapability<T>(_ path: Path): Capability<T>?

    new: fun getCapability<T>(_ path: PublicPath): Capability<T>

  • old: fun getLinkTarget(_ path: Path): Path?

    new: fun getLinkTarget(_ path: CapabilityPath): Path?

For AuthAccount:

  • old: fun save<T>(_ value: T, to: Path)

    new: fun save<T>(_ value: T, to: StoragePath)

  • old: fun load<T>(from: Path): T?

    new: fun load<T>(from: StoragePath): T?

  • old: fun copy<T: AnyStruct>(from: Path): T?

    new: fun copy<T: AnyStruct>(from: StoragePath): T?

  • old: fun borrow<T: &Any>(from: Path): T?

    new: fun borrow<T: &Any>(from: StoragePath): T?

  • old: fun link<T: &Any>(_ newCapabilityPath: Path, target: Path): Capability<T>?

    new: fun link<T: &Any>(_ newCapabilityPath: CapabilityPath, target: Path): Capability<T>?

  • old: fun getCapability<T>(_ path: Path): Capability<T>?

    new: fun getCapability<T>(_ path: CapabilityPath): Capability<T>

  • old: fun getLinkTarget(_ path: Path): Path?

    new: fun getLinkTarget(_ path: CapabilityPath): Path?

  • old: fun unlink(_ path: Path)

    new: fun unlink(_ path: CapabilityPath)

⭐ Features

  • Add a hash function to the crypto contract (#379)

  • Added npm packages for components of Cadence. This eases the development of developer tools for Cadence:

    • cadence-language-server: The Cadence Language Server
    • monaco-languageclient-cadence: Language Server Protocol client for the the Monaco editor
    • cadence-parser: The Cadence parser

    In addition, there are also examples for the language server and the parser that demonstrate the use of the packages.

  • Add a command to the language server that allows getting the entry point (transaction or script) parameters (#406)

πŸ›  Improvements

  • Allow references to be returned from from scripts (#400)
  • Panic with a dedicated error for out of bounds array index (#396)

πŸ“– Documentation

  • Document resource identifiers (#394)
  • Document iteration over dictionary entries (#399)

πŸ“¦ Dependencies

v0.9.2

06 Oct 16:33
Compare
Choose a tag to compare

πŸ› οΈ Improvements

  • Panic with a dedicated error for array out of bounds access (#396)

v0.10.0

01 Oct 21:46
e0e3f92
Compare
Choose a tag to compare

πŸ’₯ Breaking Changes

Contract Deployment

This release adds support for deploying multiple contracts per account.
The API for deploying has changed:

⭐ Features

Enumerations

This release adds support for enumerations (#344).

For example, a days-of-the-week enum can be declared though:

enum Day: UInt8 {
    case Monday
    case Tuesday
    case Wednesday
    case Thursday
    case Friday
    case Saturday
    case Sunday
}

See the documentation for further details and examples.

Switch Statement

This release adds support for switch statements (#365).

fun describe(number: Int): String {
    switch number {
    case 1:
        return "one"
    case 2:
        return "two"
    default:
        return "other"
    }
}

See the documentation for further details and examples.

Code Formatter

Development of a code formatter has started, in form of a plugin for Prettier (#348).
If you would like to contribute, please let us know!

πŸ›  Improvements

  • Limitations on data structure complexity are now enforced when decoding and also when encoding storage data, e.g number of array elements, number of dictionary entries, etc. (#370)
  • Using the force-unwrap operator on a non-optional is no longer an error, but a hint is reported suggesting the removal of the unnecessary operation (#347)
  • Language Server: The features requiring a Flow client connection are now optional. This allows using the language server in editors other than Visual Studio Code, such as Emacs, Vim, etc. (#303)

🐞 Bug Fixes

  • Fixed the encoding of bignums in storage (#370)
  • Fixed the timing of recording composite-type explicit-conformances (#356)
  • Added support for exporting and JSON encoding/decoding of type values and capabilities (#374)
  • Added support for exporting/importing and JSON encoding/decoding of path values (#319)
  • Fixed the handling of empty integer literals in the checker (#354)
  • Fixed the non-storable fields error (#350)

πŸ“– Documentation

πŸ“¦ Dependencies

This release depends on a fork of the CBOR library that Cadence uses.
When importing Cadence in another Go codebase, add the following statement to the go.mod file:

replace github.com/fxamacker/cbor/v2 => github.com/turbolent/cbor/v2 v2.2.1-0.20200911003300-cac23af49154

v0.9.0

23 Sep 17:15
Compare
Choose a tag to compare

πŸ›  Improvements

  • Add struct as supported event parameter type (#364)
  • Make recursive types storable (#329)
  • Suggest replacing number conversion function calls (#346)

⭐ Features

  • Add map function for optionals (#299)

πŸ’₯ Breaking Changes

  • Require an explicit type annotation for variable declarations with empty literal expressions (#345)

🐞 Bug Fixes

  • Fix parsing of right bitwise shift and function invocation where type argument is instantiation (#378)

πŸ“– Documentation

v0.8.2

28 Aug 22:54
Compare
Choose a tag to compare

🐞 Bug Fixes

  • Copy values on return (#355)

v0.8.1

25 Aug 01:23
Compare
Choose a tag to compare

🐞 Bug Fixes

  • Validate script argument count (#316)

v0.8.0

10 Aug 20:28
Compare
Choose a tag to compare

This release focuses on improvements, bug fixes, and bringing the documentation up-to-date.

πŸ›  Improvements

  • Improved support on Windows: Treat carriage returns as space (#304)

  • Improved JSON marshalling for more AST elements (#292, #286)

  • Recursively check if assignment target expression is valid, don't copy returned values (#288)

  • Consider existing prefix when suggesting completion items (#285)

  • Include available declarations in "not declared" error (#280)

  • Enforce the requirement for types to be storable in more places:

    • Transaction/script parameter types (#305)
    • Script return type (#291)
    • Arguments passed to the account load and store functions (#251)

    Previously, using non-storable failed at run-time, now the programs are rejected statically.

⭐ Features

  • Add a version constant (#289)
  • Language Server: Include error notes as related information in diagnostic (#276)

🐞 Bug Fixes

  • Don't return an error when a location type is not supported (#290)
  • Handle incomplete types in checker (#284)
  • Fix the suggestion in the error when an interface is used as a type (#281)

πŸ“– Documentation

  • Brought the documentation up-to-date, include all new language features and API changes (#275, #277, #279)

πŸ’₯ Breaking Changes

  • Arguments passed to cadence.Value#WithType are now typed as pointers (*cadence.Type) rather than values (cadence.Type)

    Example:

    myEventType := cadence.EventType{...})
    
    // this πŸ‘‡ 
    myEvent := cadence.NewEvent(...).WithType(myEventType)
    
    // changes to this πŸ‘‡ 
    myEvent := cadence.NewEvent(...).WithType(&myEventType)