From 64aa429a265707c0a4cfb70a298e60d3294e57c4 Mon Sep 17 00:00:00 2001 From: cardosofede Date: Mon, 22 Jun 2026 13:53:21 +0200 Subject: [PATCH 1/3] (feat) remove gateway models --- models/__init__.py | 6 ------ models/gateway.py | 22 ---------------------- 2 files changed, 28 deletions(-) diff --git a/models/__init__.py b/models/__init__.py index 42208f6c..28f5b400 100644 --- a/models/__init__.py +++ b/models/__init__.py @@ -78,15 +78,12 @@ from .gateway import ( AddPoolRequest, AddTokenRequest, - CreateWalletRequest, GatewayBalanceRequest, GatewayConfig, GatewayStatus, GatewayWalletCredential, GatewayWalletInfo, - SendTransactionRequest, SetDefaultWalletRequest, - ShowPrivateKeyRequest, UpdateApiKeysRequest, ) @@ -282,9 +279,6 @@ # Gateway models "GatewayConfig", "GatewayStatus", - "CreateWalletRequest", - "ShowPrivateKeyRequest", - "SendTransactionRequest", "SetDefaultWalletRequest", "GatewayWalletCredential", "GatewayWalletInfo", diff --git a/models/gateway.py b/models/gateway.py index 003723c1..5528326c 100644 --- a/models/gateway.py +++ b/models/gateway.py @@ -28,28 +28,6 @@ class GatewayStatus(BaseModel): # Wallet Management Models # ============================================ -class CreateWalletRequest(BaseModel): - """Request to create a new wallet in Gateway""" - chain: str = Field(description="Blockchain chain (e.g., 'solana', 'ethereum')") - set_default: bool = Field(default=True, description="Set as default wallet for this chain") - - -class ShowPrivateKeyRequest(BaseModel): - """Request to show private key for a wallet""" - chain: str = Field(description="Blockchain chain (e.g., 'solana', 'ethereum')") - address: str = Field(description="Wallet address") - passphrase: str = Field(description="Gateway passphrase for decryption") - - -class SendTransactionRequest(BaseModel): - """Request to send a native token transaction""" - chain: str = Field(description="Blockchain chain (e.g., 'solana', 'ethereum')") - network: str = Field(description="Network (e.g., 'mainnet-beta', 'mainnet')") - address: str = Field(description="Sender wallet address") - to_address: str = Field(description="Recipient address") - amount: str = Field(description="Amount to send (in native token units)") - - class GatewayWalletCredential(BaseModel): """Credentials for adding an existing wallet to Gateway""" chain: str = Field(description="Blockchain chain (e.g., 'solana', 'ethereum')") From 475fe2df44afd6ea8324705dccd4a89f044c8d9a Mon Sep 17 00:00:00 2001 From: cardosofede Date: Mon, 22 Jun 2026 13:53:30 +0200 Subject: [PATCH 2/3] (feat) remove endpoints from router --- routers/gateway.py | 146 --------------------------------------------- 1 file changed, 146 deletions(-) diff --git a/routers/gateway.py b/routers/gateway.py index fe9e6744..b7a75041 100644 --- a/routers/gateway.py +++ b/routers/gateway.py @@ -7,11 +7,8 @@ from models import ( AddPoolRequest, AddTokenRequest, - CreateWalletRequest, GatewayConfig, GatewayStatus, - SendTransactionRequest, - ShowPrivateKeyRequest, UpdateApiKeysRequest, ) from services.accounts_service import AccountsService @@ -947,146 +944,3 @@ async def delete_network_pool( raise except Exception as e: raise HTTPException(status_code=500, detail=f"Error deleting pool: {str(e)}") - - -# ============================================ -# Wallet Management -# ============================================ - -@router.post("/wallets/create") -async def create_wallet( - request: CreateWalletRequest, - accounts_service: AccountsService = Depends(get_accounts_service) -) -> Dict: - """ - Create a new wallet in Gateway. - - Args: - request: Contains chain and set_default flag - - Returns: - Dict with address and chain of the created wallet. - - Example: POST /gateway/wallets/create - { - "chain": "solana", - "set_default": true - } - """ - try: - if not await accounts_service.gateway_client.ping(): - raise HTTPException(status_code=503, detail="Gateway service is not available") - - result = await accounts_service.gateway_client.create_wallet( - chain=request.chain, - set_default=request.set_default - ) - - if result is None: - raise HTTPException(status_code=502, detail="Failed to create wallet: Gateway returned no response") - - if "error" in result: - raise HTTPException(status_code=400, detail=f"Failed to create wallet: {result.get('error')}") - - return result - - except HTTPException: - raise - except Exception as e: - raise HTTPException(status_code=500, detail=f"Error creating wallet: {str(e)}") - - -@router.post("/wallets/show-private-key") -async def show_private_key( - request: ShowPrivateKeyRequest, - accounts_service: AccountsService = Depends(get_accounts_service) -) -> Dict: - """ - Show private key for a wallet. - - WARNING: This endpoint exposes sensitive information. Use with caution. - - Args: - request: Contains chain, address, and passphrase - - Returns: - Dict with privateKey field. - - Example: POST /gateway/wallets/show-private-key - { - "chain": "solana", - "address": "", - "passphrase": "" - } - """ - try: - if not await accounts_service.gateway_client.ping(): - raise HTTPException(status_code=503, detail="Gateway service is not available") - - result = await accounts_service.gateway_client.show_private_key( - chain=request.chain, - address=request.address, - passphrase=request.passphrase - ) - - if result is None: - raise HTTPException(status_code=502, detail="Failed to retrieve private key: Gateway returned no response") - - if "error" in result: - raise HTTPException(status_code=400, detail=f"Failed to retrieve private key: {result.get('error')}") - - return result - - except HTTPException: - raise - except Exception as e: - raise HTTPException(status_code=500, detail=f"Error retrieving private key: {str(e)}") - - -@router.post("/wallets/send") -async def send_transaction( - request: SendTransactionRequest, - accounts_service: AccountsService = Depends(get_accounts_service) -) -> Dict: - """ - Send a native token transaction. - - Args: - request: Contains chain, network, sender address, recipient address, and amount - - Returns: - Dict with transaction signature/hash. - - Example: POST /gateway/wallets/send - { - "chain": "solana", - "network": "mainnet-beta", - "address": "", - "to_address": "", - "amount": "0.001" - } - """ - try: - if not await accounts_service.gateway_client.ping(): - raise HTTPException(status_code=503, detail="Gateway service is not available") - - result = await accounts_service.gateway_client.send_transaction( - chain=request.chain, - network=request.network, - address=request.address, - to_address=request.to_address, - amount=request.amount - ) - - if result is None: - raise HTTPException(status_code=502, detail="Failed to send transaction: Gateway returned no response") - - if "error" in result: - raise HTTPException(status_code=400, detail=f"Failed to send transaction: {result.get('error')}") - - return result - - except HTTPException: - raise - except Exception as e: - raise HTTPException(status_code=500, detail=f"Error sending transaction: {str(e)}") From 7a057fad6ed9ce6a3b8df82d616cfa9703b0cd09 Mon Sep 17 00:00:00 2001 From: cardosofede Date: Mon, 22 Jun 2026 13:53:41 +0200 Subject: [PATCH 3/3] (feat) remove func --- services/gateway_client.py | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/services/gateway_client.py b/services/gateway_client.py index 31a46d24..8ac120a1 100644 --- a/services/gateway_client.py +++ b/services/gateway_client.py @@ -162,38 +162,6 @@ async def add_wallet(self, chain: str, private_key: str, set_default: bool = Tru "setDefault": set_default }) - async def create_wallet(self, chain: str, set_default: bool = True) -> Dict: - """Create a new wallet in Gateway""" - return await self._request("POST", "wallet/create", json={ - "chain": chain, - "setDefault": set_default - }) - - async def show_private_key(self, chain: str, address: str, passphrase: str) -> Dict: - """Show private key for a wallet""" - return await self._request("POST", "wallet/show-private-key", json={ - "chain": chain, - "address": address, - "passphrase": passphrase - }) - - async def send_transaction( - self, - chain: str, - network: str, - address: str, - to_address: str, - amount: str - ) -> Dict: - """Send a native token transaction""" - return await self._request("POST", "wallet/send", json={ - "chain": chain, - "network": network, - "address": address, - "toAddress": to_address, - "amount": amount - }) - async def remove_wallet(self, chain: str, address: str) -> Dict: """Remove a wallet from Gateway""" return await self._request("DELETE", "wallet/remove", json={