Skip to content

v0.11.0

Compare
Choose a tag to compare
@turbolent turbolent released this 13 Oct 23:10
· 11135 commits to master since this release

πŸ’₯ 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