POST
/
api
/
wallet

Overview

The Wallet Operations endpoint handles direct deposits and withdrawals of tokens on Arbitrum to your margin wallet. This endpoint is specifically for tokens already on the Arbitrum network - for cross-chain deposits, use the crosschaindeposit endpoint instead.

Request Body

type
string
required

Operation type. Must be either:

  • deposit: Deposit tokens into margin wallet
  • withdraw: Withdraw tokens from margin wallet
tokenAddress
string
required

Contract address of the token to deposit or withdraw. Currently supported tokens:

  • USDC: 0xaf88d065e77c8cc2239327c5edb3a432268e5831 (6 decimals)
amount
string
required

Amount to deposit or withdraw (in token units with decimals)

Response Fields

calldata
string

Encoded function call data for the transaction

vaultAddress
string

Address of the vault contract

Example Usage

Deposit USDC

Withdraw USDC

Example Response

{
  "calldata": "0x4d59524546455252414c434f4445000000000000000000000000000000000000",
  "vaultAddress": "0xe3ca135782e4a17aFb31a63ee3b15351C891A1A2"
}

Implementation Notes

  • For deposits:

    • Uses depositSelf function
    • Token approval may be required before deposit
    • Amount precision handled based on token decimals (6 for USDC)
  • For withdrawals:

    • Uses withdraw function
    • Amount must not exceed available balance
    • Amount precision handled based on token decimals (6 for USDC)

Error Responses

The endpoint will return a 400 status code for:

  • Missing type, tokenAddress, or amount
  • Invalid operation type
  • Invalid token address
  • Invalid amount format

A 500 status code will be returned for:

  • Transaction encoding errors
  • Contract interaction errors

Body

application/json
type
enum<string>
required

Operation type

Available options:
deposit,
withdraw
tokenAddress
string
required

Token contract address

amount
string
required

Amount to deposit or withdraw

Response

200 - application/json
calldata
string
required

Encoded function call data

vaultAddress
string
required

Address of the vault contract

requiredGasFee
string

Required gas fee for the transaction