@pancakeswap/token-lists 0.0.11 → 0.0.13

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.
@@ -1,29 +1,29 @@
1
1
 
2
- > @pancakeswap/token-lists@0.0.11 build /home/runner/work/pancake-frontend/pancake-frontend/packages/token-lists
2
+ > @pancakeswap/token-lists@0.0.13 build /home/runner/work/pancake-frontend/pancake-frontend/packages/token-lists
3
3
  > tsup
4
4
 
5
- CLI Building entry: {"index":"./src/index.ts","react":"./react/index.ts"}
6
- CLI Using tsconfig: tsconfig.json
7
- CLI tsup v6.7.0
8
- CLI Using tsup config: /home/runner/work/pancake-frontend/pancake-frontend/packages/token-lists/tsup.config.ts
9
- CLI Target: es6
10
- ESM Build start
11
- CJS Build start
12
- Entry module "dist/getTokenList-VM72I6KY.js" is using named and default exports together. Consumers of your bundle will have to use `chunk.default` to access the default export, which may not be what you want. Use `output.exports: "named"` to disable this warning.
13
- ESM dist/chunk-2L3ZO4UM.mjs 1.42 KB
14
- ESM dist/index.mjs 160.00 B
15
- ESM dist/chunk-COROHIJN.mjs 2.67 KB
16
- ESM dist/getTokenList-B3VE4CV2.mjs 13.41 KB
17
- ESM dist/react.mjs 8.43 KB
18
- ESM ⚡️ Build success in 731ms
19
- CJS dist/chunk-4TPCCB4K.js 1.49 KB
20
- CJS dist/index.js 815.00 B
21
- CJS dist/chunk-OGWZ2K32.js 2.83 KB
22
- CJS dist/getTokenList-VM72I6KY.js 13.76 KB
23
- CJS dist/react.js 9.13 KB
24
- CJS ⚡️ Build success in 733ms
25
- DTS Build start
26
- DTS ⚡️ Build success in 6959ms
27
- DTS dist/index.d.ts 1.68 KB
28
- DTS dist/react.d.ts 2.52 KB
29
- DTS dist/types-d6730d17.d.ts 1.03 KB
5
+ CLI Building entry: {"index":"./src/index.ts","react":"./react/index.ts"}
6
+ CLI Using tsconfig: tsconfig.json
7
+ CLI tsup v6.7.0
8
+ CLI Using tsup config: /home/runner/work/pancake-frontend/pancake-frontend/packages/token-lists/tsup.config.ts
9
+ CLI Target: es6
10
+ ESM Build start
11
+ CJS Build start
12
+ Entry module "dist/getTokenList-A3DXVBCD.js" is using named and default exports together. Consumers of your bundle will have to use `chunk.default` to access the default export, which may not be what you want. Use `output.exports: "named"` to disable this warning.
13
+ CJS dist/chunk-4TPCCB4K.js 1.49 KB
14
+ CJS dist/index.js 815.00 B
15
+ CJS dist/chunk-OGWZ2K32.js 2.83 KB
16
+ CJS dist/getTokenList-A3DXVBCD.js 14.38 KB
17
+ CJS dist/react.js 9.13 KB
18
+ CJS ⚡️ Build success in 868ms
19
+ ESM dist/chunk-2L3ZO4UM.mjs 1.42 KB
20
+ ESM dist/index.mjs 160.00 B
21
+ ESM dist/chunk-COROHIJN.mjs 2.67 KB
22
+ ESM dist/getTokenList-PEH2JP67.mjs 14.03 KB
23
+ ESM dist/react.mjs 8.43 KB
24
+ ESM ⚡️ Build success in 872ms
25
+ DTS Build start
26
+ DTS ⚡️ Build success in 9684ms
27
+ DTS dist/index.d.ts 1.68 KB
28
+ DTS dist/react.d.ts 2.52 KB
29
+ DTS dist/types-d6730d17.d.ts 1.03 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @pancakeswap/token-lists
2
2
 
3
+ ## 0.0.13
4
+
5
+ ### Patch Changes
6
+
7
+ - f3e8a77: fix: Filter out tokens in list that are not matching the criteria
8
+
9
+ ## 0.0.12
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [f551e5e]
14
+ - @pancakeswap/swap-sdk-core@1.2.0
15
+
3
16
  ## 0.0.11
4
17
 
5
18
  ### Patch Changes
@@ -429,7 +429,7 @@ var pancakeswap_default = {
429
429
  var tokenListValidator = new Ajv__default.default({ allErrors: true }).compile(pancakeswap_default);
430
430
  function getTokenList(listUrl) {
431
431
  return chunk4TPCCB4K_js.__async(this, null, function* () {
432
- var _a, _b;
432
+ var _a, _b, _c, _d;
433
433
  const urls = uriToHttp(listUrl);
434
434
  for (let i = 0; i < urls.length; i++) {
435
435
  const url = urls[i];
@@ -449,18 +449,27 @@ function getTokenList(listUrl) {
449
449
  continue;
450
450
  }
451
451
  const json = yield response.json();
452
- if (json.tokens) {
453
- remove__default.default(json.tokens, (token) => {
454
- return token.symbol ? token.symbol.length === 0 : true;
455
- });
456
- }
457
452
  if (!tokenListValidator(json)) {
458
- const validationErrors = (_b = (_a = tokenListValidator.errors) == null ? void 0 : _a.reduce((memo, error) => {
453
+ const preFilterValidationErrors = (_b = (_a = tokenListValidator.errors) == null ? void 0 : _a.reduce((memo, error) => {
459
454
  var _a2;
460
455
  const add = `${error.dataPath} ${(_a2 = error.message) != null ? _a2 : ""}`;
461
456
  return memo.length > 0 ? `${memo}; ${add}` : `${add}`;
462
457
  }, "")) != null ? _b : "unknown error";
463
- throw new Error(`Token list failed validation: ${validationErrors}`);
458
+ if (json.tokens) {
459
+ remove__default.default(json.tokens, (token) => {
460
+ return !tokenListValidator(chunk4TPCCB4K_js.__spreadProps(chunk4TPCCB4K_js.__spreadValues({}, json), { tokens: [token] }));
461
+ });
462
+ }
463
+ if (!tokenListValidator(json)) {
464
+ const validationErrors = (_d = (_c = tokenListValidator.errors) == null ? void 0 : _c.reduce((memo, error) => {
465
+ var _a2;
466
+ const add = `${error.dataPath} ${(_a2 = error.message) != null ? _a2 : ""}`;
467
+ return memo.length > 0 ? `${memo}; ${add}` : `${add}`;
468
+ }, "")) != null ? _d : "unknown error";
469
+ throw new Error(`Token list ${url} failed validation: ${validationErrors}`);
470
+ } else {
471
+ console.warn(`Token list ${url} validation failed before token filtering: ${preFilterValidationErrors}`);
472
+ }
464
473
  }
465
474
  return json;
466
475
  }
@@ -1,4 +1,4 @@
1
- import { __async } from './chunk-2L3ZO4UM.mjs';
1
+ import { __async, __spreadProps, __spreadValues } from './chunk-2L3ZO4UM.mjs';
2
2
  import remove from 'lodash/remove';
3
3
  import Ajv from 'ajv';
4
4
 
@@ -420,7 +420,7 @@ var pancakeswap_default = {
420
420
  var tokenListValidator = new Ajv({ allErrors: true }).compile(pancakeswap_default);
421
421
  function getTokenList(listUrl) {
422
422
  return __async(this, null, function* () {
423
- var _a, _b;
423
+ var _a, _b, _c, _d;
424
424
  const urls = uriToHttp(listUrl);
425
425
  for (let i = 0; i < urls.length; i++) {
426
426
  const url = urls[i];
@@ -440,18 +440,27 @@ function getTokenList(listUrl) {
440
440
  continue;
441
441
  }
442
442
  const json = yield response.json();
443
- if (json.tokens) {
444
- remove(json.tokens, (token) => {
445
- return token.symbol ? token.symbol.length === 0 : true;
446
- });
447
- }
448
443
  if (!tokenListValidator(json)) {
449
- const validationErrors = (_b = (_a = tokenListValidator.errors) == null ? void 0 : _a.reduce((memo, error) => {
444
+ const preFilterValidationErrors = (_b = (_a = tokenListValidator.errors) == null ? void 0 : _a.reduce((memo, error) => {
450
445
  var _a2;
451
446
  const add = `${error.dataPath} ${(_a2 = error.message) != null ? _a2 : ""}`;
452
447
  return memo.length > 0 ? `${memo}; ${add}` : `${add}`;
453
448
  }, "")) != null ? _b : "unknown error";
454
- throw new Error(`Token list failed validation: ${validationErrors}`);
449
+ if (json.tokens) {
450
+ remove(json.tokens, (token) => {
451
+ return !tokenListValidator(__spreadProps(__spreadValues({}, json), { tokens: [token] }));
452
+ });
453
+ }
454
+ if (!tokenListValidator(json)) {
455
+ const validationErrors = (_d = (_c = tokenListValidator.errors) == null ? void 0 : _c.reduce((memo, error) => {
456
+ var _a2;
457
+ const add = `${error.dataPath} ${(_a2 = error.message) != null ? _a2 : ""}`;
458
+ return memo.length > 0 ? `${memo}; ${add}` : `${add}`;
459
+ }, "")) != null ? _d : "unknown error";
460
+ throw new Error(`Token list ${url} failed validation: ${validationErrors}`);
461
+ } else {
462
+ console.warn(`Token list ${url} validation failed before token filtering: ${preFilterValidationErrors}`);
463
+ }
455
464
  }
456
465
  return json;
457
466
  }
package/dist/react.js CHANGED
@@ -216,7 +216,7 @@ function useFetchListCallback(dispatch) {
216
216
  if (sendDispatch) {
217
217
  dispatch(fetchTokenList.pending({ requestId, url: listUrl }));
218
218
  }
219
- const getTokenList = (yield import('./getTokenList-VM72I6KY.js')).default;
219
+ const getTokenList = (yield import('./getTokenList-A3DXVBCD.js')).default;
220
220
  return getTokenList(listUrl).then((tokenList) => {
221
221
  if (sendDispatch) {
222
222
  dispatch(fetchTokenList.fulfilled({ url: listUrl, tokenList, requestId }));
package/dist/react.mjs CHANGED
@@ -210,7 +210,7 @@ function useFetchListCallback(dispatch) {
210
210
  if (sendDispatch) {
211
211
  dispatch(fetchTokenList.pending({ requestId, url: listUrl }));
212
212
  }
213
- const getTokenList = (yield import('./getTokenList-B3VE4CV2.mjs')).default;
213
+ const getTokenList = (yield import('./getTokenList-PEH2JP67.mjs')).default;
214
214
  return getTokenList(listUrl).then((tokenList) => {
215
215
  if (sendDispatch) {
216
216
  dispatch(fetchTokenList.fulfilled({ url: listUrl, tokenList, requestId }));
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@pancakeswap/token-lists",
3
- "version": "0.0.11",
3
+ "version": "0.0.13",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
7
7
  "dependencies": {
8
8
  "ajv": "^6.12.3",
9
9
  "lodash": "^4.17.21",
10
- "@pancakeswap/swap-sdk-core": "1.1.0"
10
+ "@pancakeswap/swap-sdk-core": "1.2.0"
11
11
  },
12
12
  "peerDependencies": {
13
13
  "@reduxjs/toolkit": "^1.9.1",
@@ -22,7 +22,7 @@
22
22
  "localforage": "^1.10.0",
23
23
  "react": "^18.2.0",
24
24
  "tsup": "^6.7.0",
25
- "@pancakeswap/utils": "6.0.3"
25
+ "@pancakeswap/utils": "6.0.9"
26
26
  },
27
27
  "exports": {
28
28
  ".": {
@@ -33,18 +33,27 @@ export default async function getTokenList(listUrl: string): Promise<TokenList>
33
33
  }
34
34
 
35
35
  const json = await response.json()
36
- if (json.tokens) {
37
- remove<TokenInfo>(json.tokens, (token) => {
38
- return token.symbol ? token.symbol.length === 0 : true
39
- })
40
- }
41
36
  if (!tokenListValidator(json)) {
42
- const validationErrors: string =
37
+ const preFilterValidationErrors: string =
43
38
  tokenListValidator.errors?.reduce<string>((memo, error) => {
44
39
  const add = `${(error as any).dataPath} ${error.message ?? ''}`
45
40
  return memo.length > 0 ? `${memo}; ${add}` : `${add}`
46
41
  }, '') ?? 'unknown error'
47
- throw new Error(`Token list failed validation: ${validationErrors}`)
42
+ if (json.tokens) {
43
+ remove<TokenInfo>(json.tokens, (token) => {
44
+ return !tokenListValidator({ ...json, tokens: [token] })
45
+ })
46
+ }
47
+ if (!tokenListValidator(json)) {
48
+ const validationErrors: string =
49
+ tokenListValidator.errors?.reduce<string>((memo, error) => {
50
+ const add = `${(error as any).dataPath} ${error.message ?? ''}`
51
+ return memo.length > 0 ? `${memo}; ${add}` : `${add}`
52
+ }, '') ?? 'unknown error'
53
+ throw new Error(`Token list ${url} failed validation: ${validationErrors}`)
54
+ } else {
55
+ console.warn(`Token list ${url} validation failed before token filtering: ${preFilterValidationErrors}`)
56
+ }
48
57
  }
49
58
  return json as TokenList
50
59
  }