github onflow/cadence v0.14.0

This release introduced a new high-level Account Key API and improves the interpreter performance.
The current low-level Account Key API is now deprecated and will be removed in a future release. Please switch to the new one.

The following example transaction demonstrates the functionality:

transaction {
	prepare(signer: AuthAccount) {
		let newPublicKey = PublicKey(
			publicKey: "010203".decodeHex(),
			signatureAlgorithm: SignatureAlgorithm.ECDSA_P256
		)

		// Add a key
		let addedKey = signer.keys.add(
			publicKey: newPublicKey,
			hashAlgorithm: HashAlgorithm.SHA3_256,
			weight: 100.0
		)


		// Retrieve a key
		let sameKey = signer.keys.get(keyIndex: addedKey.keyIndex)


		// Revoke a key
		signer.keys.revoke(keyIndex: addedKey.keyIndex)
	}
}

⭐ Features

💥 Breaking Changes

The Crypto contract has changed in a backwards-incompatible way, so the types and values it declared could be used in the new Account Key API:

  • The struct Crypto.PublicKey was replaced by the new built-in global struct PublicKey.
    There is no need anymore to import the Crypto contract to work with public keys.

  • The struct Crypto.SignatureAlgorithm was replaced with the new built-in global enum SignatureAlgorithm.
    There is no need anymore to import the Crypto contract to work with signature algorithms.

  • The struct Crypto.HashAlgorithm was replaced with the new built-in global enum HashAlgorithm.
    There is no need anymore to import the Crypto contract to work with hash algorithms.

  • The signature algorithm value Crypto.ECDSA_Secp256k1 was replaced with the new built-in enum case SignatureAlgorithm.ECDSA_Secp256k1

  • The signature algorithm value Crypto.ECDSA_P256 was replaced with the new built-in enum case SignatureAlgorithm.ECDSA_P256

  • The hash algorithm Crypto.SHA3_256 was replaced with the new built-in enum case HashAlgorithm.SHA3_256

  • The hash algorithm Crypto.SHA2_256 was replaced with the new built-in enum case HashAlgorithm.SHA2_256

🛠 Improvements

  • Add support for importing enum values (#672) @SupunS
  • Optimize interpreter: Make invocation location ranges lazy (#685) @turbolent
  • Optimize interpreter activations (#673) @turbolent
  • Optimize integer conversion (#677) @turbolent
  • Optimize interpreter: Evaluate statements and declarations directly, remove trampolines (#684) @turbolent
  • Optimize interpreter: Move statement evaluation code (#683) @turbolent
  • Optimize interpreter: Move evaluation of expressions and statements to separate files (#682) @turbolent
  • Optimize interpreter: Evaluate expressions directly without trampolines (#681) @turbolent
  • Optimize interpreter: Refactor function invocations to return a value instead of a trampoline (#680) @turbolent
  • Optimize interpreter: Evaluate binary expressions directly (#679) @turbolent

🐞 Bug Fixes

📖 Documentation

  • Add documentation for the new account key API (#635) @SupunS

Don't miss a new cadence release

NewReleases is sending notifications on new releases.