Guides
Deposit into Apex Omni (a perp DEX)
A step-by-step guide to deposit into Apex Omni using the Execution API.
Prerequisites
- Node.js and npm installed
- An Ethereum wallet with private key
- API key from Aarc
- Basic understanding of TypeScript and Ethereum
- USDC tokens on Arbitrum for deposit
Setup
1
Environment Setup
Create a .env
file with your credentials:
2
Install Dependencies
Install the required packages:
Implementation
1
Configure Constants
Define the necessary constants for Apex Omni and USDC:
2
Create Deposit Call Data Generator
Implement the function to generate the deposit call data:
3
Implement Deposit Function
Create the main function that handles the deposit process:
4
Execute the Deposit
Call the function with your desired deposit amount:
Understanding the Flow
- Generate Deposit Data: Creates the encoded function call for depositing into Apex Omni, including the zkLink address formatting.
- Get Deposit Address: Obtains a unique deposit address from Aarc for the transaction.
- Schedule Transaction: Notifies Aarc about the upcoming transaction for faster processing.
- Execute Transaction: Sends the transaction to the blockchain.
Complete Example
For the complete implementation, including utility functions and more detailed error handling, check out our example repository.