Skip to main content
This guide will walk you through setting up @sodax/sdk in a Next.js project, from project creation to using the SDK features.

Prerequisites

  • Node.js 18+ installed
  • npm, yarn, or pnpm package manager
  • Basic knowledge of Next.js and TypeScript

Step 1: Create Your Project

First, create a new Next.js project with TypeScript:
Navigate to your project directory:

Step 2: Install @sodax/sdk

Install the SODAX SDK and its peer dependencies:

Step 3: Create Sodax Instance

Create a Sodax instance provider. Create providers/SodaxProvider.tsx:
Update your app/layout.tsx to include the SodaxProvider:

Step 4: Start Your Build Process

Start the development server:
Your Next.js application should now be running on http://localhost:3000.

Step 5: Start Using @sodax/sdk

Now you can use the SODAX SDK in your components. Here’s an example of how to use it:

TypeScript Configuration

Make sure your tsconfig.json includes the necessary paths for the @ alias:

Next Steps

Now that you have @sodax/sdk set up in your Next.js project, you can:
  1. Explore Solver Features: Check out the Swaps documentation for cross-chain swaps
  2. Explore Money Market Features: Check out the Money Market documentation for lending and borrowing
  3. Set up Wallet Integration: Implement wallet providers for the chains you want to support
  4. Add Error Handling: Implement proper error handling for SDK operations
  5. Add Loading States: Add loading indicators for async operations

Troubleshooting

Common Issues

  1. TypeScript Errors: Make sure you have the latest version of TypeScript and that your tsconfig.json is properly configured.
  2. Import Errors: Ensure all imports are using the correct paths and that the packages are properly installed.

Getting Help

If you encounter any issues: