Skip to content

Commit

Permalink
refactor: check for fiat-to-fiat swaps
Browse files Browse the repository at this point in the history
  • Loading branch information
onmax committed Oct 24, 2024
1 parent 02ec1a9 commit c5a352b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/request/sign-swap/SignSwapApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ class SignSwapApi extends PolygonRequestParserMixin(BitcoinRequestParserMixin(To
throw new Errors.InvalidRequestError('Swap must be between two different currencies');
}

const swapToFiat = request.redeem.type === 'EUR' || request.redeem.type === 'CRC';
const swapFromFiat = request.fund.type === 'EUR' || request.fund.type === 'CRC';
if (swapToFiat && swapFromFiat) {
throw new Errors.InvalidRequestError('Swaps between fiat currencies are not supported');
}

if (request.fund.type === 'NIM') {
parsedRequest.fund = {
type: 'NIM',
Expand Down

0 comments on commit c5a352b

Please sign in to comment.