0.0.98 • Published 10 days ago

@dexhunterio/swaps v0.0.98

Weekly downloads
-
License
-
Repository
-
Last release
10 days ago

Dex Hunter - Swap Component

How to use library (with React)

  1. Install package:
    npm i @dexhunterio/swaps
  2. Import to your code 2.1. For ReactJS:
      import '@dexhunterio/swaps/lib/assets/style.css'
      import Swap from '@dexhunterio/swaps'
      ...
    2.2. Ffor NextJS:
    "use client";
    import '@dexhunterio/swaps/lib/assets/style.css'
    const Swap = dynamic(() => import("@dexhunterio/swaps"), {
        ssr: false,
    });
    ...
  3. Use Swap Component:
    function App() {
      return (
        <div>
          <Swap {...settings} />
        </div>
      );
    }

How to use library (with VanilaJS)

  • In head tag
    <head>
        ...
        <script
            src="https://unpkg.com/react@18.2/umd/react.production.min.js"
            crossorigin
          ></script>
          <script
            src="https://unpkg.com/react-dom@18.2/umd/react-dom.production.min.js"
            crossorigin
          ></script>
          <script
            type="module"
            src="https://unpkg.com/@dexhunterio/swaps@0.0.95/lib/umd/swaps.umd.js"
          ></script>
          ...
    </head>
  • In body tag:
      ...
      <div id="dexhunter"></div>
        <script type="module">
          ReactDOM.render(
            React.createElement(dexhunterSwap, {
              orderTypes: ["SWAP", "LIMIT", "DCA"],
              theme: "light",
            }),
            document.getElementById("dexhunter")
          );
        </script>
    ...

Available props:

PropRequired?TypeDefaultDescription
defaultTokenfalsestring-The default token to be selected.
widthfalsepx|%-The width of the component. Accepts values in pixels or percentage.
heightfalsepx|%-The height of the component. Accepts values in pixels or percentage.
themefalsedark | lightdarkThe theme of the component. Can be either 'dark' or 'light'.
orderTypesfalsearray'SWAP', 'LIMIT'An array of order types supported by the component. Defaults to 'SWAP' and 'LIMIT'.
supportedTokensfalsetokenId[]-An array of token IDs that are supported for searching.
partnerNametruestring-The name of the partner. This is a required field.
partnerCodetruestring-The code of the partner. This is a required field.
colorsfalseobject-Supported colors: mainText, subText, background, containers, buttonText, accent.
classNamefalsestring-Custom CSS class for the component.
stylefalseobject-Inline styles for the component.
onSwapSuccessfalse(data: any) => void-Callback function on successful swap.
onSwapErrorfalse(err: any) => void-Callback function on swap error.
selectedWalletfalseSelectedWallet-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.
inputsfalsestring[]-Input fields for the component.
onWalletConnectfalse(data: any) => void-Callback function when a wallet is connected.
onClickWalletConnectfalse() => void-Trigger when clicking the wallet connect button
onViewOrderfalse(data: any) => void-Trigger when clicking the view order button
displayTypefalse'BUTTON' | 'DEFAULT' | 'WIDGET''DEFAULT'display type
buttonTextfalsestringSwapButton text when displayType = 'BUTTON'
orderTypeOnButtonClickfalse'SWAP' | 'LIMIT' | 'DCA''SWAP'Tab default when displayed
defaultSettingsfalse{ isCustomSlippage?: boolean; isAutomaticSlippage?: boolean; slippage?: number; }-Settings default
autoFocusfalsebooleanfalseauto focus on sell input when page loads
0.0.98

10 days ago

0.0.97

13 days ago

0.0.96

3 months ago

0.0.95

4 months ago

0.0.93

4 months ago

0.0.94

4 months ago

0.0.92

4 months ago

0.0.89

4 months ago

0.0.90

4 months ago

0.0.91

4 months ago

0.0.88

4 months ago

0.0.86

4 months ago

0.0.87

4 months ago

0.0.84

4 months ago

0.0.85

4 months ago

0.0.81

4 months ago

0.0.82

4 months ago

0.0.83

4 months ago

0.0.80

4 months ago

0.0.79

4 months ago

0.0.74

5 months ago

0.0.75

5 months ago

0.0.77

5 months ago

0.0.73

5 months ago

0.0.72

5 months ago

0.0.71

5 months ago

0.0.68

5 months ago

0.0.67

5 months ago

0.0.64

5 months ago

0.0.65

5 months ago

0.0.66

5 months ago

0.0.63

6 months ago

0.0.62

6 months ago

0.0.61

6 months ago

0.0.60

6 months ago

0.0.59

6 months ago

0.0.58

6 months ago

0.0.57

6 months ago

0.0.56

6 months ago

0.0.54

6 months ago

0.0.53

6 months ago

0.0.52

6 months ago

0.0.50

6 months ago

0.0.49

6 months ago

0.0.48

6 months ago

0.0.47

6 months ago

0.0.46

6 months ago

0.0.44

7 months ago

0.0.43

7 months ago

0.0.42

7 months ago

0.0.41

7 months ago

0.0.40

7 months ago

0.0.39

7 months ago

0.0.38

7 months ago

0.0.37

7 months ago

0.0.36

7 months ago

0.0.34

7 months ago

0.0.33

7 months ago

0.0.32

7 months ago

0.0.31

7 months ago

0.0.30

7 months ago

0.0.29

7 months ago

0.0.28

7 months ago

0.0.27

7 months ago

0.0.26

7 months ago

0.0.25

7 months ago

0.0.24

7 months ago

0.0.23

7 months ago

0.0.22

7 months ago

0.0.21

7 months ago

0.0.20

7 months ago

0.0.19

7 months ago

0.0.18

7 months ago

0.0.17

7 months ago

0.0.16

7 months ago

0.0.15

7 months ago

0.0.14

7 months ago

0.0.13

7 months ago

0.0.12

7 months ago

0.0.11

7 months ago

0.0.10

7 months ago

0.0.9

7 months ago

0.0.8

7 months ago