0.11.1 • Published 20 days ago

@cowprotocol/widget-lib v0.11.1

Weekly downloads
-
License
ISC
Repository
github
Last release
20 days ago

CoW Swap Widget Library

Integrate the power of CowSwap into your product! With the widget, you can create an incredible trading interface. Specify the required pair of currencies, customize the look and much more!

Live example

See the widget in action in the widget configurator

Docs

You can find a detailed description of all widget parameters in the documentation

Quick start

npm install @cowprotocol/widget-lib --save
yarn add @cowprotocol/widget-lib

Create a container somewhere in your website, the widget will be rendered inside it:

<div id="cowswap-widget"></div>

Import the widget and initialise it:

import { createCowSwapWidget, CowSwapWidgetParams } from '@cowprotocol/widget-lib'

// Initialise the widget
const widgetContainer = document.getElementById('cowswap-widget')

// instantiate your own web3 provider
const provider = window.ethereum

const params: CowSwapWidgetParams = {
  appCode: 'NAME-OF-YOU-APP', // Add here the name of your app. e.g. "Pig Swap"
  sell: { asset: 'DAI' },
  buy: { asset: 'USDC', amount: '0.1' },
}

const {updateParams} = createCowSwapWidget(
  widgetContainer,
  // Optionally, you can provide some additional params to customise your widget
  {params, provider}
)

// You also can change widget configuration on the fly
updateParams({ ...params, tradeType: 'limit' })

Developers

Test

nx test widget-lib

Build the library

nx build widget-lib
0.11.1

20 days ago

0.11.0

21 days ago

0.10.1

29 days ago

0.10.0

1 month ago

0.9.0

1 month ago

0.9.1

1 month ago

0.9.0-RC.0

1 month ago

0.8.0

1 month ago

0.7.1

2 months ago

0.7.0

2 months ago

0.6.0

2 months ago

0.6.0-RC.4

3 months ago

0.6.0-RC.1

3 months ago

0.6.0-RC.0

3 months ago

0.6.0-RC.3

3 months ago

0.6.0-RC.2

3 months ago

0.5.0

3 months ago

0.4.0

4 months ago

0.3.0

4 months ago

0.1.0

7 months ago

0.2.1

6 months ago

0.1.2

7 months ago

0.2.0

6 months ago

0.1.1

7 months ago

0.1.4

7 months ago

0.1.3

7 months ago

0.0.7

11 months ago

0.0.6

11 months ago

0.0.5

11 months ago

0.0.4

11 months ago

0.0.3

11 months ago

0.0.2

11 months ago

0.0.1

11 months ago