Skip to content

Commit

Permalink
fix: update insufficent funds for fee error (#944)
Browse files Browse the repository at this point in the history
  • Loading branch information
erictaylor authored Dec 17, 2024
1 parent ffce9d4 commit ef80a85
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('handleFeeAndChange', () => {
testContext,
),
).toThrow(
`Insufficient funds: provided UTXOs need 4 more nAVAX (asset id: ${testContext.avaxAssetID})`,
`Insufficient funds: provided UTXOs need 4 more unlocked nAVAX (asset id: ${testContext.avaxAssetID}) to cover fee.`,
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ const canPayFeeAndNeedsChange = (
context: Context,
): boolean => {
// Not enough funds to pay the fee.
// NOTE: Time locked UTXOs can not be used to pay fees.
if (excessAVAX < requiredFee) {
throw new Error(
`Insufficient funds: provided UTXOs need ${
requiredFee - excessAVAX
} more nAVAX (asset id: ${context.avaxAssetID})`,
} more unlocked nAVAX (asset id: ${context.avaxAssetID}) to cover fee.`,
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ export const getUsableUTXOsFilter =
return true;
};

/**
* Reducer function that is responsible for spending UTXOs that are locked and stakeable.
*
* NOTE: Time locked UTXOs can not be used to pay fees.
*/
export const useSpendableLockedUTXOs: SpendReducerFunction = (
state,
spendHelper,
Expand Down

0 comments on commit ef80a85

Please sign in to comment.