OS Trading Engine
API Reference
Endpoints
Wallets

Wallets

Manage wallets assigned to trading agents for simulation and live trading.


Endpoints Overview

MethodEndpointDescription
GET/api/v1/wallets/agent/:agentIdList wallets for an agent
POST/api/v1/wallets/assignAssign a wallet to an agent
POST/api/v1/wallets/:walletAddress/resetReset wallet balances
POST/api/v1/wallets/:walletAddress/check-depositsCheck for deposits

All wallet endpoints require JWT authentication.


Wallet Types

Nexgent supports two wallet types:

TypeDescription
simulationVirtual wallet for paper trading (sim_* addresses)
liveReal Solana wallet for on-chain trading

List Wallets

Get all wallets for an agent and available wallets from environment.

GET /api/v1/wallets/agent/:agentId

Path Parameters

ParameterTypeDescription
agentIdUUIDAgent ID

Response

Success (200)

{
  "agentWallets": [
    {
      "walletAddress": "sim_abc123",
      "walletType": "simulation",
      "isAvailable": true,
      "createdAt": "2025-01-20T10:00:00.000Z",
      "updatedAt": "2025-01-20T10:00:00.000Z"
    },
    {
      "walletAddress": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
      "walletType": "live",
      "isAvailable": true,
      "createdAt": "2025-01-20T10:00:00.000Z",
      "updatedAt": "2025-01-20T10:00:00.000Z"
    }
  ],
  "availableWallets": [
    {
      "walletAddress": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
      "isAssigned": true
    },
    {
      "walletAddress": "9yLMtg3DX98e08UKTEqcC6kLzheTrB84USnAsgsW",
      "isAssigned": false
    }
  ]
}

Response Fields

agentWallets

FieldTypeDescription
walletAddressstringWallet public key
walletTypestringsimulation or live
isAvailablebooleanWhether wallet is loaded from env
createdAtISO 8601Assignment time

availableWallets (from environment)

FieldTypeDescription
walletAddressstringWallet public key
isAssignedbooleanWhether assigned to this agent

Example

curl -X GET "https://your-instance.com/api/v1/wallets/agent/123e4567-e89b-12d3-a456-426614174000" \
  -H "Authorization: Bearer <access_token>"

Assign Wallet

Assign a wallet to an agent.

POST /api/v1/wallets/assign

Request

{
  "agentId": "123e4567-e89b-12d3-a456-426614174000",
  "walletAddress": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
  "walletType": "live"
}
FieldTypeRequiredDescription
agentIdUUIDYesAgent ID
walletAddressstringYesWallet public key
walletTypestringYessimulation or live

Validation Rules

  • Live wallets must be configured in environment variables (WALLET_1, WALLET_2, etc.)
  • Simulation wallets use sim_* prefix and don't require env configuration
  • Each agent can have one wallet per type

Response

Success (201)

{
  "success": true,
  "walletAddress": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
  "walletType": "live",
  "message": "Wallet assigned successfully"
}

Wallet Not Configured (400)

{
  "error": "Wallet 7xKXt... is not loaded from environment variables. Please configure WALLET_1, WALLET_2, etc."
}

Example

curl -X POST "https://your-instance.com/api/v1/wallets/assign" \
  -H "Authorization: Bearer <access_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "agentId": "123e4567-e89b-12d3-a456-426614174000",
    "walletAddress": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
    "walletType": "live"
  }'

Reset Wallet

Reset a simulation wallet's balances to initial state.

POST /api/v1/wallets/:walletAddress/reset

Path Parameters

ParameterTypeDescription
walletAddressstringWallet address (sim_* only)

Response

Success (200)

{
  "success": true,
  "message": "Wallet balances reset"
}
⚠️

Reset is only available for simulation wallets. Live wallets cannot be reset.


Check Deposits

Check for new deposits to a wallet and update balances.

POST /api/v1/wallets/:walletAddress/check-deposits

Path Parameters

ParameterTypeDescription
walletAddressstringWallet public key

Response

Success (200)

{
  "success": true,
  "depositsFound": 2,
  "newBalance": "15.5"
}

Environment Configuration

Live wallets are configured via environment variables:

# .env
WALLET_1=base58_private_key_1
WALLET_2=base58_private_key_2
WALLET_3=base58_private_key_3
⚠️

Security: Private keys should be stored securely. Never commit them to version control.


Related Endpoints