Skip to content

Commit

Permalink
Merge pull request #585 from Concordium/ui-update/earn-various
Browse files Browse the repository at this point in the history
Use total account amount when checking available funds for staking
  • Loading branch information
soerenbf authored Dec 18, 2024
2 parents 2667cf2 + ef3627f commit 4f48032
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -305,10 +305,13 @@ export function useTransactionSubmit(sender: AccountAddress.Type, type: AccountT
return useCallback(
async (payload: AccountTransactionPayload, cost: CcdAmount.Type) => {
const accountInfo = await grpc.getAccountInfo(sender);
if (
accountInfo.accountAvailableBalance.microCcdAmount <
getTransactionAmount(type, payload) + (cost.microCcdAmount || 0n)
) {
const available = [
AccountTransactionType.ConfigureBaker,
AccountTransactionType.ConfigureDelegation,
].includes(type)
? accountInfo.accountAmount
: accountInfo.accountAvailableBalance;
if (available.microCcdAmount < getTransactionAmount(type, payload) + (cost.microCcdAmount || 0n)) {
throw TransactionSubmitError.insufficientFunds();
}

Expand Down

0 comments on commit 4f48032

Please sign in to comment.