From b16b8df93e7c13715ed54d066cedcf5a42a35612 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Mar 2026 18:38:55 +0000 Subject: [PATCH 1/2] Initial plan From 7f4d15d61dcab42630d6278f9673f63baa24978e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Mar 2026 18:56:15 +0000 Subject: [PATCH 2/2] Fix Blockfrost evaluation error by using custom evaluator in mint.ts Co-authored-by: SynthLuvr <131367121+SynthLuvr@users.noreply.github.com> --- src/mint.ts | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/src/mint.ts b/src/mint.ts index fd0e637..3ba1fd3 100644 --- a/src/mint.ts +++ b/src/mint.ts @@ -4,12 +4,15 @@ import { Assets, createClient, Data, + Effect, InlineDatum, ScriptHash, + Transaction, TransactionHash, UPLC, UTxO, } from "@evolution-sdk/evolution"; +import { EvaluationError } from "@evolution-sdk/evolution/sdk/builders/TransactionBuilder"; import { Command } from "commander"; import { isProblem } from "ts-handling"; import { @@ -108,11 +111,37 @@ const program = new Command() if (!refScript?.scriptRef) return logThenExit("Script didn't deploy"); cborTxs.push(deployChain.cbor); + // Custom evaluator: calls Blockfrost but only passes off-chain UTxOs. + // provider-based evaluation (Blockfrost) receives all additional UTxOs by + // default, which includes on-chain wallet UTxOs still in deployChain.available + // and triggers an OverlappingAdditionalUtxo error. By filtering to only the + // UTxOs not present in wallet.utxos we avoid that error while still giving + // Blockfrost the off-chain inputs it needs to evaluate the script. + const evaluator = { + evaluate: ( + tx: Transaction.Transaction, + additionalUtxos: ReadonlyArray | undefined, + _context: unknown + ) => + Effect.tryPromise({ + try: () => { + const offChainUtxos = (additionalUtxos ?? []).filter( + (u) => + !wallet.utxos.some( + (w) => + TransactionHash.toHex(w.transactionId) === + TransactionHash.toHex(u.transactionId) && + w.index === u.index + ) + ); + return client.evaluateTx(tx, offChainUtxos as UTxO.UTxO[]); + }, + catch: (error) => + new EvaluationError({ message: String(error), cause: error }), + }), + }; + // Mint transaction: mint token using the deployed reference script. - // Pass deployChain.available as availableUtxos so coin selection only uses - // off-chain UTxOs; this prevents on-chain UTxOs from being included in the - // additionalUtxoSet passed to the evaluator, which would cause an - // OverlappingAdditionalUtxo error. const mintResult = await client .newTx() .mintAssets({ @@ -125,7 +154,7 @@ const program = new Command() .build({ changeAddress, availableUtxos: deployChain.available, - passAdditionalUtxos: true, + evaluator, }); const mintChain = await buildAndChain(mintResult, deployChain.available);