OKX DEX IDL
6m2CDdhRgxpH4WjvdzxAYbGxwdGUz5MziiL5jek2kBmaOKX DEX v1 is the on-chain swap aggregation program powering OKX Wallet's decentralized exchange on Solana. Features commission-based fee routing, multi-hop swap execution, and fund settlement via claim operations.
Instructions
Events
Integration Examples
Use the OKX DEX IDL in your application with these code examples for TypeScript, Rust, and Python.
import { Connection, PublicKey } from "@solana/web3.js";
import { Program, AnchorProvider, Idl } from "@coral-xyz/anchor";
// Load the OKX DEX IDL
import idl from "./okx dex.json";
const PROGRAM_ID = new PublicKey("6m2CDdhRgxpH4WjvdzxAYbGxwdGUz5MziiL5jek2kBma");
// Set up the provider and program
const connection = new Connection("https://api.mainnet-beta.solana.com");
const provider = new AnchorProvider(connection, wallet, {
commitment: "confirmed",
});
const program = new Program(idl as Idl, provider);
// Fetch and decode an account
const accountData = await program.account.oKX_DEX
.fetch(accountPublicKey);
console.log("Account data:", accountData);
// Build and send an instruction
const tx = await program.methods
.initialize(/* ...args */)
.accounts({
/* ...required accounts */
})
.rpc();
console.log("Transaction signature:", tx);IDL JSON Preview
{
"address": "6m2CDdhRgxpH4WjvdzxAYbGxwdGUz5MziiL5jek2kBma",
"metadata": {
"name": "dex_solana",
"version": "0.1.0",
"spec": "0.1.0",
"description": "Created with Anchor"
},
"instructions": [
{
"name": "claim",
"discriminator": [
62,
198,
214,
193,
213,
159,
108,
210
],
"accounts": [
{
"name": "signer",
"writable": true,
"signer": true,
"address": "CjoV5B96reuCfPh2rRK11G1QptG97jZdyZArTn3EN1Mj"
},
{
"name": "receiver",
...Frequently Asked Questions
What is the OKX DEX IDL?
The OKX DEX IDL (Interface Definition Language) is a JSON schema that defines the on-chain program interface for the OKX DEX smart contract on Solana. It describes all available instructions, account structures, events, and custom types that developers need to interact with the OKX DEX program. This IDL contains 18 instructions, 0 account types, 13 events, and 20 type definitions.
How do I use the OKX DEX IDL in my project?
Download the JSON file and import it in your project. With TypeScript, use the @coral-xyz/anchor package to create a Program instance. In Rust, use anchor-client. For Python, use anchorpy. See the integration examples above for complete code snippets in all three languages.
What is the OKX DEX program address on Solana?
The OKX DEX program is deployed at address 6m2CDdhRgxpH4WjvdzxAYbGxwdGUz5MziiL5jek2kBma on Solana mainnet. You can verify this on any Solana block explorer.
What version of the OKX DEX IDL is this?
This is version 0.1.0 of the OKX DEX IDL. IDL versions correspond to specific program deployments and may be updated as the protocol evolves. Always verify compatibility with the on-chain program version before integrating.