Skip to content

Commit

Permalink
Fix mint endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Jann Müller committed Jan 23, 2025
1 parent 39662dd commit bbac375
Showing 1 changed file with 2 additions and 21 deletions.
23 changes: 2 additions & 21 deletions frontend/src/app/mint-authority/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,28 +106,9 @@ export default function Home() {
);
console.log('Mint response:', response.data);
const tx = await lucid.fromTx(response.data.cborHex);
// await signAndSentTx(lucid, tx);
const txBuilder = await makeTxSignBuilder(lucid.wallet(), tx.toTransaction()).complete();
const cmlTx = txBuilder.toTransaction()
// console.log("TxBody: " + cmlTx.body().to_json());
const witnessSet = txBuilder.toTransaction().witness_set();
const expectedScriptDataHash : CML.ScriptDataHash | undefined = CML.calc_script_data_hash(witnessSet.redeemers()!, CML.PlutusDataList.new(), lucid.config().costModels!, witnessSet.languages());
// console.log('Calculated Script Data Hash:', expectedScriptDataHash?.to_hex());
const cmlTxBodyClone = CML.TransactionBody.from_cbor_hex(cmlTx!.body().to_cbor_hex());
// console.log("TxBody: " + cmlTxBodyClone.to_json());
const txIDinAlert = await cmlTxBodyClone.to_json();
const txIDObject = JSON.parse(txIDinAlert);
// console.log('Preclone script hash:', cmlTxBodyClone.script_data_hash()?.to_hex());
cmlTxBodyClone.set_script_data_hash(expectedScriptDataHash!);
// console.log('Postclone script hash:', cmlTxBodyClone.script_data_hash()?.to_hex());
const cmlClonedTx = CML.Transaction.new(cmlTxBodyClone, cmlTx!.witness_set(), true, cmlTx!.auxiliary_data());
const cmlClonedSignedTx = await makeTxSignBuilder(lucid.wallet(), cmlClonedTx).sign.withWallet().complete();

const txId = await cmlClonedSignedTx.submit();
await lucid.awaitTx(txId);

changeAlertInfo({severity: 'success', message: 'Successful new WST mint. View the transaction here:', open: true, link: `https://preview.cexplorer.io/tx/${txIDObject.inputs[0].transaction_id}`});
const txId = await signAndSentTx(lucid, tx);

changeAlertInfo({severity: 'success', message: 'Successful new WST mint. View the transaction here:', open: true, link: `https://preview.cexplorer.io/tx/${txId}`});

await fetchUserDetails();
} catch (error) {
Expand Down

0 comments on commit bbac375

Please sign in to comment.