0.0.113 • Published 8 months ago

@dexhunterio/swaps v0.0.113

Weekly downloads
-
License
-
Repository
-
Last release
8 months 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.113

8 months ago

0.0.112

8 months ago

0.0.111

8 months ago

0.0.110

9 months ago

0.0.106

9 months ago

0.0.104

9 months ago

0.0.109

9 months ago

0.0.108

9 months ago

0.0.107

9 months ago

0.0.103

11 months ago

0.0.102

12 months ago

0.0.101

1 year ago

0.0.100

1 year ago

0.0.99

1 year ago

0.0.98

1 year ago

0.0.97

1 year ago

0.0.96

1 year ago

0.0.95

1 year ago

0.0.93

1 year ago

0.0.94

1 year ago

0.0.92

1 year ago

0.0.89

1 year ago

0.0.90

1 year ago

0.0.91

1 year ago

0.0.88

1 year ago

0.0.86

1 year ago

0.0.87

1 year ago

0.0.84

1 year ago

0.0.85

1 year ago

0.0.81

1 year ago

0.0.82

1 year ago

0.0.83

1 year ago

0.0.80

1 year ago

0.0.79

1 year ago

0.0.74

2 years ago

0.0.75

2 years ago

0.0.77

2 years ago

0.0.73

2 years ago

0.0.72

2 years ago

0.0.71

2 years ago

0.0.68

2 years ago

0.0.67

2 years ago

0.0.64

2 years ago

0.0.65

2 years ago

0.0.66

2 years ago

0.0.63

2 years ago

0.0.62

2 years ago

0.0.61

2 years ago

0.0.60

2 years ago

0.0.59

2 years ago

0.0.58

2 years ago

0.0.57

2 years ago

0.0.56

2 years ago

0.0.54

2 years ago

0.0.53

2 years ago

0.0.52

2 years ago

0.0.50

2 years ago

0.0.49

2 years ago

0.0.48

2 years ago

0.0.47

2 years ago

0.0.46

2 years ago

0.0.44

2 years ago

0.0.43

2 years ago

0.0.42

2 years ago

0.0.41

2 years ago

0.0.40

2 years ago

0.0.39

2 years ago

0.0.38

2 years ago

0.0.37

2 years ago

0.0.36

2 years ago

0.0.34

2 years ago

0.0.33

2 years ago

0.0.32

2 years ago

0.0.31

2 years ago

0.0.30

2 years ago

0.0.29

2 years ago

0.0.28

2 years ago

0.0.27

2 years ago

0.0.26

2 years ago

0.0.25

2 years ago

0.0.24

2 years ago

0.0.23

2 years ago

0.0.22

2 years ago

0.0.21

2 years ago

0.0.20

2 years ago

0.0.19

2 years ago

0.0.18

2 years ago

0.0.17

2 years ago

0.0.16

2 years ago

0.0.15

2 years ago

0.0.14

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago