@pancakeswap/token-lists 0.0.12 → 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.
- package/.turbo/turbo-build.log +11 -11
- package/CHANGELOG.md +6 -0
- package/dist/{getTokenList-VM72I6KY.js → getTokenList-A3DXVBCD.js} +17 -8
- package/dist/{getTokenList-B3VE4CV2.mjs → getTokenList-PEH2JP67.mjs} +18 -9
- package/dist/react.js +1 -1
- package/dist/react.mjs +1 -1
- package/package.json +1 -1
- package/react/getTokenList.ts +16 -7
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @pancakeswap/token-lists@0.0.
|
|
2
|
+
> @pancakeswap/token-lists@0.0.13 build /home/runner/work/pancake-frontend/pancake-frontend/packages/token-lists
|
|
3
3
|
> tsup
|
|
4
4
|
|
|
5
5
|
CLI Building entry: {"index":"./src/index.ts","react":"./react/index.ts"}
|
|
@@ -9,21 +9,21 @@ CLI Using tsup config: /home/runner/work/pancake-frontend/pancake-frontend/packa
|
|
|
9
9
|
CLI Target: es6
|
|
10
10
|
ESM Build start
|
|
11
11
|
CJS Build start
|
|
12
|
-
Entry module "dist/getTokenList-
|
|
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 673ms
|
|
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.
|
|
19
13
|
CJS dist/chunk-4TPCCB4K.js 1.49 KB
|
|
20
14
|
CJS dist/index.js 815.00 B
|
|
21
15
|
CJS dist/chunk-OGWZ2K32.js 2.83 KB
|
|
22
|
-
CJS dist/getTokenList-
|
|
16
|
+
CJS dist/getTokenList-A3DXVBCD.js 14.38 KB
|
|
23
17
|
CJS dist/react.js 9.13 KB
|
|
24
|
-
CJS ⚡️ Build success in
|
|
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
25
|
DTS Build start
|
|
26
|
-
DTS ⚡️ Build success in
|
|
26
|
+
DTS ⚡️ Build success in 9684ms
|
|
27
27
|
DTS dist/index.d.ts 1.68 KB
|
|
28
28
|
DTS dist/react.d.ts 2.52 KB
|
|
29
29
|
DTS dist/types-d6730d17.d.ts 1.03 KB
|
package/CHANGELOG.md
CHANGED
|
@@ -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
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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-
|
|
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-
|
|
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
package/react/getTokenList.ts
CHANGED
|
@@ -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
|
|
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
|
-
|
|
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
|
}
|