# DeFi

## Currency info

> Returns a currency info for the specified network and address if it exists.

```json
{"openapi":"3.0.0","info":{"title":"Baltex Partner API","version":"1.0.0"},"servers":[{"url":"https://api.baltex.io"}],"security":[{"Partner access key":[]}],"components":{"securitySchemes":{"Partner access key":{"type":"apiKey","in":"header","name":"x-api-key"}},"schemas":{"DeFiCurrency":{"type":"object","properties":{"name":{"type":"string","description":"Full name of the token"},"address":{"type":"string","description":"Token contract address"},"decimals":{"type":"integer","description":"Number of decimal places for the token"},"symbol":{"type":"string","description":"Token symbol"},"network":{"type":"string","description":"Network ticker"},"enabled":{"type":"boolean","description":"Indicates if token is currently available for swaps"},"image":{"type":"string","description":"URL to the token icon"}}}},"responses":{"UnauthorizedError":{"description":"Unauthorized — missing or invalid API key","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"error":{"type":"string"},"statusCode":{"type":"integer"}}}}}}}},"paths":{"/v1/defi/currency/info":{"get":{"description":"Returns a currency info for the specified network and address if it exists.","operationId":"DexController_getCurrencyInfo_v1","parameters":[{"name":"network","required":true,"in":"query","description":"Network ticker (Currently available: eth, sol, sui, sei, arbitrum, base, bsc, cchain, celo, linea, matic, op, sonic, uni)","schema":{"type":"string"}},{"name":"address","required":true,"in":"query","description":"Token contract address","schema":{"type":"string"}}],"responses":{"200":{"description":"Currency information","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeFiCurrency"}}}},"401":{"$ref":"#/components/responses/UnauthorizedError"}},"summary":"Currency info","tags":["DeFi"]}}}}
```

## Available currencies

> Returns a list of available currencies for the specified network.

```json
{"openapi":"3.0.0","info":{"title":"Baltex Partner API","version":"1.0.0"},"servers":[{"url":"https://api.baltex.io"}],"security":[{"Partner access key":[]}],"components":{"securitySchemes":{"Partner access key":{"type":"apiKey","in":"header","name":"x-api-key"}},"schemas":{"DeFiCurrency":{"type":"object","properties":{"name":{"type":"string","description":"Full name of the token"},"address":{"type":"string","description":"Token contract address"},"decimals":{"type":"integer","description":"Number of decimal places for the token"},"symbol":{"type":"string","description":"Token symbol"},"network":{"type":"string","description":"Network ticker"},"enabled":{"type":"boolean","description":"Indicates if token is currently available for swaps"},"image":{"type":"string","description":"URL to the token icon"}}}},"responses":{"UnauthorizedError":{"description":"Unauthorized — missing or invalid API key","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"error":{"type":"string"},"statusCode":{"type":"integer"}}}}}}}},"paths":{"/v1/defi/available-currencies":{"get":{"description":"Returns a list of available currencies for the specified network.","operationId":"DexController_getAvailableCurrenciesList_v1","parameters":[{"name":"network","required":true,"in":"query","description":"Network ticker (Currently available: eth, sol, sui, sei, arbitrum, base, bsc, cchain, celo, linea, matic, op, sonic, uni)","schema":{"type":"string"}},{"name":"page","required":false,"in":"query","description":"Page number for pagination","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"Number of items per page","schema":{"type":"string"}}],"responses":{"200":{"description":"List of available currencies for DeFi","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/DeFiCurrency"}}}}},"401":{"$ref":"#/components/responses/UnauthorizedError"}},"summary":"Available currencies","tags":["DeFi"]}}}}
```

## Swap quote

> Returns a quote for swapping tokens on a specified network.

```json
{"openapi":"3.0.0","info":{"title":"Baltex Partner API","version":"1.0.0"},"servers":[{"url":"https://api.baltex.io"}],"security":[{"Partner access key":[]}],"components":{"securitySchemes":{"Partner access key":{"type":"apiKey","in":"header","name":"x-api-key"}},"schemas":{"SwapQuote":{"type":"object","properties":{"fromAmount":{"type":"string","description":"Amount to swap from"},"usdFromAmount":{"type":"string","description":"USD value of from amount"},"toAmount":{"type":"string","description":"Estimated amount to receive"},"usdToAmount":{"type":"string","description":"USD value of to amount"},"receivedAmount":{"type":"string","description":"Actual amount user will receive after fees"},"fee":{"type":"string","description":"Fee amount"},"routes":{"type":"array","items":{"$ref":"#/components/schemas/SwapRoute"},"description":"Swap routes with DEX details"},"priceImpact":{"type":"string","description":"Price impact percentage"}}},"SwapRoute":{"type":"object","properties":{"percentage":{"type":"number","description":"Percentage of total swap using this route"},"subRoutes":{"type":"array","items":{"$ref":"#/components/schemas/SwapSubRoute"},"description":"Individual steps in the swap route"}}},"SwapSubRoute":{"type":"object","properties":{"from":{"type":"string","description":"Source token address in this step"},"to":{"type":"string","description":"Target token address in this step"},"dexes":{"type":"array","items":{"$ref":"#/components/schemas/SwapDexInfo"},"description":"DEXes used in this swap step"}}},"SwapDexInfo":{"type":"object","properties":{"name":{"type":"string","description":"DEX name"},"address":{"type":"string","description":"DEX contract address"},"fee":{"type":"number","description":"DEX fee percentage"},"percentage":{"type":"number","description":"Percentage of swap going through this DEX"}}}},"responses":{"UnauthorizedError":{"description":"Unauthorized — missing or invalid API key","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"error":{"type":"string"},"statusCode":{"type":"integer"}}}}}}}},"paths":{"/v1/defi/quote":{"get":{"description":"Returns a quote for swapping tokens on a specified network.","operationId":"DexController_getQuote_v1","parameters":[{"name":"network","required":true,"in":"query","description":"Network name (Currently available: eth, sol, sui, sei, arbitrum, base, bsc, cchain, celo, linea, matic, op, sonic, uni)","schema":{"type":"string"}},{"name":"fromTokenAddress","required":true,"in":"query","description":"Source token contract address","schema":{"type":"string"}},{"name":"toTokenAddress","required":true,"in":"query","description":"Target token contract address","schema":{"type":"string"}},{"name":"amount","required":true,"in":"query","description":"Amount to swap","schema":{"type":"string"}},{"name":"slippage","required":true,"in":"query","description":"Allowed slippage in percent","schema":{"type":"string"}},{"name":"referrerFee","required":true,"in":"query","description":"Referrer fee in percent","schema":{"type":"string"}}],"responses":{"200":{"description":"Swap quote","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SwapQuote"}}}},"401":{"$ref":"#/components/responses/UnauthorizedError"}},"summary":"Swap quote","tags":["DeFi"]}}}}
```

## List of exchanges

> Returns all DEX exchanges for partner from the last 24 hours with optional filters.

```json
{"openapi":"3.0.0","info":{"title":"Baltex Partner API","version":"1.0.0"},"servers":[{"url":"https://api.baltex.io"}],"security":[{"Partner access key":[]}],"components":{"securitySchemes":{"Partner access key":{"type":"apiKey","in":"header","name":"x-api-key"}},"schemas":{"DexExchangeList":{"type":"object","properties":{"total":{"type":"integer","description":"Total number of exchanges"},"exchanges":{"type":"array","items":{"$ref":"#/components/schemas/DexExchange"},"description":"Array of DEX exchanges"}}},"DexExchange":{"type":"object","properties":{"id":{"type":"string","description":"Unique exchange identifier"},"created":{"type":"string","format":"date-time","description":"Exchange creation timestamp"},"updated":{"type":"string","format":"date-time","description":"Exchange last update timestamp"},"network":{"type":"string","description":"Network where exchange occurred"},"fromTokenAddress":{"type":"string","description":"Source token contract address"},"toTokenAddress":{"type":"string","description":"Target token contract address"},"amountFrom":{"type":"string","description":"Amount sent"},"amountTo":{"type":"string","description":"Amount received"},"addressFrom":{"type":"string","description":"Sender wallet address"},"addressTo":{"type":"string","nullable":true,"description":"Recipient wallet address"},"commissionPercentage":{"type":"string","description":"Commission percentage"},"status":{"type":"string","enum":["pending","confirming","finished","failed"],"description":"Exchange status"},"hash":{"type":"string","description":"Transaction hash"}}}},"responses":{"UnauthorizedError":{"description":"Unauthorized — missing or invalid API key","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"error":{"type":"string"},"statusCode":{"type":"integer"}}}}}}}},"paths":{"/v1/defi/exchange/list":{"get":{"description":"Returns all DEX exchanges for partner from the last 24 hours with optional filters.","operationId":"DexController_getPartnerDexExchanges_v1","parameters":[{"name":"status","required":false,"in":"query","description":"Filter by exchange status","schema":{"type":"string"}},{"name":"fromTokenAddress","required":false,"in":"query","description":"Filter by source token address","schema":{"type":"string"}},{"name":"toTokenAddress","required":false,"in":"query","description":"Filter by target token address","schema":{"type":"string"}},{"name":"network","required":false,"in":"query","description":"Filter by network","schema":{"type":"string"}}],"responses":{"200":{"description":"List of DEX exchanges","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DexExchangeList"}}}},"401":{"$ref":"#/components/responses/UnauthorizedError"}},"summary":"List of exchanges","tags":["DeFi"]}}}}
```

## Swap tokens

> Build a transaction hash from the provided data and returns it to sign.

```json
{"openapi":"3.0.0","info":{"title":"Baltex Partner API","version":"1.0.0"},"servers":[{"url":"https://api.baltex.io"}],"security":[{"Partner access key":[]}],"components":{"securitySchemes":{"Partner access key":{"type":"apiKey","in":"header","name":"x-api-key"}},"schemas":{"SwapDexTransactionDto":{"type":"object","properties":{"account":{"type":"string","description":"Sender address"},"fromTokenAddress":{"type":"string","description":"Source token contract address"},"toTokenAddress":{"type":"string","description":"Target token contract address"},"amount":{"type":"string","description":"Amount to swap"},"slippage":{"type":"string","description":"Allowed slippage"},"referrerFee":{"type":"string","description":"Referrer fee"},"network":{"type":"string","description":"Network name (Currently available: eth, sol, sui, sei, arbitrum, base, bsc, cchain, celo, linea, matic, op, sonic, uni)"}},"required":["account","fromTokenAddress","toTokenAddress","amount","slippage","referrerFee","network"]}},"responses":{"UnauthorizedError":{"description":"Unauthorized — missing or invalid API key","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"error":{"type":"string"},"statusCode":{"type":"integer"}}}}}}}},"paths":{"/v1/defi/transaction/swap":{"post":{"description":"Build a transaction hash from the provided data and returns it to sign.","operationId":"DexController_swapTransaction_v1","parameters":[],"requestBody":{"required":true,"description":"Swap transaction data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SwapDexTransactionDto"}}}},"responses":{"201":{"description":"Transaction hash(es) created","content":{"application/json":{"schema":{"oneOf":[{"type":"array","items":{"type":"string"},"minItems":1,"maxItems":1,"description":"Array containing swap raw transaction hash only (approval not required)"},{"type":"array","items":{"type":"string"},"minItems":2,"maxItems":2,"description":"Array containing approval (1st string) and swap transaction (2nd string) raw transactions"}]}}}},"401":{"$ref":"#/components/responses/UnauthorizedError"}},"summary":"Swap tokens","tags":["DeFi"]}}}}
```

## Send approve transaction

> Broadcasts the client-signed transaction hash to the network to approve token spending.

```json
{"openapi":"3.0.0","info":{"title":"Baltex Partner API","version":"1.0.0"},"servers":[{"url":"https://api.baltex.io"}],"security":[{"Partner access key":[]}],"components":{"securitySchemes":{"Partner access key":{"type":"apiKey","in":"header","name":"x-api-key"}},"schemas":{"SendDexApproveTransactionDto":{"type":"object","properties":{"network":{"type":"string","description":"Network name"},"rawApproveTx":{"type":"string","description":"Raw approve transaction"}},"required":["network","rawApproveTx"]}},"responses":{"UnauthorizedError":{"description":"Unauthorized — missing or invalid API key","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"error":{"type":"string"},"statusCode":{"type":"integer"}}}}}}}},"paths":{"/v1/defi/send/approve":{"post":{"description":"Broadcasts the client-signed transaction hash to the network to approve token spending.","operationId":"DexController_sendApproveTransaction_v1","parameters":[],"requestBody":{"required":true,"description":"Approve transaction data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendDexApproveTransactionDto"}}}},"responses":{"201":{"description":"Approve transaction sent successfully","content":{"application/json":{"schema":{"type":"string","description":"Transaction hash"}}}},"401":{"$ref":"#/components/responses/UnauthorizedError"}},"summary":"Send approve transaction","tags":["DeFi"]}}}}
```

## Send transaction

> Broadcasts the client-signed transaction hash to the network to execute the swap.

```json
{"openapi":"3.0.0","info":{"title":"Baltex Partner API","version":"1.0.0"},"servers":[{"url":"https://api.baltex.io"}],"security":[{"Partner access key":[]}],"components":{"securitySchemes":{"Partner access key":{"type":"apiKey","in":"header","name":"x-api-key"}},"schemas":{"SendDexTransactionDto":{"type":"object","properties":{"account":{"type":"string","description":"Receiver address"},"amountFrom":{"type":"string","description":"Amount sent from sender"},"amountTo":{"type":"string","description":"Amount to be received"},"fromTokenAddress":{"type":"string","description":"Source token contract address"},"toTokenAddress":{"type":"string","description":"Target token contract address"},"network":{"type":"string","description":"Network name (Currently available: eth, sol, sui, sei, arbitrum, base, bsc, cchain, celo, linea, matic, op, sonic, uni)"},"commissionPercentage":{"type":"string","description":"Commission percentage"},"rawTx":{"type":"string","description":"Raw transaction data"},"hash":{"type":"string","description":"Transaction hash"},"to":{"type":"string","description":"Recipient address (again, for compatibility)"},"isExchange":{"type":"boolean","description":"If it is an approve transaction or any other transaction other than a swap, the flag must be false."}},"required":["account","amountFrom","amountTo","fromTokenAddress","toTokenAddress","network","commissionPercentage"]}},"responses":{"UnauthorizedError":{"description":"Unauthorized — missing or invalid API key","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"error":{"type":"string"},"statusCode":{"type":"integer"}}}}}}}},"paths":{"/v1/defi/send/swap":{"post":{"description":"Broadcasts the client-signed transaction hash to the network to execute the swap.","operationId":"DexController_sendTransaction_v1","parameters":[],"requestBody":{"required":true,"description":"Transaction data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendDexTransactionDto"}}}},"responses":{"201":{"description":"Transaction sent successfully","content":{"application/json":{"schema":{"type":"string","description":"Transaction hash"}}}},"401":{"$ref":"#/components/responses/UnauthorizedError"}},"summary":"Send transaction","tags":["DeFi"]}}}}
```
