diff --git a/crates/tx3-cardano/src/compile/mod.rs b/crates/tx3-cardano/src/compile/mod.rs index 7b8a86e0..bc3a54a2 100644 --- a/crates/tx3-cardano/src/compile/mod.rs +++ b/crates/tx3-cardano/src/compile/mod.rs @@ -288,24 +288,38 @@ fn compile_outputs( tx: &tir::Tx, network: Network, ) -> Result>, Error> { - let mut resolved: Vec<_> = tx - .outputs - .iter() - .map(|out| (out.optional, compile_output_block(out, network))) - .filter(|(optional, output)| !optional || output_has_assets(output)) - .map(|(_, output)| output) - .collect::, _>>()?; + let outputs = tx.outputs.iter().filter_map(|out| { + let compiled = compile_output_block(out, network); + + if out.optional && !output_has_assets(&compiled) { + return None; + } + + let idx = out.declared_index.as_number().map(|n| n as usize); + Some(compiled.map(|o| (idx, o))) + }); let cardano_outputs = tx .adhoc .iter() .filter(|x| x.name.as_str() == "cardano_publish") - .map(|adhoc| compile_cardano_publish_directive(adhoc, network)) + .map(|adhoc| { + let idx = adhoc + .data + .get("declared_index") + .and_then(|expr| expr.as_number()) + .map(|n| n as usize); + + compile_cardano_publish_directive(adhoc, network).map(|o| (idx, o)) + }); + + let mut all_outputs: Vec<_> = outputs + .chain(cardano_outputs) .collect::, _>>()?; - resolved.extend(cardano_outputs); + all_outputs.sort_by_key(|(idx, _)| idx.unwrap_or(usize::MAX)); - Ok(resolved) + Ok(all_outputs.into_iter().map(|(_, out)| out).collect()) } pub fn compile_cardano_publish_directive( diff --git a/crates/tx3-cardano/src/tests.rs b/crates/tx3-cardano/src/tests.rs index f87bad57..cb35d3af 100644 --- a/crates/tx3-cardano/src/tests.rs +++ b/crates/tx3-cardano/src/tests.rs @@ -524,3 +524,23 @@ async fn min_utxo_compiler_op_test() { assert!(!assets.is_empty()); } } + +#[pollster::test] +async fn cardano_publish_min_utxo_test() { + let mut compiler = test_compiler(None); + let utxos = wildcard_utxos(None); + let protocol = load_protocol("cardano_publish_min_utxo"); + + let tx = protocol.tir("test_min_utxo_publish").unwrap().clone(); + + let args = BTreeMap::from([]); + + let tx = test_compile(tx, &args, &mut compiler, utxos); + + println!("{}", hex::encode(tx.payload)); + + assert_eq!( + hex::encode(tx.hash), + "2da0a42d6245f61d595f0acf77df1560fd3e4c5f553737caf606003804ea5014" + ); +} diff --git a/crates/tx3-lang/src/analyzing.rs b/crates/tx3-lang/src/analyzing.rs index 55e50b02..29b0a2c6 100644 --- a/crates/tx3-lang/src/analyzing.rs +++ b/crates/tx3-lang/src/analyzing.rs @@ -1243,8 +1243,21 @@ impl TxDef { scope.track_input(&input.name, input.clone()) } - for (index, output) in self.outputs.iter().enumerate() { - scope.track_output(index, output.clone()) + for output in self.outputs.iter() { + scope.track_output(output.declared_index, output.clone()) + } + + for adhoc in self.adhoc.iter() { + match adhoc { + ChainSpecificBlock::Cardano(crate::cardano::CardanoBlock::Publish(pb)) => { + if let Some(n) = &pb.name { + scope + .symbols + .insert(n.value.clone(), Symbol::Output(pb.declared_index)); + } + } + _ => {} + } } let scope_snapshot = Rc::new(scope); diff --git a/crates/tx3-lang/src/ast.rs b/crates/tx3-lang/src/ast.rs index 54578928..5164834d 100644 --- a/crates/tx3-lang/src/ast.rs +++ b/crates/tx3-lang/src/ast.rs @@ -404,6 +404,7 @@ pub struct OutputBlock { pub optional: bool, pub fields: Vec, pub span: Span, + pub declared_index: usize, } impl OutputBlock { diff --git a/crates/tx3-lang/src/cardano.rs b/crates/tx3-lang/src/cardano.rs index 036ab79f..3916034e 100644 --- a/crates/tx3-lang/src/cardano.rs +++ b/crates/tx3-lang/src/cardano.rs @@ -586,6 +586,7 @@ pub struct CardanoPublishBlock { pub name: Option, pub fields: Vec, pub span: Span, + pub declared_index: usize, } impl CardanoPublishBlock { @@ -663,7 +664,12 @@ impl AstNode for CardanoPublishBlock { .map(|x| CardanoPublishBlockField::parse(x)) .collect::, _>>()?; - Ok(CardanoPublishBlock { name, fields, span }) + Ok(CardanoPublishBlock { + name, + fields, + span, + declared_index: 0, + }) } fn span(&self) -> &Span { @@ -711,9 +717,18 @@ impl IntoLower for CardanoPublishBlockField { ctx: &crate::lowering::Context, ) -> Result { match self { - CardanoPublishBlockField::To(x) => Ok(("to".to_string(), x.into_lower(ctx)?)), - CardanoPublishBlockField::Amount(x) => Ok(("amount".to_string(), x.into_lower(ctx)?)), - CardanoPublishBlockField::Datum(x) => Ok(("datum".to_string(), x.into_lower(ctx)?)), + CardanoPublishBlockField::To(x) => { + let ctx = ctx.enter_address_expr(); + Ok(("to".to_string(), x.into_lower(&ctx)?)) + } + CardanoPublishBlockField::Amount(x) => { + let ctx = ctx.enter_asset_expr(); + Ok(("amount".to_string(), x.into_lower(&ctx)?)) + } + CardanoPublishBlockField::Datum(x) => { + let ctx = ctx.enter_datum_expr(); + Ok(("datum".to_string(), x.into_lower(&ctx)?)) + } CardanoPublishBlockField::Version(x) => Ok(("version".to_string(), x.into_lower(ctx)?)), CardanoPublishBlockField::Script(x) => Ok(("script".to_string(), x.into_lower(ctx)?)), } @@ -727,12 +742,17 @@ impl IntoLower for CardanoPublishBlock { &self, ctx: &crate::lowering::Context, ) -> Result { - let data = self + let mut data: HashMap = self .fields .iter() .map(|x| x.into_lower(ctx)) .collect::>()?; + data.insert( + "declared_index".to_string(), + ir::Expression::Number(self.declared_index as i128), + ); + Ok(ir::AdHocDirective { name: "cardano_publish".to_string(), data, @@ -938,6 +958,7 @@ mod tests { ))), ], span: Span::DUMMY, + declared_index: 0, } ); @@ -967,6 +988,7 @@ mod tests { ))), ], span: Span::DUMMY, + declared_index: 0, } ); diff --git a/crates/tx3-lang/src/lowering.rs b/crates/tx3-lang/src/lowering.rs index a49dfe79..4d66d720 100644 --- a/crates/tx3-lang/src/lowering.rs +++ b/crates/tx3-lang/src/lowering.rs @@ -697,12 +697,14 @@ impl IntoLower for ast::OutputBlock { let address = self.find("to").into_lower(ctx)?.unwrap_or_default(); let datum = self.find("datum").into_lower(ctx)?.unwrap_or_default(); let amount = self.find("amount").into_lower(ctx)?.unwrap_or_default(); + let declared_ix = self.declared_index; Ok(ir::Output { address, datum, amount, optional: self.optional, + declared_index: ir::Expression::Number(declared_ix as i128), }) } } diff --git a/crates/tx3-lang/src/parsing.rs b/crates/tx3-lang/src/parsing.rs index 2b34fc1c..816e054f 100644 --- a/crates/tx3-lang/src/parsing.rs +++ b/crates/tx3-lang/src/parsing.rs @@ -208,16 +208,32 @@ impl AstNode for TxDef { let mut signers = None; let mut metadata = None; + let mut declared_index: usize = 0; + for item in inner { match item.as_rule() { Rule::locals_block => locals = Some(LocalsBlock::parse(item)?), Rule::reference_block => references.push(ReferenceBlock::parse(item)?), Rule::input_block => inputs.push(InputBlock::parse(item)?), - Rule::output_block => outputs.push(OutputBlock::parse(item)?), + Rule::output_block => { + let mut ob = OutputBlock::parse(item)?; + ob.declared_index = declared_index; + declared_index += 1; + outputs.push(ob); + } Rule::validity_block => validity = Some(ValidityBlock::parse(item)?), Rule::mint_block => mints.push(MintBlock::parse(item)?), Rule::burn_block => burns.push(MintBlock::parse(item)?), - Rule::chain_specific_block => adhoc.push(ChainSpecificBlock::parse(item)?), + Rule::chain_specific_block => { + let mut csb = ChainSpecificBlock::parse(item)?; + let ChainSpecificBlock::Cardano(cardano_block) = &mut csb; + if let crate::cardano::CardanoBlock::Publish(pb) = cardano_block { + pb.declared_index = declared_index; + declared_index += 1; + } + + adhoc.push(csb); + } Rule::collateral_block => collateral.push(CollateralBlock::parse(item)?), Rule::signers_block => signers = Some(SignersBlock::parse(item)?), Rule::metadata_block => metadata = Some(MetadataBlock::parse(item)?), @@ -617,6 +633,8 @@ impl AstNode for OutputBlock { optional, fields, span, + // Default to 0 and set it later + declared_index: 0, }) } @@ -2464,6 +2482,7 @@ mod tests { }))), ], span: Span::DUMMY, + declared_index: 0, } ); @@ -2817,4 +2836,6 @@ mod tests { test_parsing!(list_concat); test_parsing!(buidler_fest_2026); + + test_parsing!(cardano_publish_min_utxo); } diff --git a/crates/tx3-tir/src/model/v1beta0.rs b/crates/tx3-tir/src/model/v1beta0.rs index 1d0ad338..ad43dccd 100644 --- a/crates/tx3-tir/src/model/v1beta0.rs +++ b/crates/tx3-tir/src/model/v1beta0.rs @@ -305,6 +305,8 @@ pub struct Output { pub datum: Expression, pub amount: Expression, pub optional: bool, + #[serde(default)] + pub declared_index: Expression, } #[derive(Serialize, Deserialize, Debug, Clone)] @@ -522,6 +524,7 @@ impl Node for Output { datum: self.datum.apply(visitor)?, amount: self.amount.apply(visitor)?, optional: self.optional, + declared_index: self.declared_index, }; Ok(visited) diff --git a/crates/tx3-tir/src/reduce/mod.rs b/crates/tx3-tir/src/reduce/mod.rs index eb60cf4c..15617dca 100644 --- a/crates/tx3-tir/src/reduce/mod.rs +++ b/crates/tx3-tir/src/reduce/mod.rs @@ -1159,6 +1159,7 @@ impl Composite for Output { datum: f(self.datum)?, amount: f(self.amount)?, optional: self.optional, + declared_index: self.declared_index, }) } } diff --git a/examples/asteria.ast b/examples/asteria.ast index 4b556cb1..9cdda1d4 100644 --- a/examples/asteria.ast +++ b/examples/asteria.ast @@ -597,7 +597,8 @@ "dummy": false, "start": 1158, "end": 1379 - } + }, + "declared_index": 0 }, { "name": null, @@ -651,7 +652,8 @@ "dummy": false, "start": 1385, "end": 1449 - } + }, + "declared_index": 1 } ], "validity": null, diff --git a/examples/asteria.move_ship.tir b/examples/asteria.move_ship.tir index b3cf5322..11d1815e 100644 --- a/examples/asteria.move_ship.tir +++ b/examples/asteria.move_ship.tir @@ -1168,7 +1168,10 @@ ] } }, - "optional": false + "optional": false, + "declared_index": { + "Number": 0 + } }, { "address": { @@ -1262,7 +1265,10 @@ ] } }, - "optional": false + "optional": false, + "declared_index": { + "Number": 1 + } } ], "validity": null, diff --git a/examples/buidler_fest_2026.ast b/examples/buidler_fest_2026.ast index c0c0f570..53cf2bab 100644 --- a/examples/buidler_fest_2026.ast +++ b/examples/buidler_fest_2026.ast @@ -537,7 +537,8 @@ "dummy": false, "start": 958, "end": 1063 - } + }, + "declared_index": 0 }, { "name": { @@ -672,7 +673,8 @@ "dummy": false, "start": 1069, "end": 1246 - } + }, + "declared_index": 1 }, { "name": { @@ -733,7 +735,8 @@ "dummy": false, "start": 1252, "end": 1331 - } + }, + "declared_index": 2 } ], "validity": { diff --git a/examples/buidler_fest_2026.buy_ticket.tir b/examples/buidler_fest_2026.buy_ticket.tir index 28354443..e5133d3a 100644 --- a/examples/buidler_fest_2026.buy_ticket.tir +++ b/examples/buidler_fest_2026.buy_ticket.tir @@ -324,7 +324,10 @@ ] } }, - "optional": false + "optional": false, + "declared_index": { + "Number": 0 + } }, { "address": { @@ -458,7 +461,10 @@ } } }, - "optional": false + "optional": false, + "declared_index": { + "Number": 1 + } }, { "address": { @@ -486,7 +492,10 @@ } ] }, - "optional": false + "optional": false, + "declared_index": { + "Number": 2 + } } ], "validity": { diff --git a/examples/burn.ast b/examples/burn.ast index 6eafd087..b181ae69 100644 --- a/examples/burn.ast +++ b/examples/burn.ast @@ -222,7 +222,8 @@ "dummy": false, "start": 337, "end": 412 - } + }, + "declared_index": 0 } ], "validity": null, diff --git a/examples/burn.burn_stuff.tir b/examples/burn.burn_stuff.tir index 3a8a4e89..897dfd9e 100644 --- a/examples/burn.burn_stuff.tir +++ b/examples/burn.burn_stuff.tir @@ -244,7 +244,10 @@ ] } }, - "optional": false + "optional": false, + "declared_index": { + "Number": 0 + } } ], "validity": null, diff --git a/examples/cardano_publish_min_utxo.ast b/examples/cardano_publish_min_utxo.ast new file mode 100644 index 00000000..fec23a96 --- /dev/null +++ b/examples/cardano_publish_min_utxo.ast @@ -0,0 +1,207 @@ +{ + "env": null, + "txs": [ + { + "name": { + "value": "test_min_utxo_publish", + "span": { + "dummy": false, + "start": 3, + "end": 24 + } + }, + "parameters": { + "parameters": [], + "span": { + "dummy": false, + "start": 24, + "end": 26 + } + }, + "locals": null, + "references": [], + "inputs": [], + "outputs": [ + { + "name": { + "value": "s", + "span": { + "dummy": false, + "start": 267, + "end": 268 + } + }, + "optional": false, + "fields": [ + { + "To": { + "String": { + "value": "addr1qx0rs5qrvx9qkndwu0w88t0xghgy3f53ha76kpx8uf496m9rn2ursdm3r0fgf5pmm4lpufshl8lquk5yykg4pd00hp6quf2hh2", + "span": { + "dummy": false, + "start": 283, + "end": 388 + } + } + } + }, + { + "Amount": { + "FnCall": { + "callee": { + "value": "Ada", + "span": { + "dummy": false, + "start": 406, + "end": 409 + } + }, + "args": [ + { + "FnCall": { + "callee": { + "value": "min_utxo", + "span": { + "dummy": false, + "start": 410, + "end": 418 + } + }, + "args": [ + { + "Identifier": { + "value": "my_block", + "span": { + "dummy": false, + "start": 419, + "end": 427 + } + } + } + ], + "span": { + "dummy": false, + "start": 410, + "end": 428 + } + } + } + ], + "span": { + "dummy": false, + "start": 406, + "end": 429 + } + } + } + } + ], + "span": { + "dummy": false, + "start": 261, + "end": 436 + }, + "declared_index": 1 + } + ], + "validity": null, + "mints": [], + "burns": [], + "signers": null, + "adhoc": [ + { + "Cardano": { + "Publish": { + "name": { + "value": "my_block", + "span": { + "dummy": false, + "start": 50, + "end": 58 + } + }, + "fields": [ + { + "To": { + "String": { + "value": "addr1qx0rs5qrvx9qkndwu0w88t0xghgy3f53ha76kpx8uf496m9rn2ursdm3r0fgf5pmm4lpufshl8lquk5yykg4pd00hp6quf2hh2", + "span": { + "dummy": false, + "start": 73, + "end": 178 + } + } + } + }, + { + "Amount": { + "FnCall": { + "callee": { + "value": "Ada", + "span": { + "dummy": false, + "start": 196, + "end": 199 + } + }, + "args": [ + { + "Number": 100 + } + ], + "span": { + "dummy": false, + "start": 196, + "end": 204 + } + } + } + }, + { + "Script": { + "HexString": { + "value": "5709", + "span": { + "dummy": false, + "start": 222, + "end": 228 + } + } + } + }, + { + "Version": { + "Number": 2 + } + } + ], + "span": { + "dummy": false, + "start": 42, + "end": 255 + }, + "declared_index": 0 + } + } + } + ], + "span": { + "dummy": false, + "start": 0, + "end": 438 + }, + "collateral": [], + "metadata": null + } + ], + "types": [], + "aliases": [], + "assets": [], + "parties": [], + "policies": [], + "span": { + "dummy": false, + "start": 0, + "end": 439 + } +} \ No newline at end of file diff --git a/examples/cardano_publish_min_utxo.tx3 b/examples/cardano_publish_min_utxo.tx3 new file mode 100644 index 00000000..4615ef4e --- /dev/null +++ b/examples/cardano_publish_min_utxo.tx3 @@ -0,0 +1,13 @@ +tx test_min_utxo_publish() { + cardano::publish my_block { + to: "addr1qx0rs5qrvx9qkndwu0w88t0xghgy3f53ha76kpx8uf496m9rn2ursdm3r0fgf5pmm4lpufshl8lquk5yykg4pd00hp6quf2hh2", + amount: Ada(100), + script: 0x5709, + version: 2, + } + + outputs { + to: "addr1qx0rs5qrvx9qkndwu0w88t0xghgy3f53ha76kpx8uf496m9rn2ursdm3r0fgf5pmm4lpufshl8lquk5yykg4pd00hp6quf2hh2", + amount: Ada(min_utxo(my_block)), + } +} diff --git a/examples/cardano_witness.ast b/examples/cardano_witness.ast index 9136d18d..28f753d1 100644 --- a/examples/cardano_witness.ast +++ b/examples/cardano_witness.ast @@ -203,7 +203,8 @@ "dummy": false, "start": 404, "end": 481 - } + }, + "declared_index": 0 } ], "validity": null, @@ -525,7 +526,8 @@ "dummy": false, "start": 972, "end": 1049 - } + }, + "declared_index": 0 } ], "validity": null, diff --git a/examples/cardano_witness.mint_from_native_script.tir b/examples/cardano_witness.mint_from_native_script.tir index 95e1c83e..da5381cc 100644 --- a/examples/cardano_witness.mint_from_native_script.tir +++ b/examples/cardano_witness.mint_from_native_script.tir @@ -134,7 +134,10 @@ ] } }, - "optional": false + "optional": false, + "declared_index": { + "Number": 0 + } } ], "validity": null, diff --git a/examples/cardano_witness.mint_from_plutus.tir b/examples/cardano_witness.mint_from_plutus.tir index c0f4530f..b3a6bb4e 100644 --- a/examples/cardano_witness.mint_from_plutus.tir +++ b/examples/cardano_witness.mint_from_plutus.tir @@ -134,7 +134,10 @@ ] } }, - "optional": false + "optional": false, + "declared_index": { + "Number": 0 + } } ], "validity": null, diff --git a/examples/disordered.ast b/examples/disordered.ast index de9c48f3..42e4b4e1 100644 --- a/examples/disordered.ast +++ b/examples/disordered.ast @@ -160,7 +160,8 @@ "dummy": false, "start": 58, "end": 125 - } + }, + "declared_index": 0 }, { "name": null, @@ -252,7 +253,8 @@ "dummy": false, "start": 214, "end": 295 - } + }, + "declared_index": 1 } ], "validity": null, diff --git a/examples/donation.ast b/examples/donation.ast index f82e5c24..3e763f5c 100644 --- a/examples/donation.ast +++ b/examples/donation.ast @@ -267,7 +267,8 @@ "dummy": false, "start": 187, "end": 286 - } + }, + "declared_index": 0 } ], "validity": null, diff --git a/examples/donation.mint_from_plutus.tir b/examples/donation.mint_from_plutus.tir index 4aacfdf6..0305adae 100644 --- a/examples/donation.mint_from_plutus.tir +++ b/examples/donation.mint_from_plutus.tir @@ -198,7 +198,10 @@ ] } }, - "optional": false + "optional": false, + "declared_index": { + "Number": 0 + } } ], "validity": null, diff --git a/examples/env_vars.ast b/examples/env_vars.ast index cef2b474..24ad5171 100644 --- a/examples/env_vars.ast +++ b/examples/env_vars.ast @@ -170,7 +170,8 @@ "dummy": false, "start": 343, "end": 426 - } + }, + "declared_index": 0 } ], "validity": null, diff --git a/examples/env_vars.mint_from_env.tir b/examples/env_vars.mint_from_env.tir index b2b72adb..f1871695 100644 --- a/examples/env_vars.mint_from_env.tir +++ b/examples/env_vars.mint_from_env.tir @@ -72,7 +72,10 @@ } ] }, - "optional": false + "optional": false, + "declared_index": { + "Number": 0 + } } ], "validity": null, diff --git a/examples/faucet.ast b/examples/faucet.ast index e961c1d4..13a88f6d 100644 --- a/examples/faucet.ast +++ b/examples/faucet.ast @@ -171,7 +171,8 @@ "dummy": false, "start": 429, "end": 523 - } + }, + "declared_index": 0 } ], "validity": null, diff --git a/examples/faucet.claim_with_password.tir b/examples/faucet.claim_with_password.tir index d1f3874b..a669e3f6 100644 --- a/examples/faucet.claim_with_password.tir +++ b/examples/faucet.claim_with_password.tir @@ -134,7 +134,10 @@ ] } }, - "optional": false + "optional": false, + "declared_index": { + "Number": 0 + } } ], "validity": null, diff --git a/examples/input_datum.ast b/examples/input_datum.ast index c0cb2672..e1070141 100644 --- a/examples/input_datum.ast +++ b/examples/input_datum.ast @@ -259,7 +259,8 @@ "dummy": false, "start": 208, "end": 397 - } + }, + "declared_index": 0 } ], "validity": null, diff --git a/examples/input_datum.increase_counter.tir b/examples/input_datum.increase_counter.tir index f46c0176..f5668f6d 100644 --- a/examples/input_datum.increase_counter.tir +++ b/examples/input_datum.increase_counter.tir @@ -166,7 +166,10 @@ ] } }, - "optional": false + "optional": false, + "declared_index": { + "Number": 0 + } } ], "validity": null, diff --git a/examples/lang_tour.ast b/examples/lang_tour.ast index cfe0e4cd..b5b0597b 100644 --- a/examples/lang_tour.ast +++ b/examples/lang_tour.ast @@ -845,7 +845,8 @@ "dummy": false, "start": 1243, "end": 1622 - } + }, + "declared_index": 0 } ], "validity": { diff --git a/examples/lang_tour.my_tx.tir b/examples/lang_tour.my_tx.tir index 525dcb75..dedfe104 100644 --- a/examples/lang_tour.my_tx.tir +++ b/examples/lang_tour.my_tx.tir @@ -534,7 +534,10 @@ ] } }, - "optional": false + "optional": false, + "declared_index": { + "Number": 0 + } } ], "validity": { @@ -645,14 +648,6 @@ { "name": "vote_delegation_certificate", "data": { - "stake": { - "Bytes": [ - 135, - 101, - 67, - 33 - ] - }, "drep": { "Bytes": [ 18, @@ -660,14 +655,25 @@ 86, 120 ] + }, + "stake": { + "Bytes": [ + 135, + 101, + 67, + 33 + ] } } }, { "name": "withdrawal", "data": { - "amount": { - "Number": 100 + "redeemer": { + "Struct": { + "constructor": 0, + "fields": [] + } }, "credential": { "EvalParam": { @@ -677,11 +683,8 @@ ] } }, - "redeemer": { - "Struct": { - "constructor": 0, - "fields": [] - } + "amount": { + "Number": 100 } } }, diff --git a/examples/list_concat.ast b/examples/list_concat.ast index f8b6c17f..49c7f67d 100644 --- a/examples/list_concat.ast +++ b/examples/list_concat.ast @@ -214,7 +214,8 @@ "dummy": false, "start": 156, "end": 303 - } + }, + "declared_index": 0 } ], "validity": null, diff --git a/examples/list_concat.concat_list.tir b/examples/list_concat.concat_list.tir index 2c78d058..1bd9a505 100644 --- a/examples/list_concat.concat_list.tir +++ b/examples/list_concat.concat_list.tir @@ -128,7 +128,10 @@ ] } }, - "optional": false + "optional": false, + "declared_index": { + "Number": 0 + } } ], "validity": null, diff --git a/examples/local_vars.ast b/examples/local_vars.ast index 432bb4ff..aa1f690b 100644 --- a/examples/local_vars.ast +++ b/examples/local_vars.ast @@ -195,7 +195,8 @@ "dummy": false, "start": 302, "end": 366 - } + }, + "declared_index": 0 } ], "validity": null, diff --git a/examples/local_vars.mint_from_local.tir b/examples/local_vars.mint_from_local.tir index 03853938..ea7efbdc 100644 --- a/examples/local_vars.mint_from_local.tir +++ b/examples/local_vars.mint_from_local.tir @@ -77,7 +77,10 @@ ] } }, - "optional": false + "optional": false, + "declared_index": { + "Number": 0 + } } ], "validity": null, diff --git a/examples/map.ast b/examples/map.ast index 148694e0..525147e4 100644 --- a/examples/map.ast +++ b/examples/map.ast @@ -141,7 +141,8 @@ "dummy": false, "start": 190, "end": 257 - } + }, + "declared_index": 0 }, { "name": null, @@ -336,7 +337,8 @@ "dummy": false, "start": 263, "end": 418 - } + }, + "declared_index": 1 } ], "validity": null, diff --git a/examples/map.transfer.tir b/examples/map.transfer.tir index 99a17871..0fd8f133 100644 --- a/examples/map.transfer.tir +++ b/examples/map.transfer.tir @@ -72,7 +72,10 @@ } ] }, - "optional": false + "optional": false, + "declared_index": { + "Number": 0 + } }, { "address": { @@ -191,7 +194,10 @@ ] } }, - "optional": false + "optional": false, + "declared_index": { + "Number": 1 + } } ], "validity": null, diff --git a/examples/min_utxo.transfer_min.tir b/examples/min_utxo.transfer_min.tir index 8e5d4184..06f62871 100644 --- a/examples/min_utxo.transfer_min.tir +++ b/examples/min_utxo.transfer_min.tir @@ -76,7 +76,10 @@ } } }, - "optional": false + "optional": false, + "declared_index": { + "Number": 0 + } }, { "address": { @@ -163,7 +166,10 @@ ] } }, - "optional": false + "optional": false, + "declared_index": { + "Number": 1 + } } ], "validity": null, diff --git a/examples/reference_script.ast b/examples/reference_script.ast index ccb5f6db..61a70385 100644 --- a/examples/reference_script.ast +++ b/examples/reference_script.ast @@ -179,7 +179,8 @@ "dummy": false, "start": 323, "end": 404 - } + }, + "declared_index": 1 } ], "validity": null, @@ -257,7 +258,8 @@ "dummy": false, "start": 173, "end": 317 - } + }, + "declared_index": 0 } } } @@ -448,7 +450,8 @@ "dummy": false, "start": 675, "end": 756 - } + }, + "declared_index": 1 } ], "validity": null, @@ -526,7 +529,8 @@ "dummy": false, "start": 549, "end": 669 - } + }, + "declared_index": 0 } } } diff --git a/examples/reference_script.publish_native.tir b/examples/reference_script.publish_native.tir index 90fdd3b9..8f63bf5a 100644 --- a/examples/reference_script.publish_native.tir +++ b/examples/reference_script.publish_native.tir @@ -127,7 +127,10 @@ ] } }, - "optional": false + "optional": false, + "declared_index": { + "Number": 1 + } } ], "validity": null, @@ -137,16 +140,6 @@ { "name": "cardano_publish", "data": { - "script": { - "Bytes": [ - 130, - 1, - 129, - 130, - 4, - 0 - ] - }, "amount": { "Assets": [ { @@ -173,6 +166,19 @@ }, "version": { "Number": 0 + }, + "script": { + "Bytes": [ + 130, + 1, + 129, + 130, + 4, + 0 + ] + }, + "declared_index": { + "Number": 0 } } } diff --git a/examples/reference_script.publish_plutus.tir b/examples/reference_script.publish_plutus.tir index 7506c0f5..a42893e9 100644 --- a/examples/reference_script.publish_plutus.tir +++ b/examples/reference_script.publish_plutus.tir @@ -127,7 +127,10 @@ ] } }, - "optional": false + "optional": false, + "declared_index": { + "Number": 1 + } } ], "validity": null, @@ -137,24 +140,8 @@ { "name": "cardano_publish", "data": { - "version": { - "Number": 3 - }, - "amount": { - "Assets": [ - { - "policy": "None", - "asset_name": "None", - "amount": { - "EvalParam": { - "ExpectValue": [ - "quantity", - "Int" - ] - } - } - } - ] + "declared_index": { + "Number": 0 }, "script": { "Bytes": [ @@ -185,6 +172,25 @@ "Address" ] } + }, + "amount": { + "Assets": [ + { + "policy": "None", + "asset_name": "None", + "amount": { + "EvalParam": { + "ExpectValue": [ + "quantity", + "Int" + ] + } + } + } + ] + }, + "version": { + "Number": 3 } } } diff --git a/examples/swap.ast b/examples/swap.ast index 8d915d0f..57a28d15 100644 --- a/examples/swap.ast +++ b/examples/swap.ast @@ -465,7 +465,8 @@ "dummy": false, "start": 479, "end": 682 - } + }, + "declared_index": 0 }, { "name": null, @@ -557,7 +558,8 @@ "dummy": false, "start": 688, "end": 765 - } + }, + "declared_index": 1 } ], "validity": null, diff --git a/examples/swap.swap.tir b/examples/swap.swap.tir index c9a20a39..a4a33b99 100644 --- a/examples/swap.swap.tir +++ b/examples/swap.swap.tir @@ -249,7 +249,10 @@ } } }, - "optional": false + "optional": false, + "declared_index": { + "Number": 0 + } }, { "address": { @@ -339,7 +342,10 @@ ] } }, - "optional": false + "optional": false, + "declared_index": { + "Number": 1 + } } ], "validity": null, diff --git a/examples/transfer.ast b/examples/transfer.ast index a21a5413..4cf90a6a 100644 --- a/examples/transfer.ast +++ b/examples/transfer.ast @@ -141,7 +141,8 @@ "dummy": false, "start": 159, "end": 226 - } + }, + "declared_index": 0 }, { "name": null, @@ -233,7 +234,8 @@ "dummy": false, "start": 232, "end": 313 - } + }, + "declared_index": 1 } ], "validity": null, diff --git a/examples/transfer.transfer.tir b/examples/transfer.transfer.tir index d6750767..aaba3250 100644 --- a/examples/transfer.transfer.tir +++ b/examples/transfer.transfer.tir @@ -72,7 +72,10 @@ } ] }, - "optional": false + "optional": false, + "declared_index": { + "Number": 0 + } }, { "address": { @@ -155,7 +158,10 @@ ] } }, - "optional": false + "optional": false, + "declared_index": { + "Number": 1 + } } ], "validity": null, diff --git a/examples/vesting.ast b/examples/vesting.ast index dac2dfa9..b68cf240 100644 --- a/examples/vesting.ast +++ b/examples/vesting.ast @@ -271,7 +271,8 @@ "dummy": false, "start": 323, "end": 526 - } + }, + "declared_index": 0 }, { "name": null, @@ -363,7 +364,8 @@ "dummy": false, "start": 532, "end": 612 - } + }, + "declared_index": 1 } ], "validity": null, @@ -564,7 +566,8 @@ "dummy": false, "start": 911, "end": 994 - } + }, + "declared_index": 0 } ], "validity": null, diff --git a/examples/vesting.lock.tir b/examples/vesting.lock.tir index 5d9609db..b1824836 100644 --- a/examples/vesting.lock.tir +++ b/examples/vesting.lock.tir @@ -130,7 +130,10 @@ } ] }, - "optional": false + "optional": false, + "declared_index": { + "Number": 0 + } }, { "address": { @@ -213,7 +216,10 @@ ] } }, - "optional": false + "optional": false, + "declared_index": { + "Number": 1 + } } ], "validity": null, diff --git a/examples/vesting.unlock.tir b/examples/vesting.unlock.tir index 23f07fd2..0f8b20c4 100644 --- a/examples/vesting.unlock.tir +++ b/examples/vesting.unlock.tir @@ -210,7 +210,10 @@ ] } }, - "optional": false + "optional": false, + "declared_index": { + "Number": 0 + } } ], "validity": null, diff --git a/examples/withdrawal.ast b/examples/withdrawal.ast index 0f0e7382..f0a48934 100644 --- a/examples/withdrawal.ast +++ b/examples/withdrawal.ast @@ -141,7 +141,8 @@ "dummy": false, "start": 158, "end": 225 - } + }, + "declared_index": 0 }, { "name": null, @@ -233,7 +234,8 @@ "dummy": false, "start": 231, "end": 312 - } + }, + "declared_index": 1 } ], "validity": null, diff --git a/examples/withdrawal.transfer.tir b/examples/withdrawal.transfer.tir index facdbb3c..939505a7 100644 --- a/examples/withdrawal.transfer.tir +++ b/examples/withdrawal.transfer.tir @@ -72,7 +72,10 @@ } ] }, - "optional": false + "optional": false, + "declared_index": { + "Number": 0 + } }, { "address": { @@ -155,7 +158,10 @@ ] } }, - "optional": false + "optional": false, + "declared_index": { + "Number": 1 + } } ], "validity": null,