diff --git a/README.md b/README.md index 79a71bd..5526431 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Vodka is a library build for [Aiken](https://aiken-lang.org/) development. It of Simply run ```sh -aiken add sidan-lab/vodka --version 0.1.10 +aiken add sidan-lab/vodka --version 0.1.11 ``` or putting the below in you `aiken.toml` @@ -27,7 +27,7 @@ or putting the below in you `aiken.toml` ```toml [[dependencies]] name = "sidan-lab/vodka" -version = "0.1.10" +version = "0.1.11" source = "github" ``` @@ -37,7 +37,7 @@ Vodka is now upgraded to support latest PlutusV3 with latest version, if you wan | Vodka | Aiken Compiler | `aiken-lang/stdlib` | | ---------- | -------------- | ------------------- | -| 0.1.10 | ^v1.1.9 | v2.2.0 | +| 0.1.11 | ^v1.1.9 | v2.2.0 | | 0.1.6 | ^v1.1.5 | v2.1.0 | | 0.0.1-beta | v1.0.29-alpha | v1.9.0 | diff --git a/aiken.toml b/aiken.toml index 685224d..0ada645 100644 --- a/aiken.toml +++ b/aiken.toml @@ -1,5 +1,5 @@ name = "sidan-lab/vodka" -version = "0.1.10" +version = "0.1.11" compiler = "v1.1.9" plutus = "v3" license = "Apache-2.0" diff --git a/lib/mocktail.ak b/lib/mocktail.ak index 778b132..79a8e7c 100644 --- a/lib/mocktail.ak +++ b/lib/mocktail.ak @@ -477,7 +477,7 @@ pub fn add_input(tx: Transaction, condition: Bool, input: Input) -> Transaction if !condition { tx } else { - Transaction { ..tx, inputs: tx.inputs |> list.push(input) } + Transaction { ..tx, inputs: tx.inputs |> list.concat([input]) } } } @@ -500,7 +500,7 @@ pub fn add_reference_input( } else { Transaction { ..tx, - reference_inputs: tx.reference_inputs |> list.push(input), + reference_inputs: tx.reference_inputs |> list.concat([input]), } } } @@ -522,7 +522,7 @@ pub fn add_output( if !condition { tx } else { - Transaction { ..tx, outputs: tx.outputs |> list.push(output) } + Transaction { ..tx, outputs: tx.outputs |> list.concat([output]) } } } @@ -587,7 +587,7 @@ pub fn add_certificate( } else { Transaction { ..tx, - certificates: tx.certificates |> list.push(certificate), + certificates: tx.certificates |> list.concat([certificate]), } } } @@ -609,7 +609,10 @@ pub fn add_withdrawal( if !condition { tx } else { - Transaction { ..tx, withdrawals: tx.withdrawals |> list.push(withdrawal) } + Transaction { + ..tx, + withdrawals: tx.withdrawals |> list.concat([withdrawal]), + } } } @@ -632,7 +635,7 @@ pub fn add_extra_signatory( } else { Transaction { ..tx, - extra_signatories: tx.extra_signatories |> list.push(signatory), + extra_signatories: tx.extra_signatories |> list.concat([signatory]), } } } @@ -654,7 +657,7 @@ pub fn add_redeemer( if !condition { tx } else { - Transaction { ..tx, redeemers: tx.redeemers |> list.push(redeemer) } + Transaction { ..tx, redeemers: tx.redeemers |> list.concat([redeemer]) } } } @@ -756,3 +759,18 @@ pub const mock_script_output = virgin_outputs.mock_script_output /// Documentation please refer to [`virgin_validity_range`](./mocktail/virgin_validity_range.html) pub const mock_interval = virgin_validity_range.mock_interval + +test preserve_tx_in_order() { + let tx: Transaction = + mocktail_tx() + |> tx_in(True, mock_tx_hash(0), 0, zero, mock_pub_key_address(0, None)) + |> tx_in(True, mock_tx_hash(1), 1, zero, mock_pub_key_address(1, None)) + |> complete() + expect [input1, input2] = tx.inputs + and { + input1.output_reference.transaction_id == mock_tx_hash(0), + input1.output_reference.output_index == 0, + input2.output_reference.transaction_id == mock_tx_hash(1), + input2.output_reference.output_index == 1, + } +} diff --git a/plutus.json b/plutus.json index cb12d47..9a4edb7 100644 --- a/plutus.json +++ b/plutus.json @@ -2,7 +2,7 @@ "preamble": { "title": "sidan-lab/vodka", "description": "Aiken utils for project 'sidan-lab/vodka", - "version": "0.1.10", + "version": "0.1.11", "plutusVersion": "v3", "compiler": { "name": "Aiken",