npm package: @hungnm192/swaps-test
Description: ### How to use library
Latest version: 0.0.81

# Dex Hunter - Swap Component

### How to use library

- Install package:
  ```console
  npm i @dexhunterio/swaps
  ```
- Import to your code:
  ```js
  import Swap from '@dexhunterio/swaps'
  import '@dexhunterio/swaps/lib/assets/style.css'
  ...
  ```
- Use Swap Component:
  ```js
  function App() {
    return (
      <div>
        <Swap {...settings} />
      </div>
    );
  }
  ```

### Available props:

|      Prop       | Required? |        Type         |      Default      |                                                                                                 Description                                                                                                 |
| :-------------: | :-------: | :-----------------: | :---------------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
|  defaultToken   |   false   |       string        |         -         |                                                                                      The default token to be selected.                                                                                      |
|      width      |   false   |        px\|%        |         -         |                                                                     The width of the component. Accepts values in pixels or percentage.                                                                     |
|     height      |   false   |        px\|%        |         -         |                                                                    The height of the component. Accepts values in pixels or percentage.                                                                     |
|      theme      |   false   |    dark \| light    |       dark        |                                                                        The theme of the component. Can be either 'dark' or 'light'.                                                                         |
|   orderTypes    |   false   |        array        | ['SWAP', 'LIMIT'] |                                                             An array of order types supported by the component. Defaults to 'SWAP' and 'LIMIT'.                                                             |
| supportedTokens |   false   |      tokenId[]      |         -         |                                                                           An array of token IDs that are supported for searching.                                                                           |
|   partnerName   |   true    |       string        |         -         |                                                                             The name of the partner. This is a required field.                                                                              |
|   partnerCode   |   true    |       string        |         -         |                                                                             The code of the partner. This is a required field.                                                                              |
|     colors      |   false   |       object        |         -         |                                                        Supported colors: `mainText`, `subText`, `background`, `containers`, `buttonText`, `accent`.                                                         |
|    className    |   false   |       string        |         -         |                                                                                     Custom CSS class for the component.                                                                                     |
|      style      |   false   |       object        |         -         |                                                                                      Inline styles for the component.                                                                                       |
|  onSwapSuccess  |   false   | (data: any) => void |         -         |                                                                                    Callback function on successful swap.                                                                                    |
|   onSwapError   |   false   | (err: any) => void  |         -         |                                                                                      Callback function on swap error.                                                                                       |
| selectedWallet  |   false   |   SelectedWallet    |         -         | The wallet selected by the user. Accepts one of the specified wallet identifiers. Supported wallets: `nami`, `eternl`, `flint`, `gerowallet`, `typhoncip30`, `nufi`, `lace`, `vespr`, `begin`, and `yoroi`. |
|     inputs      |   false   |      string[]       |         -         |                                                                                       Input fields for the component.                                                                                       |
| onWalletConnect |   false   | (data: any) => void |         -         |                                                                                Callback function when a wallet is connected.                                                                                |