From 02f877f9364595080d1d4f0c2e3b59b0d3751f87 Mon Sep 17 00:00:00 2001 From: Daniel Farrelly Date: Fri, 23 Aug 2024 20:06:45 +0700 Subject: [PATCH] Fix CIP68 minting + chaining missing UTxOs --- addons/@mlabs-haskell/godot-cardano/src/provider/provider.gd | 5 ++++- .../godot-cardano/src/transaction/tx_builder.gd | 4 ++-- libcsl_godot/src/lib.rs | 1 + shop-demo/shop.gd | 1 - 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/addons/@mlabs-haskell/godot-cardano/src/provider/provider.gd b/addons/@mlabs-haskell/godot-cardano/src/provider/provider.gd index d3455de..aa794ca 100644 --- a/addons/@mlabs-haskell/godot-cardano/src/provider/provider.gd +++ b/addons/@mlabs-haskell/godot-cardano/src/provider/provider.gd @@ -130,7 +130,10 @@ func _chain_utxos(utxos: Array[Utxo]) -> Array[Utxo]: return utxos var chained: Array[Utxo] = utxos.duplicate() - for utxo in utxos: + for utxo: Utxo in utxos: + if utxo == null: + continue + var out_ref := utxo.to_out_ref_string() for key in _chaining_map: var inner: Dictionary = _chaining_map[key] diff --git a/addons/@mlabs-haskell/godot-cardano/src/transaction/tx_builder.gd b/addons/@mlabs-haskell/godot-cardano/src/transaction/tx_builder.gd index 1e5ddf0..82d85c7 100644 --- a/addons/@mlabs-haskell/godot-cardano/src/transaction/tx_builder.gd +++ b/addons/@mlabs-haskell/godot-cardano/src/transaction/tx_builder.gd @@ -233,8 +233,8 @@ func mint_cip68_pair(redeemer: PlutusData, conf: Cip68Config) -> TxBuilder: mint_assets( conf.minting_policy_source, [ - TxBuilder.MintToken.new(conf.get_user_token_name(), conf.get_quantity().negate()), - TxBuilder.MintToken.new(conf.get_ref_token_name(), BigInt.one().negate()) + TxBuilder.MintToken.new(conf.get_user_token_name(), conf.get_quantity()), + TxBuilder.MintToken.new(conf.get_ref_token_name(), BigInt.one()) ], redeemer ) diff --git a/libcsl_godot/src/lib.rs b/libcsl_godot/src/lib.rs index e5bca33..7366155 100644 --- a/libcsl_godot/src/lib.rs +++ b/libcsl_godot/src/lib.rs @@ -216,6 +216,7 @@ impl GTxBuilder { &BigNum::from(params.ref_script_coins_per_byte), &BigNum::from(1u64), )) + .deduplicate_explicit_ref_inputs_with_regular_inputs(true) .build() .map_err(|e| TxBuilderError::BadProtocolParameters(e))?; let tx_builder = TransactionBuilder::new(&tx_builder_config); diff --git a/shop-demo/shop.gd b/shop-demo/shop.gd index 236e491..af58387 100644 --- a/shop-demo/shop.gd +++ b/shop-demo/shop.gd @@ -16,7 +16,6 @@ var update_timer: Timer = null var cip68_data: Array[Cip68Config] = [] var owner_pub_key_hash: PubKeyHash = null -var tag: BigInt = BigInt.from_int(239058) var ref_lock_source: PlutusScriptSource var shop_script_source: PlutusScriptSource