Skip to content

feat: Gateway wallet management & bot orchestration improvements#131

Merged
fengtality merged 12 commits intomainfrom
fix/gateway-proxy-operation-ids
Mar 29, 2026
Merged

feat: Gateway wallet management & bot orchestration improvements#131
fengtality merged 12 commits intomainfrom
fix/gateway-proxy-operation-ids

Conversation

@fengtality
Copy link
Copy Markdown
Contributor

@fengtality fengtality commented Mar 4, 2026

Summary

API Changes

New Endpoints

  • POST /bot-orchestration/deploy-v2-script - Deploy a V2 script bot
  • POST /accounts/gateway/wallet/set-default - Set default wallet for a chain

Modified Models

  • GatewayWalletCredential: Added set_default (default: true), removed unused network field
  • V2ScriptDeployment: New model for script deployment

Test Plan for QA

Prerequisites

  • Gateway running on port 15888
  • Valid Ethereum private key for testing

Wallet Endpoint Tests

  1. List wallets

    curl -u admin:admin http://localhost:8000/accounts/gateway/wallets
  2. Create new wallet

    curl -u admin:admin -X POST http://localhost:8000/gateway/wallets/create \
      -H "Content-Type: application/json" \
      -d '{"chain": "ethereum", "set_default": true}'

    Expected: Returns {"address": "0x...", "chain": "ethereum"}

  3. Add existing wallet

    curl -u admin:admin -X POST http://localhost:8000/accounts/gateway/add-wallet \
      -H "Content-Type: application/json" \
      -d '{"chain": "ethereum", "private_key": "0x...", "set_default": false}'

    Expected: Returns {"address": "0x..."}

  4. Set default wallet

    curl -u admin:admin -X POST http://localhost:8000/accounts/gateway/wallet/set-default \
      -H "Content-Type: application/json" \
      -d '{"chain": "ethereum", "address": "<address-from-step-3>"}'

    Expected: Returns {"success": true, "message": "Set ... as default wallet for ethereum", ...}

  5. Show private key

    curl -u admin:admin -X POST http://localhost:8000/gateway/wallets/show-private-key \
      -H "Content-Type: application/json" \
      -d '{"chain": "ethereum", "address": "<address>", "passphrase": "a"}'

    Expected: Returns {"address": "...", "chain": "ethereum", "privateKey": "0x..."}

  6. Delete wallet

    curl -u admin:admin -X DELETE "http://localhost:8000/accounts/gateway/ethereum/<address>"

    Expected: Returns {"success": true, "message": "Successfully removed ethereum wallet"}

Bot Orchestration Test

  1. Verify deploy-v2-script endpoint exists
    curl -u admin:admin http://localhost:8000/openapi.json | grep deploy-v2-script
    Expected: Endpoint appears in OpenAPI spec

Gateway Proxy Test

  1. Verify gateway proxy works
    curl -u admin:admin http://localhost:8000/gateway-proxy/wallet
    Expected: Returns wallet list from Gateway

Placeholder Wallet Test

  1. Verify no errors for placeholder wallets
    • Configure Gateway with defaultWallet: '<ethereum-wallet-address>' (template default)
    • Start API server
    • Check logs for absence of "Invalid Ethereum address format" errors

🤖 Generated with Claude Code

Closes #129
Closes #124

fengtality and others added 9 commits March 4, 2026 12:56
Split the single api_route handler into separate handlers for each HTTP
method (GET, POST, PUT, DELETE, PATCH) with explicit operation_ids.
This ensures unique operation IDs in the OpenAPI schema.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Gateway templates use placeholder addresses like '<ethereum-wallet-address>'
which cause errors when the API tries to fetch balances. Now detects and
skips these placeholder patterns.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Issue #129: Restore deploy-v2-script endpoint
- Add V2ScriptDeployment model for script-based bot deployment
- Add POST /bot-orchestration/deploy-v2-script endpoint
- Track bot runs in database for script deployments

Issue #124: Add set-default wallet functionality
- Add set_default parameter to POST /accounts/gateway/add-wallet (default: true)
- Add POST /gateway/wallets/set-default endpoint to change default wallet
- Add set_default_wallet method to GatewayClient

Also:
- Enable CLMM add/remove liquidity endpoints (uncommented)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Moved from /gateway/wallets/* to /accounts/gateway/wallet/*:
- POST /accounts/gateway/wallet/create
- POST /accounts/gateway/wallet/show-private-key
- POST /accounts/gateway/wallet/send
- POST /accounts/gateway/wallet/set-default

This consolidates all account/wallet management under the Accounts router.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace debug print statements with proper logging.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Consistent endpoint naming for all wallet operations under /accounts/gateway/wallet/*.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…/{chain}/{address}

Consistent endpoint naming for all wallet operations.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Logical grouping: add -> set-default -> delete -> create -> show-private-key -> send

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@fengtality fengtality changed the title fix: add explicit operation IDs to gateway proxy routes feat: Gateway wallet management & bot orchestration improvements Mar 23, 2026
@fengtality fengtality requested a review from rapcmia March 23, 2026 18:53
fengtality and others added 3 commits March 23, 2026 11:54
Reverts the endpoint moves from PR #131 to save for a different PR:
- POST /gateway/wallets/create (stays in gateway.py)
- POST /gateway/wallets/show-private-key (stays in gateway.py)
- POST /gateway/wallets/send (stays in gateway.py)
- GET /accounts/gateway/wallets (back to accounts.py)
- POST /accounts/gateway/add-wallet (back to accounts.py)
- DELETE /accounts/gateway/{chain}/{address} (back to accounts.py)
- POST /accounts/gateway/wallet/set-default (new, in accounts.py)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Reverted unnecessary function name changes:
- create_gateway_wallet -> create_wallet
- show_gateway_wallet_private_key -> show_private_key
- send_gateway_wallet_transaction -> send_transaction

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@rapcmia
Copy link
Copy Markdown
Contributor

rapcmia commented Mar 27, 2026

Commit 99aeea7

  • Build local docker image and run make deploy
  • Deploy gateway successfully using development branch ✅
  • Tested wallet routes ✅
    • Lists wallet
    • Create new wallet
    • Add existing wallet
    • Set default wallet
    • Show private key
    • Delete wallet
    • Tested what happens if default wallet gets deleted ❌
      • Other wallets are still the same
      • Default wallet still uses the deleted wallet
        image
        • I think we need to clear the default wallet or
        • Create a fallback where it will automatically select any of the remaining wallets?
  • Verify deploy-v2-script endpoint exists ✅
    • deploy a fake-script.yml and successfully deployed
    • expected results return non existing file from bots/conf/scripts
  • Verify gateway proxy works ✅
    curl -s -u admin:admin 'http://localhost:8000/gateway-proxy/config?namespace=solana' | jq
    {
      "defaultNetwork": "mainnet-beta",
      "defaultWallet": "<solana-wallet-address>",
      "defaultNetworks": [
        "mainnet-beta"
      ],
      "rpcProvider": "url"
    }
    logs: INFO:     172.18.0.1:53396 - "GET /gateway-proxy/config?namespace=solana HTTP/1.1" 200 OK
    
  • Verify no errors for placeholder wallets ✅
    • Manually setup defaultWallet: '<ethereum-wallet-address>’ from ./gateway-files/conf/chains/ethereum.yml
    • Start hummingbot-api using make deploy
    • No found error related to invalid ethereum address

@fengtality
Copy link
Copy Markdown
Contributor Author

tested what happens if default wallet gets deleted ❌
Other wallets are still the same
Default wallet still uses the deleted wallet
image.png (view on web)
I think we need to clear the default wallet or
Create a fallback where it will automatically select any of the remaining wallets?

@rapcmia I will improve Gateway's delete wallet endpoint to clear the defaultWallet. That will be cleaner.

Copy link
Copy Markdown
Contributor

@cardosofede cardosofede left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@fengtality fengtality merged commit 5cee487 into main Mar 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing deploy-v2-script endpoint after PR refactoring Add endpoint for setting default Gateway wallet

3 participants