Hey degens and builders! If you've been eyeing VeloraDEX for seamless swaps in your dApp, you're in luck. Integrating the SDK is straight-up simple – especially for Delta (gasless, intent-based magic) with automatic fallback to Market when needed.

No rocket science here; just plug-and-play code that handles the heavy lifting.

In this quick blog, I'll walk through the steps to get Delta swaps rolling in your dApp, complete with fallback logic.

We'll cover installation, setup, quoting, execution, and even monitoring. By the end, you'll have a full example to copy-paste and tweak.

LFG! 🚀

Why Bother with Delta + Market Fallback?

Delta lets users sign intents for gasless trades where agents compete for the best fill – async and chill. But if Delta isn't available (e.g., tiny trade sizes where gas eats profits), it falls back to Market: user-paid gas for instant settlement. The SDK's mode: 'all' makes this automatic. No manual retries, just one unified quote system. Sweet, right?

Step 1: Install the SDK

Kick things off by adding the package to your project. Yarn or npm – your call.

yarn add @velora-dex/sdk

Or if you're npm gang:

npm install @velora-dex/sdk

Pro tip: The SDK plays nice with ethers, viem, or web3.js – no direct deps needed.

Step 2: Set Up Your Web3 Provider

Connect to the user's wallet and grab a signer. Here's the ethers version (adapt for viem/web3 if needed).

import { ethers } from 'ethers';
import axios from 'axios';
import { constructSimpleSDK } from '@velora-dex/sdk';

// Connect to user's wallet
const ethersProvider = new ethers.providers.Web3Provider(window.ethereum);
const accounts = await ethersProvider.listAccounts();
const account = accounts[0];
const signer = ethersProvider.getSigner(account);

This gets you the basics: provider, account, and signer.

Step 3: Initialize the SDK

Spin up the SDK instance. Use constructSimpleSDK for most dApps – it's the easiest.