Skip to content

Commit 7410ae0

Browse files
committed
fix(cip2): adjust fee by hardcoded value (+10k)
1 parent 28d0e67 commit 7410ae0

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

Diff for: packages/cip2/src/selectionConstraints.ts

+12-8
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,18 @@ export const computeMinimumCost =
2727
): EstimateTxFee =>
2828
async (selection) => {
2929
const tx = await buildTx(selection);
30-
return BigInt(
31-
CSL.min_fee(
32-
tx,
33-
CSL.LinearFee.new(
34-
CSL.BigNum.from_str(minFeeCoefficient.toString()),
35-
CSL.BigNum.from_str(minFeeConstant.toString())
36-
)
37-
).to_str()
30+
return (
31+
BigInt(
32+
CSL.min_fee(
33+
tx,
34+
CSL.LinearFee.new(
35+
CSL.BigNum.from_str(minFeeCoefficient.toString()),
36+
CSL.BigNum.from_str(minFeeConstant.toString())
37+
)
38+
).to_str()
39+
// TODO: for some reason this works unreliably for transactions with metadata.
40+
// Figure out why and remove the hardcoded +lovelace
41+
) + 10_000n
3842
);
3943
};
4044

Diff for: packages/cip2/test/selectionConstraints.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ describe('defaultSelectionConstraints', () => {
5050
protocolParameters
5151
});
5252
const result = await constraints.computeMinimumCost(selectionSkeleton);
53-
expect(result).toEqual(fee);
53+
expect(result).toEqual(fee + 10_000n);
5454
expect(buildTx).toBeCalledTimes(1);
5555
expect(buildTx).toBeCalledWith(selectionSkeleton);
5656
});

0 commit comments

Comments
 (0)