diff --git a/src/mint.ts b/src/mint.ts index f02e221..5b53420 100644 --- a/src/mint.ts +++ b/src/mint.ts @@ -130,6 +130,7 @@ const program = new Command() .newTx() .mintAssets({ assets: Assets.fromRecord({ [token]: amount }), + redeemer: TransactionHash.toBytes(ref.transactionId), }) .readFrom({ referenceInputs: [refScript] }) .collectFrom({ inputs: [ref] }) diff --git a/validators/mint.ak b/validators/mint.ak index c7fcd57..f058ed8 100644 --- a/validators/mint.ak +++ b/validators/mint.ak @@ -6,11 +6,15 @@ use cardano/assets.{PolicyId, Value} use cardano/transaction.{Input, NoDatum, Output, OutputReference, Transaction} validator mint(tx_id: Hash, index: Int) { - mint(_redeemer, policy: PolicyId, self: Transaction) { + mint( + redeemer: Hash, + policy: PolicyId, + self: Transaction, + ) { let reference = OutputReference { transaction_id: tx_id, output_index: index } let Transaction { inputs, mint, .. } = self - mint_validator(policy, reference, inputs, mint) + redeemer == tx_id && mint_validator(policy, reference, inputs, mint) } else(_) {