From f63da1a36702cc9f50b5639288a2a2b3fc9b94e6 Mon Sep 17 00:00:00 2001 From: KtorZ Date: Wed, 16 Nov 2022 18:04:58 +0100 Subject: [PATCH] Draft a few more core types for ScriptContext / Transaction Interesting points: - We don't have tuples yet, so we fake it until we make it. - Aliases are 'order-sensitive', especially if an alias uses another not-yet-declared alias. --- examples/aiken_std/lib/aiken/context.ak | 38 ++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/examples/aiken_std/lib/aiken/context.ak b/examples/aiken_std/lib/aiken/context.ak index 3cc49644..ba0909b7 100644 --- a/examples/aiken_std/lib/aiken/context.ak +++ b/examples/aiken_std/lib/aiken/context.ak @@ -4,14 +4,44 @@ pub type ScriptContext(purpose) { } pub type Transaction { - inputs: List(Nil), + inputs: List(Input), + reference_inputs: List(Input), outputs: List(Nil), - fee: Nil, - mint: Nil, + fee: Value, + mint: Value, certificates: List(Nil), withdrawals: List(Nil), validity_range: Nil, extra_signatories: Nil, + redeemers: List(Nil), datums: List(Nil), - id: ByteArray, + id: TransactionId, } + +pub type TransactionId = + ByteArray + +pub type Input { + output_reference: OutputReference, + output: Output, +} + +pub type OutputReference { + transction_id: TransactionId, + output_index: Int, +} + +pub type PolicyId = + ByteArray + +pub type Output = + Nil + +pub type AssetName = + ByteArray + +pub type Pair(a, b) = + Nil + +pub type Value = + List(Pair(PolicyId, List(Pair(AssetName, Int))))