@cowprotocol/widget-react
v0.13.0
Published
CoW Swap Widget Library. Allows you to easily embed a CoW Swap widget on your React application.
Downloads
10,374
Readme
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