Skip to content

feat / Add execute-tx endpoint with Privy wallet integration#618

Draft
fengtality wants to merge 6 commits into
developmentfrom
feat/execute-tx-privy-integration
Draft

feat / Add execute-tx endpoint with Privy wallet integration#618
fengtality wants to merge 6 commits into
developmentfrom
feat/execute-tx-privy-integration

Conversation

@fengtality
Copy link
Copy Markdown
Contributor

Summary

  • Adds a generic execute-tx endpoint for executing transaction payloads from external APIs (like USDM)
  • Includes full Privy server wallet integration for both Solana and Ethereum chains
  • Supports multiple wallet types: local, hardware (Ledger), and Privy

New Endpoints

Execute Transaction

  • POST /chains/solana/execute-tx - Execute Solana transactions
  • POST /chains/ethereum/execute-tx - Execute Ethereum transactions

Privy Wallet Management

  • POST /wallet/add-privy - Register a Privy wallet
  • DELETE /wallet/remove-privy - Unregister a Privy wallet

Features

  • Multiple input formats: Accepts serialized transactions, instructions arrays, or single instruction (ix) for USDM compatibility
  • Wallet type auto-detection: Automatically detects wallet type (local, hardware, Privy) and uses appropriate signing method
  • Transaction simulation: Simulates transactions before sending to catch errors early
  • Comprehensive error handling: Proper error codes for insufficient funds, timeouts, etc.

Request Format (Solana)

{
  "network": "mainnet-beta",
  "walletAddress": "...",
  "ix": {
    "keys": [{"pubkey": "...", "isSigner": true, "isWritable": true}],
    "programId": "...",
    "data": "base64..."
  }
}

Or with instructions array:

{
  "instructions": [...]
}

Or with serialized transaction:

{
  "serializedTx": "base64..."
}

Test plan

  • Unit tests for execute-tx route (22 tests passing)
  • Build passes
  • Manual testing with USDM API integration
  • Test Privy wallet signing

🤖 Generated with Claude Code

Adds a generic execute-tx endpoint for executing transaction payloads
from external APIs (like USDM). Includes full Privy server wallet
integration for both Solana and Ethereum chains.

New features:
- POST /chains/solana/execute-tx endpoint
- POST /chains/ethereum/execute-tx endpoint
- Privy wallet management (add/remove routes)
- Support for serialized transactions, instructions arrays, and
  single instruction (ix) format for USDM compatibility
- Hardware wallet (Ledger), Privy, and local wallet signing

Files created:
- src/chains/solana/routes/execute-tx.ts
- src/chains/ethereum/routes/execute-tx.ts
- src/schemas/execute-tx-schema.ts
- src/wallet/privy/privy-client.ts
- src/wallet/privy/privy-evm-signer.ts
- src/wallet/privy/privy-solana-signer.ts
- src/wallet/routes/addPrivyWallet.ts
- src/wallet/routes/removePrivyWallet.ts
- test/chains/solana/routes/execute-tx.test.ts

Files modified:
- src/app.ts (register sensible globally)
- src/chains/solana/schemas.ts (add execute-tx schemas)
- src/chains/solana/solana.ts (add isPrivyWallet method)
- src/chains/ethereum/ethereum.ts (add isPrivyWallet method)
- src/wallet/utils.ts (add Privy wallet utilities)
- src/templates/apiKeys.yml (add Privy credentials)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Comment thread src/wallet/privy/privy-client.ts Fixed
fengtality and others added 2 commits March 25, 2026 22:07
Addresses CodeQL security finding by:
- Adding validateWalletId() function to validate wallet IDs contain
  only alphanumeric characters, hyphens, and underscores
- Rejecting wallet IDs with path traversal or URL manipulation chars
- Adding encodeURIComponent() as additional defense in depth
- Adding length limit to prevent abuse

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The @fastify/sensible plugin returns error names like 'InternalServerError'
instead of 'Internal Server Error'. Updated test to accept both formats.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@rapcmia rapcmia requested a review from nikspz March 30, 2026 02:06
@rapcmia rapcmia moved this to Backlog in Pull Request Board Mar 30, 2026
@rapcmia rapcmia added this to the v2.14 milestone Mar 30, 2026
@rapcmia rapcmia changed the title feat: Add execute-tx endpoint with Privy wallet integration feat/ Add execute-tx endpoint with Privy wallet integration Mar 30, 2026
@rapcmia rapcmia changed the title feat/ Add execute-tx endpoint with Privy wallet integration feat / Add execute-tx endpoint with Privy wallet integration Mar 30, 2026
@fengtality fengtality removed this from the v2.14 milestone Mar 31, 2026
@fengtality fengtality marked this pull request as draft March 31, 2026 17:29
@fengtality
Copy link
Copy Markdown
Contributor Author

@rapcmia this PR needs more work before it's ready. Moving to v2.15

@nikspz nikspz moved this from Backlog to In Discussion in Pull Request Board Apr 3, 2026
@rapcmia rapcmia removed the request for review from nikspz May 12, 2026 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Discussion

Development

Successfully merging this pull request may close these issues.

4 participants