Check addesses against known list (#98)

This commit is contained in:
Jaco Greeff
2021-02-12 22:03:06 +01:00
committed by GitHub
parent 2e706deb07
commit 610774754b
3 changed files with 20 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
{
"binance": [
"1exaAg2VJRQbyUBAeXcktChCAqjVP9TUxF3zo23R2T6EGdE"
],
"simpleswap.io": [
"14QsifyV7XyEDay8C862PNLRngid2AGZmtCwz1K88x5gpf58"
]
}
+11
View File
@@ -1,6 +1,8 @@
// Copyright 2020-2021 @polkadot/phishing authors & contributors // Copyright 2020-2021 @polkadot/phishing authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import denied from '../../../address.json';
import allowed from '../../../known.json';
import { checkAddress, checkIfDenied } from '.'; import { checkAddress, checkIfDenied } from '.';
describe('checkIfDenied', (): void => { describe('checkIfDenied', (): void => {
@@ -60,3 +62,12 @@ describe('checkAddress', (): void => {
).toEqual('polkadots.network'); ).toEqual('polkadots.network');
}); });
}); });
describe('check additions', (): void => {
it('has no entries on the known addresses list', (): void => {
const added = Object.values(denied as Record<string, string[]>).reduce((all: string[], addrs: string[]) => all.concat(addrs), []);
const dupes = Object.entries(allowed as Record<string, string[]>).reduce((all: [string, string][], [site, addrs]) => all.concat(addrs.map((a) => [site, a])), []).filter(([, a]) => added.includes(a));
expect(dupes).toEqual([]);
});
});
+1
View File
@@ -11,6 +11,7 @@
"@polkadot/phishing": ["packages/phishing/src"], "@polkadot/phishing": ["packages/phishing/src"],
"@polkadot/phishing/*": ["packages/phishing/src/*"] "@polkadot/phishing/*": ["packages/phishing/src/*"]
}, },
"resolveJsonModule": true,
"skipLibCheck": true, "skipLibCheck": true,
"typeRoots": [ "typeRoots": [
"./node_modules/@types" "./node_modules/@types"