From da92aff775a9f7fae598489fbb482d46678f624b Mon Sep 17 00:00:00 2001 From: Jaco Date: Sun, 10 Jul 2022 08:43:56 +0200 Subject: [PATCH] Bump common (#1788) --- packages/phishing/package.json | 6 +- packages/phishing/src/crosscheck.spec.ts | 6 +- packages/phishing/src/fetch.ts | 7 +- yarn.lock | 108 +++++++++++------------ 4 files changed, 65 insertions(+), 62 deletions(-) diff --git a/packages/phishing/package.json b/packages/phishing/package.json index 8af996f27..a4ce20887 100644 --- a/packages/phishing/package.json +++ b/packages/phishing/package.json @@ -21,9 +21,9 @@ "main": "index.js", "dependencies": { "@babel/runtime": "^7.18.6", - "@polkadot/util": "^10.0.1", - "@polkadot/util-crypto": "^10.0.1", - "@polkadot/x-fetch": "^10.0.1" + "@polkadot/util": "^10.0.2", + "@polkadot/util-crypto": "^10.0.2", + "@polkadot/x-fetch": "^10.0.2" }, "devDependencies": { "@types/js-yaml": "^4.0.5", diff --git a/packages/phishing/src/crosscheck.spec.ts b/packages/phishing/src/crosscheck.spec.ts index 7ff207330..75a9cf30c 100644 --- a/packages/phishing/src/crosscheck.spec.ts +++ b/packages/phishing/src/crosscheck.spec.ts @@ -4,7 +4,7 @@ import fs from 'fs'; import { load as yamlParse } from 'js-yaml'; -import { fetch } from '@polkadot/x-fetch'; +import { fetchJson, fetchText } from './fetch'; interface CryptoScamEntry { addresses: Record; @@ -56,7 +56,7 @@ describe('crosscheck', (): void => { }); it('has all the relevant entries from CryptoScamDb', async (): Promise => { - const raw = await fetch(CRYPTODB).then((r) => r.text()); + const raw = await fetchText(CRYPTODB); // this is a hack, the text slipped in upstream const scamDb = yamlParse(raw.replace('∂ç', '')) as CryptoScamEntry[]; @@ -72,7 +72,7 @@ describe('crosscheck', (): void => { }); it('has polkadot/kusama entries from eth-phishing-detect', async (): Promise => { - const ethDb = await fetch(ETHPHISH).then((r) => r.json()); + const ethDb = await fetchJson(ETHPHISH); const filtered = ethDb.blacklist.filter((url) => matchName(url)); const missing = filtered.filter((url) => !ours.includes(url)); diff --git a/packages/phishing/src/fetch.ts b/packages/phishing/src/fetch.ts index b91912c9c..de3767d2b 100644 --- a/packages/phishing/src/fetch.ts +++ b/packages/phishing/src/fetch.ts @@ -3,6 +3,9 @@ import { fetch } from '@polkadot/x-fetch'; +// this is also in @polkadot/apps-config - we may want to expose it +// inside x-fetch at some point in the future... + // a fetch with a 2s timeout async function fetchWithTimeout (url: string, timeout = 2000): Promise { const controller = new AbortController(); @@ -29,10 +32,10 @@ async function fetchWithTimeout (url: string, timeout = 2000): Promise } } -export function fetchJson (url: string, timeout = 2000): Promise { +export function fetchJson (url: string, timeout?: number): Promise { return fetchWithTimeout(url, timeout).then((r) => r.json()); } -export function fetchText (url: string, timeout = 2000): Promise { +export function fetchText (url: string, timeout?: number): Promise { return fetchWithTimeout(url, timeout).then((r) => r.text()); } diff --git a/yarn.lock b/yarn.lock index 93426e51a..7ddf730ab 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2063,14 +2063,14 @@ __metadata: languageName: node linkType: hard -"@polkadot/networks@npm:10.0.1": - version: 10.0.1 - resolution: "@polkadot/networks@npm:10.0.1" +"@polkadot/networks@npm:10.0.2": + version: 10.0.2 + resolution: "@polkadot/networks@npm:10.0.2" dependencies: "@babel/runtime": ^7.18.6 - "@polkadot/util": 10.0.1 + "@polkadot/util": 10.0.2 "@substrate/ss58-registry": ^1.23.0 - checksum: 136c17155364a32c6d43c1cab9263fc38e691a9da35e6419934a09d6614eaa9521778fe9a1afe008f15b4cbf0a7fff0fee2322169232c6fcdb49396bbca0d075 + checksum: d8ab6c706f3059e925cadfe9801c097c657bb8f41293514fca7fd7edb20b0bae941d2cd1ecd24615d68e626b751b13ba3fe47d916a8968225771d0f936e7c043 languageName: node linkType: hard @@ -2079,47 +2079,47 @@ __metadata: resolution: "@polkadot/phishing@workspace:packages/phishing" dependencies: "@babel/runtime": ^7.18.6 - "@polkadot/util": ^10.0.1 - "@polkadot/util-crypto": ^10.0.1 - "@polkadot/x-fetch": ^10.0.1 + "@polkadot/util": ^10.0.2 + "@polkadot/util-crypto": ^10.0.2 + "@polkadot/x-fetch": ^10.0.2 "@types/js-yaml": ^4.0.5 js-yaml: ^4.1.0 languageName: unknown linkType: soft -"@polkadot/util-crypto@npm:^10.0.1": - version: 10.0.1 - resolution: "@polkadot/util-crypto@npm:10.0.1" +"@polkadot/util-crypto@npm:^10.0.2": + version: 10.0.2 + resolution: "@polkadot/util-crypto@npm:10.0.2" dependencies: "@babel/runtime": ^7.18.6 "@noble/hashes": 1.1.2 "@noble/secp256k1": 1.6.0 - "@polkadot/networks": 10.0.1 - "@polkadot/util": 10.0.1 + "@polkadot/networks": 10.0.2 + "@polkadot/util": 10.0.2 "@polkadot/wasm-crypto": ^6.2.3 - "@polkadot/x-bigint": 10.0.1 - "@polkadot/x-randomvalues": 10.0.1 + "@polkadot/x-bigint": 10.0.2 + "@polkadot/x-randomvalues": 10.0.2 "@scure/base": 1.1.1 ed2curve: ^0.3.0 tweetnacl: ^1.0.3 peerDependencies: - "@polkadot/util": 10.0.1 - checksum: 2ba98e39a874769ddcd8388f2b3edddcdf41aea00127f82b1d1511f655989bffd37c30da3d5079a339457abf32375812ddc61ccff65241f58e18e87ac1ee0693 + "@polkadot/util": 10.0.2 + checksum: 472e5678fcd9e6ed0bc39f203af56d62dc82f1dcb708c5cd0678fd85e3407090a335f70d16e2afb42136d9e007cc190057bede8ac5f9c772e2c395cddf9c0dec languageName: node linkType: hard -"@polkadot/util@npm:10.0.1, @polkadot/util@npm:^10.0.1": - version: 10.0.1 - resolution: "@polkadot/util@npm:10.0.1" +"@polkadot/util@npm:10.0.2, @polkadot/util@npm:^10.0.2": + version: 10.0.2 + resolution: "@polkadot/util@npm:10.0.2" dependencies: "@babel/runtime": ^7.18.6 - "@polkadot/x-bigint": 10.0.1 - "@polkadot/x-global": 10.0.1 - "@polkadot/x-textdecoder": 10.0.1 - "@polkadot/x-textencoder": 10.0.1 + "@polkadot/x-bigint": 10.0.2 + "@polkadot/x-global": 10.0.2 + "@polkadot/x-textdecoder": 10.0.2 + "@polkadot/x-textencoder": 10.0.2 "@types/bn.js": ^5.1.0 bn.js: ^5.2.1 - checksum: 039fe5450158554eed5e519f8fcb1fd9a7c387307dda16fd728d39b8bf63991ff0add0e538f50dd91fe9e19f138eb95505be2d010afe752bbb12018d6719cce8 + checksum: dbcc331da2e3383225266ae00163d73641fdecaa3e2b994df62d77a268d86dc3c0b725836b7073bd5673707974b0a21f929a6bac6a6bb3e213b5967053c96c0a languageName: node linkType: hard @@ -2201,64 +2201,64 @@ __metadata: languageName: node linkType: hard -"@polkadot/x-bigint@npm:10.0.1": - version: 10.0.1 - resolution: "@polkadot/x-bigint@npm:10.0.1" +"@polkadot/x-bigint@npm:10.0.2": + version: 10.0.2 + resolution: "@polkadot/x-bigint@npm:10.0.2" dependencies: "@babel/runtime": ^7.18.6 - "@polkadot/x-global": 10.0.1 - checksum: b6d0bad30d76ac0d1978e941a735571bdf765597d0af11fad65aed9d21d0cb3ecdc359aaecd169bf11791fb61e4c150a85f9760c0c33dead3a62b0382897385c + "@polkadot/x-global": 10.0.2 + checksum: 77bf8554d74591750bb0c8afad9da1a5b754fb749233daf44c7aee9773819b61e6125544e116d96b157bd774b20145acbce2e6f5fdd51ecc0e4cab8de0161126 languageName: node linkType: hard -"@polkadot/x-fetch@npm:^10.0.1": - version: 10.0.1 - resolution: "@polkadot/x-fetch@npm:10.0.1" +"@polkadot/x-fetch@npm:^10.0.2": + version: 10.0.2 + resolution: "@polkadot/x-fetch@npm:10.0.2" dependencies: "@babel/runtime": ^7.18.6 - "@polkadot/x-global": 10.0.1 + "@polkadot/x-global": 10.0.2 "@types/node-fetch": ^2.6.2 node-fetch: ^3.2.6 - checksum: 3f452941421b7786edc256a28da550eb4d1d557b89df029a5401b14af9eb35c6bd1f3d881606ebda1d8e2c1dff380636532b95f49e376409b802b890c16af813 + checksum: c7ecc29345ff4feab7cfa1d9282c172dc7f63254f52786725c8c89e9bded138ad311c2f18fb42eb39c891090e00fbd006ec2bff7dab00ab84507991f8da54615 languageName: node linkType: hard -"@polkadot/x-global@npm:10.0.1": - version: 10.0.1 - resolution: "@polkadot/x-global@npm:10.0.1" +"@polkadot/x-global@npm:10.0.2": + version: 10.0.2 + resolution: "@polkadot/x-global@npm:10.0.2" dependencies: "@babel/runtime": ^7.18.6 - checksum: 1493f2408baf6a6c3e77c644bd9981e2db20235ed1d4859f26a96a574d42ed4bb62f32954ee940f7d4721b2f5bc88d7330122c658a1a1329c728e60aec56b831 + checksum: 2f2416f3796a2708e04a9b73ae68b29c5dd00ad800b74c674e2df3eb8d070403443a5fa0f29e08d0c1e889628e45e09e36765f8cad7c2a6c6bebf40fbae2d669 languageName: node linkType: hard -"@polkadot/x-randomvalues@npm:10.0.1": - version: 10.0.1 - resolution: "@polkadot/x-randomvalues@npm:10.0.1" +"@polkadot/x-randomvalues@npm:10.0.2": + version: 10.0.2 + resolution: "@polkadot/x-randomvalues@npm:10.0.2" dependencies: "@babel/runtime": ^7.18.6 - "@polkadot/x-global": 10.0.1 - checksum: cda0b5721a6b3fd064e4458a72cfc45e497767b291474776a2fed8a8a306d1f4c2d45746cfbe5fb6eac02265c5c30b48175d4cd6f3e928ca16b105770ae306c7 + "@polkadot/x-global": 10.0.2 + checksum: a8febcde1e09e3686d9165ac699c6a606b0411536adab522e98deef2433875236adac696f6dce2f887c202b1304cf5e512de1fe0b689bec3f5f7aeeedb03a6fe languageName: node linkType: hard -"@polkadot/x-textdecoder@npm:10.0.1": - version: 10.0.1 - resolution: "@polkadot/x-textdecoder@npm:10.0.1" +"@polkadot/x-textdecoder@npm:10.0.2": + version: 10.0.2 + resolution: "@polkadot/x-textdecoder@npm:10.0.2" dependencies: "@babel/runtime": ^7.18.6 - "@polkadot/x-global": 10.0.1 - checksum: f5c8ce059e16c220bee8a460ce29959e2ff2b71a775472f791913a6296b90461af0f6bdf9c3d16e57aee5702c6ffa27abf4e965e70e1d204bed03cee625a2b5f + "@polkadot/x-global": 10.0.2 + checksum: 93a47cc3082c2d6ca6a45552f05a5e29d33c4ca0891af2585e5e09db7e054a754faaf359fbc89b18a2c897dbd792f84b5a86fa3d98831ff0ba15015ed960f093 languageName: node linkType: hard -"@polkadot/x-textencoder@npm:10.0.1": - version: 10.0.1 - resolution: "@polkadot/x-textencoder@npm:10.0.1" +"@polkadot/x-textencoder@npm:10.0.2": + version: 10.0.2 + resolution: "@polkadot/x-textencoder@npm:10.0.2" dependencies: "@babel/runtime": ^7.18.6 - "@polkadot/x-global": 10.0.1 - checksum: f36370dbdea0a3d681a42fdbf1f40801313592d80e57714f0e6efb543442c72334f2ea9ebfd539c3eb78c424c64520943ff51628504d789c17ab180dc1f33f7d + "@polkadot/x-global": 10.0.2 + checksum: 24600fb003e48b030b610e404964630c901c65c8d1e9be95c1d0c4f385a9b40ae118d881ac50061e87ff2c4bbf1a80b3017a18ff03fd82e12b3b6102b508e6fc languageName: node linkType: hard