Filter for extensions (#7579)

This commit is contained in:
Jaco 2022-05-14 14:19:58 +02:00 committed by GitHub
parent e0f05af84b
commit 7f8f18f908
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -57,6 +57,15 @@ export const DEFAULT_DECIMALS = registry.createType('u32', 12);
export const DEFAULT_SS58 = registry.createType('u32', addressDefaults.prefix);
export const DEFAULT_AUX = ['Aux1', 'Aux2', 'Aux3', 'Aux4', 'Aux5', 'Aux6', 'Aux7', 'Aux8', 'Aux9'];
const DISALLOW_EXTENSIONS = [
// The issue here is that they build on the polkadot-js extension, which is all good and
// certainly encouraged. Copying the code, all good, it is meant to be used and broken in
// weird and wonderful ways. Then the team changed all the copyright headers to drop
// attribution to the original project. This is not good.
// See https://github.com/Koniverse/SubWallet-Extension/commit/ad4c510779e0e26c0e12159f9ee99c1763c6a0e6
'subwallet-js'
];
let api: ApiPromise;
export { api };
@ -118,7 +127,9 @@ async function retrieve (api: ApiPromise, injectedPromise: Promise<InjectedExten
]);
return {
injectedAccounts,
injectedAccounts: injectedAccounts.filter(({ meta: { source } }) =>
!DISALLOW_EXTENSIONS.includes(source)
),
properties: registry.createType('ChainProperties', {
ss58Format: api.registry.chainSS58,
tokenDecimals: api.registry.chainDecimals,