Gathering detailed insights and metrics for @cowprotocol/widget-lib
Gathering detailed insights and metrics for @cowprotocol/widget-lib
Gathering detailed insights and metrics for @cowprotocol/widget-lib
Gathering detailed insights and metrics for @cowprotocol/widget-lib
npm install @cowprotocol/widget-lib
ui: v1.14.0
Published on 21 Nov 2024
common-const: v1.10.1
Published on 21 Nov 2024
balances-and-allowances: v1.1.1
Published on 21 Nov 2024
assets: v1.10.0
Published on 21 Nov 2024
cowswap: v1.90.0
Published on 21 Nov 2024
cowswap: v1.89.0
Published on 14 Nov 2024
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
124 Stars
7,433 Commits
94 Forks
10 Watching
586 Branches
170 Contributors
Updated on 27 Nov 2024
TypeScript (99.47%)
JavaScript (0.39%)
HTML (0.14%)
Cumulative downloads
Total Downloads
Last day
-30.6%
297
Compared to previous day
Last week
43%
2,499
Compared to previous week
Last month
19.6%
8,939
Compared to previous month
Last year
2,522.5%
37,502
Compared to previous year
2
CoW Swap is the first trading interface built on top of CoW Protocol.
It allows you to buy and sell tokens using gasless orders that are settled peer-to-peer among its users or into any on-chain liquidity source while providing MEV protection.
Platform | Link |
---|---|
🐮 CoW Swap 🐮 | swap.cow.fi |
CoW Swap (IPFS) | Every release is deployed automatically to IPFS (Releases) |
CoW Swap (ENS) | ens://cowswap.eth or (cowswap.eth.limo) |
CoW Protocol | cow.fi |
Docs | docs.cow.fi |
Governance (Snapshot) | snapshot.org/#/cow.eth |
Stats | dune.com/cowprotocol/cowswap |
X/Twitter | @CoWSwap |
Discord | discord.com/invite/cowprotocol |
Forum | forum.cow.fi |
First install Dependencies:
1yarn
Start CoW Swap on http://localhost:3000
1yarn start
Build the project. The static files will be generated in the build
folder.
1yarn build
1yarn test
Start the Explorer on http://localhost:4200
1yarn start:explorer
1yarn build:explorer
Start CoW.fi on http://localhost:3001
1yarn start:cowfi
1yarn build:cowfi
Start the Widget Configurator on http://127.0.0.1:4200/widget-configurator
1# Start 2yarn start:widget 3 4# Build 5yarn build:widget
Start the Cosmos UI Library on http://localhost:5000
1yarn run cosmos
⚠️ To run the tests. Make sure you add the required environment varianbles to your
.env.local
file with:
INTEGRATION_TEST_PRIVATE_KEY=<your-private-key>
: Private keyINTEGRATION_TESTS_INFURA_KEY=<your-infura-key>
: Infura key
To launch it with our development server (so you have live-reloading):
1yarn start 2yarn cypress
Alternatively, you can build the project and launch the integration test.
1yarn build 2yarn integration-test
If we want to use the Cypress UI:
1yarn build 2yarn serve 3yarn cypress
CoW Swap has a library of reusable components.
1yarn ui:build 2yarn ui:test
1yarn build
Analyze CoW Swap bundle:
1# Use one of the following templates: "sunburst" | "treemap" | "network" | "raw-data" | "list"; 2ANALYZE_BUNDLE=true ANALYZE_BUNDLE_TEMPLATE=sunburst yarn build
You should set your own RPC endpoints.
One simple way to do this, is by defining your own REACT_APP_INFURA_KEY
environment var.
Alternatively you can define the RPC URLs directly with the following environment variables:
1REACT_APP_NETWORK_URL_1: https://... 2REACT_APP_NETWORK_URL_11155111: https://... 3REACT_APP_NETWORK_URL_100: https://... 4REACT_APP_NETWORK_URL_42161: https://... 5REACT_APP_NETWORK_URL_8453: https://...
Additionally, if you plan to run the integration tests locally you must define:
1INTEGRATION_TESTS_INFURA_KEY: YOUR_INFURA_KEY 2INTEGRATION_TESTS_PRIVATE_KEY: YOUR_TEST_WALLET_PRIVATE_KEY
Fee quote requests and posting orders are sent to the Orderbook API. This API has the responsibility of collecting orders and handing them to the solvers.
The reference implementation of the API is CoW Protocol Services.
The API endpoint is configured using the environment variable
REACT_APP_ORDER_BOOK_URLS
:
1REACT_APP_ORDER_BOOK_URLS='{"1":"https://YOUR_HOST","100":"https://YOUR_HOST","5":"https://YOUR_HOST"}
The BFF API is a helper API that provides some additional data to the frontend. It is a API that is used to enhance the frontend experience enabling some features. It is not consider a required API for CoW Swap core functionality, the app will still allow the user to place order and will have some fallback logics in case this API is not available.
The reference implementation of the API is BFF (Backend For Frontend).
The API endpoint is configured using the environment variable
REACT_APP_BFF_BASE_URL
:
1REACT_APP_BFF_BASE_URL=https://bff.cow.fi
The CMS API is a helper API that provides some additional content to the frontend.
It is not considered a required API for CoW Swap core functionality, the app will still allow the user to place orders and will have some fallback logic in case this API is not available.
The reference implementation of the API is CMS API.
The API endpoint is configured using the environment variable
REACT_APP_CMS_BASE_URL
:
1REACT_APP_CMS_BASE_URL=https://cms.cow.fi/api
CoW Swap tries to find the best price available on-chain using some price feeds.
All price feeds are enabled by default, but they can be individually disabled by using an environment variable:
Name | Environment variable | Type | Description |
---|---|---|---|
1inch | REACT_APP_PRICE_FEED_1INCH_ENABLED | boolean (default = true ) | Paraswap price estimation. Used for all price estimations. |
0x | REACT_APP_PRICE_FEED_0X_ENABLED | boolean (default = true ) | 0x price estimation. Used for all price estimation. |
The app will attach some metadata to all orders.
This metadata will be sent to the smart contract as a hexadecimal value in an
order field called AppData
. This value comes from hashing the content of a
metadata JSON containing some information about the trade (using keccak256
on
the UTF-8
bytes).
The format of the JSON follows the format defined in @cowprotocol/app-data.
To set your own AppData
, change REACT_APP_FULL_APP_DATA_<environment>
environment variable. For more details, check out the environment file (<.env>)
The sitemap can be found in <./public/sitemap.xml>
To update its content:
yarn sitemap
In case of problems with the service worker cache you force a reset using emergency.js The plan:
const resetCacheInCaseOfEmergency = false
- change false
to true
emergency.js
is not cached by browser and loaded before all.
No vulnerabilities found.
No security vulnerabilities found.