Skip to content

Commit d276c37

Browse files
committed
reset before all crowdfund tx
1 parent 0d25ef2 commit d276c37

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/components/crowdfund/base-crowdfund/offchain.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ export class MeshCrowdfundContract extends MeshTxInitiator {
266266
paramUtxoInput: paramUtxoFull.input,
267267
collateralInput: collateral?.input,
268268
});
269-
269+
this.mesh.reset(); // Reset Mesh instance to clear any previous state
270270
const tx = this.mesh
271271
.txIn(
272272
paramUtxoFull.input.txHash,
@@ -281,18 +281,18 @@ export class MeshCrowdfundContract extends MeshTxInitiator {
281281
.txOut(crowdfundAddress, [{ unit: policyId, quantity: "1" }])
282282
.txOutInlineDatumValue(mDatum, "Mesh")
283283
.txInCollateral(
284-
collateral.input.txHash,
285-
collateral.input.outputIndex,
286-
collateral.output.amount,
287-
collateral.output.address,
284+
"0cc83336343f873e04467849ae747bb4b12d5ece72d0f348bbd55ddaa001f946",
285+
0,
286+
[{ unit: "lovelace", quantity: "5000000" }],
287+
"addr_test1qp29f5n5m63f7999w3vwxe9gxfxljc7qzgfzc5f7lff5c4xeax8zlcrh4xn2z797m6z4zet2wd884799d97ge4g2mptsclvkey",
288288
)
289289
.changeAddress(walletAddress)
290290
.selectUtxosFrom(utxos);
291291

292292
console.log("[setupCrowdfund] Completing transaction...");
293293
const txHex = await tx.complete();
294294
console.log("[setupCrowdfund] Transaction completed", {
295-
txHexLength: txHex.length,
295+
tx: txHex,
296296
});
297297

298298
// Extract paramUtxo input for return - should always be a full UTxO at this point
@@ -461,6 +461,7 @@ export class MeshCrowdfundContract extends MeshTxInitiator {
461461
// mint ShareToken and send to walletAddress
462462

463463
console.log("[contributeCrowdfund] Building transaction...");
464+
this.mesh.reset();
464465
const txHex = await this.mesh
465466
.spendingPlutusScriptV3()
466467
.txIn(
@@ -623,7 +624,7 @@ export class MeshCrowdfundContract extends MeshTxInitiator {
623624
);
624625

625626
// Build transaction: spend crowdfund UTxO, burn share tokens, update datum, return funds to user
626-
627+
this.mesh.reset();
627628
const txHex = await this.mesh
628629
.spendingPlutusScriptV3()
629630
.txIn(
@@ -716,6 +717,7 @@ export class MeshCrowdfundContract extends MeshTxInitiator {
716717
initDatum,
717718
});
718719

720+
this.mesh.reset();
719721
const txHex = this.mesh
720722
.txInCollateral(
721723
collateral.input.txHash,

0 commit comments

Comments
 (0)