From b8da427129ad8fe5b9ca0e2fe74cdc4c85cc89a4 Mon Sep 17 00:00:00 2001 From: sourabhxyz Date: Mon, 4 Nov 2024 17:44:58 +0530 Subject: [PATCH 1/3] feat(#388): require collateral only for plutus scripts & ignore for native scripts --- packages/lucid/src/tx-builder/internal/CompleteTxBuilder.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/lucid/src/tx-builder/internal/CompleteTxBuilder.ts b/packages/lucid/src/tx-builder/internal/CompleteTxBuilder.ts index 3168d4f7..59ab7611 100644 --- a/packages/lucid/src/tx-builder/internal/CompleteTxBuilder.ts +++ b/packages/lucid/src/tx-builder/internal/CompleteTxBuilder.ts @@ -118,9 +118,9 @@ export const complete = ( // Execute programs sequentially yield* Effect.all(config.programs); - const hasScriptExecutions: boolean = config.scripts.size > 0; + const hasPlutusScriptExecutions: boolean = Array.from(config.scripts.values()).some((value) => value.type !== "Native"); // Set collateral input if there are script executions - if (hasScriptExecutions) { + if (hasPlutusScriptExecutions) { const collateralInput = yield* findCollateral( config.lucidConfig.protocolParameters.coinsPerUtxoByte, setCollateral, @@ -141,7 +141,7 @@ export const complete = ( // Second round of coin selection by including script execution costs in fee estimation. // UPLC evaluation need to be performed again if new inputs are selected during coin selection. // Because increasing the inputs can increase the script execution budgets. - if (hasScriptExecutions) + if (hasPlutusScriptExecutions) yield* selectionAndEvaluation( config, walletInputs, From 609fd66ecef093b6aae9a387e812842729634cfa Mon Sep 17 00:00:00 2001 From: sourabhxyz Date: Mon, 4 Nov 2024 17:48:53 +0530 Subject: [PATCH 2/3] style(#388): formatting... --- packages/lucid/src/tx-builder/internal/CompleteTxBuilder.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/lucid/src/tx-builder/internal/CompleteTxBuilder.ts b/packages/lucid/src/tx-builder/internal/CompleteTxBuilder.ts index 59ab7611..36581c1d 100644 --- a/packages/lucid/src/tx-builder/internal/CompleteTxBuilder.ts +++ b/packages/lucid/src/tx-builder/internal/CompleteTxBuilder.ts @@ -118,7 +118,9 @@ export const complete = ( // Execute programs sequentially yield* Effect.all(config.programs); - const hasPlutusScriptExecutions: boolean = Array.from(config.scripts.values()).some((value) => value.type !== "Native"); + const hasPlutusScriptExecutions: boolean = Array.from( + config.scripts.values(), + ).some((value) => value.type !== "Native"); // Set collateral input if there are script executions if (hasPlutusScriptExecutions) { const collateralInput = yield* findCollateral( From 23f1fddf74b131a4f6ee28e8c4d7020bf62d8bcc Mon Sep 17 00:00:00 2001 From: solidsnakedev Date: Tue, 5 Nov 2024 08:43:59 -0700 Subject: [PATCH 3/3] docs: add changeset --- .changeset/two-shrimps-refuse.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/two-shrimps-refuse.md diff --git a/.changeset/two-shrimps-refuse.md b/.changeset/two-shrimps-refuse.md new file mode 100644 index 00000000..ec8deb4d --- /dev/null +++ b/.changeset/two-shrimps-refuse.md @@ -0,0 +1,5 @@ +--- +"@lucid-evolution/lucid": patch +--- + +add collateral only when Script is not NativeScript