Skip to main content

Endpoints

MethodEndpointDescription
POST/spicedepositRecord a deposit or withdrawal
GET/spicedeposit/:addressGet user token balances

POST /spicedeposit

Record a deposit (add balance) or withdrawal (subtract balance) after on-chain verification.

Request Body

{
  user: Address;         // User wallet address
  sender: Address;       // Transaction sender
  txHash: Hash;          // Transaction hash for verification
  chainId: number;       // Chain ID where tx occurred
  tokenAddress: Address; // Token contract address
  amount: bigint;        // Amount in wei
  isDeposit?: boolean;   // true = deposit (add), false = withdrawal (subtract). Default: true
}

Response

Success (200)
{
  "success": true
}
Error (400)
{
  "success": false,
  "error": {
    "message": "Missing txHash, sender, tokenAddress, chainId, or amount"
  }
}
{
  "success": false,
  "error": {
    "message": "Spice deposit verification failed"
  }
}

Verification

For deposits (isDeposit: true), the API verifies the transaction on-chain by:
  1. Fetching the transaction receipt
  2. Verifying deposit events match the claimed amount
  3. Confirming the sender and token address
Withdrawal verification is currently pending while the exact withdrawal event signature is confirmed.

Example

curl -X POST /spicedeposit \
  -H "Content-Type: application/json" \
  -d '{
    "user": "0x742d35Cc6634C0532925a3b844e4B7db0D6d8E5c",
    "sender": "0x742d35Cc6634C0532925a3b844e4B7db0D6d8E5c",
    "txHash": "0x1234567890abcdef...",
    "chainId": 84532,
    "tokenAddress": "0xTokenAddress...",
    "amount": "1000000000000000000",
    "isDeposit": true
  }'

GET /spicedeposit/:address

Get all token balances for a user across all chains.

Path Parameters

ParameterTypeRequiredDescription
addressstringYesUser wallet address

Response

Success (200)
{
  "success": true,
  "data": {
    "tokens": {
      "84532": {
        "0xTokenAddress1...": "1000000000000000000",
        "0xTokenAddress2...": "500000000000000000"
      },
      "421614": {
        "0xTokenAddress3...": "2500000000000000000"
      }
    }
  }
}
The tokens object is structured as:
  • Key (outer): Chain ID as string
  • Key (inner): Token contract address
  • Value: Balance amount as string (in wei)

Example

curl /spicedeposit/0x742d35Cc6634C0532925a3b844e4B7db0D6d8E5c

Response Fields

FieldTypeDescription
tokensobjectNested mapping: chainId → tokenAddress → amount