Add now-necessary type-annotations in tests
This commit is contained in:
parent
a124bdbb05
commit
99c35a6459
|
@ -13,4 +13,4 @@ requirements = []
|
||||||
source = "github"
|
source = "github"
|
||||||
|
|
||||||
[etags]
|
[etags]
|
||||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1714846140, nanos_since_epoch = 960222000 }, "5ee55dc5ccf269bb493f4cacb32096f0191a6adb2ef39d62a1f79b8c5a8fcc7f"]
|
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1714911372, nanos_since_epoch = 250896000 }, "5ee55dc5ccf269bb493f4cacb32096f0191a6adb2ef39d62a1f79b8c5a8fcc7f"]
|
||||||
|
|
|
@ -9,7 +9,7 @@ validator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn find_stuff(context) -> Output {
|
fn find_stuff(context: ScriptContext) -> Output {
|
||||||
expect Some(stuff) = list.find(context.transaction.outputs, fn(_) { True })
|
expect Some(stuff) = list.find(context.transaction.outputs, fn(_) { True })
|
||||||
stuff
|
stuff
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
||||||
source = "github"
|
source = "github"
|
||||||
|
|
||||||
[etags]
|
[etags]
|
||||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1714846166, nanos_since_epoch = 809844000 }, "5ee55dc5ccf269bb493f4cacb32096f0191a6adb2ef39d62a1f79b8c5a8fcc7f"]
|
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1714913251, nanos_since_epoch = 578539000 }, "5ee55dc5ccf269bb493f4cacb32096f0191a6adb2ef39d62a1f79b8c5a8fcc7f"]
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"plutusVersion": "v2",
|
"plutusVersion": "v2",
|
||||||
"compiler": {
|
"compiler": {
|
||||||
"name": "Aiken",
|
"name": "Aiken",
|
||||||
"version": "v1.0.26-alpha+a44ed4c"
|
"version": "v1.0.26-alpha+f8607b8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"validators": [
|
"validators": [
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
use aiken/option
|
use aiken/option
|
||||||
use aiken/transaction.{NoDatum, ScriptContext, Spend, TransactionId}
|
use aiken/transaction.{NoDatum,
|
||||||
|
ScriptContext, Spend, Transaction, TransactionId}
|
||||||
use aiken/transaction/credential.{VerificationKeyCredential}
|
use aiken/transaction/credential.{VerificationKeyCredential}
|
||||||
use aiken/transaction/value
|
use aiken/transaction/value
|
||||||
|
|
||||||
|
@ -14,7 +15,7 @@ validator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn assert_id(transaction) {
|
fn assert_id(transaction: Transaction) {
|
||||||
transaction.id != TransactionId(
|
transaction.id != TransactionId(
|
||||||
#"0000000000000000000000000000000000000000000000000000000000000000",
|
#"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
)
|
)
|
||||||
|
@ -30,14 +31,13 @@ fn assert_purpose(purpose) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn assert_fee(transaction) {
|
fn assert_fee(transaction: Transaction) {
|
||||||
transaction.fee == value.from_lovelace(42)
|
transaction.fee == value.from_lovelace(42)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn assert_outputs(transaction) {
|
fn assert_outputs(transaction: Transaction) {
|
||||||
when transaction.outputs is {
|
when transaction.outputs is {
|
||||||
[output] ->
|
[output] -> and {
|
||||||
and {
|
|
||||||
output.value == value.from_lovelace(1000000000),
|
output.value == value.from_lovelace(1000000000),
|
||||||
output.address.payment_credential == VerificationKeyCredential(
|
output.address.payment_credential == VerificationKeyCredential(
|
||||||
#"11111111111111111111111111111111111111111111111111111111",
|
#"11111111111111111111111111111111111111111111111111111111",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use aiken/builtin
|
use aiken/builtin
|
||||||
use aiken/dict
|
use aiken/dict.{Dict}
|
||||||
use aiken/hash.{blake2b_256}
|
use aiken/hash.{blake2b_256}
|
||||||
use aiken/transaction.{DatumHash, InlineDatum, ScriptContext}
|
use aiken/transaction.{DatumHash, InlineDatum, Output, ScriptContext}
|
||||||
use aiken/transaction/credential.{Inline, VerificationKeyCredential}
|
use aiken/transaction/credential.{Inline, VerificationKeyCredential}
|
||||||
|
|
||||||
validator {
|
validator {
|
||||||
|
@ -23,7 +23,7 @@ type MyDatum {
|
||||||
MyDatum(Int)
|
MyDatum(Int)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn assert_datums(datums) {
|
fn assert_datums(datums: Dict<ByteArray, Data>) {
|
||||||
let my_datum = MyDatum(42)
|
let my_datum = MyDatum(42)
|
||||||
|
|
||||||
expect Some(datum) =
|
expect Some(datum) =
|
||||||
|
@ -42,7 +42,7 @@ fn assert_outputs(outputs) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn assert_first_output(output) {
|
fn assert_first_output(output: Output) {
|
||||||
and {
|
and {
|
||||||
output.datum == DatumHash(
|
output.datum == DatumHash(
|
||||||
#"fcaa61fb85676101d9e3398a484674e71c45c3fd41b492682f3b0054f4cf3273",
|
#"fcaa61fb85676101d9e3398a484674e71c45c3fd41b492682f3b0054f4cf3273",
|
||||||
|
@ -53,7 +53,7 @@ fn assert_first_output(output) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn assert_second_output(output) {
|
fn assert_second_output(output: Output) {
|
||||||
and {
|
and {
|
||||||
output.address.stake_credential == Some(
|
output.address.stake_credential == Some(
|
||||||
Inline(
|
Inline(
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use aiken/dict
|
use aiken/dict
|
||||||
use aiken/list
|
use aiken/list
|
||||||
use aiken/transaction.{Mint, ScriptContext}
|
use aiken/transaction.{Mint, ScriptContext, Transaction}
|
||||||
use aiken/transaction/value
|
use aiken/transaction/value
|
||||||
|
|
||||||
validator {
|
validator {
|
||||||
|
@ -13,7 +13,7 @@ validator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn assert_purpose(ctx) {
|
fn assert_purpose(ctx: ScriptContext) {
|
||||||
expect [my_policy_id] =
|
expect [my_policy_id] =
|
||||||
ctx.transaction.mint
|
ctx.transaction.mint
|
||||||
|> value.from_minted_value
|
|> value.from_minted_value
|
||||||
|
@ -25,7 +25,7 @@ fn assert_purpose(ctx) {
|
||||||
my_policy_id == policy_id
|
my_policy_id == policy_id
|
||||||
}
|
}
|
||||||
|
|
||||||
fn assert_mint(purpose, transaction) {
|
fn assert_mint(purpose, transaction: Transaction) {
|
||||||
expect Mint(policy_id) = purpose
|
expect Mint(policy_id) = purpose
|
||||||
let tokens =
|
let tokens =
|
||||||
value.tokens(transaction.mint |> value.from_minted_value, policy_id)
|
value.tokens(transaction.mint |> value.from_minted_value, policy_id)
|
||||||
|
@ -36,7 +36,7 @@ fn assert_mint(purpose, transaction) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn assert_redeemers(ctx, my_redeemer) {
|
fn assert_redeemers(ctx: ScriptContext, my_redeemer) {
|
||||||
expect Some(Pair(_, redeemer)) =
|
expect Some(Pair(_, redeemer)) =
|
||||||
list.find(ctx.transaction.redeemers, fn(kv) { kv.1st == ctx.purpose })
|
list.find(ctx.transaction.redeemers, fn(kv) { kv.1st == ctx.purpose })
|
||||||
my_redeemer == redeemer && list.length(ctx.transaction.redeemers) == 1
|
my_redeemer == redeemer && list.length(ctx.transaction.redeemers) == 1
|
||||||
|
|
Loading…
Reference in New Issue