
- Built complete CEX platform with FastAPI and Python - JWT-based authentication system with secure password hashing - Multi-currency crypto wallet support (BTC, ETH, USDT) - Fiat account management (USD, EUR, GBP) - Local transaction signing without external APIs - Comprehensive transaction handling (send/receive/deposit/withdraw) - SQLAlchemy models with Alembic migrations - Security middleware (rate limiting, headers, logging) - Input validation and sanitization - Encrypted private key storage with PBKDF2 - Standardized codebase architecture with service layer pattern - Complete API documentation with health endpoints - Comprehensive README with setup instructions Features: - User registration and authentication - Crypto wallet creation and management - Secure transaction signing using local private keys - Fiat deposit/withdrawal system - Transaction history and tracking - Rate limiting and security headers - Input validation for all endpoints - Error handling and logging
56 lines
1.3 KiB
Python
56 lines
1.3 KiB
Python
from pydantic import BaseModel
|
|
from typing import Optional
|
|
from datetime import datetime
|
|
from app.models.transaction import TransactionStatus, TransactionType
|
|
|
|
|
|
class TransactionBase(BaseModel):
|
|
amount: float
|
|
currency: str
|
|
to_address: str
|
|
notes: Optional[str] = None
|
|
|
|
|
|
class TransactionCreate(TransactionBase):
|
|
from_wallet_id: Optional[int] = None
|
|
|
|
|
|
class TransactionResponse(TransactionBase):
|
|
id: int
|
|
user_id: int
|
|
from_wallet_id: Optional[int]
|
|
to_wallet_id: Optional[int]
|
|
transaction_hash: Optional[str]
|
|
fee: float
|
|
transaction_type: TransactionType
|
|
status: TransactionStatus
|
|
from_address: Optional[str]
|
|
block_number: Optional[int]
|
|
confirmations: int
|
|
created_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
class FiatTransactionBase(BaseModel):
|
|
amount: float
|
|
currency: str
|
|
payment_method: Optional[str] = None
|
|
notes: Optional[str] = None
|
|
|
|
|
|
class FiatTransactionCreate(FiatTransactionBase):
|
|
transaction_type: TransactionType
|
|
|
|
|
|
class FiatTransactionResponse(FiatTransactionBase):
|
|
id: int
|
|
account_id: int
|
|
transaction_type: TransactionType
|
|
status: TransactionStatus
|
|
bank_reference: Optional[str]
|
|
created_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True |