Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@dexhunterio/swaps

Package Overview
Dependencies
Maintainers
3
Versions
161
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dexhunterio/swaps

### How to use library (with React)

  • 0.0.168
  • npm
  • Socket score

Version published
Weekly downloads
1K
decreased by-33.53%
Maintainers
3
Weekly downloads
 
Created
Source

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'
buttonTextfalsestringSwapButton text when displayType = 'BUTTON'
orderTypeOnButtonClickfalse'SWAP' `'LIMIT'` 'DCA'
defaultSettingsfalse{ isCustomSlippage?: boolean; isAutomaticSlippage?: boolean; slippage?: number; }-Settings default
autoFocusfalsebooleanfalseauto focus on sell input when page loads

FAQs

Package last updated on 29 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc