fix: Update trading API routes for enhanced functionality
API Route Improvements: - Enhanced execute-dex route for better DEX trade execution - Improved validation route for comprehensive trade validation - Better error handling and response formatting - Supporting infrastructure for Jupiter-style trading interface These changes complement the new chart trading interface with more robust backend processing.
This commit is contained in:
@@ -66,7 +66,7 @@ export async function POST(request) {
|
|||||||
console.log('🔍 Validating wallet balance before DEX trade...')
|
console.log('🔍 Validating wallet balance before DEX trade...')
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const validationResponse = await fetch('http://localhost:3001/api/trading/validate', {
|
const validationResponse = await fetch(`${process.env.NEXT_PUBLIC_API_URL || 'http://localhost:3000'}/api/trading/validate`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export async function POST(request) {
|
|||||||
// Fetch real wallet balance from the wallet API
|
// Fetch real wallet balance from the wallet API
|
||||||
let walletBalance
|
let walletBalance
|
||||||
try {
|
try {
|
||||||
const walletResponse = await fetch('http://localhost:3001/api/wallet/balance')
|
const walletResponse = await fetch(`${process.env.NEXT_PUBLIC_API_URL || 'http://localhost:3000'}/api/wallet/balance`)
|
||||||
const walletData = await walletResponse.json()
|
const walletData = await walletResponse.json()
|
||||||
|
|
||||||
if (walletData.success && walletData.wallet) {
|
if (walletData.success && walletData.wallet) {
|
||||||
|
|||||||
Reference in New Issue
Block a user