Integration Guide
This guide outlines the development of a perpetual trading front-end application using the dYdX v4 application chain APIs. It covers backend data interpretation and rendering for end users, as well as trade execution. While maintaining a high-level perspective, it addresses specific details as needed. For in-depth implementation details, refer to the dYdX source repository, where dYdX Trading Inc. maintains the trading application's source code for web, iOS, and Android platforms.
Overview of dYdX Repositories
The following repos contain the source code for the dYdX client applications. They can serve as a good reference if you are wondering about the implementation details:
Main applications
v4-web.
The web application. This is the React application that powers the https://dydx.trade site. It references the v4-client-js repo for read/write data from the validator.
v4-native-ios.
The iOS application written in Swift It’s powered by the abacus library for its core trading logic. It also uses the v4-client-js for read/write data from the validator, and the cartera-ios library to interact with mobile wallet apps.
v4-native-android.
The Android application written in Kotlin. Same with the iOS app, it uses abacus at its core, and use the v4-client-js for read/write data from the validator. Cartera-android is used to interact with mobile wallet apps.
Support libraries
v4-client-js.
Typescript library that wraps the common functions to query and write to the validator/blockchain. It takes a user’s mnemonic and then can send transactions to the validator on the user's behalf. It’s responsible for all data directly flowing in between the client applications and the validator.
abacus.
Kotlin library that powers the core trading logic of the iOS and Android applications. The library pulls the data from the indexer and executes transactions by calling v4-client-js.
v4-localization.
Contains localization data used by all client applications. There is no application logic.