POST
/
storeWallet_v2
Import Wallet (v2)
curl --request POST \
  --url http://localhost:2400/storeWallet_v2 \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "privateKey": "YOUR_SOLANA_PRIVATE_KEY_BASE58_ENCODED",
  "network": "sol"
}'
{
  "message": "Wallet stored successfully."
}

Endpoint

POST /storeWallet_v2

Description

Imports an existing wallet (EVM or Solana) by its private key and associates it with the authenticated user’s account. The endpoint validates the private key format for the specified network, checks if the user has reached their wallet limit based on their subscription tier, and then saves the wallet address and encrypted private key.

Authentication

Requires a valid JWT token passed via cookies.

Request Body

ParameterTypeRequiredDescriptionExample
privateKeystringYesThe private key of the wallet to import (Hex for EVM, Base58 for Solana).0xabc... or 4Xy...
networkstringYesThe network type (‘eth’, ‘base’, ‘sol’, ‘bsc’, ‘avax’).sol
Example (Import Solana)
{
  "privateKey": "YOUR_SOLANA_PRIVATE_KEY_BASE58_ENCODED",
  "network": "sol"
}
Example (Import EVM)
{
  "privateKey": "0xYOUR_EVM_PRIVATE_KEY_HEX",
  "network": "base"
}

Success Response (200 OK)

Indicates the wallet was successfully imported and stored.
Example
{
  "message": "Wallet stored successfully."
}

Error Response (400 Bad Request)

Indicates invalid input, such as an invalid network type or an incorrectly formatted/invalid private key for the specified network.
Example
{
  "message": "Invalid network type. Must be one of: eth, sol, bsc, avax, base"
  // or
  // "message": "Invalid Solana private key format: Unrecognized Solana private key format"
  // or
  // "message": "Invalid EVM private key format"
}

Error Response (401 Unauthorized)

Indicates that no valid JWT token was provided or the token is expired.
Example
{
  "error": "No access token provided"
}

Error Response (403 Forbidden)

Indicates that the user has reached their maximum allowed wallet limit for their subscription tier.
Example
{
  "message": "Wallet limit reached: You have reached the limit of 10 wallets for your Base tier."
}

Error Response (500 Internal Server Error)

Indicates a server-side error occurred during wallet validation or saving.
Example
{
  "message": "Server error: Database connection failed"
}

Notes

  • This endpoint is handled by the User server (Port 5000).
  • Saves the imported wallet details to the GeneralWalletData collection.
  • Performs format validation on the provided privateKey based on the network.
  • Checks against user’s wallet limit based on their subscription tier (UserData.tier).
  • The colortag is initially set to undefined, allowing the system to assign a default color.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Response

200
application/json

Success response indicating wallet was imported.

The response is of type object.