Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update insufficent funds for fee error #944

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading