New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@cowprotocol/widget-lib

Package Overview
Dependencies
Maintainers
5
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cowprotocol/widget-lib

CoW Swap Widget Library. Allows you to easily embed a CoW Swap widget on your website.

0.1.0
Source
npm
Version published
Maintainers
5
Created
Source

CoW Swap Widget Library

Use it

Install dependency

# Install the dependency using NPM
npm install @cowprotocol/widget-lib --save

# ...or alternativelly use YARN
yarn add @cowprotocol/widget-lib

Create an empty div somewhere in your website:

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

Import the widget and initialise it:

import { cowSwapWidget } from '@cowprotocol/widget-lib'

// Initialise the widget
const widgetContainer = document.getElementById('cowswap-widget')
cowSwapWidget({
  container: widgetContainer
})


// Additionally, you can pass some additional params to customise your widget
provider = /* instantiate your own web3 provider */
cowSwapWidget({
  container: widgetContainer,
  width: 600
  height: 640
  urlParams: {
    sell: { asset: 'DAI' },
    buy: { asset: 'USDC', amount: '0.1' }
  },
  provider
})

Developers

# Run demo project locally
# Will open http://localhost:3012/src/demo/index.html
nx serve widget-lib

# Test
nx test widget-lib

# Build the library
nx build widget-lib

# Publish to NPM
nx publish widget-lib --ver 0.0.7 --tag latest

Keywords

cowprotocol

FAQs

Package last updated on 31 Oct 2023

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