@cowprotocol/widget-react

v0.2.3
CoW Swap Widget Library. Allows you to easily embed a CoW Swap widget on your React application.
cowprotocol widget cowswap dex widget-lib react

CoW Swap React widget

React component that creates a CoW Swap widget. It is based on https://npmjs.com/package/@cowprotocol/widget-lib

Use it

Install dependency

yarn add @cowprotocol/widget-react
npm install @cowprotocol/widget-react

Import component and some convenient types

import { CowSwapWidget, CowSwapWidgetParams } from '@cowprotocol/widget-react'

Prepare the config for the widget:

const cowSwapWidgetParams: CowSwapWidgetParams = {
  appCode: 'NAME-OF-YOU-APP', // Add here the name of your app. e.g. "Pig Swap"
  width: '600px',
  height: '700px',
  tradeType: 'swap',
}

Render the component:

<CowSwapWidget params={cowSwapWidgetParams} />

Developers

# Test
nx test widget-react

# Build the library
nx build widget-react

# Publish to NPM
nx publish widget-react --ver x.y.z --tag latest
npm i @cowprotocol/[email protected]

Metadata

  • ISC
  • Whatever
  • Unknown
  • released 11/16/2023

Downloads