After adding option to prevent users to send money without any control1

This commit is contained in:
Your Name 2026-11-02 20:06:37 +02:00
parent e3b109a988
commit 977d7a8e43
2 changed files with 9 additions and 7 deletions

View File

@ -17,7 +17,7 @@ import {
formatUsdtRawHuman,
getTransferMinRemainingRaw,
} from '../utils/withdrawalFee';
import { voidUserAdminStatsRefresh } from './userAdminStatsService';
import { queueUserAdminStatsRefresh } from './userAdminStatsService';
/**
* Transfers balance from one user to another identified by email.
@ -115,8 +115,8 @@ export async function requestTransfer(
metadata: { amount: amountRaw.toString(), from_user_id: userId },
});
voidUserAdminStatsRefresh(userId);
voidUserAdminStatsRefresh(recipient.id);
queueUserAdminStatsRefresh(userId);
queueUserAdminStatsRefresh(recipient.id);
return { transactionId: senderTx.id, status: 'completed' };
}

View File

@ -346,6 +346,8 @@ class _TransferScreenState extends State<TransferScreen> {
],
);
}
// Non-null local so closures (e.g. Builder) keep promotion.
final ledgerType = selectedType;
final busy = _submitting || _confirming;
return RefreshIndicator(
@ -493,20 +495,20 @@ class _TransferScreenState extends State<TransferScreen> {
final minRemaining =
CoinDisplay.scaleWithdrawalFeeRaw(
_transferMinRemainingRaw,
selectedType.decimals,
ledgerType.decimals,
);
final maxRaw = available > minRemaining
? available - minRemaining
: BigInt.zero;
final label = minRemaining > BigInt.zero
? s.transferMaxWithMinRemaining(
'${rawAmountToHuman(maxRaw.toString(), selectedType.decimals)} USDT',
'${rawAmountToHuman(minRemaining.toString(), selectedType.decimals)} USDT',
'${rawAmountToHuman(maxRaw.toString(), ledgerType.decimals)} USDT',
'${rawAmountToHuman(minRemaining.toString(), ledgerType.decimals)} USDT',
)
: s.availableAsset(
rawAmountToHuman(
availableRaw,
selectedType.decimals,
ledgerType.decimals,
),
'USDT',
);