Firstly, thanks for your work on this project! π
Today I used patch-package to patch @hyperionbt/helios@0.13.38 for the project I'm working on.
As discussed in the Discord, the method balanceCollateral makes use of any 'clean' Transaction Input, however if you are using Script Inputs that are for Lovelace only then this can cause issues.
The below patch fixes the issue for me (it removes our the Script Inputs) but I'm not sure if this will be the best solution overall,
Here is the diff that solved my problem:
diff --git a/node_modules/@hyperionbt/helios/helios.js b/node_modules/@hyperionbt/helios/helios.js
index 9ef16f8..23e8c0a 100644
--- a/node_modules/@hyperionbt/helios/helios.js
+++ b/node_modules/@hyperionbt/helios/helios.js
@@ -37835,7 +37835,7 @@ export class Tx extends CborData {
*/
function addCollateralInputs(inputs) {
// first try using the UTxOs that already form the inputs
- const cleanInputs = inputs.filter(utxo => utxo.value.assets.isZero()).sort((a, b) => Number(a.value.lovelace - b.value.lovelace));
+ const cleanInputs = inputs.filter(utxo => !utxo.address.validatorHash && utxo.value.assets.isZero()).sort((a, b) => Number(a.value.lovelace - b.value.lovelace));
for (let input of cleanInputs) {
if (collateral > minCollateral) {
diff --git a/node_modules/@hyperionbt/helios/src/tx-builder.js b/node_modules/@hyperionbt/helios/src/tx-builder.js
index a6cdfc3..e80310a 100644
--- a/node_modules/@hyperionbt/helios/src/tx-builder.js
+++ b/node_modules/@hyperionbt/helios/src/tx-builder.js
@@ -625,7 +625,7 @@ export class Tx extends CborData {
*/
function addCollateralInputs(inputs) {
// first try using the UTxOs that already form the inputs
- const cleanInputs = inputs.filter(utxo => utxo.value.assets.isZero()).sort((a, b) => Number(a.value.lovelace - b.value.lovelace));
+ const cleanInputs = inputs.filter(utxo => !utxo.address.validatorHash && utxo.value.assets.isZero()).sort((a, b) => Number(a.value.lovelace - b.value.lovelace));
for (let input of cleanInputs) {
if (collateral > minCollateral) {
Hi! π
Firstly, thanks for your work on this project! π
Today I used patch-package to patch
@hyperionbt/helios@0.13.38
for the project I'm working on.As discussed in the Discord, the method
balanceCollateral
makes use of any 'clean' Transaction Input, however if you are using Script Inputs that are for Lovelace only then this can cause issues.The below patch fixes the issue for me (it removes our the Script Inputs) but I'm not sure if this will be the best solution overall,
Here is the diff that solved my problem:
This issue body was partially generated by patch-package.