From ff8fd0af73112a23176758c59972f22d42c883f9 Mon Sep 17 00:00:00 2001 From: "Joshua Marchand (JSHy)" <79121297+yHSJ@users.noreply.github.com> Date: Wed, 11 Sep 2024 12:05:03 -0400 Subject: [PATCH] fix: add collateralUtxos to scope when searching for utxos to balance collateral change (#165) --- .changeset/late-geese-tie.md | 5 +++++ packages/blaze-tx/src/tx.ts | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .changeset/late-geese-tie.md diff --git a/.changeset/late-geese-tie.md b/.changeset/late-geese-tie.md new file mode 100644 index 00000000..b596e3d5 --- /dev/null +++ b/.changeset/late-geese-tie.md @@ -0,0 +1,5 @@ +--- +"@blaze-cardano/tx": patch +--- + +search collateralUtxos when balancing collateral change diff --git a/packages/blaze-tx/src/tx.ts b/packages/blaze-tx/src/tx.ts index 3a4e1684..9f0e87a0 100644 --- a/packages/blaze-tx/src/tx.ts +++ b/packages/blaze-tx/src/tx.ts @@ -1334,7 +1334,10 @@ export class TxBuilder { return; } // Retrieve available UTXOs within scope. - const scope = [...this.utxoScope.values()]; + const scope = [ + ...this.utxoScope.values(), + ...this.collateralUtxos.values(), + ]; // Calculate the total collateral based on the transaction fee and collateral percentage. const totalCollateral = BigInt( Math.ceil(