After correcting the problem of withdrawal2
This commit is contained in:
parent
e3e9433c4c
commit
71ad7598d7
2
backend/dist/dto/user.dto.d.ts
vendored
2
backend/dist/dto/user.dto.d.ts
vendored
@ -75,6 +75,8 @@ export interface SelfProfileRow extends ProfileRow {
|
|||||||
role_name: string;
|
role_name: string;
|
||||||
email_verified: boolean;
|
email_verified: boolean;
|
||||||
totp_enabled: boolean;
|
totp_enabled: boolean;
|
||||||
|
withdrawals_suspended: boolean;
|
||||||
|
under_surveillance: boolean;
|
||||||
created_at: Date;
|
created_at: Date;
|
||||||
}
|
}
|
||||||
//# sourceMappingURL=user.dto.d.ts.map
|
//# sourceMappingURL=user.dto.d.ts.map
|
||||||
2
backend/dist/dto/user.dto.d.ts.map
vendored
2
backend/dist/dto/user.dto.d.ts.map
vendored
@ -1 +1 @@
|
|||||||
{"version":3,"file":"user.dto.d.ts","sourceRoot":"","sources":["../../src/dto/user.dto.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,wGAAwG;AACxG,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,OAAO,CAAC;IACxB,YAAY,EAAE,OAAO,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,sBAAsB,EAAE,OAAO,CAAC;IAChC,qBAAqB,EAAE,OAAO,CAAC;IAC/B,0BAA0B,EAAE,OAAO,CAAC;IACpC,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,WAAW,EAAE,MAAM,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ACnC,UAAU,EAAE,IAAI,CAAC;CAClB;AAED,6GAA6G;AAC7G,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED,+DAA+D;AAC/D,MAAM,WAAW,cAAe,SAAQ,UAAU;IAChD,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,OAAO,CAAC;IACxB,YAAY,EAAE,OAAO,CAAC;IACtB,qBAAqB,EAAE,OAAO,CAAC;IAC/B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,UAAU,EAAE,IAAI,CAAC;CAClB"}
|
||||||
File diff suppressed because one or more lines are too long
5
backend/dist/repositories/userRepository.js
vendored
5
backend/dist/repositories/userRepository.js
vendored
@ -603,7 +603,10 @@ async function getSelfProfileForUser(userId) {
|
|||||||
END
|
END
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
), 'user') AS role_name,
|
), 'user') AS role_name,
|
||||||
u.email_verified, u.totp_enabled, u.created_at
|
u.email_verified, u.totp_enabled,
|
||||||
|
COALESCE(u.withdrawals_suspended, false) AS withdrawals_suspended,
|
||||||
|
COALESCE(u.under_surveillance, false) AS under_surveillance,
|
||||||
|
u.created_at
|
||||||
FROM users u
|
FROM users u
|
||||||
LEFT JOIN roles r ON r.id = u.role_id
|
LEFT JOIN roles r ON r.id = u.role_id
|
||||||
WHERE u.id = $1`, [userId]);
|
WHERE u.id = $1`, [userId]);
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
2
backend/dist/services/authService.d.ts
vendored
2
backend/dist/services/authService.d.ts
vendored
@ -111,6 +111,8 @@ export declare function getProfile(userId: string): Promise<{
|
|||||||
role: string;
|
role: string;
|
||||||
emailVerified: boolean;
|
emailVerified: boolean;
|
||||||
totpEnabled: boolean;
|
totpEnabled: boolean;
|
||||||
|
/** True when withdrawals are blocked for this account (security hold / surveillance). */
|
||||||
|
withdrawalsSuspended: boolean;
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
}>;
|
}>;
|
||||||
/**
|
/**
|
||||||
|
|||||||
2
backend/dist/services/authService.d.ts.map
vendored
2
backend/dist/services/authService.d.ts.map
vendored
@ -1 +1 @@
|
|||||||
{"version":3,"file":"authService.d.ts","sourceRoot":"","sources":["../../src/services/authService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA4BH,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAmB,KAAK,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAmCtC,+DAA+D;AAC/D,wBAAsB,eAAe,CAAC,IAAI,EAAE;IAC1C,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,GAAG,OAAO,CAAC,UAAU,CAAC,CAatB;AAED,wEAAwE;AACxE,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,UAAU,GAAG,UAAU,CAWnE;AAoBD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,GAAG,IAAI,CAgB/E;AAED;;GAEG;AACH,wBAAsB,QAAQ,CAAC,KAAK,EAAE;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,E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CAAA;CAAE,GACxD,OAAO,CAAC;IAAE,aAAa,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAoBtC;AAED;;;;;GAKG;AACH,wBAAsB,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAG1E;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,OAAO,EAAE,UAAU,KAAK,IAAI,CAQ5E"}
|
||||||
1
backend/dist/services/authService.js
vendored
1
backend/dist/services/authService.js
vendored
@ -541,6 +541,7 @@ async function getProfile(userId) {
|
|||||||
role: row.role_name,
|
role: row.role_name,
|
||||||
emailVerified: row.email_verified,
|
emailVerified: row.email_verified,
|
||||||
totpEnabled: row.totp_enabled,
|
totpEnabled: row.totp_enabled,
|
||||||
|
withdrawalsSuspended: Boolean(row.withdrawals_suspended || row.under_surveillance),
|
||||||
createdAt,
|
createdAt,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
2
backend/dist/services/authService.js.map
vendored
2
backend/dist/services/authService.js.map
vendored
File diff suppressed because one or more lines are too long
3
backend/dist/services/securityService.d.ts
vendored
3
backend/dist/services/securityService.d.ts
vendored
@ -6,7 +6,8 @@ import type { SecurityAlert, SecurityAlertSeverity, SecurityAlertStatus } from '
|
|||||||
/** Ledger entry types that may credit or debit user balances. */
|
/** Ledger entry types that may credit or debit user balances. */
|
||||||
export declare const AUTHORIZED_LEDGER_TYPES: Set<string>;
|
export declare const AUTHORIZED_LEDGER_TYPES: Set<string>;
|
||||||
export declare class SecurityBlockedError extends Error {
|
export declare class SecurityBlockedError extends Error {
|
||||||
constructor(message: string);
|
readonly code: string;
|
||||||
|
constructor(message: string, code: string);
|
||||||
}
|
}
|
||||||
export declare function assertUserCanWithdraw(userId: string): Promise<void>;
|
export declare function assertUserCanWithdraw(userId: string): Promise<void>;
|
||||||
export declare function suspendUserForSecurity(userId: string, reason: string, alertType: string, severity?: SecurityAlertSeverity): Promise<void>;
|
export declare function suspendUserForSecurity(userId: string, reason: string, alertType: string, severity?: SecurityAlertSeverity): Promise<void>;
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
{"version":3,"file":"securityService.d.ts","sourceRoot":"","sources":["../../src/services/securityService.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,yBAAyB,MAAM,2CAA2C,CAAC;AASvF,OAAO,KAAK,EAAE,aAAa,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE1G,iEAAiE;AACjE,eAAO,MAAM,uBAAuB,aAclC,CAAC;AAEH,qBAAa,oBAAqB,SAAQ,KAAK;gBACjC,OAAO,EAAE,MAAM;CAI5B;AAED,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAazE;AAED,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,QAAQ,GAAE,qBAA8B,GACvC,OAAO,CAAC,IAAI,CAAC,CAiBf;AAED,wBAAsB,UAAU,CAAC,KAAK,EAAE;IACtC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,qBAAqB,CAAC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,GAAG,OAAO,CAAC,aAAa,CAAC,CAsBzB;AAED,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAsE7E;AAED,wBAAsB,YAAY,CAChC,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,m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AE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;;;;;;;;;;;;;;;;;GAsBA;AAED,wBAAgB,2BAA2B,IAAI,MAAM,CAEpD;AAED,qGAAqG;AACrG,wBAAsB,2BAA2B,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAsBtF"}
|
||||||
7
backend/dist/services/securityService.js
vendored
7
backend/dist/services/securityService.js
vendored
@ -78,9 +78,10 @@ exports.AUTHORIZED_LEDGER_TYPES = new Set([
|
|||||||
'solo_encouragement_bonus',
|
'solo_encouragement_bonus',
|
||||||
]);
|
]);
|
||||||
class SecurityBlockedError extends Error {
|
class SecurityBlockedError extends Error {
|
||||||
constructor(message) {
|
constructor(message, code) {
|
||||||
super(message);
|
super(message);
|
||||||
this.name = 'SecurityBlockedError';
|
this.name = 'SecurityBlockedError';
|
||||||
|
this.code = code;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.SecurityBlockedError = SecurityBlockedError;
|
exports.SecurityBlockedError = SecurityBlockedError;
|
||||||
@ -89,10 +90,10 @@ async function assertUserCanWithdraw(userId) {
|
|||||||
if (!user)
|
if (!user)
|
||||||
throw new Error('User not found');
|
throw new Error('User not found');
|
||||||
if (user.withdrawals_suspended) {
|
if (user.withdrawals_suspended) {
|
||||||
throw new SecurityBlockedError('Withdrawals are suspended on your account pending security review. Contact support.');
|
throw new SecurityBlockedError('Withdrawals are suspended on your account pending security review. Contact support.', 'WITHDRAWALS_SUSPENDED');
|
||||||
}
|
}
|
||||||
if (user.under_surveillance) {
|
if (user.under_surveillance) {
|
||||||
throw new SecurityBlockedError('Your account is under security surveillance. Withdrawals are temporarily disabled.');
|
throw new SecurityBlockedError('Your account is under security surveillance. Withdrawals are temporarily disabled. Contact support.', 'ACCOUNT_UNDER_SURVEILLANCE');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async function suspendUserForSecurity(userId, reason, alertType, severity = 'high') {
|
async function suspendUserForSecurity(userId, reason, alertType, severity = 'high') {
|
||||||
|
|||||||
2
backend/dist/services/securityService.js.map
vendored
2
backend/dist/services/securityService.js.map
vendored
File diff suppressed because one or more lines are too long
@ -79,5 +79,7 @@ export interface SelfProfileRow extends ProfileRow {
|
|||||||
role_name: string;
|
role_name: string;
|
||||||
email_verified: boolean;
|
email_verified: boolean;
|
||||||
totp_enabled: boolean;
|
totp_enabled: boolean;
|
||||||
|
withdrawals_suspended: boolean;
|
||||||
|
under_surveillance: boolean;
|
||||||
created_at: Date;
|
created_at: Date;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -778,7 +778,10 @@ export async function getSelfProfileForUser(userId: string): Promise<SelfProfile
|
|||||||
END
|
END
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
), 'user') AS role_name,
|
), 'user') AS role_name,
|
||||||
u.email_verified, u.totp_enabled, u.created_at
|
u.email_verified, u.totp_enabled,
|
||||||
|
COALESCE(u.withdrawals_suspended, false) AS withdrawals_suspended,
|
||||||
|
COALESCE(u.under_surveillance, false) AS under_surveillance,
|
||||||
|
u.created_at
|
||||||
FROM users u
|
FROM users u
|
||||||
LEFT JOIN roles r ON r.id = u.role_id
|
LEFT JOIN roles r ON r.id = u.role_id
|
||||||
WHERE u.id = $1`,
|
WHERE u.id = $1`,
|
||||||
|
|||||||
@ -534,6 +534,8 @@ export async function getProfile(userId: string): Promise<{
|
|||||||
role: string;
|
role: string;
|
||||||
emailVerified: boolean;
|
emailVerified: boolean;
|
||||||
totpEnabled: boolean;
|
totpEnabled: boolean;
|
||||||
|
/** True when withdrawals are blocked for this account (security hold / surveillance). */
|
||||||
|
withdrawalsSuspended: boolean;
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
}> {
|
}> {
|
||||||
const row = await userRepository.getSelfProfileForUser(userId);
|
const row = await userRepository.getSelfProfileForUser(userId);
|
||||||
@ -571,6 +573,7 @@ export async function getProfile(userId: string): Promise<{
|
|||||||
role: row.role_name,
|
role: row.role_name,
|
||||||
emailVerified: row.email_verified,
|
emailVerified: row.email_verified,
|
||||||
totpEnabled: row.totp_enabled,
|
totpEnabled: row.totp_enabled,
|
||||||
|
withdrawalsSuspended: Boolean(row.withdrawals_suspended || row.under_surveillance),
|
||||||
createdAt,
|
createdAt,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,9 +34,12 @@ export const AUTHORIZED_LEDGER_TYPES = new Set([
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
export class SecurityBlockedError extends Error {
|
export class SecurityBlockedError extends Error {
|
||||||
constructor(message: string) {
|
readonly code: string;
|
||||||
|
|
||||||
|
constructor(message: string, code: string) {
|
||||||
super(message);
|
super(message);
|
||||||
this.name = 'SecurityBlockedError';
|
this.name = 'SecurityBlockedError';
|
||||||
|
this.code = code;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,12 +48,14 @@ export async function assertUserCanWithdraw(userId: string): Promise<void> {
|
|||||||
if (!user) throw new Error('User not found');
|
if (!user) throw new Error('User not found');
|
||||||
if (user.withdrawals_suspended) {
|
if (user.withdrawals_suspended) {
|
||||||
throw new SecurityBlockedError(
|
throw new SecurityBlockedError(
|
||||||
'Withdrawals are suspended on your account pending security review. Contact support.'
|
'Withdrawals are suspended on your account pending security review. Contact support.',
|
||||||
|
'WITHDRAWALS_SUSPENDED'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (user.under_surveillance) {
|
if (user.under_surveillance) {
|
||||||
throw new SecurityBlockedError(
|
throw new SecurityBlockedError(
|
||||||
'Your account is under security surveillance. Withdrawals are temporarily disabled.'
|
'Your account is under security surveillance. Withdrawals are temporarily disabled. Contact support.',
|
||||||
|
'ACCOUNT_UNDER_SURVEILLANCE'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
33
backend/src/tests/securityWithdrawBlock.test.ts
Normal file
33
backend/src/tests/securityWithdrawBlock.test.ts
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
import { describe, test } from 'node:test';
|
||||||
|
import assert from 'node:assert/strict';
|
||||||
|
|
||||||
|
import { SecurityBlockedError } from '../services/securityService';
|
||||||
|
import { clientErrorMessage } from '../utils/safeError';
|
||||||
|
import { httpStatusForError } from '../utils/httpError';
|
||||||
|
|
||||||
|
describe('security withdrawal block errors', () => {
|
||||||
|
test('maps suspended / surveillance to 403 with a stable code', () => {
|
||||||
|
const suspended = new SecurityBlockedError(
|
||||||
|
'Withdrawals are suspended on your account pending security review. Contact support.',
|
||||||
|
'WITHDRAWALS_SUSPENDED'
|
||||||
|
);
|
||||||
|
const surveillance = new SecurityBlockedError(
|
||||||
|
'Your account is under security surveillance. Withdrawals are temporarily disabled. Contact support.',
|
||||||
|
'ACCOUNT_UNDER_SURVEILLANCE'
|
||||||
|
);
|
||||||
|
assert.equal(httpStatusForError(suspended), 403);
|
||||||
|
assert.equal(httpStatusForError(surveillance), 403);
|
||||||
|
assert.equal(suspended.code, 'WITHDRAWALS_SUSPENDED');
|
||||||
|
assert.equal(surveillance.code, 'ACCOUNT_UNDER_SURVEILLANCE');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('exposes a clear client message (not generic Request failed)', () => {
|
||||||
|
const err = new SecurityBlockedError(
|
||||||
|
'Withdrawals are suspended on your account pending security review. Contact support.',
|
||||||
|
'WITHDRAWALS_SUSPENDED'
|
||||||
|
);
|
||||||
|
const msg = clientErrorMessage(err, 'Request failed');
|
||||||
|
assert.match(msg, /suspended/i);
|
||||||
|
assert.notEqual(msg, 'Request failed');
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -7,10 +7,12 @@ function computeWithdrawEligibility(input: {
|
|||||||
hasWithdrawNetwork: boolean;
|
hasWithdrawNetwork: boolean;
|
||||||
availableRaw: string;
|
availableRaw: string;
|
||||||
feeRaw: string;
|
feeRaw: string;
|
||||||
|
withdrawalsSuspended?: boolean;
|
||||||
}) {
|
}) {
|
||||||
const availableRaw = BigInt(input.availableRaw || '0');
|
const availableRaw = BigInt(input.availableRaw || '0');
|
||||||
const feeRaw = BigInt(input.feeRaw || '0');
|
const feeRaw = BigInt(input.feeRaw || '0');
|
||||||
const maxReceivableRaw = availableRaw > feeRaw ? availableRaw - feeRaw : 0n;
|
const maxReceivableRaw = availableRaw > feeRaw ? availableRaw - feeRaw : 0n;
|
||||||
|
if (input.withdrawalsSuspended) return { allowed: false, reason: 'account_suspended' as const };
|
||||||
if (!input.withdrawalsEnabled) return { allowed: false, reason: 'global_off' as const };
|
if (!input.withdrawalsEnabled) return { allowed: false, reason: 'global_off' as const };
|
||||||
if (!input.hasWithdrawNetwork) return { allowed: false, reason: 'no_network' as const };
|
if (!input.hasWithdrawNetwork) return { allowed: false, reason: 'no_network' as const };
|
||||||
if (maxReceivableRaw <= 0n) return { allowed: false, reason: 'insufficient_for_fee' as const };
|
if (maxReceivableRaw <= 0n) return { allowed: false, reason: 'insufficient_for_fee' as const };
|
||||||
@ -18,6 +20,18 @@ function computeWithdrawEligibility(input: {
|
|||||||
}
|
}
|
||||||
|
|
||||||
describe('withdraw eligibility rules', () => {
|
describe('withdraw eligibility rules', () => {
|
||||||
|
test('blocks when account withdrawals are suspended', () => {
|
||||||
|
const r = computeWithdrawEligibility({
|
||||||
|
withdrawalsEnabled: true,
|
||||||
|
hasWithdrawNetwork: true,
|
||||||
|
availableRaw: '5000000',
|
||||||
|
feeRaw: '500000',
|
||||||
|
withdrawalsSuspended: true,
|
||||||
|
});
|
||||||
|
assert.equal(r.allowed, false);
|
||||||
|
assert.equal(r.reason, 'account_suspended');
|
||||||
|
});
|
||||||
|
|
||||||
test('blocks when global kill-switch off', () => {
|
test('blocks when global kill-switch off', () => {
|
||||||
const r = computeWithdrawEligibility({
|
const r = computeWithdrawEligibility({
|
||||||
withdrawalsEnabled: false,
|
withdrawalsEnabled: false,
|
||||||
|
|||||||
@ -21,7 +21,14 @@ export function httpStatusForError(error: unknown): number {
|
|||||||
const code = (error as { code?: string })?.code;
|
const code = (error as { code?: string })?.code;
|
||||||
if (code === 'EMAIL_NOT_VERIFIED') return 403;
|
if (code === 'EMAIL_NOT_VERIFIED') return 403;
|
||||||
if (code === 'WITHDRAWAL_2FA_REQUIRED') return 403;
|
if (code === 'WITHDRAWAL_2FA_REQUIRED') return 403;
|
||||||
if (code === 'WITHDRAWALS_DISABLED' || code === 'WITHDRAWAL_NETWORK_DISABLED') return 403;
|
if (
|
||||||
|
code === 'WITHDRAWALS_DISABLED' ||
|
||||||
|
code === 'WITHDRAWAL_NETWORK_DISABLED' ||
|
||||||
|
code === 'WITHDRAWALS_SUSPENDED' ||
|
||||||
|
code === 'ACCOUNT_UNDER_SURVEILLANCE'
|
||||||
|
) {
|
||||||
|
return 403;
|
||||||
|
}
|
||||||
if (
|
if (
|
||||||
code === 'INSUFFICIENT_BALANCE' ||
|
code === 'INSUFFICIENT_BALANCE' ||
|
||||||
code === 'HOT_WALLET_INSUFFICIENT_LIQUIDITY' ||
|
code === 'HOT_WALLET_INSUFFICIENT_LIQUIDITY' ||
|
||||||
|
|||||||
@ -14,6 +14,8 @@ export function clientErrorMessage(error: unknown, fallback = 'Request failed'):
|
|||||||
const exposeByCode = new Set([
|
const exposeByCode = new Set([
|
||||||
'WITHDRAWALS_DISABLED',
|
'WITHDRAWALS_DISABLED',
|
||||||
'WITHDRAWAL_NETWORK_DISABLED',
|
'WITHDRAWAL_NETWORK_DISABLED',
|
||||||
|
'WITHDRAWALS_SUSPENDED',
|
||||||
|
'ACCOUNT_UNDER_SURVEILLANCE',
|
||||||
'HOT_WALLET_INSUFFICIENT_LIQUIDITY',
|
'HOT_WALLET_INSUFFICIENT_LIQUIDITY',
|
||||||
'INSUFFICIENT_BALANCE',
|
'INSUFFICIENT_BALANCE',
|
||||||
'DAILY_WITHDRAWAL_LIMIT_EXCEEDED',
|
'DAILY_WITHDRAWAL_LIMIT_EXCEEDED',
|
||||||
@ -28,11 +30,18 @@ export function clientErrorMessage(error: unknown, fallback = 'Request failed'):
|
|||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (error instanceof Error && error.name === 'SecurityBlockedError' && msg.trim()) {
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
if (error instanceof Error && error.message) {
|
if (error instanceof Error && error.message) {
|
||||||
if (/^(Invalid|Unauthorized|Forbidden|Not found|2FA|Account|Password|Email|Phone|Referrer|referral)/i.test(msg)) {
|
if (/^(Invalid|Unauthorized|Forbidden|Not found|2FA|Account|Password|Email|Phone|Referrer|referral)/i.test(msg)) {
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
if (/Withdrawals are disabled/i.test(msg)) {
|
if (/Withdrawals are (disabled|suspended)/i.test(msg)) {
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
if (/under security surveillance/i.test(msg)) {
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -118,6 +118,16 @@ class AppException implements Exception {
|
|||||||
code: 'TRANSFER_MIN_REMAINING',
|
code: 'TRANSFER_MIN_REMAINING',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
if (code == 'WITHDRAWALS_SUSPENDED' || code == 'ACCOUNT_UNDER_SURVEILLANCE') {
|
||||||
|
return AppException(
|
||||||
|
_t(
|
||||||
|
'Withdrawals are suspended on your account pending a security review. Please contact support for help.',
|
||||||
|
'Les retraits sont suspendus sur votre compte en attendant une vérification de sécurité. Contactez le support pour obtenir de l’aide.',
|
||||||
|
),
|
||||||
|
statusCode: status,
|
||||||
|
code: code is String ? code : 'WITHDRAWALS_SUSPENDED',
|
||||||
|
);
|
||||||
|
}
|
||||||
if (code == 'TEST_PREDICTION_LIMIT') {
|
if (code == 'TEST_PREDICTION_LIMIT') {
|
||||||
final waitRaw = data['wait'];
|
final waitRaw = data['wait'];
|
||||||
final wait = waitRaw is String && waitRaw.trim().isNotEmpty ? waitRaw.trim() : '24h';
|
final wait = waitRaw is String && waitRaw.trim().isNotEmpty ? waitRaw.trim() : '24h';
|
||||||
|
|||||||
@ -340,6 +340,7 @@ class AuthRepositoryImpl implements AuthRepository {
|
|||||||
nationality: (data['nationality'] as String?)?.toUpperCase(),
|
nationality: (data['nationality'] as String?)?.toUpperCase(),
|
||||||
gender: data['gender'] as String?,
|
gender: data['gender'] as String?,
|
||||||
totpEnabled: data['totpEnabled'] == true,
|
totpEnabled: data['totpEnabled'] == true,
|
||||||
|
withdrawalsSuspended: data['withdrawalsSuspended'] == true,
|
||||||
);
|
);
|
||||||
} on DioException catch (e) {
|
} on DioException catch (e) {
|
||||||
throw AppException.fromDio(e, fallback: 'Failed to load profile');
|
throw AppException.fromDio(e, fallback: 'Failed to load profile');
|
||||||
@ -419,6 +420,7 @@ class UserProfile {
|
|||||||
this.nationality,
|
this.nationality,
|
||||||
this.gender,
|
this.gender,
|
||||||
this.totpEnabled = false,
|
this.totpEnabled = false,
|
||||||
|
this.withdrawalsSuspended = false,
|
||||||
});
|
});
|
||||||
final String? firstName;
|
final String? firstName;
|
||||||
final String? middleName;
|
final String? middleName;
|
||||||
@ -430,6 +432,8 @@ class UserProfile {
|
|||||||
final String? nationality;
|
final String? nationality;
|
||||||
final String? gender;
|
final String? gender;
|
||||||
final bool totpEnabled;
|
final bool totpEnabled;
|
||||||
|
/// Security hold / surveillance — withdrawals blocked until support clears it.
|
||||||
|
final bool withdrawalsSuspended;
|
||||||
}
|
}
|
||||||
|
|
||||||
class LoginResult {
|
class LoginResult {
|
||||||
|
|||||||
@ -14,6 +14,7 @@ import '../../../data/models/test_wallet_models.dart';
|
|||||||
import '../../../data/models/transaction_model.dart';
|
import '../../../data/models/transaction_model.dart';
|
||||||
import '../../../data/repositories/share_card_repository.dart';
|
import '../../../data/repositories/share_card_repository.dart';
|
||||||
import '../../../data/repositories/wallet_repository_impl.dart';
|
import '../../../data/repositories/wallet_repository_impl.dart';
|
||||||
|
import '../../../domain/repositories/repositories.dart';
|
||||||
import '../../../domain/repositories/referral_repository.dart';
|
import '../../../domain/repositories/referral_repository.dart';
|
||||||
import '../../../l10n/app_strings.dart';
|
import '../../../l10n/app_strings.dart';
|
||||||
import '../../../shared/widgets/app_snackbar.dart';
|
import '../../../shared/widgets/app_snackbar.dart';
|
||||||
@ -51,6 +52,7 @@ class _WalletOverviewScreenState extends State<WalletOverviewScreen>
|
|||||||
bool _prefsLoaded = false;
|
bool _prefsLoaded = false;
|
||||||
bool _requestingTestCredits = false;
|
bool _requestingTestCredits = false;
|
||||||
bool _transferringBonus = false;
|
bool _transferringBonus = false;
|
||||||
|
bool _withdrawalsSuspended = false;
|
||||||
|
|
||||||
static const _categories = ['deposits', 'withdrawals', 'transfers', 'predictions'];
|
static const _categories = ['deposits', 'withdrawals', 'transfers', 'predictions'];
|
||||||
|
|
||||||
@ -61,6 +63,7 @@ class _WalletOverviewScreenState extends State<WalletOverviewScreen>
|
|||||||
_tabController.addListener(_onTabChanged);
|
_tabController.addListener(_onTabChanged);
|
||||||
context.read<WalletBloc>().add(const WalletLoadRequested(ifStale: true));
|
context.read<WalletBloc>().add(const WalletLoadRequested(ifStale: true));
|
||||||
_loadHidePreference();
|
_loadHidePreference();
|
||||||
|
_loadWithdrawSecurityFlag();
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
sl<ShareCardRepository>().getConfig();
|
sl<ShareCardRepository>().getConfig();
|
||||||
@ -70,6 +73,20 @@ class _WalletOverviewScreenState extends State<WalletOverviewScreen>
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> _loadWithdrawSecurityFlag() async {
|
||||||
|
try {
|
||||||
|
final cached = sl<AuthRepository>().peekLastProfile();
|
||||||
|
if (cached != null && mounted) {
|
||||||
|
setState(() => _withdrawalsSuspended = cached.withdrawalsSuspended);
|
||||||
|
}
|
||||||
|
final profile = await sl<AuthRepository>().getProfile(force: true);
|
||||||
|
if (!mounted) return;
|
||||||
|
setState(() => _withdrawalsSuspended = profile.withdrawalsSuspended);
|
||||||
|
} catch (_) {
|
||||||
|
// Keep last known flag; API still returns a clear error on submit.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_tabController.removeListener(_onTabChanged);
|
_tabController.removeListener(_onTabChanged);
|
||||||
@ -285,21 +302,22 @@ class _WalletOverviewScreenState extends State<WalletOverviewScreen>
|
|||||||
hasWithdrawNetwork: hasRail,
|
hasWithdrawNetwork: hasRail,
|
||||||
availableRaw: balance.available,
|
availableRaw: balance.available,
|
||||||
feeRaw: state.withdrawalFeeRaw,
|
feeRaw: state.withdrawalFeeRaw,
|
||||||
|
withdrawalsSuspended: _withdrawalsSuspended,
|
||||||
);
|
);
|
||||||
String? withdrawReason;
|
String? withdrawReason;
|
||||||
if (!eligibility.allowed) {
|
if (!eligibility.allowed) {
|
||||||
switch (eligibility.reason) {
|
switch (eligibility.reason) {
|
||||||
|
case WithdrawBlockReason.accountSuspended:
|
||||||
|
withdrawReason = s.withdrawalsSuspendedAccount;
|
||||||
case WithdrawBlockReason.globalOff:
|
case WithdrawBlockReason.globalOff:
|
||||||
withdrawReason =
|
withdrawReason = s.withdrawalsDisabled;
|
||||||
'Withdrawals are temporarily disabled by the platform.';
|
|
||||||
case WithdrawBlockReason.noNetwork:
|
case WithdrawBlockReason.noNetwork:
|
||||||
withdrawReason =
|
withdrawReason = s.noWithdrawNetworks;
|
||||||
'No withdrawal network is enabled right now.';
|
|
||||||
case WithdrawBlockReason.insufficientForFee:
|
case WithdrawBlockReason.insufficientForFee:
|
||||||
withdrawReason =
|
withdrawReason =
|
||||||
'Insufficient balance for a withdrawal after the network fee.';
|
'Insufficient balance for a withdrawal after the network fee.';
|
||||||
case null:
|
case null:
|
||||||
withdrawReason = 'Withdrawals unavailable.';
|
withdrawReason = s.withdrawalsDisabled;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Column(
|
return Column(
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import '../../../core/utils/amount_utils.dart';
|
|||||||
import '../../../core/utils/coin_display.dart';
|
import '../../../core/utils/coin_display.dart';
|
||||||
import '../../../data/repositories/wallet_repository_impl.dart';
|
import '../../../data/repositories/wallet_repository_impl.dart';
|
||||||
import '../../../domain/repositories/health_repository.dart';
|
import '../../../domain/repositories/health_repository.dart';
|
||||||
|
import '../../../domain/repositories/repositories.dart';
|
||||||
import '../../../l10n/app_strings.dart';
|
import '../../../l10n/app_strings.dart';
|
||||||
import '../../../shared/widgets/app_snackbar.dart';
|
import '../../../shared/widgets/app_snackbar.dart';
|
||||||
import '../../../shared/widgets/pred_card.dart';
|
import '../../../shared/widgets/pred_card.dart';
|
||||||
@ -43,6 +44,7 @@ class _WithdrawScreenState extends State<WithdrawScreen> {
|
|||||||
String? _selectedWalletType;
|
String? _selectedWalletType;
|
||||||
String _networkFeeRaw = '0';
|
String _networkFeeRaw = '0';
|
||||||
bool _withdrawalsEnabled = false;
|
bool _withdrawalsEnabled = false;
|
||||||
|
bool _withdrawalsSuspended = false;
|
||||||
bool _healthLoaded = false;
|
bool _healthLoaded = false;
|
||||||
bool _healthFailed = false;
|
bool _healthFailed = false;
|
||||||
bool _confirming = false;
|
bool _confirming = false;
|
||||||
@ -55,6 +57,21 @@ class _WithdrawScreenState extends State<WithdrawScreen> {
|
|||||||
super.initState();
|
super.initState();
|
||||||
context.read<WalletBloc>().add(const WalletLoadRequested(ifStale: true));
|
context.read<WalletBloc>().add(const WalletLoadRequested(ifStale: true));
|
||||||
_loadHealthFresh();
|
_loadHealthFresh();
|
||||||
|
_loadWithdrawSecurityFlag();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _loadWithdrawSecurityFlag() async {
|
||||||
|
try {
|
||||||
|
final cached = sl<AuthRepository>().peekLastProfile();
|
||||||
|
if (cached != null && mounted) {
|
||||||
|
setState(() => _withdrawalsSuspended = cached.withdrawalsSuspended);
|
||||||
|
}
|
||||||
|
final profile = await sl<AuthRepository>().getProfile(force: true);
|
||||||
|
if (!mounted) return;
|
||||||
|
setState(() => _withdrawalsSuspended = profile.withdrawalsSuspended);
|
||||||
|
} catch (_) {
|
||||||
|
// Keep last known flag; API still returns a clear error on submit.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _loadHealthFresh() async {
|
Future<void> _loadHealthFresh() async {
|
||||||
@ -79,7 +96,7 @@ class _WithdrawScreenState extends State<WithdrawScreen> {
|
|||||||
|
|
||||||
Future<void> _refreshAll() async {
|
Future<void> _refreshAll() async {
|
||||||
context.read<WalletBloc>().add(const WalletLoadRequested());
|
context.read<WalletBloc>().add(const WalletLoadRequested());
|
||||||
await _loadHealthFresh();
|
await Future.wait([_loadHealthFresh(), _loadWithdrawSecurityFlag()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -98,6 +115,10 @@ class _WithdrawScreenState extends State<WithdrawScreen> {
|
|||||||
await _loadHealthFresh();
|
await _loadHealthFresh();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (_withdrawalsSuspended) {
|
||||||
|
showErrorSnackBar(context, s.withdrawalsSuspendedAccount);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!_withdrawalsEnabled) {
|
if (!_withdrawalsEnabled) {
|
||||||
showErrorSnackBar(context, s.withdrawalsDisabled);
|
showErrorSnackBar(context, s.withdrawalsDisabled);
|
||||||
return;
|
return;
|
||||||
@ -143,6 +164,10 @@ class _WithdrawScreenState extends State<WithdrawScreen> {
|
|||||||
|
|
||||||
context.read<WalletBloc>().add(const WalletLoadRequested());
|
context.read<WalletBloc>().add(const WalletLoadRequested());
|
||||||
|
|
||||||
|
if (_withdrawalsSuspended) {
|
||||||
|
showErrorSnackBar(context, s.withdrawalsSuspendedAccount);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!preflight.health.withdrawalsEnabled) {
|
if (!preflight.health.withdrawalsEnabled) {
|
||||||
showErrorSnackBar(context, s.withdrawalsDisabled);
|
showErrorSnackBar(context, s.withdrawalsDisabled);
|
||||||
return;
|
return;
|
||||||
@ -367,6 +392,7 @@ class _WithdrawScreenState extends State<WithdrawScreen> {
|
|||||||
hasWithdrawNetwork: types.isNotEmpty,
|
hasWithdrawNetwork: types.isNotEmpty,
|
||||||
availableRaw: spendable?.available ?? '0',
|
availableRaw: spendable?.available ?? '0',
|
||||||
feeRaw: _networkFeeRaw,
|
feeRaw: _networkFeeRaw,
|
||||||
|
withdrawalsSuspended: _withdrawalsSuspended,
|
||||||
);
|
);
|
||||||
final formEnabled = _healthLoaded &&
|
final formEnabled = _healthLoaded &&
|
||||||
!_healthFailed &&
|
!_healthFailed &&
|
||||||
@ -401,6 +427,8 @@ class _WithdrawScreenState extends State<WithdrawScreen> {
|
|||||||
padding: const EdgeInsets.all(12),
|
padding: const EdgeInsets.all(12),
|
||||||
child: Text(
|
child: Text(
|
||||||
switch (eligibility.reason) {
|
switch (eligibility.reason) {
|
||||||
|
WithdrawBlockReason.accountSuspended =>
|
||||||
|
s.withdrawalsSuspendedAccount,
|
||||||
WithdrawBlockReason.globalOff =>
|
WithdrawBlockReason.globalOff =>
|
||||||
s.withdrawalsDisabled,
|
s.withdrawalsDisabled,
|
||||||
WithdrawBlockReason.noNetwork =>
|
WithdrawBlockReason.noNetwork =>
|
||||||
|
|||||||
@ -1,7 +1,12 @@
|
|||||||
/// Shared withdraw eligibility (global kill-switch, rails, fee vs balance).
|
/// Shared withdraw eligibility (global kill-switch, rails, fee vs balance).
|
||||||
library;
|
library;
|
||||||
|
|
||||||
enum WithdrawBlockReason { globalOff, noNetwork, insufficientForFee }
|
enum WithdrawBlockReason {
|
||||||
|
accountSuspended,
|
||||||
|
globalOff,
|
||||||
|
noNetwork,
|
||||||
|
insufficientForFee,
|
||||||
|
}
|
||||||
|
|
||||||
class WithdrawEligibility {
|
class WithdrawEligibility {
|
||||||
const WithdrawEligibility({
|
const WithdrawEligibility({
|
||||||
@ -26,11 +31,21 @@ WithdrawEligibility computeWithdrawEligibility({
|
|||||||
required bool hasWithdrawNetwork,
|
required bool hasWithdrawNetwork,
|
||||||
required String availableRaw,
|
required String availableRaw,
|
||||||
required String feeRaw,
|
required String feeRaw,
|
||||||
|
bool withdrawalsSuspended = false,
|
||||||
}) {
|
}) {
|
||||||
final available = BigInt.tryParse(availableRaw.trim()) ?? BigInt.zero;
|
final available = BigInt.tryParse(availableRaw.trim()) ?? BigInt.zero;
|
||||||
final fee = BigInt.tryParse(feeRaw.trim()) ?? BigInt.zero;
|
final fee = BigInt.tryParse(feeRaw.trim()) ?? BigInt.zero;
|
||||||
final maxReceivable = available > fee ? available - fee : BigInt.zero;
|
final maxReceivable = available > fee ? available - fee : BigInt.zero;
|
||||||
|
|
||||||
|
if (withdrawalsSuspended) {
|
||||||
|
return WithdrawEligibility(
|
||||||
|
allowed: false,
|
||||||
|
reason: WithdrawBlockReason.accountSuspended,
|
||||||
|
maxReceivableRaw: maxReceivable,
|
||||||
|
feeRaw: fee,
|
||||||
|
availableRaw: available,
|
||||||
|
);
|
||||||
|
}
|
||||||
if (!withdrawalsEnabled) {
|
if (!withdrawalsEnabled) {
|
||||||
return WithdrawEligibility(
|
return WithdrawEligibility(
|
||||||
allowed: false,
|
allowed: false,
|
||||||
|
|||||||
@ -296,6 +296,10 @@ class AppStrings {
|
|||||||
'Withdrawals are temporarily disabled by the platform.',
|
'Withdrawals are temporarily disabled by the platform.',
|
||||||
'Les retraits sont temporairement désactivés par la plateforme.',
|
'Les retraits sont temporairement désactivés par la plateforme.',
|
||||||
);
|
);
|
||||||
|
String get withdrawalsSuspendedAccount => t(
|
||||||
|
'Withdrawals are suspended on your account pending a security review. Please contact support for help.',
|
||||||
|
'Les retraits sont suspendus sur votre compte en attendant une vérification de sécurité. Contactez le support pour obtenir de l’aide.',
|
||||||
|
);
|
||||||
String get noWithdrawNetworks => t(
|
String get noWithdrawNetworks => t(
|
||||||
'No withdrawal networks enabled',
|
'No withdrawal networks enabled',
|
||||||
'Aucun réseau de retrait activé',
|
'Aucun réseau de retrait activé',
|
||||||
|
|||||||
@ -18,6 +18,8 @@ export type UserProfile = {
|
|||||||
role: string;
|
role: string;
|
||||||
emailVerified: boolean;
|
emailVerified: boolean;
|
||||||
totpEnabled: boolean;
|
totpEnabled: boolean;
|
||||||
|
/** Account security hold — withdrawals are blocked until support clears it. */
|
||||||
|
withdrawalsSuspended?: boolean;
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -36,6 +36,7 @@ import type { WalletActivityCategory } from './types';
|
|||||||
import { networkLabel } from './utils/coinDisplay';
|
import { networkLabel } from './utils/coinDisplay';
|
||||||
import { USDT_WALLET_CODE } from './utils/walletCapabilities';
|
import { USDT_WALLET_CODE } from './utils/walletCapabilities';
|
||||||
import { rawToHuman } from './utils/walletFormat';
|
import { rawToHuman } from './utils/walletFormat';
|
||||||
|
import { useProfile } from '../profile/hooks/useProfile';
|
||||||
import { computeWithdrawEligibility } from './utils/withdrawEligibility';
|
import { computeWithdrawEligibility } from './utils/withdrawEligibility';
|
||||||
|
|
||||||
type DialogKind = 'receive' | 'transfer' | 'withdraw' | null;
|
type DialogKind = 'receive' | 'transfer' | 'withdraw' | null;
|
||||||
@ -51,6 +52,7 @@ export function WalletPage() {
|
|||||||
|
|
||||||
const balancesQ = useBalances();
|
const balancesQ = useBalances();
|
||||||
const txQ = useTransactions(txPage, DEFAULT_TX_PAGE_SIZE, activityCategory);
|
const txQ = useTransactions(txPage, DEFAULT_TX_PAGE_SIZE, activityCategory);
|
||||||
|
const profileQ = useProfile();
|
||||||
|
|
||||||
const healthQ = useQuery({
|
const healthQ = useQuery({
|
||||||
queryKey: ['health'],
|
queryKey: ['health'],
|
||||||
@ -72,6 +74,8 @@ export function WalletPage() {
|
|||||||
const depositable = useMemo(() => networks.filter((n) => n.depositEnabled), [networks]);
|
const depositable = useMemo(() => networks.filter((n) => n.depositEnabled), [networks]);
|
||||||
const withdrawable = useMemo(() => networks.filter((n) => n.withdrawEnabled), [networks]);
|
const withdrawable = useMemo(() => networks.filter((n) => n.withdrawEnabled), [networks]);
|
||||||
|
|
||||||
|
const withdrawalsSuspended = profileQ.data?.withdrawalsSuspended === true;
|
||||||
|
|
||||||
const withdrawEligibility = useMemo(
|
const withdrawEligibility = useMemo(
|
||||||
() =>
|
() =>
|
||||||
computeWithdrawEligibility({
|
computeWithdrawEligibility({
|
||||||
@ -79,12 +83,15 @@ export function WalletPage() {
|
|||||||
hasWithdrawNetwork: withdrawable.length > 0,
|
hasWithdrawNetwork: withdrawable.length > 0,
|
||||||
availableRaw: spendable?.available ?? '0',
|
availableRaw: spendable?.available ?? '0',
|
||||||
feeRaw: healthQ.data?.withdrawalNetworkFeeRaw ?? '0',
|
feeRaw: healthQ.data?.withdrawalNetworkFeeRaw ?? '0',
|
||||||
|
withdrawalsSuspended,
|
||||||
}),
|
}),
|
||||||
[healthQ.data, withdrawable.length, spendable?.available]
|
[healthQ.data, withdrawable.length, spendable?.available, withdrawalsSuspended]
|
||||||
);
|
);
|
||||||
|
|
||||||
const withdrawBlockReasonText = useMemo(() => {
|
const withdrawBlockReasonText = useMemo(() => {
|
||||||
switch (withdrawEligibility.reason) {
|
switch (withdrawEligibility.reason) {
|
||||||
|
case 'account_suspended':
|
||||||
|
return t('wallet.withdrawDisabledAccountSuspended');
|
||||||
case 'global_off':
|
case 'global_off':
|
||||||
return t('wallet.withdrawDisabledGlobal');
|
return t('wallet.withdrawDisabledGlobal');
|
||||||
case 'no_network':
|
case 'no_network':
|
||||||
|
|||||||
@ -84,6 +84,7 @@ export function WithdrawDialog({
|
|||||||
|
|
||||||
const requireWithdrawal2fa = policyQ.data?.requireWithdrawal2fa ?? true;
|
const requireWithdrawal2fa = policyQ.data?.requireWithdrawal2fa ?? true;
|
||||||
const totpEnabled = profileQ.data?.totpEnabled ?? false;
|
const totpEnabled = profileQ.data?.totpEnabled ?? false;
|
||||||
|
const withdrawalsSuspended = profileQ.data?.withdrawalsSuspended === true;
|
||||||
const needs2faSetup = requireWithdrawal2fa && !totpEnabled;
|
const needs2faSetup = requireWithdrawal2fa && !totpEnabled;
|
||||||
|
|
||||||
const decimals = spendable?.walletType.decimals ?? 6;
|
const decimals = spendable?.walletType.decimals ?? 6;
|
||||||
@ -161,6 +162,11 @@ export function WithdrawDialog({
|
|||||||
const apiErr = err?.response?.data;
|
const apiErr = err?.response?.data;
|
||||||
if (apiErr?.code === 'WITHDRAWAL_2FA_REQUIRED' || /2FA must be enabled/i.test(apiErr?.error ?? '')) {
|
if (apiErr?.code === 'WITHDRAWAL_2FA_REQUIRED' || /2FA must be enabled/i.test(apiErr?.error ?? '')) {
|
||||||
onError?.(t('wallet.withdrawDialog.twoFaRequiredError'));
|
onError?.(t('wallet.withdrawDialog.twoFaRequiredError'));
|
||||||
|
} else if (
|
||||||
|
apiErr?.code === 'WITHDRAWALS_SUSPENDED' ||
|
||||||
|
apiErr?.code === 'ACCOUNT_UNDER_SURVEILLANCE'
|
||||||
|
) {
|
||||||
|
onError?.(t('wallet.withdrawDisabledAccountSuspended'));
|
||||||
} else if (apiErr?.code === 'WITHDRAWALS_DISABLED') {
|
} else if (apiErr?.code === 'WITHDRAWALS_DISABLED') {
|
||||||
onError?.(t('wallet.withdrawDisabledGlobal'));
|
onError?.(t('wallet.withdrawDisabledGlobal'));
|
||||||
} else if (apiErr?.code === 'WITHDRAWAL_NETWORK_DISABLED') {
|
} else if (apiErr?.code === 'WITHDRAWAL_NETWORK_DISABLED') {
|
||||||
@ -182,6 +188,7 @@ export function WithdrawDialog({
|
|||||||
|
|
||||||
const canProceed =
|
const canProceed =
|
||||||
withdrawalsEnabled &&
|
withdrawalsEnabled &&
|
||||||
|
!withdrawalsSuspended &&
|
||||||
!!selectedRail &&
|
!!selectedRail &&
|
||||||
!!spendable &&
|
!!spendable &&
|
||||||
toAddress.trim().length > 8 &&
|
toAddress.trim().length > 8 &&
|
||||||
@ -203,7 +210,13 @@ export function WithdrawDialog({
|
|||||||
<DialogTitle sx={{ fontWeight: 900 }}>{t('wallet.withdrawDialog.title')}</DialogTitle>
|
<DialogTitle sx={{ fontWeight: 900 }}>{t('wallet.withdrawDialog.title')}</DialogTitle>
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
<Stack spacing={2} sx={{ pt: 0.5 }}>
|
<Stack spacing={2} sx={{ pt: 0.5 }}>
|
||||||
{!withdrawalsEnabled && (
|
{withdrawalsSuspended && (
|
||||||
|
<Alert severity="error" sx={{ borderRadius: 2 }}>
|
||||||
|
{t('wallet.withdrawDisabledAccountSuspended')}
|
||||||
|
</Alert>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{!withdrawalsEnabled && !withdrawalsSuspended && (
|
||||||
<Alert severity="warning" sx={{ borderRadius: 2 }}>
|
<Alert severity="warning" sx={{ borderRadius: 2 }}>
|
||||||
<Trans i18nKey="wallet.withdrawDialog.disabled" components={{ code: <code /> }} />
|
<Trans i18nKey="wallet.withdrawDialog.disabled" components={{ code: <code /> }} />
|
||||||
</Alert>
|
</Alert>
|
||||||
@ -215,7 +228,7 @@ export function WithdrawDialog({
|
|||||||
</Alert>
|
</Alert>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{needs2faSetup && (
|
{needs2faSetup && !withdrawalsSuspended && (
|
||||||
<Alert severity="warning" sx={{ borderRadius: 2 }}>
|
<Alert severity="warning" sx={{ borderRadius: 2 }}>
|
||||||
<Typography variant="body2" sx={{ mb: 1 }}>
|
<Typography variant="body2" sx={{ mb: 1 }}>
|
||||||
{t('wallet.withdrawDialog.twoFaRequiredBody')}
|
{t('wallet.withdrawDialog.twoFaRequiredBody')}
|
||||||
@ -240,7 +253,15 @@ export function WithdrawDialog({
|
|||||||
</Alert>
|
</Alert>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<FormControl fullWidth disabled={!withdrawalsEnabled || needs2faSetup || withdrawRails.length === 0}>
|
<FormControl
|
||||||
|
fullWidth
|
||||||
|
disabled={
|
||||||
|
!withdrawalsEnabled ||
|
||||||
|
withdrawalsSuspended ||
|
||||||
|
needs2faSetup ||
|
||||||
|
withdrawRails.length === 0
|
||||||
|
}
|
||||||
|
>
|
||||||
<InputLabel id="withdraw-rail-label">{t('wallet.withdrawDialog.payoutNetwork')}</InputLabel>
|
<InputLabel id="withdraw-rail-label">{t('wallet.withdrawDialog.payoutNetwork')}</InputLabel>
|
||||||
<Select
|
<Select
|
||||||
labelId="withdraw-rail-label"
|
labelId="withdraw-rail-label"
|
||||||
@ -264,7 +285,7 @@ export function WithdrawDialog({
|
|||||||
fullWidth
|
fullWidth
|
||||||
value={toAddress}
|
value={toAddress}
|
||||||
onChange={(e) => setToAddress(e.target.value)}
|
onChange={(e) => setToAddress(e.target.value)}
|
||||||
disabled={!withdrawalsEnabled || needs2faSetup}
|
disabled={!withdrawalsEnabled || withdrawalsSuspended || needs2faSetup}
|
||||||
placeholder={addressPlaceholder(rail)}
|
placeholder={addressPlaceholder(rail)}
|
||||||
slotProps={{
|
slotProps={{
|
||||||
htmlInput: { style: { fontFamily: 'monospace', fontSize: 13 } },
|
htmlInput: { style: { fontFamily: 'monospace', fontSize: 13 } },
|
||||||
@ -277,7 +298,7 @@ export function WithdrawDialog({
|
|||||||
value={amount}
|
value={amount}
|
||||||
onChange={(e) => setAmount(e.target.value)}
|
onChange={(e) => setAmount(e.target.value)}
|
||||||
inputMode="decimal"
|
inputMode="decimal"
|
||||||
disabled={!withdrawalsEnabled || needs2faSetup}
|
disabled={!withdrawalsEnabled || withdrawalsSuspended || needs2faSetup}
|
||||||
error={insufficientFunds}
|
error={insufficientFunds}
|
||||||
helperText={
|
helperText={
|
||||||
spendable
|
spendable
|
||||||
@ -298,7 +319,7 @@ export function WithdrawDialog({
|
|||||||
value={totpCode}
|
value={totpCode}
|
||||||
onChange={(e) => setTotpCode(e.target.value.replace(/\D/g, '').slice(0, 6))}
|
onChange={(e) => setTotpCode(e.target.value.replace(/\D/g, '').slice(0, 6))}
|
||||||
inputMode="numeric"
|
inputMode="numeric"
|
||||||
disabled={!withdrawalsEnabled || needs2faSetup}
|
disabled={!withdrawalsEnabled || withdrawalsSuspended || needs2faSetup}
|
||||||
placeholder={t('wallet.withdrawDialog.totpPlaceholder')}
|
placeholder={t('wallet.withdrawDialog.totpPlaceholder')}
|
||||||
helperText={
|
helperText={
|
||||||
requireWithdrawal2fa && totpEnabled
|
requireWithdrawal2fa && totpEnabled
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
export type WithdrawBlockReason =
|
export type WithdrawBlockReason =
|
||||||
| 'global_off'
|
| 'global_off'
|
||||||
|
| 'account_suspended'
|
||||||
| 'no_network'
|
| 'no_network'
|
||||||
| 'insufficient_for_fee'
|
| 'insufficient_for_fee'
|
||||||
| null;
|
| null;
|
||||||
@ -34,11 +35,16 @@ export function computeWithdrawEligibility(input: {
|
|||||||
hasWithdrawNetwork: boolean;
|
hasWithdrawNetwork: boolean;
|
||||||
availableRaw: string;
|
availableRaw: string;
|
||||||
feeRaw: string;
|
feeRaw: string;
|
||||||
|
/** Security hold / surveillance — blocks withdrawals for this account. */
|
||||||
|
withdrawalsSuspended?: boolean;
|
||||||
}): WithdrawEligibility {
|
}): WithdrawEligibility {
|
||||||
const availableRaw = parseRaw(input.availableRaw);
|
const availableRaw = parseRaw(input.availableRaw);
|
||||||
const feeRaw = parseRaw(input.feeRaw);
|
const feeRaw = parseRaw(input.feeRaw);
|
||||||
const maxReceivableRaw = availableRaw > feeRaw ? availableRaw - feeRaw : 0n;
|
const maxReceivableRaw = availableRaw > feeRaw ? availableRaw - feeRaw : 0n;
|
||||||
|
|
||||||
|
if (input.withdrawalsSuspended) {
|
||||||
|
return { allowed: false, reason: 'account_suspended', maxReceivableRaw, feeRaw, availableRaw };
|
||||||
|
}
|
||||||
if (!input.withdrawalsEnabled) {
|
if (!input.withdrawalsEnabled) {
|
||||||
return { allowed: false, reason: 'global_off', maxReceivableRaw, feeRaw, availableRaw };
|
return { allowed: false, reason: 'global_off', maxReceivableRaw, feeRaw, availableRaw };
|
||||||
}
|
}
|
||||||
|
|||||||
@ -392,6 +392,8 @@ export const en = {
|
|||||||
send: 'Send',
|
send: 'Send',
|
||||||
withdraw: 'Withdraw',
|
withdraw: 'Withdraw',
|
||||||
withdrawDisabledGlobal: 'Withdrawals are temporarily disabled by the platform.',
|
withdrawDisabledGlobal: 'Withdrawals are temporarily disabled by the platform.',
|
||||||
|
withdrawDisabledAccountSuspended:
|
||||||
|
'Withdrawals are suspended on your account pending a security review. Please contact support for help.',
|
||||||
withdrawDisabledNoNetwork: 'No withdrawal network is enabled right now.',
|
withdrawDisabledNoNetwork: 'No withdrawal network is enabled right now.',
|
||||||
withdrawDisabledInsufficientFee:
|
withdrawDisabledInsufficientFee:
|
||||||
'Insufficient balance for a withdrawal (need more than the {{fee}} USDT network fee).',
|
'Insufficient balance for a withdrawal (need more than the {{fee}} USDT network fee).',
|
||||||
|
|||||||
@ -400,6 +400,8 @@ export const fr = {
|
|||||||
send: 'Envoyer',
|
send: 'Envoyer',
|
||||||
withdraw: 'Retirer',
|
withdraw: 'Retirer',
|
||||||
withdrawDisabledGlobal: 'Les retraits sont temporairement désactivés par la plateforme.',
|
withdrawDisabledGlobal: 'Les retraits sont temporairement désactivés par la plateforme.',
|
||||||
|
withdrawDisabledAccountSuspended:
|
||||||
|
'Les retraits sont suspendus sur votre compte en attendant une vérification de sécurité. Contactez le support pour obtenir de l’aide.',
|
||||||
withdrawDisabledNoNetwork: 'Aucun réseau de retrait n’est activé pour le moment.',
|
withdrawDisabledNoNetwork: 'Aucun réseau de retrait n’est activé pour le moment.',
|
||||||
withdrawDisabledInsufficientFee:
|
withdrawDisabledInsufficientFee:
|
||||||
'Solde insuffisant pour un retrait (il faut plus que les frais réseau de {{fee}} USDT).',
|
'Solde insuffisant pour un retrait (il faut plus que les frais réseau de {{fee}} USDT).',
|
||||||
|
|||||||
@ -51,6 +51,9 @@ export function apiErrorMessage(error: unknown, fallback?: string): string {
|
|||||||
if (data?.code === 'TRANSFER_LEDGER_ONLY') {
|
if (data?.code === 'TRANSFER_LEDGER_ONLY') {
|
||||||
return i18n.t('wallet.transferDialog.ledgerOnlyError');
|
return i18n.t('wallet.transferDialog.ledgerOnlyError');
|
||||||
}
|
}
|
||||||
|
if (data?.code === 'WITHDRAWALS_SUSPENDED' || data?.code === 'ACCOUNT_UNDER_SURVEILLANCE') {
|
||||||
|
return i18n.t('wallet.withdrawDisabledAccountSuspended');
|
||||||
|
}
|
||||||
const apiMsg = data?.error ?? data?.message;
|
const apiMsg = data?.error ?? data?.message;
|
||||||
if (typeof apiMsg === 'string' && apiMsg.trim()) {
|
if (typeof apiMsg === 'string' && apiMsg.trim()) {
|
||||||
return sanitizeApiText(apiMsg, fb);
|
return sanitizeApiText(apiMsg, fb);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user