@cowprotocol/widget-lib 4.13.0 → 4.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +4 -4
  2. package/types.d.ts +30 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cowprotocol/widget-lib",
3
- "version": "4.13.0",
3
+ "version": "4.14.0",
4
4
  "description": "CoW Swap Widget Library. Allows you to easily embed a CoW Swap widget on your website.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -15,9 +15,9 @@
15
15
  "access": "public"
16
16
  },
17
17
  "dependencies": {
18
- "@cowprotocol/cow-sdk": "9.2.22",
19
- "@cowprotocol/events": "^4.17.2",
20
- "@cowprotocol/iframe-transport": "^2.3.13"
18
+ "@cowprotocol/cow-sdk": "9.3.3",
19
+ "@cowprotocol/events": "^4.18.0",
20
+ "@cowprotocol/iframe-transport": "^2.3.14"
21
21
  },
22
22
  "devDependencies": {
23
23
  "csstype": "3.1.3"
package/types.d.ts CHANGED
@@ -99,6 +99,28 @@ export type TokenPairConstraint = {
99
99
  chainId: SupportedChainId;
100
100
  };
101
101
  };
102
+ /**
103
+ * Narrows the tokens of one token selector (sell or buy).
104
+ * Search results and recent tokens are narrowed the same way.
105
+ */
106
+ export interface TokenSelectorFilter {
107
+ /**
108
+ * Addresses of the only tokens to show
109
+ */
110
+ tokens?: string[];
111
+ /**
112
+ * Addresses of tokens to hide. Like `tokens`, it limits search results to the token lists (no token import).
113
+ */
114
+ excludedTokens?: string[];
115
+ /**
116
+ * Shows only the tokens the connected wallet holds. Ignored while no wallet is connected, and for bridge target tokens.
117
+ */
118
+ onlyWithBalance?: boolean;
119
+ /**
120
+ * Shown above the token list, to explain why tokens are missing
121
+ */
122
+ notice?: string;
123
+ }
102
124
  export type WidgetHookResult = Promise<boolean> | boolean;
103
125
  export declare enum TradeType {
104
126
  SWAP = "swap",
@@ -244,6 +266,14 @@ export interface CowSwapWidgetParams {
244
266
  * If omitted, the buy selector falls back to the globally enabled lists.
245
267
  */
246
268
  buyTokenLists?: string[];
269
+ /**
270
+ * Narrows the tokens of the sell selector, on top of `sellTokenLists`
271
+ */
272
+ sellTokensFilter?: TokenSelectorFilter;
273
+ /**
274
+ * Narrows the tokens of the buy selector, on top of `buyTokenLists`
275
+ */
276
+ buyTokensFilter?: TokenSelectorFilter;
247
277
  /**
248
278
  * Forces the widget locale.
249
279
  * Serialized as the `lng` query param used by the frontend locale resolver.