# Table of Contents - [DexHunter Partners | DexHunter Partners](#dexhunter-partners-dexhunter-partners) - [Introduction | DexHunter Partners](#introduction-dexhunter-partners) - [API Documentation | DexHunter Partners](#api-documentation-dexhunter-partners) - [Swap Customizations | DexHunter Partners](#swap-customizations-dexhunter-partners) - [DexHunter API | DexHunter Partners](#dexhunter-api-dexhunter-partners) - [Swap Integration | DexHunter Partners](#swap-integration-dexhunter-partners) - [API Examples | DexHunter Partners](#api-examples-dexhunter-partners) - [Advanced Nodes | DexHunter Partners](#advanced-nodes-dexhunter-partners) - [Planned Utility | DexHunter Partners](#planned-utility-dexhunter-partners) - [DexHunter Swap React Library | DexHunter Partners](#dexhunter-swap-react-library-dexhunter-partners) - [Dashboard | DexHunter Partners](#dashboard-dexhunter-partners) - [Embedded Swaps | DexHunter Partners](#embedded-swaps-dexhunter-partners) - [Buybacks & Burn | DexHunter Partners](#buybacks-burn-dexhunter-partners) - [API Documentation | DexHunter Partners](#api-documentation-dexhunter-partners) - [Swap Integration | DexHunter Partners](#swap-integration-dexhunter-partners) - [Buybacks & Burn | DexHunter Partners](#buybacks-burn-dexhunter-partners) --- # DexHunter Partners | DexHunter Partners DexHunter partner program helps projects integrate our advanced trading features with a customizable interface and fees. With our partners' program, you don't have to worry about handling any of the swap infrastructure and can focus on building your own products, we handle everything for you. Let's see how easy is to setup and integrate DexHunter into your app [NextIntroduction](https://dexhunter.gitbook.io/dexhunter-partners/introduction) Last updated 7 months ago --- # Introduction | DexHunter Partners 1. Please go to [https://app.dexhunter.io/partners](https://app.dexhunter.io/partners) 2. There you will be presented with the following page: ![](https://dexhunter.gitbook.io/dexhunter-partners/~gitbook/image?url=https%3A%2F%2F1498457622-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fv37xZ5NdkW7bg9xkKhi2%252Fuploads%252FfTEtK8ErVaNC5Q0TABfY%252FScreenshot%25202023-10-24%2520at%252013.14.45.png%3Falt%3Dmedia%26token%3De74241ef-4116-462d-82e7-5e94c58040e7&width=300&dpr=4&quality=100&sign=34aea70e&sv=2) To create a partner you need to do the following: * Connect wallet - this wallet will be used to the % split from swaps * Company name - a unique partner name that will be used to identify your specific integration * Percentage fee - the amount of custom fees you'd like the swap element to have 1. Clicking "Create Partner" will generate a specific name and code for the integration, you can create many different partners and codes per your use cases. 2. About the profit split please refer to DexHunter Plans. [PreviousDexHunter Partners](https://dexhunter.gitbook.io/dexhunter-partners) [NextAPI Documentation](https://dexhunter.gitbook.io/dexhunter-partners/api-documentation/api-documentation) Last updated 1 year ago --- # API Documentation | DexHunter Partners **\[NOTE\] On all requests you must provide X-Partner-Id with the Api Key generated on https://app.dexhunter.io/partners -> Dashboard Tab** **\[NOTE\] Base API URL:** [**https://api-us.dexhunterv3.app**](https://api-us.dexhunterv3.app/) **1\. Token List (Verified and Unverified Tokens)** Fetches a list of verified or unverified tokens based on search criteria. **Endpoint:** `**GET /swap/tokens**` * **Parameters**: * `query`: The search input string for token filtering. * `verified`: Boolean to specify whether to fetch verified (`true`) or unverified (`false`) tokens. **Example Request:** Copy GET /swap/tokens?query=name&verified=true **Response:** Copy [\ {\ "token_id": "279c909f348e533da5808898f87f9a14bb2c3dfbbacccd631d927a3f534e454b",\ "ticker": "ADA",\ "token_ascii": "Cardano",\ "is_verified": true\ },\ {\ "token_id": "f87f9a14bb2c3dfbbacccd631d927a3f5",\ "ticker": "TEST",\ "token_ascii": "Test Token",\ "is_verified": false\ }\ ] * * * **2\. Pools (Liquidity Pool Information)** Fetches liquidity pool data for a given token pair. **Endpoint:** `**GET /stats/pools/{tokenIdSell}/{tokenIdBuy}**` * **Parameters**: * `tokenIdSell`: The ID of the token being sold. * `tokenIdBuy`: The ID of the token being purchased. **Example Request:** Copy httpCopy codeGET /stats/pools/ADA/279c909f348e533da5808898f87f9a14bb2c3dfbbacccd631d927a3f534e454b **Response:** Copy { "pool_id": "pool1xyz...", "token_in": "ADA", "token_out": "USDT", "liquidity": { "total_in": 100000, "total_out": 95000 }, "pool_fee": 0.003, "price": 1.05 } * * * **3\. Token Information** Fetches details for a specific token, including verification status and metadata. **Endpoint:** `**GET /swap/token/{tokenId}**` * **Parameters**: * `tokenId`: The unique ID of the token. **Example Request:** Copy GET /swap/token/279c909f348e533da5808898f87f9a14bb2c3dfbbacccd631d927a3f534e454b **Response:** Copy { "token_id": "279c909f348e533da5808898f87f9a14bb2c3dfbbacccd631d927a3f534e454b", "ticker": "ADA", "token_ascii": "Cardano", "is_verified": true, "total_supply": 45000000000, "decimals": 6 } **Error Handling:** * If a token is not found, a fallback mechanism will attempt to parse the token details from the ID: Copy { "token_id": "unverified_token_id", "token_policy": "policy_id_part_of_token_id", "token_ascii": "Parsed ASCII", "is_verified": false, "ticker": "Parsed Ticker" } #### [](https://dexhunter.gitbook.io/dexhunter-partners/api-documentation/api-documentation#id-4.-estimation-of-swap-order) **4\. Estimation of Swap Order** The **estimate** API call is used to estimate the swap details for a specific trade. It provides details such as the input and output amounts, possible routes, and bonus outputs, based on the provided sell or buy amounts. **Request: Estimate Swap** **Endpoint:** `POST /estimate` **Payload:** Copy { "amount_in": 1000, // Amount being sold "token_in": "token_id_for_selling", // ID of the token being sold "token_out": "token_id_for_buying", // ID of the token being bought "slippage": 0.5, // Slippage tolerance "blacklisted_dexes": ["DEX1", "DEX2"] // List of blacklisted DEXes } **Response:** Copy { "total_input_without_slippage": 1000, "total_output_without_slippage": 950, "possible_routes": [...], // Array of potential swap routes "bonus_output": "+5 ADA" // Bonus output for the swap } **Description:** * `amount_in`: The amount you are selling (in base units). * `token_in`: The token being sold (its ID). * `token_out`: The token you want to buy (its ID). * `slippage`: The acceptable slippage for the transaction. * `blacklisted_dexes`: A list of DEXes to avoid during the trade. * **Response Fields**: * `total_input_without_slippage`: The total amount of tokens being sold without considering slippage. * `total_output_without_slippage`: The estimated amount of tokens you will receive without considering slippage. * `possible_routes`: Potential routes for the trade. * `bonus_output`: The bonus output, if applicable. * * * #### [](https://dexhunter.gitbook.io/dexhunter-partners/api-documentation/api-documentation#id-5.-estimation-of-price-average-price) **5\. Estimation of Price (Average Price)** The **averagePrice** API call is used to fetch the average exchange rate for a given token pair. **Request: Average Price for Token Pair** **Endpoint:** `GET /swap/averagePrice/{sellTokenId}/{buyTokenId}` **Example Request:** Copy GET /swap/averagePrice/ADA/279c909f348e533da5808898f87f9a14bb2c3dfbbacccd631d927a3f534e454b **Response:** Copy { "price_ba": 1.234, // 1 Token = X ADA "price_ab": 1.2 // 1 ADA = x Token } **Description:** * **Request Path Variables**: * `sellTokenId`: The ID of the token you are selling (e.g., `ADA`). * `buyTokenId`: The ID of the token you want to buy (e.g., `USDT`). * **Response Fields**: * `price_ba`: The average price for the given token pair, in base units (1 Token = X ADA) * `price_ab`: A secondary price representation (1 ADA = x Token) * * * #### [](https://dexhunter.gitbook.io/dexhunter-partners/api-documentation/api-documentation#id-6.-swap-operation-submit-a-swap) **6\. Swap Operation (Submit a Swap)** The **swap** operation involves submitting a swap request where tokens are exchanged, and the transaction is signed and submitted. **Request: Initiate Swap** **Endpoint:** `POST /swap/build` **Payload:** Copy { "buyer_address": "user_address", // The address of the user initiating the swap "token_in": "token_id_for_selling", // ID of the token being sold "token_out": "token_id_for_buying", // ID of the token being bought "slippage": 0.5, // Slippage tolerance "amount_in": 1000, // Amount being sold "tx_optimization": true, // Whether to optimize for multiple DEXes "blacklisted_dexes": ["DEX1", "DEX2"] // List of blacklisted DEXes } **Response:** Copy { "cbor": "transaction_cbor_data", // The CBOR encoded transaction data "status": "pending" // The status of the swap } **Description:** * `buyer_address`: The address of the user making the purchase. * `token_in`: The token being sold. * `token_out`: The token being purchased. * `slippage`: The maximum slippage allowed for the transaction. * `amount_in`: The amount of tokens being sold. * `tx_optimization`: Whether to optimize the transaction across multiple DEXes. * `blacklisted_dexes`: A list of DEXes to avoid. * **Response Fields**: * `cbor`: The CBOR-encoded transaction data, which will be signed. * `status`: The initial status of the swap transaction. * * * **Request: Sign the Transaction** Once the swap request has been created, it needs to be signed using the wallet API. **Endpoint:** `POST /swap/sign` **Payload:** Copy { "txCbor": "transaction_cbor_data", // The CBOR transaction data to be signed "signatures": ["signature_1", "signature_2"] // List of signatures } **Response:** Copy { "cbor": "signed_cbor_data", // The signed transaction data "strat_id": "strategy_id" // The strategy ID for this transaction, if applicable } * * * **Request: Submit the Signed Transaction** After the transaction is signed, it can be submitted to the blockchain. **User submits tx themselves either via wallet api or library api** **Example:** Copy ```typescript const tx = await api.submitTx(sign.cbor); ``` **Where api is cip30 wallet** * * * #### [](https://dexhunter.gitbook.io/dexhunter-partners/api-documentation/api-documentation#sample-flow-of-swap-operation) **Sample Flow of Swap Operation** 1. **Initiate Swap**: First, initiate the swap by sending a `POST` request to `/swap` with the appropriate payload. 2. **Sign Transaction**: Next, sign the transaction by sending a `POST` request to `/swap/sign` with the transaction's CBOR data and signatures. 3. **Submit Transaction**: Finally, submit the signed transaction using the `wallet submit api or your own node/infrastructure provider.` * * * #### [](https://dexhunter.gitbook.io/dexhunter-partners/api-documentation/api-documentation#error-handling) **Error Handling** If the estimation or swap operation encounters an error, the system will respond with appropriate error messages such as: * **Not Enough Liquidity**: When there's not enough liquidity to perform the swap. * **Pool Out of Sync**: When the liquidity pool data is not in sync. * **Input Too Small**: When the input amount is too small to be processed. * * * #### [](https://dexhunter.gitbook.io/dexhunter-partners/api-documentation/api-documentation#dex-blacklist-example) **DEX Blacklist Example** The **DEX Blacklist** is used to avoid certain decentralized exchanges (DEXes) during the swap operation. Here is an example of the DEX blacklist array that can be included in the payload when making a swap request: **DEX Blacklist Array** Copy [\ "SUNDAESWAPV3",\ "SPLASH",\ "MINSWAPV2",\ "MINSWAP",\ "AXO",\ "WINGRIDER",\ "WINGRIDERV2",\ "SNEKFUN",\ "SPECTRUM",\ "SUNDAESWAP",\ "VYFI",\ "MUESLISWAP"\ ] This array represents a list of DEXes that should be avoided during the swap transaction. * * * #### [](https://dexhunter.gitbook.io/dexhunter-partners/api-documentation/api-documentation#code-snippet-for-swap-action-tx-building-signing-and-submission) **Code Snippet for Swap Action (Tx Building, Signing, and Submission)** Here’s an example of how to build the full transaction for the swap action, including signing and submitting the transaction using the `api.signTx` and `api.submitTx` methods. **1\. Build Swap Payload** Copy const buildSwapPayload = () => { const swapPayload = { buyer_address: userAddress, // The buyer's address token_in: tokenSell?.token_id, // Token being sold token_out: tokenBuy?.token_id, // Token being bought slippage: adjustedSlippage, // The acceptable slippage for the swap amount_in: formatAmount(), // The amount to be swapped tx_optimization: isDexSplitting, // Whether to optimize the swap for multiple DEXes blacklisted_dexes: adjustedDexBlacklist, // The DEXes to be avoided during the swap }; return swapPayload; } **2\. Sending the Swap Request to Server** Copy const sendSwapRequest = async (swapPayload) => { try { const { data: swap } = await server.post(routingMapping.swap, swapPayload); return swap; // Response containing CBOR transaction data } catch (err) { console.error("Error sending swap request:", err); throw new Error("Error sending swap request"); } } **3\. Signing the Transaction** Copy const signTransaction = async (swap) => { try { const signatures = await api?.signTx(swap?.cbor, true); // Signing the transaction return signatures; } catch (err) { console.error("Error signing transaction:", err); throw new Error("Error signing transaction"); } } **4\. Submitting the Signed Transaction** Copy const submitTransaction = async (signatures, swap) => { try { const { data: sign } = await server.post(`/swap/sign`, { txCbor: swap?.cbor, // The transaction CBOR data signatures, // The signatures for the transaction }); // Submit the signed transaction const tx = await api?.submitTx(sign?.cbor); return tx; // The transaction hash after submission } catch (err) { console.error("Error submitting transaction:", err); throw new Error("Error submitting transaction"); } } **5\. Full Swap Flow:** Copy const executeSwap = async () => { const swapPayload = buildSwapPayload(); // Step 1: Build the payload const swap = await sendSwapRequest(swapPayload); // Step 2: Send the swap request to the server const signatures = await signTransaction(swap); // Step 3: Sign the transaction const tx = await submitTransaction(signatures, swap); // Step 4: Submit the signed transaction // You can now handle the transaction result (e.g., showing a success message) console.log("Swap transaction successful with tx hash:", tx); }; * * * #### [](https://dexhunter.gitbook.io/dexhunter-partners/api-documentation/api-documentation#flow-explanation) **Flow Explanation:** 1. **Build the Swap Payload**: The `buildSwapPayload` function creates a payload with all the necessary data for the swap request, including the tokens involved, slippage, and blacklisted DEXes. 2. **Send Swap Request**: The `sendSwapRequest` function sends a request to the server to initiate the swap, returning the CBOR transaction data (`swap.cbor`). 3. **Sign Transaction**: The `signTransaction` function uses the `api.signTx` method to sign the transaction, ensuring it can be submitted on the blockchain. 4. **Submit Transaction**: The `submitTransaction` function sends the signed transaction data to the server, which submits it to the blockchain, and returns the transaction hash (`tx`). By following this flow, you can ensure that the swap operation is fully executed, from request creation to final transaction submission. [PreviousIntroduction](https://dexhunter.gitbook.io/dexhunter-partners/introduction) [NextAPI Examples](https://dexhunter.gitbook.io/dexhunter-partners/api-documentation/api-examples) Last updated 6 months ago --- # Swap Customizations | DexHunter Partners To customize the feel and look of the swap you can add the following settings: Setting Required? Type Default Description defaultToken false string width false px|% height false px|% theme false dark|light dark orderTypes false array \['SWAP', 'LIMIT'\] supportedTokens false tokenId\[\] list of token id that you can search partnerName true string partnerCode true string colors false object Supported colors:`mainText` `subText` `background` `containers` `buttonText` `accent` className false string style false string Our npm package link for reference: [https://www.npmjs.com/package/@dexhunterio/swaps](https://www.npmjs.com/package/@dexhunterio/swaps) [PreviousSwap Integration](https://dexhunter.gitbook.io/dexhunter-partners/swap-widget/swap-integration) [NextDexHunter Swap React Library](https://dexhunter.gitbook.io/dexhunter-partners/swap-widget/dexhunter-swap-react-library) Last updated 7 months ago --- # DexHunter API | DexHunter Partners Our API docs are available [here](https://dhapi.io/swagger) , however for complex integrations it's best to contact our development team at suppport@dexhunter.io or in our [discord](https://discord.gg/invite/dexhunter) . [PreviousAPI Examples](https://dexhunter.gitbook.io/dexhunter-partners/api-documentation/api-examples) [NextSwap Integration](https://dexhunter.gitbook.io/dexhunter-partners/swap-widget/swap-integration) Last updated 7 months ago --- # Swap Integration | DexHunter Partners There are three ways to integrate our swaps: * Using our official [DexHunter swap react library](https://dexhunter.gitbook.io/dexhunter-partners/swap-widget/dexhunter-swap-react-library) (For React 19 users: please use library version 183 and higher, for React 18 and below 182 is the last supported version) * Embedding our swap on your page * For more complex apps and custom integrations, we offer [our API](https://dexhunter.gitbook.io/dexhunter-partners/api-documentation/dexhunter-api) [PreviousDexHunter API](https://dexhunter.gitbook.io/dexhunter-partners/api-documentation/dexhunter-api) [NextSwap Customizations](https://dexhunter.gitbook.io/dexhunter-partners/swap-widget/swap-customizations) Last updated 6 months ago --- # API Examples | DexHunter Partners [](https://dexhunter.gitbook.io/dexhunter-partners/api-documentation/api-examples#sample-javascript-frontend-example) Sample JavaScript frontend example ------------------------------------------------------------------------------------------------------------------------------------------------------------- #### [](https://dexhunter.gitbook.io/dexhunter-partners/api-documentation/api-examples#code-snippet-for-swap-action-tx-building-signing-and-submission) **Code Snippet for Swap Action (Tx Building, Signing, and Submission)** Here’s an example of how to build the full transaction for the swap action, including signing and submitting the transaction using the `api.signTx` and `api.submitTx` methods. **1\. Build Swap Payload** Copy const buildSwapPayload = () => { const swapPayload = { buyer_address: userAddress, // The buyer's address token_in: tokenSell?.token_id, // Token being sold token_out: tokenBuy?.token_id, // Token being bought slippage: adjustedSlippage, // The acceptable slippage for the swap amount_in: formatAmount(), // The amount to be swapped tx_optimization: isDexSplitting, // Whether to optimize the swap for multiple DEXes blacklisted_dexes: adjustedDexBlacklist, // The DEXes to be avoided during the swap }; return swapPayload; } **2\. Sending the Swap Request to Server** Copy const sendSwapRequest = async (swapPayload) => { try { const { data: swap } = await server.post('/swap/build', swapPayload); return swap; // Response containing CBOR transaction data } catch (err) { console.error("Error sending swap request:", err); throw new Error("Error sending swap request"); } } **3\. Signing the Transaction** Copy const signTransaction = async (swap) => { try { const signatures = await api?.signTx(swap?.cbor, true); // Signing the transaction return signatures; } catch (err) { console.error("Error signing transaction:", err); throw new Error("Error signing transaction"); } } **4\. Submitting the Signed Transaction** Copy const submitTransaction = async (signatures, swap) => { try { const { data: sign } = await server.post(`/swap/sign`, { txCbor: swap?.cbor, // The transaction CBOR data signatures, // The signatures for the transaction }); // Submit the signed transaction const tx = await api?.submitTx(sign?.cbor); return tx; // The transaction hash after submission } catch (err) { console.error("Error submitting transaction:", err); throw new Error("Error submitting transaction"); } } **5\. Full Swap Flow:** Copy const executeSwap = async () => { const swapPayload = buildSwapPayload(); // Step 1: Build the payload const swap = await sendSwapRequest(swapPayload); // Step 2: Send the swap request to the server const signatures = await signTransaction(swap); // Step 3: Sign the transaction const tx = await submitTransaction(signatures, swap); // Step 4: Submit the signed transaction // You can now handle the transaction result (e.g., showing a success message) console.log("Swap transaction successful with tx hash:", tx); }; * * * [](https://dexhunter.gitbook.io/dexhunter-partners/api-documentation/api-examples#sample-python-script-to-swap) Sample Python script to swap ------------------------------------------------------------------------------------------------------------------------------------------------- [4KB\ \ sample.py](https://1498457622-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fv37xZ5NdkW7bg9xkKhi2%2Fuploads%2Fu4W0mMPRJ6XkcfC8OS3x%2Fsample.py?alt=media&token=d7b56f9f-a84c-49ec-83ad-c8db8911127e) More examples and languages are coming soon, if you urgently need one please request in our [discord](https://discord.gg/invite/dexhunter) . [PreviousAPI Documentation](https://dexhunter.gitbook.io/dexhunter-partners/api-documentation/api-documentation) [NextDexHunter API](https://dexhunter.gitbook.io/dexhunter-partners/api-documentation/dexhunter-api) Last updated 5 months ago --- # Advanced Nodes | DexHunter Partners DexHunter Nodes FAQ Q: How do you test node speed? A: We evaluate node speed at several layers, focusing on its performance during traffic surges, transaction delivery rates to Cardano node relays, and the speed of on-chain transactions under various conditions. This involves internal tests with transactions across different entry points and monitoring their confirmation speeds, especially with DexHunter nodes. Q: What statistical advantages does each speed level bring? A: Each level represents the number of node relays receiving the transaction, improving the transaction's chances of faster processing, especially when the chain is heavily loaded. For example, level 10 involves distribution to 20 node relays, enhancing speed and reliability. Q: Are there bonuses for delegating to a partner SPO? A: Yes, delegating to a partner SPO provides extra speed bonuses. Over 1K ADA delegations receive a +2 speed bonus, and those over 100K ADA get a +4 bonus. The bonus is added to your existing speed from HUNT holdings. A: Yes, delegating to a partner SPO provides extra speed bonuses. You get a speed boost from HUNT level (for example lvl 10 node gives speed boost of 20x). On top of that, for delegations between 1k and 100k ada you get an extra 2x speed boost, and for delegations above 100k you get an extra 4x speed boost. Some examples: If you hold no HUNT (lvl 1 node, with 2x speed boost) and delegate 25K ADA to a partner SPO (+2x speed boost), you will have 4x speed boost. If you hold 50K HUNT (lvl 10 node, with 20x speed boost) and delegate 50K ADA to a partner SPO (+4x speed boost), you will have 24x speed boost. Q: How does a speed boost work in real time? A: We maintain a real-time cache of all stake addresses with HUNT or those delegated to partner SPOs. This system allows us to apply speed boosts instantly based on the current status of each stake. [PreviousBuybacks & Burn](https://dexhunter.gitbook.io/dexhunter-partners/hunt-utility/buybacks-and-burn) [NextPlanned Utility](https://dexhunter.gitbook.io/dexhunter-partners/planned-utility) Last updated 1 month ago --- # Planned Utility | DexHunter Partners We are consistently discussing what makes sense given the circumstances and environment for the project, most of the discussions happen in DexHunter Discord: [https://discord.gg/f4hvFwGP](https://discord.gg/f4hvFwGP) Currently in the discussion/planning phase are: * Staking for the protocol revenue * DexHunter DAO for governance and voting * Swap discounts based on HUNT holdings This is not a final or guaranteed list, just something that had always been on our radar, here are many other utiltities possible and if you have a great suggestion we'd like to hear it in our discord. [PreviousAdvanced Nodes](https://dexhunter.gitbook.io/dexhunter-partners/advanced-nodes) Last updated 1 month ago --- # DexHunter Swap React Library | DexHunter Partners #### [](https://dexhunter.gitbook.io/dexhunter-partners/swap-widget/dexhunter-swap-react-library#library-official-link-dexhunter-swaps) Library official link: DexHunter Swaps #### [](https://dexhunter.gitbook.io/dexhunter-partners/swap-widget/dexhunter-swap-react-library#how-to-use-the-library) How to use the library * Install package: Copy npm i @dexhunterio/swaps * Import to your code: Copy import Swap from '@dexhunterio/swaps' import '@dexhunterio/swaps/lib/assets/style.css' * Use Swap Component: Copy * Refer to this list for available customizations [PreviousSwap Customizations](https://dexhunter.gitbook.io/dexhunter-partners/swap-widget/swap-customizations) [NextEmbedded Swaps](https://dexhunter.gitbook.io/dexhunter-partners/swap-widget/embedded-swaps) Last updated 7 months ago --- # Dashboard | DexHunter Partners The Partners dashboard is a simple display of how much volume, transactions, and fees your code has generated ![](https://dexhunter.gitbook.io/dexhunter-partners/~gitbook/image?url=https%3A%2F%2F1498457622-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fv37xZ5NdkW7bg9xkKhi2%252Fuploads%252FU4K1y0aU68VgOqYDmq39%252FScreenshot%25202023-10-17%2520at%252023.14.51.png%3Falt%3Dmedia%26token%3D05d8dd93-6448-43fd-8038-4b98e92f0342&width=300&dpr=4&quality=100&sign=2804e00b&sv=2) * Transactions - the amount of swaps done using your partner code * Volume - total ADA volume done using your partner code * Fees - total fees generated before the split using your partner code [PreviousEmbedded Swaps](https://dexhunter.gitbook.io/dexhunter-partners/swap-widget/embedded-swaps) [NextBuybacks & Burn](https://dexhunter.gitbook.io/dexhunter-partners/hunt-utility/buybacks-and-burn) Last updated 7 months ago --- # Embedded Swaps | DexHunter Partners If your app is not using react, the simplest thing for the integration is to use the ifram, docs for iframe usage are coming soon. [PreviousDexHunter Swap React Library](https://dexhunter.gitbook.io/dexhunter-partners/swap-widget/dexhunter-swap-react-library) [NextDashboard](https://dexhunter.gitbook.io/dexhunter-partners/swap-widget/dashboard) Last updated 7 months ago --- # Buybacks & Burn | DexHunter Partners Important buyback information: - 50% of DexHunter interface fees go to $dexhunter.dao to buy and burn HUNT - Buy and burn interval depends on volume, it can be daily, every other day or weekly - Currently not included in buybacks: partner, dca and boost fees as they go to cover project's expenses alongside the other half of interface fees Best place to monitor the buyback status is [https://www.taptools.io/pro/profiler?address=stake1u8u8alj84x8uyraqamup0n2vh5fqyea03vdkhnsmxkqt6lq20eccc](https://www.taptools.io/pro/profiler?address=stake1u8u8alj84x8uyraqamup0n2vh5fqyea03vdkhnsmxkqt6lq20eccc) Current buyback ratio is around 0.1% of total supply each 7-10 days, which is subject to change due to volume. [PreviousDashboard](https://dexhunter.gitbook.io/dexhunter-partners/swap-widget/dashboard) [NextAdvanced Nodes](https://dexhunter.gitbook.io/dexhunter-partners/advanced-nodes) Last updated 1 month ago --- # API Documentation | DexHunter Partners **\[NOTE\] On all requests you must provide X-Partner-Id with the Api Key generated on https://app.dexhunter.io/partners -> Dashboard Tab** **\[NOTE\] Base API URL:** [**https://api-us.dexhunterv3.app**](https://api-us.dexhunterv3.app/) **1\. Token List (Verified and Unverified Tokens)** Fetches a list of verified or unverified tokens based on search criteria. **Endpoint:** `**GET /swap/tokens**` * **Parameters**: * `query`: The search input string for token filtering. * `verified`: Boolean to specify whether to fetch verified (`true`) or unverified (`false`) tokens. **Example Request:** Copy GET /swap/tokens?query=name&verified=true **Response:** Copy [\ {\ "token_id": "279c909f348e533da5808898f87f9a14bb2c3dfbbacccd631d927a3f534e454b",\ "ticker": "ADA",\ "token_ascii": "Cardano",\ "is_verified": true\ },\ {\ "token_id": "f87f9a14bb2c3dfbbacccd631d927a3f5",\ "ticker": "TEST",\ "token_ascii": "Test Token",\ "is_verified": false\ }\ ] * * * **2\. Pools (Liquidity Pool Information)** Fetches liquidity pool data for a given token pair. **Endpoint:** `**GET /stats/pools/{tokenIdSell}/{tokenIdBuy}**` * **Parameters**: * `tokenIdSell`: The ID of the token being sold. * `tokenIdBuy`: The ID of the token being purchased. **Example Request:** Copy httpCopy codeGET /stats/pools/ADA/279c909f348e533da5808898f87f9a14bb2c3dfbbacccd631d927a3f534e454b **Response:** Copy { "pool_id": "pool1xyz...", "token_in": "ADA", "token_out": "USDT", "liquidity": { "total_in": 100000, "total_out": 95000 }, "pool_fee": 0.003, "price": 1.05 } * * * **3\. Token Information** Fetches details for a specific token, including verification status and metadata. **Endpoint:** `**GET /swap/token/{tokenId}**` * **Parameters**: * `tokenId`: The unique ID of the token. **Example Request:** Copy GET /swap/token/279c909f348e533da5808898f87f9a14bb2c3dfbbacccd631d927a3f534e454b **Response:** Copy { "token_id": "279c909f348e533da5808898f87f9a14bb2c3dfbbacccd631d927a3f534e454b", "ticker": "ADA", "token_ascii": "Cardano", "is_verified": true, "total_supply": 45000000000, "decimals": 6 } **Error Handling:** * If a token is not found, a fallback mechanism will attempt to parse the token details from the ID: Copy { "token_id": "unverified_token_id", "token_policy": "policy_id_part_of_token_id", "token_ascii": "Parsed ASCII", "is_verified": false, "ticker": "Parsed Ticker" } #### [](https://dexhunter.gitbook.io/dexhunter-partners/api-documentation#id-4.-estimation-of-swap-order) **4\. Estimation of Swap Order** The **estimate** API call is used to estimate the swap details for a specific trade. It provides details such as the input and output amounts, possible routes, and bonus outputs, based on the provided sell or buy amounts. **Request: Estimate Swap** **Endpoint:** `POST /estimate` **Payload:** Copy { "amount_in": 1000, // Amount being sold "token_in": "token_id_for_selling", // ID of the token being sold "token_out": "token_id_for_buying", // ID of the token being bought "slippage": 0.5, // Slippage tolerance "blacklisted_dexes": ["DEX1", "DEX2"] // List of blacklisted DEXes } **Response:** Copy { "total_input_without_slippage": 1000, "total_output_without_slippage": 950, "possible_routes": [...], // Array of potential swap routes "bonus_output": "+5 ADA" // Bonus output for the swap } **Description:** * `amount_in`: The amount you are selling (in base units). * `token_in`: The token being sold (its ID). * `token_out`: The token you want to buy (its ID). * `slippage`: The acceptable slippage for the transaction. * `blacklisted_dexes`: A list of DEXes to avoid during the trade. * **Response Fields**: * `total_input_without_slippage`: The total amount of tokens being sold without considering slippage. * `total_output_without_slippage`: The estimated amount of tokens you will receive without considering slippage. * `possible_routes`: Potential routes for the trade. * `bonus_output`: The bonus output, if applicable. * * * #### [](https://dexhunter.gitbook.io/dexhunter-partners/api-documentation#id-5.-estimation-of-price-average-price) **5\. Estimation of Price (Average Price)** The **averagePrice** API call is used to fetch the average exchange rate for a given token pair. **Request: Average Price for Token Pair** **Endpoint:** `GET /swap/averagePrice/{sellTokenId}/{buyTokenId}` **Example Request:** Copy GET /swap/averagePrice/ADA/279c909f348e533da5808898f87f9a14bb2c3dfbbacccd631d927a3f534e454b **Response:** Copy { "price_ba": 1.234, // 1 Token = X ADA "price_ab": 1.2 // 1 ADA = x Token } **Description:** * **Request Path Variables**: * `sellTokenId`: The ID of the token you are selling (e.g., `ADA`). * `buyTokenId`: The ID of the token you want to buy (e.g., `USDT`). * **Response Fields**: * `price_ba`: The average price for the given token pair, in base units (1 Token = X ADA) * `price_ab`: A secondary price representation (1 ADA = x Token) * * * #### [](https://dexhunter.gitbook.io/dexhunter-partners/api-documentation#id-6.-swap-operation-submit-a-swap) **6\. Swap Operation (Submit a Swap)** The **swap** operation involves submitting a swap request where tokens are exchanged, and the transaction is signed and submitted. **Request: Initiate Swap** **Endpoint:** `POST /swap/build` **Payload:** Copy { "buyer_address": "user_address", // The address of the user initiating the swap "token_in": "token_id_for_selling", // ID of the token being sold "token_out": "token_id_for_buying", // ID of the token being bought "slippage": 0.5, // Slippage tolerance "amount_in": 1000, // Amount being sold "tx_optimization": true, // Whether to optimize for multiple DEXes "blacklisted_dexes": ["DEX1", "DEX2"] // List of blacklisted DEXes } **Response:** Copy { "cbor": "transaction_cbor_data", // The CBOR encoded transaction data "status": "pending" // The status of the swap } **Description:** * `buyer_address`: The address of the user making the purchase. * `token_in`: The token being sold. * `token_out`: The token being purchased. * `slippage`: The maximum slippage allowed for the transaction. * `amount_in`: The amount of tokens being sold. * `tx_optimization`: Whether to optimize the transaction across multiple DEXes. * `blacklisted_dexes`: A list of DEXes to avoid. * **Response Fields**: * `cbor`: The CBOR-encoded transaction data, which will be signed. * `status`: The initial status of the swap transaction. * * * **Request: Sign the Transaction** Once the swap request has been created, it needs to be signed using the wallet API. **Endpoint:** `POST /swap/sign` **Payload:** Copy { "txCbor": "transaction_cbor_data", // The CBOR transaction data to be signed "signatures": ["signature_1", "signature_2"] // List of signatures } **Response:** Copy { "cbor": "signed_cbor_data", // The signed transaction data "strat_id": "strategy_id" // The strategy ID for this transaction, if applicable } * * * **Request: Submit the Signed Transaction** After the transaction is signed, it can be submitted to the blockchain. **User submits tx themselves either via wallet api or library api** **Example:** Copy ```typescript const tx = await api.submitTx(sign.cbor); ``` **Where api is cip30 wallet** * * * #### [](https://dexhunter.gitbook.io/dexhunter-partners/api-documentation#sample-flow-of-swap-operation) **Sample Flow of Swap Operation** 1. **Initiate Swap**: First, initiate the swap by sending a `POST` request to `/swap` with the appropriate payload. 2. **Sign Transaction**: Next, sign the transaction by sending a `POST` request to `/swap/sign` with the transaction's CBOR data and signatures. 3. **Submit Transaction**: Finally, submit the signed transaction using the `wallet submit api or your own node/infrastructure provider.` * * * #### [](https://dexhunter.gitbook.io/dexhunter-partners/api-documentation#error-handling) **Error Handling** If the estimation or swap operation encounters an error, the system will respond with appropriate error messages such as: * **Not Enough Liquidity**: When there's not enough liquidity to perform the swap. * **Pool Out of Sync**: When the liquidity pool data is not in sync. * **Input Too Small**: When the input amount is too small to be processed. * * * #### [](https://dexhunter.gitbook.io/dexhunter-partners/api-documentation#dex-blacklist-example) **DEX Blacklist Example** The **DEX Blacklist** is used to avoid certain decentralized exchanges (DEXes) during the swap operation. Here is an example of the DEX blacklist array that can be included in the payload when making a swap request: **DEX Blacklist Array** Copy [\ "SUNDAESWAPV3",\ "SPLASH",\ "MINSWAPV2",\ "MINSWAP",\ "AXO",\ "WINGRIDER",\ "WINGRIDERV2",\ "SNEKFUN",\ "SPECTRUM",\ "SUNDAESWAP",\ "VYFI",\ "MUESLISWAP"\ ] This array represents a list of DEXes that should be avoided during the swap transaction. * * * #### [](https://dexhunter.gitbook.io/dexhunter-partners/api-documentation#code-snippet-for-swap-action-tx-building-signing-and-submission) **Code Snippet for Swap Action (Tx Building, Signing, and Submission)** Here’s an example of how to build the full transaction for the swap action, including signing and submitting the transaction using the `api.signTx` and `api.submitTx` methods. **1\. Build Swap Payload** Copy const buildSwapPayload = () => { const swapPayload = { buyer_address: userAddress, // The buyer's address token_in: tokenSell?.token_id, // Token being sold token_out: tokenBuy?.token_id, // Token being bought slippage: adjustedSlippage, // The acceptable slippage for the swap amount_in: formatAmount(), // The amount to be swapped tx_optimization: isDexSplitting, // Whether to optimize the swap for multiple DEXes blacklisted_dexes: adjustedDexBlacklist, // The DEXes to be avoided during the swap }; return swapPayload; } **2\. Sending the Swap Request to Server** Copy const sendSwapRequest = async (swapPayload) => { try { const { data: swap } = await server.post(routingMapping.swap, swapPayload); return swap; // Response containing CBOR transaction data } catch (err) { console.error("Error sending swap request:", err); throw new Error("Error sending swap request"); } } **3\. Signing the Transaction** Copy const signTransaction = async (swap) => { try { const signatures = await api?.signTx(swap?.cbor, true); // Signing the transaction return signatures; } catch (err) { console.error("Error signing transaction:", err); throw new Error("Error signing transaction"); } } **4\. Submitting the Signed Transaction** Copy const submitTransaction = async (signatures, swap) => { try { const { data: sign } = await server.post(`/swap/sign`, { txCbor: swap?.cbor, // The transaction CBOR data signatures, // The signatures for the transaction }); // Submit the signed transaction const tx = await api?.submitTx(sign?.cbor); return tx; // The transaction hash after submission } catch (err) { console.error("Error submitting transaction:", err); throw new Error("Error submitting transaction"); } } **5\. Full Swap Flow:** Copy const executeSwap = async () => { const swapPayload = buildSwapPayload(); // Step 1: Build the payload const swap = await sendSwapRequest(swapPayload); // Step 2: Send the swap request to the server const signatures = await signTransaction(swap); // Step 3: Sign the transaction const tx = await submitTransaction(signatures, swap); // Step 4: Submit the signed transaction // You can now handle the transaction result (e.g., showing a success message) console.log("Swap transaction successful with tx hash:", tx); }; * * * #### [](https://dexhunter.gitbook.io/dexhunter-partners/api-documentation#flow-explanation) **Flow Explanation:** 1. **Build the Swap Payload**: The `buildSwapPayload` function creates a payload with all the necessary data for the swap request, including the tokens involved, slippage, and blacklisted DEXes. 2. **Send Swap Request**: The `sendSwapRequest` function sends a request to the server to initiate the swap, returning the CBOR transaction data (`swap.cbor`). 3. **Sign Transaction**: The `signTransaction` function uses the `api.signTx` method to sign the transaction, ensuring it can be submitted on the blockchain. 4. **Submit Transaction**: The `submitTransaction` function sends the signed transaction data to the server, which submits it to the blockchain, and returns the transaction hash (`tx`). By following this flow, you can ensure that the swap operation is fully executed, from request creation to final transaction submission. [PreviousIntroduction](https://dexhunter.gitbook.io/dexhunter-partners/introduction) [NextAPI Examples](https://dexhunter.gitbook.io/dexhunter-partners/api-documentation/api-examples) Last updated 6 months ago --- # Swap Integration | DexHunter Partners There are three ways to integrate our swaps: * Using our official [DexHunter swap react library](https://dexhunter.gitbook.io/dexhunter-partners/swap-widget/dexhunter-swap-react-library) (For React 19 users: please use library version 183 and higher, for React 18 and below 182 is the last supported version) * Embedding our swap on your page * For more complex apps and custom integrations, we offer [our API](https://dexhunter.gitbook.io/dexhunter-partners/api-documentation/dexhunter-api) [PreviousDexHunter API](https://dexhunter.gitbook.io/dexhunter-partners/api-documentation/dexhunter-api) [NextSwap Customizations](https://dexhunter.gitbook.io/dexhunter-partners/swap-widget/swap-customizations) Last updated 6 months ago --- # Buybacks & Burn | DexHunter Partners Important buyback information: - 50% of DexHunter interface fees go to $dexhunter.dao to buy and burn HUNT - Buy and burn interval depends on volume, it can be daily, every other day or weekly - Currently not included in buybacks: partner, dca and boost fees as they go to cover project's expenses alongside the other half of interface fees Best place to monitor the buyback status is [https://www.taptools.io/pro/profiler?address=stake1u8u8alj84x8uyraqamup0n2vh5fqyea03vdkhnsmxkqt6lq20eccc](https://www.taptools.io/pro/profiler?address=stake1u8u8alj84x8uyraqamup0n2vh5fqyea03vdkhnsmxkqt6lq20eccc) Current buyback ratio is around 0.1% of total supply each 7-10 days, which is subject to change due to volume. [PreviousDashboard](https://dexhunter.gitbook.io/dexhunter-partners/swap-widget/dashboard) [NextAdvanced Nodes](https://dexhunter.gitbook.io/dexhunter-partners/advanced-nodes) Last updated 1 month ago ---