aiken-lang / stdlib

The Aiken Standard Library
https://aiken-lang.github.io/stdlib
Apache License 2.0
47 stars 26 forks source link

Inability to create the Transaction Type because of Opaque MintValue Type #51

Closed logicalmechanism closed 1 year ago

logicalmechanism commented 1 year ago

In v1.1.0 the type for the mint field inside a transaction has changed into the opaque type MintValue. This value can not be created which restricts the ability to create fake Transaction types for unit tests.

Before, we use to be able to do something like this:

let tx =
    Transaction {
      ...
      mint: value.from_asset(#"acab", #"beef", 1),
      ...
    }

But without the ability to create a MintValue type, we lose our ability to write unit tests that require a fake transaction type.

Potential solutions:

KtorZ commented 1 year ago

Another option would be to provide safe conversion functions from Value. A Value is already sanitized, to it is safe to convert from Value to MintedValue.