@@ -283,7 +283,7 @@ router.post('/', rotationLockMiddleware(), payloadSizeLimiter(ENDPOINT_LIMITS.si
283283 return await processCustodialDonation ( req , res , next ) ;
284284 }
285285
286- const { amount, currency, donor, recipient, memo, memoType, notes, tags, encryptMemo, anonymous, sourceAsset, sourceAmount } = req . body ;
286+ const { amount, currency, donor, recipient, memo, memoType, notes, tags, encryptMemo, anonymous, sourceAsset, sourceAmount, sendAsset , receiveAsset , slippageTolerance } = req . body ;
287287
288288 if ( ! amount || ! recipient ) {
289289 throw new ValidationError ( 'Missing required fields: amount, recipient' , null , ERROR_CODES . MISSING_REQUIRED_FIELD ) ;
@@ -314,6 +314,32 @@ router.post('/', rotationLockMiddleware(), payloadSizeLimiter(ENDPOINT_LIMITS.si
314314 }
315315 }
316316
317+ let normalizedSendAsset = null ;
318+ let normalizedReceiveAsset = null ;
319+ let normalizedSlippageTolerance = null ;
320+ if ( sendAsset || receiveAsset ) {
321+ if ( ! sendAsset || ! receiveAsset ) {
322+ return res . status ( 400 ) . json ( {
323+ success : false ,
324+ error : { code : 'VALIDATION_ERROR' , message : 'Both sendAsset and receiveAsset must be provided for cross-asset donations' }
325+ } ) ;
326+ }
327+ normalizedSendAsset = parseAssetInput ( sendAsset , 'sendAsset' ) ;
328+ normalizedReceiveAsset = parseAssetInput ( receiveAsset , 'receiveAsset' ) ;
329+
330+ if ( slippageTolerance !== undefined && slippageTolerance !== null ) {
331+ if ( typeof slippageTolerance !== 'number' || slippageTolerance < 0 || slippageTolerance > 1 ) {
332+ return res . status ( 400 ) . json ( {
333+ success : false ,
334+ error : { code : 'VALIDATION_ERROR' , message : 'slippageTolerance must be a number between 0 and 1' }
335+ } ) ;
336+ }
337+ normalizedSlippageTolerance = slippageTolerance ;
338+ } else {
339+ normalizedSlippageTolerance = 0.01 ;
340+ }
341+ }
342+
317343 if ( memo || memoType ) {
318344 const memoValidator = require ( '../../utils/memoValidator' ) ;
319345 const memoValidation = memoValidator . validateWithType ( memo || '' , memoType || 'text' ) ;
@@ -357,6 +383,9 @@ router.post('/', rotationLockMiddleware(), payloadSizeLimiter(ENDPOINT_LIMITS.si
357383 memo,
358384 sourceAsset : normalizedSourceAsset ,
359385 sourceAmount : sourceAmountValidation ? sourceAmountValidation . value : undefined ,
386+ sendAsset : normalizedSendAsset ,
387+ receiveAsset : normalizedReceiveAsset ,
388+ slippageTolerance : normalizedSlippageTolerance ,
360389 memoType : memoType || 'text' ,
361390 notes,
362391 tags,
0 commit comments