Skip to content

Commit ef80a85

Browse files
authored
fix: update insufficent funds for fee error (#944)
1 parent ffce9d4 commit ef80a85

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

src/vms/pvm/etna-builder/spend-reducers/handleFeeAndChange.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ describe('handleFeeAndChange', () => {
2222
testContext,
2323
),
2424
).toThrow(
25-
`Insufficient funds: provided UTXOs need 4 more nAVAX (asset id: ${testContext.avaxAssetID})`,
25+
`Insufficient funds: provided UTXOs need 4 more unlocked nAVAX (asset id: ${testContext.avaxAssetID}) to cover fee.`,
2626
);
2727
});
2828

src/vms/pvm/etna-builder/spend-reducers/handleFeeAndChange.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@ const canPayFeeAndNeedsChange = (
1919
context: Context,
2020
): boolean => {
2121
// Not enough funds to pay the fee.
22+
// NOTE: Time locked UTXOs can not be used to pay fees.
2223
if (excessAVAX < requiredFee) {
2324
throw new Error(
2425
`Insufficient funds: provided UTXOs need ${
2526
requiredFee - excessAVAX
26-
} more nAVAX (asset id: ${context.avaxAssetID})`,
27+
} more unlocked nAVAX (asset id: ${context.avaxAssetID}) to cover fee.`,
2728
);
2829
}
2930

src/vms/pvm/etna-builder/spend-reducers/useSpendableLockedUTXOs.ts

+5
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ export const getUsableUTXOsFilter =
5050
return true;
5151
};
5252

53+
/**
54+
* Reducer function that is responsible for spending UTXOs that are locked and stakeable.
55+
*
56+
* NOTE: Time locked UTXOs can not be used to pay fees.
57+
*/
5358
export const useSpendableLockedUTXOs: SpendReducerFunction = (
5459
state,
5560
spendHelper,

0 commit comments

Comments
 (0)