Releases: aiken-lang/stdlib
1.2.0
Added
transaction/value.MintedValue
transaction/value.from_minted_value
: Convert fromMintedValue
toValue
transaction/value.to_minted_value
: Convert fromValue
toMintedValue
transaction/bytearray.to_hex
: Convert aByteArray
to a hex encodedString
math/rational
: Working with rational numbers.-
abs
-
add
-
ceil
-
compare
-
compare_with
-
div
-
floor
-
from_int
-
mul
-
negate
-
new
-
proper_fraction
-
reciprocal
-
reduce
-
round
-
round_even
-
sub
-
truncate
-
zero
-
Removed
- module
MintedValue
was merged withValue
1.1.0
Added
-
list.count
: Count how many items in the list satisfy the given predicate. -
int.from_utf8
: Parse an integer from a utf-8 encodedByteArray
, when possible. -
dict.foldl
&dict.foldr
: for left and right folds over dictionnary elements in ascending key order. -
dict.insert_with
: Insert a value in the dictionary at a given key. When the key already exist, the provided merge function is called. -
transaction/value.add
: Add a (positive or negative) quantity of a single token to a value. This is more efficient thanmerge
for a single asset. -
transaction/value.to_dict
: Convert aValue
into a dictionnary of dictionnaries. -
A new module
transaction/minted_value
: This is used exclusively for representing values present in themint
field of transactions. This allows to simplify some of the implementation forValue
which no longer needs to handle the special case where null-quantity tokens would be present. It isn't possible to constructMintedValue
by hand, they come from the script context entirely and are 'read-only'. -
More documentation for
dict
andinterval
modules.
Changed
Warning
Most of those changes are breaking-changes. Though, given we're still in an
alpha state, only theminor
component is bumped from the version number.
Please forgive us.
-
Rework
list.{foldl, foldr, reduce, indexed_foldr}
,dict.{fold}
,bytearray.{foldl, foldr, reduce}
to take the iterator as last argument. For example:fn foldl(self: List<a>, with: fn(a, b) -> b, zero: b) -> b ↓ becomes fn foldl(self: List<a>, zero: b, with: fn(a, b) -> b) -> b
-
Fixed implementation of
bytearray.slice
;slice
would otherwise behave as if the second argument were an offset. -
Rename
transaction/value.add
intotransaction/value.merge
. -
Swap arguments of the merge function in
dict.union_with
; the first value received now corresponds to the value already present in the dictionnary. -
Fixed various examples from the documentation
Removed
- Removed
dict.fold
; replaced withdict.foldl
anddict.foldr
to remove ambiguity.