This Changelog only applies to notable changes of language related features in helios.js
on the main branch.
- addition of
Map.to_list[T]()
- cleanup of IR simplication (might change some script hashes)
- StakeKeyHash replaced by PubKeyHash everywhere (has almost exactly the same functionality, so makes little sense for it to be a different type)
- Generic typing for functions, enums and structs
map.update
andmap.update_safe
const
statements always require typing, but value is optional (throws error if value is unset before compilation)Any
,<empty>
andValuable
typeclasses[]Int.sum
,[]Real.sum
,[]String.join
,[]ByteArray.join
,[][]ItemType.flatten
List.drop
,.take
,.drop_end
and.take_end
implemented
Real
fixed point number type with most basic math operators- auto-set tx validity time_range if tx.time_range is called in any of the scripts
List.get_singleton()
- Destructuring enum instances into enum variants throws runtime errors instead of compile-time errors
Int
methods:abs
,encode_zigzag
,decode_zigzag
,to_little_endian
,to_big_endian
,to_base58
Int::from_big_endian
andfrom_base58
associated functionsByteArray.prepend
- Destructuring syntax for assignments and for switch cases
Duration::SECOND
,MINUTE
,HOUR
,DAY
,WEEK
AssetClass.mph
andAssetClass.token_name
TimeRange.show
- Functions can have optional arguments
Value.show
copy
automatically defined on all user structs and user enum variants
- Addition of
ctx.get_cont_outputs()
- Addition of
value.get_assets()
- Addition of
option.map()
- Addition of
Map.for_each
- Addition of
Int::min
,Int::max
,int.bound()
,int.bound_min()
,int.bound_max()
- Addition of
tx.get_datum_data(output: TxOutput)
- Addition of
Value.get_lovelace()
- Addition of
Data.tag
- Addition of
List.for_each()
- IR: Removed simplify calls from inline methods. Slight decrease in optimization performance, huge increase in compiler speed.
- TxId, TxOutputId and hash-type comparison operators and
show
- Functions can return void
()
by usingprint
,error
orassert
as final expressions - Function expressions return type is optional
(...) -> {...}
OutputDataum.inline_data
Address::new_empty
Wallet
,Cip30Wallet
,WalletHelper
,Network
andBlockfrostV0
for interacting with browser wallets and the blockchainCoinSelection
class with static methodpickSmallest
HeliosData
instances which can be assigned directly toProgram.parameters
- Builtin
HeliosData
types:Int
,Bool
,ByteArray
,HeliosString
,Address
,TxId
, hash-types,Time
,Duration
,TxOutputId
,Value
- Builtin
List
,HeliosMap
andOption
HeliosData
-type generators. - Helios structs and enums are avaible as
HeliosData
types throughprogram.types
- Addition of
Map.prepend
- Addition of comparisons for ByteArray:
<
,>
,<=
and>=
- Function definitions can ignore (all but one) argument with
_
- Functions can returns multiple values, assignments can assign multi-value rhs to multiple variables (not
const
though), and multi-value expressions are automatically flattened when used in a call
- Addition of
Map.delete
,Map.set
,Map.find
,Map.find_by_key
,Map.find_by_value
- Addition of
Map.head_key
,Map.head_value
,Map.tail
- Addition of
List.fold_lazy
,Map.fold_lazy
,Map.fold_keys_lazy
,Map.fold_values_lazy
- Printing of messages when redemption computation throws an error
- Addition of
List.sort
- Addition of
StakingHash::Validator.hash
andStakingHash::StakeKey.hash
- Addition of
Map.find_key
,Map.find_key_safe
,Map.find_value
,Map.find_value_safe
- Addition of
Map.sort
,Map.sort_by_key
,Map.sort_by_value
- Addition of
Value.get_safe
.
- Addition of
ScriptHash
,StakingHash
,StakingHash::StakeKey
,StakingHash::Validator
,StakeKeyHash
,StakingValidatorHash
(on-chain) TxOutput.ref_script_hash -> Option[ScriptHash]
getter (on-chain)(ValidatorHash|MintingPolicyHash|StakingValidatorHash).from_script_hash()
(on-chain)- Addition StakeAddress, StakeKeyHash and StakingValidatorHash (off-chain)
- Address construction distinguishes between StakeKeyHash and StakingValidatorHash
Value.to_map()
- Switch expression works over Data
- Type inference for literal enum member constructors that have zero fields
PubKey
builtin type, andPubKey.verify
method (aka verifyEd25519Signature)
- Structs with 1 field are represented directly by their contained field in Uplc
- Structs with more than 1 field are represented as a list of data in Uplc (no longer as ConstrData)
- IR functions with zero arguments become Delay terms in Uplc
- IR calls with zero arguments become Force terms in Uplc
- Core cast functions are extracted as high up as possible
- Special syntax for throwing errors inside switch/if-else branches:
error("...")
- Added
Int::from_little_endian()
- Added
Value.contains_policy()
method
- Modules functionality with
import
- Added
TxRefInput
export
- Added
new
constructor forScriptPurpose
members - Added list.
find_safe
method
redeemers
field added toTx::new
constructor
- Better error message when catching
RuntimeError
insideevalParam
- HashedDatum and InlineDatum no longer exported
- TxId and DatumHash exported,
Hash
no longer exported - changeParam handles Hash type literals
- ScriptPurpose type, with members Minting, Spending, Rewarding and Certifying
ScriptContext.get_script_purpose()
Tx.redeemers
Int::parse
- unused struct/enum fields, and unused enum variants, are now allowed
Option.unwrap()
- added
Value::from_map
- removed
tx.now()
(in favor oftx.time_range.start
andtx.time_range.end
) - changed
time_range.get_start()
totime_range.start
(is a getter!) - added
time_range.end
(is a getter!) - added
map.map_keys()
andmap.map_values()
- support for operator overloading (internally), with
Time - Duration -> Time
andDuration/Duration -> Int
as new overloads +
and*
operators are now commutative in case left and right types differ
- toSchemaJSON renamed to toSchemaJson
- tx.outputs_sent_to_datum, tx.value_sent_to_datum, tx.outputs_locked_by_datum, tx.value_locked_by_datum: now take 'isInline' as a third boolean argument
- PlutusCore renamed to UPLC everywhere
- helios.d.ts file generated
- program.changeParam accepts both jsons strings and PlutusCoreValue is value
[]a.new
method usesfunc(Int) -> a
as second arg (first arg is length), List.new_const introduced that usesa
as second arg (first arg is length).
- TxOutput can have inline datum
- TxOutput.datum returns OutputDatum enum (replaces the .datum_hash field)
- OutputDatum enum has members None, Hash and Inline
- generic Data type introduced (used by inline datum)
- All types have builtin associated ::from_data() method that converts
Data
into that type - Map.get_safe() method that returns Option
- staking script purpose
- StakingPurpose enum, with members Rewarding and Certifying, returned by ScriptContext.get_staking_purpose() (only available in staking/testing script)
- DCert enum with members Register, Deregister, Delegate, RegisterPool, RetirePool (DCertGenesis and DCertMir ignored)
- New fields for Tx: Tx.ref_inputs, Tx.dcerts and Tx.withdrawals (constructor for Tx also changed accordingly)
- ScriptContext constructors have been renamed: new_spending, new_minting, new_rewarding and new_certifying
- Library interface changed to something more object-like
- Script purpose keywords changed to 'testing', 'spending' and 'minting'
- Macro-like builtins whichs are only allowed after 'main': ValidatorHash::CURRENT, MintingPolicyHash::CURRENT, ScriptContext::new, Tx::new, TxID::CURRENT, TxInput::new, TxOutput::new
- Generally usable constructors: TxId::new, Address::new, Credential::new_pubkey, Credential::new_validator, StakingCredential::new_hash, StakingCredential::new_ptr
- First argument of AssetClass::new must be MintingPolicyHash (was ByteArray previously)
- Cost calculation of a plutus-core program run
- 'simplify' boolean flag in config object that is passed to compile()
- Map key can't be bool type (makes it easier to use bool as primitive in plutus-core, instead of as data type)
Value*Int
(not commutative) andValue/Int
operators- tx methods: 'outputs_sent_to_datum', 'outputs_locked_by_datum' and 'value_sent_to_datum' (not yet property tested)
- ByteArray.slice (negative indices relative to end)
- ByteArray starts_with and ends_with
- String starts_with and ends_with
- Map + Map operator (note: map merge doesn't assert uniqueness of keys and simply acts as a concatenation of two lists)
- Map methods: all, all_keys, all_values, any, any_key, any_value, filter, filter_by_key, filter_by_value, fold, fold_keys, fold_values
- all methods named 'get...' or 'find...' throw errors if not found
- TokenName in AssetClass is now ByteArray in order to align with Plutus-Ledger-API (used to be String)
- Rust-like syntax, structs and enums can have methods
- No commas in struct/enum-member definitions
- No semicolon after const statement
- C#-like switch syntax
- TimeRange constructors: ALWAYS, NEVER, from, to
- TimeRange comparison: is_before(Time) and is_after(Time)
- Map literal construction, Map.length, Map.is_empty() and Map.get()
- Value.get_policy()
- renamed to helios
- all named variables in the Plutus-Light are prefixed with u_ when generating the untyped IR