diff --git a/backend/src/controllers/shareCardController.ts b/backend/src/controllers/shareCardController.ts index 8e86805b..f89e92b2 100644 --- a/backend/src/controllers/shareCardController.ts +++ b/backend/src/controllers/shareCardController.ts @@ -29,6 +29,19 @@ export async function getBetShareCard(req: AuthRequest, res: Response): Promise< } } +export async function getTransactionShareCard(req: AuthRequest, res: Response): Promise { + try { + const transactionId = String(req.params.transactionId || ''); + const payload = await shareCardService.getWalletOpSharePayloadForOwner( + req.user!.userId, + transactionId + ); + res.json(payload); + } catch (e) { + sendError(res, e, 'Failed'); + } +} + export async function verifyShareCard(req: AuthRequest, res: Response): Promise { try { const token = String(req.params.token || ''); @@ -58,6 +71,10 @@ export async function updateAdminSettings(req: AuthRequest, res: Response): Prom allowWon?: boolean; allowLost?: boolean; allowRefunded?: boolean; + walletOpsEnabled?: boolean; + allowDeposit?: boolean; + allowWithdrawal?: boolean; + allowTransfer?: boolean; }; const settings = await shareCardService.updateSettings(body); res.json(settings); diff --git a/backend/src/db/schema.sql b/backend/src/db/schema.sql index ee4f59ca..c352d6cb 100644 --- a/backend/src/db/schema.sql +++ b/backend/src/db/schema.sql @@ -2465,6 +2465,10 @@ CREATE TABLE IF NOT EXISTS share_card_settings ( allow_won BOOLEAN NOT NULL DEFAULT TRUE, allow_lost BOOLEAN NOT NULL DEFAULT TRUE, allow_refunded BOOLEAN NOT NULL DEFAULT TRUE, + wallet_ops_enabled BOOLEAN NOT NULL DEFAULT TRUE, + allow_deposit BOOLEAN NOT NULL DEFAULT TRUE, + allow_withdrawal BOOLEAN NOT NULL DEFAULT TRUE, + allow_transfer BOOLEAN NOT NULL DEFAULT TRUE, updated_at TIMESTAMPTZ DEFAULT NOW() ); @@ -2472,6 +2476,21 @@ INSERT INTO share_card_settings (id) VALUES (1) ON CONFLICT (id) DO NOTHING; +DO $$ +BEGIN + IF NOT EXISTS ( + SELECT 1 FROM information_schema.columns + WHERE table_schema = 'public' AND table_name = 'share_card_settings' + AND column_name = 'wallet_ops_enabled' + ) THEN + ALTER TABLE share_card_settings + ADD COLUMN wallet_ops_enabled BOOLEAN NOT NULL DEFAULT TRUE, + ADD COLUMN allow_deposit BOOLEAN NOT NULL DEFAULT TRUE, + ADD COLUMN allow_withdrawal BOOLEAN NOT NULL DEFAULT TRUE, + ADD COLUMN allow_transfer BOOLEAN NOT NULL DEFAULT TRUE; + END IF; +END $$; + -- Tamper trigger for share_card_settings (created after the table exists) DO $$ BEGIN diff --git a/backend/src/repositories/shareCardRepository.ts b/backend/src/repositories/shareCardRepository.ts index 53366e4a..e7186507 100644 --- a/backend/src/repositories/shareCardRepository.ts +++ b/backend/src/repositories/shareCardRepository.ts @@ -1,5 +1,5 @@ /** - * Share card settings (single-row admin config for prediction result sharing). + * Share card settings (single-row admin config for prediction + wallet op sharing). */ import { query } from '../db/connection'; @@ -13,11 +13,17 @@ export type ShareCardSettingsRow = { allow_won: boolean; allow_lost: boolean; allow_refunded: boolean; + wallet_ops_enabled: boolean; + allow_deposit: boolean; + allow_withdrawal: boolean; + allow_transfer: boolean; updated_at: Date; }; const SELECT_COLS = `id, enabled, allow_main_wallet, allow_bonus_wallet, allow_test_wallet, - allow_won, allow_lost, allow_refunded, updated_at`; + allow_won, allow_lost, allow_refunded, + wallet_ops_enabled, allow_deposit, allow_withdrawal, allow_transfer, + updated_at`; export async function getSettings(): Promise { const rows = await query( @@ -37,6 +43,10 @@ export async function updateSettings(input: { allowWon?: boolean; allowLost?: boolean; allowRefunded?: boolean; + walletOpsEnabled?: boolean; + allowDeposit?: boolean; + allowWithdrawal?: boolean; + allowTransfer?: boolean; }): Promise { const current = await getSettings(); const rows = await query( @@ -48,6 +58,10 @@ export async function updateSettings(input: { allow_won = COALESCE($5, allow_won), allow_lost = COALESCE($6, allow_lost), allow_refunded = COALESCE($7, allow_refunded), + wallet_ops_enabled = COALESCE($8, wallet_ops_enabled), + allow_deposit = COALESCE($9, allow_deposit), + allow_withdrawal = COALESCE($10, allow_withdrawal), + allow_transfer = COALESCE($11, allow_transfer), updated_at = NOW() WHERE id = 1 RETURNING ${SELECT_COLS}`, @@ -59,6 +73,10 @@ export async function updateSettings(input: { input.allowWon ?? null, input.allowLost ?? null, input.allowRefunded ?? null, + input.walletOpsEnabled ?? null, + input.allowDeposit ?? null, + input.allowWithdrawal ?? null, + input.allowTransfer ?? null, ] ); return rows[0] ?? current; diff --git a/backend/src/repositories/walletRepository.ts b/backend/src/repositories/walletRepository.ts index aabce1dd..8c8f6abb 100644 --- a/backend/src/repositories/walletRepository.ts +++ b/backend/src/repositories/walletRepository.ts @@ -29,6 +29,14 @@ export async function getWalletTypeByCode(code: string): Promise { + const rows = await query( + 'SELECT id, code, name, network, decimals, contract_address FROM wallet_types WHERE id = $1', + [id] + ); + return rows[0] || null; +} + /** * Retrieves a user's wallet for a specific wallet type. * @param userId - ID of the user. diff --git a/backend/src/routes/index.ts b/backend/src/routes/index.ts index e2318a63..9ca5230b 100644 --- a/backend/src/routes/index.ts +++ b/backend/src/routes/index.ts @@ -209,6 +209,7 @@ router.get('/test-wallet', testWalletController.getTestWalletStatus); router.post('/test-wallet/request-credits', validateBody(testWalletCreditBodySchema), testWalletController.requestTestCredits); router.get('/share-cards/config', shareCardController.getConfig); router.get('/share-cards/bets/:betId', shareCardController.getBetShareCard); +router.get('/share-cards/transactions/:transactionId', shareCardController.getTransactionShareCard); router.get('/referral/me', referralController.getMyReferralInfo); router.get('/referral/dashboard', referralController.getMyReferralDashboard); router.get('/referral/commissions', referralController.getMyReferralCommissions); diff --git a/backend/src/services/shareCardService.ts b/backend/src/services/shareCardService.ts index 717cc271..9d8bfbe0 100644 --- a/backend/src/services/shareCardService.ts +++ b/backend/src/services/shareCardService.ts @@ -1,5 +1,6 @@ /** - * Share Cards: eligibility, signed verify tokens, and share payloads for prediction results. + * Share Cards: eligibility, signed verify tokens, and share payloads + * for prediction results and wallet operations (deposit / withdrawal / transfer). */ import crypto from 'crypto'; @@ -8,10 +9,14 @@ import { getPublicWebBaseUrl, buildReferralRegisterLink } from '../utils/publicW import * as shareCardRepository from '../repositories/shareCardRepository'; import * as candlePredictRepository from '../repositories/candlePredictRepository'; import * as referralRepository from '../repositories/referralRepository'; +import * as transactionRepository from '../repositories/transactionRepository'; +import * as walletRepository from '../repositories/walletRepository'; import type { ShareCardSettingsRow } from '../repositories/shareCardRepository'; +import type { Transaction } from '../models'; export type ShareableBetStatus = 'won' | 'lost' | 'refunded'; export type StakeAccountKind = 'main' | 'bonus' | 'test'; +export type ShareableWalletOpType = 'deposit' | 'withdrawal' | 'transfer'; const STAKE_DECIMALS = 6; @@ -24,6 +29,10 @@ export function mapSettingsForClient(row: ShareCardSettingsRow) { allowWon: row.allow_won, allowLost: row.allow_lost, allowRefunded: row.allow_refunded, + walletOpsEnabled: row.wallet_ops_enabled, + allowDeposit: row.allow_deposit, + allowWithdrawal: row.allow_withdrawal, + allowTransfer: row.allow_transfer, updatedAt: row.updated_at.toISOString(), }; } @@ -45,11 +54,23 @@ export function canSharePredictionResult( return true; } -function rawToDisplay(raw: bigint): string { +export function canShareWalletOperation( + settings: ShareCardSettingsRow, + input: { type: string } +): boolean { + if (!settings.enabled || !settings.wallet_ops_enabled) return false; + if (input.type === 'deposit') return settings.allow_deposit; + if (input.type === 'withdrawal') return settings.allow_withdrawal; + if (input.type === 'transfer') return settings.allow_transfer; + return false; +} + +function rawToDisplay(raw: bigint, decimals = STAKE_DECIMALS): string { const neg = raw < 0n; const abs = neg ? -raw : raw; - const whole = abs / 10n ** BigInt(STAKE_DECIMALS); - const frac = (abs % 10n ** BigInt(STAKE_DECIMALS)).toString().padStart(STAKE_DECIMALS, '0'); + const base = 10n ** BigInt(decimals); + const whole = abs / base; + const frac = (abs % base).toString().padStart(decimals, '0'); const trimmed = frac.replace(/0+$/, ''); const body = trimmed ? `${whole}.${trimmed}` : whole.toString(); return neg ? `-${body}` : body; @@ -93,15 +114,26 @@ function shareSecret(): string { return process.env.SHARE_CARD_SECRET?.trim() || config.jwt.secret; } -export function createShareVerifyToken(betId: string, userId: string): string { - const payload = b64url(JSON.stringify({ b: betId, u: userId, v: 1 })); +export type ShareTokenKind = 'bet' | 'tx'; + +export function createShareVerifyToken( + kind: ShareTokenKind, + resourceId: string, + userId: string +): string { + const payload = b64url(JSON.stringify({ k: kind, id: resourceId, u: userId, v: 2 })); const sig = crypto.createHmac('sha256', shareSecret()).update(payload).digest(); return `${payload}.${b64url(sig)}`; } +/** @deprecated Prefer createShareVerifyToken('bet', ...) — kept for call-site clarity. */ +export function createBetShareVerifyToken(betId: string, userId: string): string { + return createShareVerifyToken('bet', betId, userId); +} + export function parseShareVerifyToken( token: string -): { betId: string; userId: string } | null { +): { kind: ShareTokenKind; id: string; userId: string } | null { const parts = token.split('.'); if (parts.length !== 2) return null; const [payload, sig] = parts; @@ -112,12 +144,23 @@ export function parseShareVerifyToken( if (a.length !== b.length || !crypto.timingSafeEqual(a, b)) return null; try { const json = JSON.parse(Buffer.from(payload, 'base64url').toString('utf8')) as { + k?: string; + id?: string; b?: string; u?: string; v?: number; }; - if (!json.b || !json.u) return null; - return { betId: json.b, userId: json.u }; + if (!json.u) return null; + // v2: { k, id, u } + if (json.k === 'bet' || json.k === 'tx') { + if (!json.id) return null; + return { kind: json.k, id: json.id, userId: json.u }; + } + // v1 legacy prediction tokens: { b, u } + if (json.b) { + return { kind: 'bet', id: json.b, userId: json.u }; + } + return null; } catch { return null; } @@ -127,7 +170,7 @@ export function buildShareVerifyUrl(token: string): string { return `${getPublicWebBaseUrl()}/share/r/${encodeURIComponent(token)}`; } -function buildCardPayload( +function buildPredictionCardPayload( bet: candlePredictRepository.CandlePredictBetWithSettlement, opts: { includeReferral: boolean; referralCode: string | null } ) { @@ -135,13 +178,14 @@ function buildCardPayload( const stakeRaw = BigInt(bet.stake_raw); const payoutRaw = BigInt(bet.payout_raw); const result = computeResultAmount(status, stakeRaw, payoutRaw); - const token = createShareVerifyToken(bet.id, bet.user_id); + const token = createShareVerifyToken('bet', bet.id, bet.user_id); const verifyUrl = buildShareVerifyUrl(token); const registerUrl = opts.referralCode ? buildReferralRegisterLink(opts.referralCode) : `${getPublicWebBaseUrl()}/register`; return { + kind: 'prediction' as const, betId: bet.id, gameName: 'Candle Predict', direction: bet.direction, @@ -166,6 +210,53 @@ function buildCardPayload( }; } +function shortAssetSymbol(code: string): string { + const base = code.split('_')[0] || code; + return base.toUpperCase(); +} + +async function buildWalletOpCardPayload( + tx: Transaction, + opts: { includeReferral: boolean; referralCode: string | null } +) { + const wt = await walletRepository.getWalletTypeById(tx.wallet_type_id); + const decimals = wt?.decimals ?? STAKE_DECIMALS; + const amountRaw = BigInt(tx.amount); + const amountDisplay = rawToDisplay(amountRaw, decimals); + const assetCode = wt?.code ?? 'USDT'; + const assetSymbol = shortAssetSymbol(assetCode); + const network = wt?.network ?? null; + const token = createShareVerifyToken('tx', tx.id, tx.user_id); + const verifyUrl = buildShareVerifyUrl(token); + const registerUrl = opts.referralCode + ? buildReferralRegisterLink(opts.referralCode) + : `${getPublicWebBaseUrl()}/register`; + + const signedDisplay = + tx.type === 'deposit' ? `+${amountDisplay}` : tx.type === 'withdrawal' ? `-${amountDisplay}` : amountDisplay; + + return { + kind: 'wallet' as const, + transactionId: tx.id, + operationType: tx.type as ShareableWalletOpType, + status: tx.status, + amountRaw: tx.amount, + amountDisplay, + amountSignedDisplay: signedDisplay, + feeRaw: tx.fee, + assetCode, + assetSymbol, + assetName: wt?.name ?? assetCode, + network, + createdAt: tx.created_at.toISOString(), + blockchainTxId: tx.blockchain_tx_id, + verifyUrl, + verifyToken: token, + referralCode: opts.includeReferral ? opts.referralCode : null, + registerUrl, + }; +} + export async function getConfigForUser() { const settings = await shareCardRepository.getSettings(); return mapSettingsForClient(settings); @@ -184,6 +275,10 @@ export async function updateSettings(input: { allowWon?: boolean; allowLost?: boolean; allowRefunded?: boolean; + walletOpsEnabled?: boolean; + allowDeposit?: boolean; + allowWithdrawal?: boolean; + allowTransfer?: boolean; }) { const row = await shareCardRepository.updateSettings(input); return mapSettingsForClient(row); @@ -213,7 +308,20 @@ export async function getSharePayloadForOwner(userId: string, betId: string) { throw new ShareCardError('Sharing is not available for this prediction', 403); } const referralCode = await referralRepository.getUserReferralCode(userId); - return buildCardPayload(bet, { includeReferral: true, referralCode }); + return buildPredictionCardPayload(bet, { includeReferral: true, referralCode }); +} + +export async function getWalletOpSharePayloadForOwner(userId: string, transactionId: string) { + const settings = await shareCardRepository.getSettings(); + const tx = await transactionRepository.findById(transactionId); + if (!tx || tx.user_id !== userId) { + throw new ShareCardError('Transaction not found', 404); + } + if (!canShareWalletOperation(settings, { type: tx.type })) { + throw new ShareCardError('Sharing is not available for this operation', 403); + } + const referralCode = await referralRepository.getUserReferralCode(userId); + return buildWalletOpCardPayload(tx, { includeReferral: true, referralCode }); } export async function getPublicVerifyPayload(token: string) { @@ -225,7 +333,37 @@ export async function getPublicVerifyPayload(token: string) { if (!settings.enabled) { throw new ShareCardError('Share cards are disabled', 404); } - const bet = await candlePredictRepository.getBetById(parsed.betId); + + if (parsed.kind === 'tx') { + if (!settings.wallet_ops_enabled) { + throw new ShareCardError('Wallet share cards are disabled', 404); + } + const tx = await transactionRepository.findById(parsed.id); + if (!tx || tx.user_id !== parsed.userId) { + throw new ShareCardError('Transaction not found', 404); + } + if (!canShareWalletOperation(settings, { type: tx.type })) { + throw new ShareCardError('This operation is no longer shareable', 404); + } + const referralCode = await referralRepository.getUserReferralCode(tx.user_id); + const card = await buildWalletOpCardPayload(tx, { includeReferral: true, referralCode }); + return { + authentic: true as const, + kind: 'wallet' as const, + operationType: card.operationType, + status: card.status, + amountSignedDisplay: card.amountSignedDisplay, + amountDisplay: card.amountDisplay, + assetSymbol: card.assetSymbol, + assetCode: card.assetCode, + network: card.network, + createdAt: card.createdAt, + registerUrl: card.registerUrl, + referralCode: card.referralCode, + }; + } + + const bet = await candlePredictRepository.getBetById(parsed.id); if (!bet || bet.user_id !== parsed.userId) { throw new ShareCardError('Prediction not found', 404); } @@ -238,10 +376,10 @@ export async function getPublicVerifyPayload(token: string) { throw new ShareCardError('This result is no longer shareable', 404); } const referralCode = await referralRepository.getUserReferralCode(bet.user_id); - const card = buildCardPayload(bet, { includeReferral: true, referralCode }); - // Public verify: omit internal ids that aren't needed for marketing display + const card = buildPredictionCardPayload(bet, { includeReferral: true, referralCode }); return { authentic: true as const, + kind: 'prediction' as const, gameName: card.gameName, direction: card.direction, sequence: card.sequence, diff --git a/backend/src/tests/shareCardService.test.ts b/backend/src/tests/shareCardService.test.ts index 4b8c5120..8cf3346c 100644 --- a/backend/src/tests/shareCardService.test.ts +++ b/backend/src/tests/shareCardService.test.ts @@ -2,6 +2,7 @@ import { describe, test } from 'node:test'; import assert from 'node:assert/strict'; import { canSharePredictionResult, + canShareWalletOperation, createShareVerifyToken, parseShareVerifyToken, } from '../services/shareCardService'; @@ -17,6 +18,10 @@ function settings(partial: Partial = {}): ShareCardSetting allow_won: true, allow_lost: true, allow_refunded: true, + wallet_ops_enabled: true, + allow_deposit: true, + allow_withdrawal: true, + allow_transfer: true, updated_at: new Date(), ...partial, }; @@ -63,19 +68,41 @@ describe('share card eligibility', () => { false ); }); + + test('wallet ops respect global and per-type flags', () => { + assert.equal(canShareWalletOperation(settings(), { type: 'deposit' }), true); + assert.equal( + canShareWalletOperation(settings({ wallet_ops_enabled: false }), { type: 'deposit' }), + false + ); + assert.equal( + canShareWalletOperation(settings({ allow_transfer: false }), { type: 'transfer' }), + false + ); + assert.equal(canShareWalletOperation(settings(), { type: 'game_stake' }), false); + }); }); describe('share card verify token', () => { test('round-trips bet and user ids', () => { const betId = '11111111-1111-1111-1111-111111111111'; const userId = '22222222-2222-2222-2222-222222222222'; - const token = createShareVerifyToken(betId, userId); + const token = createShareVerifyToken('bet', betId, userId); const parsed = parseShareVerifyToken(token); - assert.deepEqual(parsed, { betId, userId }); + assert.deepEqual(parsed, { kind: 'bet', id: betId, userId }); + }); + + test('round-trips wallet transaction tokens', () => { + const txId = '33333333-3333-3333-3333-333333333333'; + const userId = '22222222-2222-2222-2222-222222222222'; + const token = createShareVerifyToken('tx', txId, userId); + const parsed = parseShareVerifyToken(token); + assert.deepEqual(parsed, { kind: 'tx', id: txId, userId }); }); test('rejects tampered token', () => { const token = createShareVerifyToken( + 'bet', '11111111-1111-1111-1111-111111111111', '22222222-2222-2222-2222-222222222222' ); diff --git a/backend/src/validation/adminResourceSchemas.ts b/backend/src/validation/adminResourceSchemas.ts index 2e2c81e9..0de9a565 100644 --- a/backend/src/validation/adminResourceSchemas.ts +++ b/backend/src/validation/adminResourceSchemas.ts @@ -196,6 +196,10 @@ export const shareCardSettingsBodySchema = atLeastOneField( allowWon: z.boolean().optional(), allowLost: z.boolean().optional(), allowRefunded: z.boolean().optional(), + walletOpsEnabled: z.boolean().optional(), + allowDeposit: z.boolean().optional(), + allowWithdrawal: z.boolean().optional(), + allowTransfer: z.boolean().optional(), }) ); diff --git a/prediqo_mobile/lib/data/models/share_card_models.dart b/prediqo_mobile/lib/data/models/share_card_models.dart index 11feb304..32fb4cd1 100644 --- a/prediqo_mobile/lib/data/models/share_card_models.dart +++ b/prediqo_mobile/lib/data/models/share_card_models.dart @@ -7,6 +7,10 @@ class ShareCardConfig { required this.allowWon, required this.allowLost, required this.allowRefunded, + required this.walletOpsEnabled, + required this.allowDeposit, + required this.allowWithdrawal, + required this.allowTransfer, }); final bool enabled; @@ -16,6 +20,10 @@ class ShareCardConfig { final bool allowWon; final bool allowLost; final bool allowRefunded; + final bool walletOpsEnabled; + final bool allowDeposit; + final bool allowWithdrawal; + final bool allowTransfer; factory ShareCardConfig.fromJson(Map json) { return ShareCardConfig( @@ -26,10 +34,14 @@ class ShareCardConfig { allowWon: json['allowWon'] != false, allowLost: json['allowLost'] != false, allowRefunded: json['allowRefunded'] != false, + walletOpsEnabled: json['walletOpsEnabled'] != false, + allowDeposit: json['allowDeposit'] != false, + allowWithdrawal: json['allowWithdrawal'] != false, + allowTransfer: json['allowTransfer'] != false, ); } - bool isEligible({ + bool isPredictionEligible({ required String? status, required String? stakeAccountKind, bool requireStatus = true, @@ -46,58 +58,119 @@ class ShareCardConfig { if (status == 'refunded' && !allowRefunded) return false; return true; } + + bool isWalletOpEligible(String operationType) { + if (!enabled || !walletOpsEnabled) return false; + switch (operationType) { + case 'deposit': + return allowDeposit; + case 'withdrawal': + return allowWithdrawal; + case 'transfer': + return allowTransfer; + default: + return false; + } + } + + /// Backward-compatible alias. + bool isEligible({ + required String? status, + required String? stakeAccountKind, + bool requireStatus = true, + }) => + isPredictionEligible( + status: status, + stakeAccountKind: stakeAccountKind, + requireStatus: requireStatus, + ); } class ShareCardPayload { const ShareCardPayload({ - required this.betId, - required this.gameName, - required this.direction, - required this.status, - required this.resultSignedDisplay, - required this.stakeDisplay, - required this.intervalMinutes, - required this.settledAt, + required this.kind, required this.verifyUrl, - required this.predictionMode, - required this.isAuto, + this.betId, + this.gameName, + this.direction, + this.status, + this.resultSignedDisplay, + this.stakeDisplay, + this.intervalMinutes, + this.settledAt, + this.predictionMode, + this.isAuto = false, this.sequence = const [], + this.transactionId, + this.operationType, + this.amountSignedDisplay, + this.amountDisplay, + this.assetSymbol, + this.assetName, + this.network, + this.createdAt, + this.txStatus, }); - final String betId; - final String gameName; - final String direction; - final String status; - final String resultSignedDisplay; - final num stakeDisplay; - final int intervalMinutes; - final String settledAt; + final String kind; // prediction | wallet final String verifyUrl; - final String predictionMode; + + // Prediction + final String? betId; + final String? gameName; + final String? direction; + final String? status; + final String? resultSignedDisplay; + final num? stakeDisplay; + final int? intervalMinutes; + final String? settledAt; + final String? predictionMode; final bool isAuto; final List sequence; + // Wallet + final String? transactionId; + final String? operationType; + final String? amountSignedDisplay; + final String? amountDisplay; + final String? assetSymbol; + final String? assetName; + final String? network; + final String? createdAt; + final String? txStatus; + + bool get isWallet => kind == 'wallet'; + factory ShareCardPayload.fromJson(Map json) { + final kind = (json['kind'] ?? 'prediction').toString(); final seq = json['sequence']; return ShareCardPayload( - betId: (json['betId'] ?? '').toString(), + kind: kind, + verifyUrl: (json['verifyUrl'] ?? '').toString(), + betId: json['betId']?.toString(), gameName: (json['gameName'] ?? 'Candle Predict').toString(), direction: (json['direction'] ?? 'long').toString(), - status: (json['status'] ?? '').toString(), - resultSignedDisplay: (json['resultSignedDisplay'] ?? '0').toString(), + status: json['status']?.toString(), + resultSignedDisplay: json['resultSignedDisplay']?.toString(), stakeDisplay: json['stakeDisplay'] is num ? json['stakeDisplay'] as num - : num.tryParse('${json['stakeDisplay']}') ?? 0, + : num.tryParse('${json['stakeDisplay']}'), intervalMinutes: json['intervalMinutes'] is int ? json['intervalMinutes'] as int - : int.tryParse('${json['intervalMinutes']}') ?? 1, - settledAt: (json['settledAt'] ?? '').toString(), - verifyUrl: (json['verifyUrl'] ?? '').toString(), + : int.tryParse('${json['intervalMinutes']}'), + settledAt: json['settledAt']?.toString(), predictionMode: (json['predictionMode'] ?? 'single').toString(), isAuto: json['isAuto'] == true, - sequence: seq is List - ? seq.map((e) => e.toString()).toList() - : const [], + sequence: seq is List ? seq.map((e) => e.toString()).toList() : const [], + transactionId: json['transactionId']?.toString(), + operationType: json['operationType']?.toString(), + amountSignedDisplay: json['amountSignedDisplay']?.toString(), + amountDisplay: json['amountDisplay']?.toString(), + assetSymbol: json['assetSymbol']?.toString(), + assetName: json['assetName']?.toString(), + network: json['network']?.toString(), + createdAt: json['createdAt']?.toString(), + txStatus: json['status']?.toString(), ); } } diff --git a/prediqo_mobile/lib/data/repositories/share_card_repository.dart b/prediqo_mobile/lib/data/repositories/share_card_repository.dart index f62e1040..05a9165e 100644 --- a/prediqo_mobile/lib/data/repositories/share_card_repository.dart +++ b/prediqo_mobile/lib/data/repositories/share_card_repository.dart @@ -39,4 +39,15 @@ class ShareCardRepository { throw AppException.fromDio(e); } } + + Future getTransactionShareCard(String transactionId) async { + try { + final res = await _api.dio.get>( + '/api/v1/share-cards/transactions/$transactionId', + ); + return ShareCardPayload.fromJson(res.data ?? {}); + } on DioException catch (e) { + throw AppException.fromDio(e); + } + } } diff --git a/prediqo_mobile/lib/features/share_cards/presentation/share_result_widgets.dart b/prediqo_mobile/lib/features/share_cards/presentation/share_result_widgets.dart index 2b2d8171..3cbb08e0 100644 --- a/prediqo_mobile/lib/features/share_cards/presentation/share_result_widgets.dart +++ b/prediqo_mobile/lib/features/share_cards/presentation/share_result_widgets.dart @@ -16,17 +16,23 @@ import '../../../shared/widgets/prediqo_logo.dart'; Future openShareResultDialog( BuildContext context, { - required String betId, + String? betId, + String? transactionId, }) { + assert(betId != null || transactionId != null); return showDialog( context: context, - builder: (ctx) => _ShareResultDialog(betId: betId), + builder: (ctx) => _ShareResultDialog( + betId: betId, + transactionId: transactionId, + ), ); } class _ShareResultDialog extends StatefulWidget { - const _ShareResultDialog({required this.betId}); - final String betId; + const _ShareResultDialog({this.betId, this.transactionId}); + final String? betId; + final String? transactionId; @override State<_ShareResultDialog> createState() => _ShareResultDialogState(); @@ -51,7 +57,10 @@ class _ShareResultDialogState extends State<_ShareResultDialog> { _error = null; }); try { - final payload = await sl().getBetShareCard(widget.betId); + final repo = sl(); + final payload = widget.transactionId != null + ? await repo.getTransactionShareCard(widget.transactionId!) + : await repo.getBetShareCard(widget.betId!); if (!mounted) return; setState(() { _payload = payload; @@ -77,9 +86,12 @@ class _ShareResultDialogState extends State<_ShareResultDialog> { final bytes = await image.toByteData(format: ui.ImageByteFormat.png); if (bytes == null) throw Exception('export failed'); final dir = await getTemporaryDirectory(); - final file = File( - '${dir.path}/prediqo-${payload.status}-${payload.betId.substring(0, 8)}.png', - ); + final tag = payload.isWallet + ? (payload.operationType ?? 'wallet') + : (payload.status ?? 'result'); + final id = (payload.isWallet ? payload.transactionId : payload.betId) ?? 'x'; + final shortId = id.length >= 8 ? id.substring(0, 8) : id; + final file = File('${dir.path}/prediqo-$tag-$shortId.png'); await file.writeAsBytes(bytes.buffer.asUint8List()); await SharePlus.instance.share( ShareParams( @@ -153,6 +165,16 @@ class ShareResultCard extends StatelessWidget { const ShareResultCard({super.key, required this.payload}); final ShareCardPayload payload; + @override + Widget build(BuildContext context) { + return payload.isWallet ? _WalletCard(payload: payload) : _PredictionCard(payload: payload); + } +} + +class _PredictionCard extends StatelessWidget { + const _PredictionCard({required this.payload}); + final ShareCardPayload payload; + Color get _accent { switch (payload.status) { case 'won': @@ -167,17 +189,105 @@ class ShareResultCard extends StatelessWidget { @override Widget build(BuildContext context) { final s = context.strings; - final settled = DateTime.tryParse(payload.settledAt)?.toLocal(); + final settled = DateTime.tryParse(payload.settledAt ?? '')?.toLocal(); final direction = payload.sequence.isNotEmpty ? payload.sequence.map(_dirLabel).join(' → ') - : _dirLabel(payload.direction); + : _dirLabel(payload.direction ?? 'long'); final statusLabel = switch (payload.status) { 'won' => s.t('Won', 'Gagné'), 'lost' => s.t('Lost', 'Perdu'), 'refunded' => s.t('Refunded', 'Remboursé'), - _ => payload.status, + _ => payload.status ?? '', }; + return _CardShell( + title: payload.gameName ?? 'Candle Predict', + accent: _accent, + amountLine: '${payload.resultSignedDisplay ?? '0'} USDT', + subtitle: statusLabel, + rows: [ + _KV(s.t('Prediction', 'Prédiction'), direction), + _KV(s.t('Interval', 'Intervalle'), '${payload.intervalMinutes ?? 1} min'), + _KV(s.t('Stake', 'Mise'), '${payload.stakeDisplay ?? 0} USDT'), + if (settled != null) _KV(s.t('Settled', 'Validé le'), _fmt(settled)), + ], + verifyUrl: payload.verifyUrl, + ); + } + + String _dirLabel(String d) => d == 'short' ? 'Short' : 'Long'; +} + +class _WalletCard extends StatelessWidget { + const _WalletCard({required this.payload}); + final ShareCardPayload payload; + + Color get _accent { + switch (payload.operationType) { + case 'deposit': + return const Color(0xFF3DDC97); + case 'withdrawal': + return const Color(0xFF5EB2D6); + default: + return const Color(0xFFC4A4FF); + } + } + + @override + Widget build(BuildContext context) { + final s = context.strings; + final created = DateTime.tryParse(payload.createdAt ?? '')?.toLocal(); + final opLabel = switch (payload.operationType) { + 'deposit' => s.t('Deposit', 'Dépôt'), + 'withdrawal' => s.t('Withdrawal', 'Retrait'), + 'transfer' => s.t('Transfer', 'Transfert'), + _ => payload.operationType ?? '', + }; + final statusLabel = switch (payload.txStatus) { + 'completed' => s.t('Completed', 'Réussi'), + 'pending' => s.t('Pending', 'En attente'), + 'confirming' => s.t('Confirming', 'Confirmation'), + 'failed' => s.t('Failed', 'Échoué'), + _ => payload.txStatus ?? '', + }; + + return _CardShell( + title: 'Prediqo Wallet', + accent: _accent, + amountLine: '${payload.amountSignedDisplay ?? '0'} ${payload.assetSymbol ?? ''}', + subtitle: opLabel, + rows: [ + _KV(s.t('Status', 'Statut'), statusLabel), + _KV(s.t('Asset', 'Actif'), payload.assetName ?? payload.assetSymbol ?? ''), + if ((payload.network ?? '').isNotEmpty) + _KV(s.t('Network', 'Réseau'), payload.network!), + if (created != null) _KV(s.t('Date', 'Date'), _fmt(created)), + ], + verifyUrl: payload.verifyUrl, + ); + } +} + +class _CardShell extends StatelessWidget { + const _CardShell({ + required this.title, + required this.accent, + required this.amountLine, + required this.subtitle, + required this.rows, + required this.verifyUrl, + }); + + final String title; + final Color accent; + final String amountLine; + final String subtitle; + final List<_KV> rows; + final String verifyUrl; + + @override + Widget build(BuildContext context) { + final s = context.strings; return Container( width: 320, padding: const EdgeInsets.all(18), @@ -206,7 +316,7 @@ class ShareResultCard extends StatelessWidget { ), const Spacer(), Text( - payload.gameName, + title, style: const TextStyle( color: Colors.white70, fontWeight: FontWeight.w700, @@ -217,29 +327,29 @@ class ShareResultCard extends StatelessWidget { ), const SizedBox(height: 16), Text( - '${payload.resultSignedDisplay} USDT', - style: TextStyle( - color: _accent, - fontWeight: FontWeight.w900, - fontSize: 28, - ), - ), - Text( - statusLabel, - style: TextStyle(color: _accent, fontWeight: FontWeight.w800), + amountLine, + style: TextStyle(color: accent, fontWeight: FontWeight.w900, fontSize: 28), ), + Text(subtitle, style: TextStyle(color: accent, fontWeight: FontWeight.w800)), const SizedBox(height: 12), - _row(s.t('Prediction', 'Prédiction'), direction), - _row(s.t('Interval', 'Intervalle'), '${payload.intervalMinutes} min'), - _row(s.t('Stake', 'Mise'), '${payload.stakeDisplay} USDT'), - if (settled != null) - _row( - s.t('Settled', 'Validé le'), - '${settled.day.toString().padLeft(2, '0')}/' - '${settled.month.toString().padLeft(2, '0')}/' - '${settled.year} ' - '${settled.hour.toString().padLeft(2, '0')}:' - '${settled.minute.toString().padLeft(2, '0')}', + for (final row in rows) + Padding( + padding: const EdgeInsets.only(bottom: 4), + child: Row( + children: [ + Expanded( + child: Text(row.k, style: const TextStyle(color: Colors.white54, fontSize: 12)), + ), + Text( + row.v, + style: const TextStyle( + color: Colors.white, + fontWeight: FontWeight.w700, + fontSize: 12, + ), + ), + ], + ), ), const SizedBox(height: 14), const Divider(color: Colors.white12), @@ -249,17 +359,15 @@ class ShareResultCard extends StatelessWidget { Container( padding: const EdgeInsets.all(6), color: Colors.white, - child: QrImageView( - data: payload.verifyUrl, - size: 64, - padding: EdgeInsets.zero, - ), + child: QrImageView(data: verifyUrl, size: 64, padding: EdgeInsets.zero), ), const SizedBox(width: 12), Expanded( child: Text( - s.t('Scan to verify · Authentic Prediqo result', - 'Scanner pour vérifier · Résultat Prediqo authentique'), + s.t( + 'Scan to verify · Authentic Prediqo result', + 'Scanner pour vérifier · Résultat Prediqo authentique', + ), style: const TextStyle(color: Colors.white70, fontSize: 11), ), ), @@ -269,34 +377,36 @@ class ShareResultCard extends StatelessWidget { ), ); } +} - String _dirLabel(String d) => d == 'short' ? 'Short' : 'Long'; +class _KV { + const _KV(this.k, this.v); + final String k; + final String v; +} - Widget _row(String label, String value) { - return Padding( - padding: const EdgeInsets.only(bottom: 4), - child: Row( - children: [ - Expanded( - child: Text(label, style: const TextStyle(color: Colors.white54, fontSize: 12)), - ), - Text(value, style: const TextStyle(color: Colors.white, fontWeight: FontWeight.w700, fontSize: 12)), - ], - ), - ); - } +String _fmt(DateTime dt) { + final d = dt.day.toString().padLeft(2, '0'); + final m = dt.month.toString().padLeft(2, '0'); + final h = dt.hour.toString().padLeft(2, '0'); + final min = dt.minute.toString().padLeft(2, '0'); + return '$d/$m/${dt.year} $h:$min'; } class ShareResultIconButton extends StatefulWidget { const ShareResultIconButton({ super.key, - required this.betId, + this.betId, + this.transactionId, + this.operationType, this.status, this.stakeAccountKind, this.requireStatus = true, }); - final String betId; + final String? betId; + final String? transactionId; + final String? operationType; final String? status; final String? stakeAccountKind; final bool requireStatus; @@ -332,16 +442,22 @@ class _ShareResultIconButtonState extends State { @override Widget build(BuildContext context) { if (!_loaded || _config == null) return const SizedBox.shrink(); - final ok = _config!.isEligible( - status: widget.status, - stakeAccountKind: widget.stakeAccountKind, - requireStatus: widget.requireStatus, - ); + final ok = widget.transactionId != null + ? _config!.isWalletOpEligible(widget.operationType ?? '') + : _config!.isPredictionEligible( + status: widget.status, + stakeAccountKind: widget.stakeAccountKind, + requireStatus: widget.requireStatus, + ); if (!ok) return const SizedBox.shrink(); return IconButton( tooltip: context.strings.t('Share result', 'Partager le résultat'), icon: const Icon(Icons.ios_share_rounded), - onPressed: () => openShareResultDialog(context, betId: widget.betId), + onPressed: () => openShareResultDialog( + context, + betId: widget.betId, + transactionId: widget.transactionId, + ), ); } } diff --git a/prediqo_mobile/lib/features/wallet/presentation/wallet_overview_screen.dart b/prediqo_mobile/lib/features/wallet/presentation/wallet_overview_screen.dart index 76883e35..82cdce2a 100644 --- a/prediqo_mobile/lib/features/wallet/presentation/wallet_overview_screen.dart +++ b/prediqo_mobile/lib/features/wallet/presentation/wallet_overview_screen.dart @@ -954,6 +954,11 @@ class _StatusTxTile extends StatelessWidget { ), ], ), + if (tx.type == 'deposit' || tx.type == 'withdrawal' || tx.type == 'transfer') + ShareResultIconButton( + transactionId: tx.id, + operationType: tx.type, + ), ], ), ); diff --git a/prediqo_web/src/features/share-cards/ShareCardsAdminPage.tsx b/prediqo_web/src/features/share-cards/ShareCardsAdminPage.tsx index 8dfe3c64..e305e60a 100644 --- a/prediqo_web/src/features/share-cards/ShareCardsAdminPage.tsx +++ b/prediqo_web/src/features/share-cards/ShareCardsAdminPage.tsx @@ -1,5 +1,5 @@ /** - * Admin configuration for Share Cards (prediction result sharing). + * Admin configuration for Share Cards (prediction + wallet operation sharing). */ import { Alert, @@ -27,6 +27,10 @@ export type ShareCardSettings = { allowWon: boolean; allowLost: boolean; allowRefunded: boolean; + walletOpsEnabled: boolean; + allowDeposit: boolean; + allowWithdrawal: boolean; + allowTransfer: boolean; updatedAt: string; }; @@ -68,6 +72,8 @@ export function ShareCardsAdminPage() { ); } + const walletOpsDisabled = !form.enabled || !form.walletOpsEnabled; + return ( @@ -104,6 +110,9 @@ export function ShareCardsAdminPage() { + {t('admin.shareCards.predictionsTitle')} + + {t('admin.shareCards.walletsTitle')} @@ -139,9 +148,7 @@ export function ShareCardsAdminPage() { /> - - - + {t('admin.shareCards.outcomesTitle')} @@ -177,6 +184,57 @@ export function ShareCardsAdminPage() { /> + + + + {t('admin.shareCards.walletOpsTitle')} + + setForm({ ...form, walletOpsEnabled: e.target.checked })} + /> + } + label={t('admin.shareCards.walletOpsEnabled')} + /> + + {t('admin.shareCards.walletOpsHelper')} + + + setForm({ ...form, allowDeposit: e.target.checked })} + /> + } + label={t('admin.shareCards.allowDeposit')} + /> + setForm({ ...form, allowWithdrawal: e.target.checked })} + /> + } + label={t('admin.shareCards.allowWithdrawal')} + /> + setForm({ ...form, allowTransfer: e.target.checked })} + /> + } + label={t('admin.shareCards.allowTransfer')} + /> + + + + + )} + {data?.kind === 'wallet' && ( + <> + {t('shareCard.verifyAuthentic')} + + {data.amountSignedDisplay} {data.assetSymbol} + + + {t(`shareCard.operationType.${data.operationType}`)} ·{' '} + {t(`shareCard.txStatusLabel.${data.status}`, { defaultValue: data.status })} + + + {data.network ? `${data.network} · ` : ''} + {new Date(data.createdAt).toLocaleString()} + + + + )} + {/* Legacy responses without kind field (older prediction tokens) */} + {data && !('kind' in data) && ( + <> + {t('shareCard.verifyAuthentic')} + )} @@ -99,3 +114,17 @@ export function ShareResultVerifyPage() { ); } + +function JoinButton({ referralCode }: { referralCode: string | null }) { + const { t } = useTranslation(); + return ( + + ); +} diff --git a/prediqo_web/src/features/share-cards/hooks.ts b/prediqo_web/src/features/share-cards/hooks.ts index 760bcc6d..d20330f0 100644 --- a/prediqo_web/src/features/share-cards/hooks.ts +++ b/prediqo_web/src/features/share-cards/hooks.ts @@ -18,3 +18,12 @@ export async function fetchShareCardPayload(betId: string): Promise(`/api/v1/share-cards/bets/${betId}`); return res.data; } + +export async function fetchWalletShareCardPayload( + transactionId: string +): Promise { + const res = await api.get( + `/api/v1/share-cards/transactions/${transactionId}` + ); + return res.data; +} diff --git a/prediqo_web/src/features/share-cards/types.ts b/prediqo_web/src/features/share-cards/types.ts index aceac5b4..264dcc94 100644 --- a/prediqo_web/src/features/share-cards/types.ts +++ b/prediqo_web/src/features/share-cards/types.ts @@ -6,10 +6,15 @@ export type ShareCardConfig = { allowWon: boolean; allowLost: boolean; allowRefunded: boolean; + walletOpsEnabled: boolean; + allowDeposit: boolean; + allowWithdrawal: boolean; + allowTransfer: boolean; updatedAt?: string; }; -export type ShareCardPayload = { +export type ShareCardPredictionPayload = { + kind: 'prediction'; betId: string; gameName: string; direction: 'short' | 'long'; @@ -33,23 +38,62 @@ export type ShareCardPayload = { registerUrl: string; }; -export type ShareCardVerifyPayload = { - authentic: true; - gameName: string; - direction: 'short' | 'long'; - sequence: ('short' | 'long')[] | null; - multiLevel: number | null; - predictionMode: string; - status: 'won' | 'lost' | 'refunded'; - resultSignedDisplay: string; - stakeDisplay: number; - intervalMinutes: number; - settledAt: string; - registerUrl: string; +export type ShareCardWalletPayload = { + kind: 'wallet'; + transactionId: string; + operationType: 'deposit' | 'withdrawal' | 'transfer'; + status: string; + amountRaw: string; + amountDisplay: string; + amountSignedDisplay: string; + feeRaw: string; + assetCode: string; + assetSymbol: string; + assetName: string; + network: string | null; + createdAt: string; + blockchainTxId: string | null; + verifyUrl: string; + verifyToken: string; referralCode: string | null; + registerUrl: string; }; -export function isShareEligibleClient( +export type ShareCardPayload = ShareCardPredictionPayload | ShareCardWalletPayload; + +export type ShareCardVerifyPayload = + | { + authentic: true; + kind: 'prediction'; + gameName: string; + direction: 'short' | 'long'; + sequence: ('short' | 'long')[] | null; + multiLevel: number | null; + predictionMode: string; + status: 'won' | 'lost' | 'refunded'; + resultSignedDisplay: string; + stakeDisplay: number; + intervalMinutes: number; + settledAt: string; + registerUrl: string; + referralCode: string | null; + } + | { + authentic: true; + kind: 'wallet'; + operationType: 'deposit' | 'withdrawal' | 'transfer'; + status: string; + amountSignedDisplay: string; + amountDisplay: string; + assetSymbol: string; + assetCode: string; + network: string | null; + createdAt: string; + registerUrl: string; + referralCode: string | null; + }; + +export function isPredictionShareEligible( config: ShareCardConfig | null | undefined, input: { stakeAccountKind?: string | null; status?: string | null; requireStatus?: boolean } ): boolean { @@ -61,7 +105,6 @@ export function isShareEligibleClient( const status = input.status; if (!status) { - // Wallet activity may not know outcome yet; allow button if wallets pass. return input.requireStatus === false; } if (status !== 'won' && status !== 'lost' && status !== 'refunded') return false; @@ -70,3 +113,17 @@ export function isShareEligibleClient( if (status === 'refunded' && !config.allowRefunded) return false; return true; } + +export function isWalletOpShareEligible( + config: ShareCardConfig | null | undefined, + operationType: string +): boolean { + if (!config?.enabled || !config.walletOpsEnabled) return false; + if (operationType === 'deposit') return config.allowDeposit; + if (operationType === 'withdrawal') return config.allowWithdrawal; + if (operationType === 'transfer') return config.allowTransfer; + return false; +} + +/** @deprecated use isPredictionShareEligible */ +export const isShareEligibleClient = isPredictionShareEligible; diff --git a/prediqo_web/src/features/wallet/components/TransactionList.tsx b/prediqo_web/src/features/wallet/components/TransactionList.tsx index 9b2880e3..52947fac 100644 --- a/prediqo_web/src/features/wallet/components/TransactionList.tsx +++ b/prediqo_web/src/features/wallet/components/TransactionList.tsx @@ -54,10 +54,18 @@ function predictionShareMeta(tx: WalletTransaction): { if (tx.type === 'game_refund') { return { betId, status: 'refunded', stakeAccountKind }; } - // Stake row: outcome unknown until settle (lost has no payout row). return { betId, stakeAccountKind }; } +function walletOpShareMeta( + tx: WalletTransaction +): { transactionId: string; operationType: 'deposit' | 'withdrawal' | 'transfer' } | null { + if (tx.type === 'deposit' || tx.type === 'withdrawal' || tx.type === 'transfer') { + return { transactionId: tx.id, operationType: tx.type }; + } + return null; +} + /** Maps wallet_type_id to wallet type metadata for display. */ function walletTypeById( balances: BalanceEntry[], @@ -142,7 +150,8 @@ export function TransactionList({ const credit = isCredit(tx); const [c1, c2] = coinColors(code); const human = rawToHuman(tx.amount, decimals); - const share = predictionShareMeta(tx); + const predictionShare = predictionShareMeta(tx); + const walletShare = walletOpShareMeta(tx); return ( @@ -200,12 +209,18 @@ export function TransactionList({ - {share ? ( + {predictionShare ? ( + ) : walletShare ? ( + ) : null} diff --git a/prediqo_web/src/shared/i18n/locales/en.ts b/prediqo_web/src/shared/i18n/locales/en.ts index 3e36c482..20d6cbed 100644 --- a/prediqo_web/src/shared/i18n/locales/en.ts +++ b/prediqo_web/src/shared/i18n/locales/en.ts @@ -234,10 +234,27 @@ export const en = { modeMulti: 'Multi-candle', verifyTitle: 'Scan to verify', verifyHint: 'Authentic Prediqo result', - verifyPageTitle: 'Verified prediction result', - verifyAuthentic: 'This Prediqo result is authentic.', + verifyPageTitle: 'Verified Prediqo share', + verifyAuthentic: 'This Prediqo share is authentic.', verifyInvalid: 'This share link is invalid or no longer available.', joinCta: 'Join Prediqo', + operation: 'Operation', + amount: 'Amount', + asset: 'Asset', + network: 'Network', + date: 'Date', + txStatus: 'Status', + operationType: { + deposit: 'Deposit', + withdrawal: 'Withdrawal', + transfer: 'Transfer', + }, + txStatusLabel: { + pending: 'Pending', + confirming: 'Confirming', + completed: 'Completed', + failed: 'Failed', + }, status: { won: 'Won', lost: 'Lost', @@ -1717,6 +1734,7 @@ export const en = { loadError: 'Failed to load Share Card settings.', globalEnabled: 'Enable Share Cards', globalHelper: 'When off, share buttons are hidden everywhere.', + predictionsTitle: 'Prediction results', walletsTitle: 'Allowed stake wallets', allowMain: 'Main wallet', allowBonus: 'Bonus wallet', @@ -1725,6 +1743,12 @@ export const en = { allowWon: 'Won', allowLost: 'Lost', allowRefunded: 'Refunded (neutral)', + walletOpsTitle: 'Wallet operations', + walletOpsEnabled: 'Enable wallet operation sharing', + walletOpsHelper: 'Allow users to share deposits, withdrawals, and transfers from Wallet Activity.', + allowDeposit: 'Deposits', + allowWithdrawal: 'Withdrawals', + allowTransfer: 'Transfers', save: 'Save settings', saveFailed: 'Save failed', saved: 'Settings saved.', diff --git a/prediqo_web/src/shared/i18n/locales/fr.ts b/prediqo_web/src/shared/i18n/locales/fr.ts index 7978e06c..eefbc793 100644 --- a/prediqo_web/src/shared/i18n/locales/fr.ts +++ b/prediqo_web/src/shared/i18n/locales/fr.ts @@ -241,10 +241,27 @@ export const fr = { modeMulti: 'Multi-bougies', verifyTitle: 'Scanner pour vérifier', verifyHint: 'Résultat Prediqo authentique', - verifyPageTitle: 'Résultat de prédiction vérifié', - verifyAuthentic: 'Ce résultat Prediqo est authentique.', + verifyPageTitle: 'Partage Prediqo vérifié', + verifyAuthentic: 'Ce partage Prediqo est authentique.', verifyInvalid: 'Ce lien de partage est invalide ou n’est plus disponible.', joinCta: 'Rejoindre Prediqo', + operation: 'Opération', + amount: 'Montant', + asset: 'Actif', + network: 'Réseau', + date: 'Date', + txStatus: 'Statut', + operationType: { + deposit: 'Dépôt', + withdrawal: 'Retrait', + transfer: 'Transfert', + }, + txStatusLabel: { + pending: 'En attente', + confirming: 'Confirmation', + completed: 'Réussi', + failed: 'Échoué', + }, status: { won: 'Gagné', lost: 'Perdu', @@ -1733,6 +1750,7 @@ export const fr = { loadError: 'Impossible de charger les paramètres Share Cards.', globalEnabled: 'Activer les Share Cards', globalHelper: 'Si désactivé, les boutons de partage sont masqués partout.', + predictionsTitle: 'Résultats de prédiction', walletsTitle: 'Wallets de mise autorisés', allowMain: 'Wallet principal', allowBonus: 'Wallet bonus', @@ -1741,6 +1759,13 @@ export const fr = { allowWon: 'Gagné', allowLost: 'Perdu', allowRefunded: 'Remboursé (neutre)', + walletOpsTitle: 'Opérations Wallet', + walletOpsEnabled: 'Activer le partage des opérations Wallet', + walletOpsHelper: + 'Autoriser les utilisateurs à partager dépôts, retraits et transferts depuis l’Activity du Wallet.', + allowDeposit: 'Dépôts', + allowWithdrawal: 'Retraits', + allowTransfer: 'Transferts', save: 'Enregistrer les paramètres', saveFailed: 'Échec de l’enregistrement', saved: 'Paramètres enregistrés.',