Skip to content

0.19.0

Compare
Choose a tag to compare
@lastmjs lastmjs released this 14 Dec 03:32
· 2548 commits to main since this release
0a217a0

This release focuses on introducing a framework for property-testing and adding many foundational property tests. Azle has never been subjected to more automated testing than with this release.

We also introduce the concept of a Serializable object and change StableBTreeMap to accept arbitrary Serializable objects. A default (and much more performant than CandidType objects) stableJson Serializable object has also been introduced. See The Azle Book and the examples for more info.

Breaking Changes

StableBTreeMap uses Serializable objects

By default a StableBTreeMap will use the stableJson Serializable to store and retrieve data to and from stable memory. Each CandidType object is also a Serializable. If you want to continue using your StableBTreeMaps that you've already created without migrating them, then you'll need to manually do so:

Before

import { nat8, StableBTreeMap, text } from 'azle';

let map = StableBTreeMap(nat8, text, 0);

Now

import { nat8, StableBTreeMap, text } from 'azle';

let map = StableBTreeMap<nat8, text>(0, nat8, text);

StableBTreeMap parameters

The parameters for StableBTreeMap have changed. The memory id is now the first parameter, and the two following parameters are optional and by default are set to stableJson.

Before

import { nat8, StableBTreeMap, text } from 'azle';

let map = StableBTreeMap(nat8, text, 0);

Now

import { nat8, StableBTreeMap, text } from 'azle';

let map = StableBTreeMap<nat8, text>(0);

StableBTreeMap float64

By default (using the built-in stableJson) float64 values stored in a StableBTreeMap may have issues because of this bug: bellard/quickjs#206

StableBTreeMap types

StableBTreeMap types are no longer inferred, you must explicitly set them as type arguments to StableBTreeMap:

Before

import { nat8, StableBTreeMap, text } from 'azle';

let map = StableBTreeMap(nat8, text, 0);

Now

import { nat8, StableBTreeMap, text } from 'azle';

let map = StableBTreeMap<nat8, text>(0);

What's Changed

Full Changelog: 0.18.6...0.19.0