This commit is contained in:
Jaco 2023-08-18 10:22:07 +03:00 committed by GitHub
parent 8fec81cfc3
commit 8487f528bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 1280 additions and 1006 deletions

View File

@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/dev authors & contributors
// Copyright 2017-2023 @polkadot/extension authors & contributors
// SPDX-License-Identifier: Apache-2.0
import baseConfig from '@polkadot/dev/config/eslint';

View File

@ -40,19 +40,19 @@
"watch": "cd packages/extension && yarn polkadot-exec-webpack --config webpack.watch.cjs --mode development --watch"
},
"devDependencies": {
"@polkadot/dev": "^0.75.27",
"@types/node": "^20.4.1",
"@polkadot/dev": "^0.76.16",
"@types/node": "^20.5.0",
"i18next-scanner": "^4.3.0",
"sinon-chrome": "^3.0.1"
},
"resolutions": {
"@polkadot/api": "^10.9.1",
"@polkadot/keyring": "^12.3.2",
"@polkadot/networks": "^12.3.2",
"@polkadot/keyring": "^12.4.1",
"@polkadot/networks": "^12.4.1",
"@polkadot/types": "^10.9.1",
"@polkadot/util": "^12.3.2",
"@polkadot/util-crypto": "^12.3.2",
"@polkadot/x-fetch": "^12.3.2",
"@polkadot/util": "^12.4.1",
"@polkadot/util-crypto": "^12.4.1",
"@polkadot/x-fetch": "^12.4.1",
"safe-buffer": "^5.2.1",
"typescript": "^5.0.3"
}

View File

@ -25,18 +25,18 @@
"@polkadot/extension-chains": "0.46.6-2-x",
"@polkadot/extension-dapp": "0.46.6-2-x",
"@polkadot/extension-inject": "0.46.6-2-x",
"@polkadot/keyring": "^12.3.2",
"@polkadot/networks": "^12.3.2",
"@polkadot/keyring": "^12.4.1",
"@polkadot/networks": "^12.4.1",
"@polkadot/phishing": "^0.21.5",
"@polkadot/rpc-provider": "^10.9.1",
"@polkadot/types": "^10.9.1",
"@polkadot/ui-keyring": "^3.5.1",
"@polkadot/ui-settings": "^3.5.1",
"@polkadot/util": "^12.3.2",
"@polkadot/util-crypto": "^12.3.2",
"@polkadot/util": "^12.4.1",
"@polkadot/util-crypto": "^12.4.1",
"eventemitter3": "^5.0.1",
"rxjs": "^7.8.1",
"tslib": "^2.6.0"
"tslib": "^2.6.1"
},
"devDependencies": {
"@polkadot/extension-mocks": "0.46.6-2-x"

View File

@ -20,12 +20,15 @@ const tabs = new Tabs(state);
export default function handler<TMessageType extends MessageTypes> ({ id, message, request }: TransportRequestMessage<TMessageType>, port?: chrome.runtime.Port, extensionPortName = PORT_EXTENSION): void {
const isExtension = !port || port?.name === extensionPortName;
const sender = port?.sender;
const sender = port?.sender as chrome.runtime.MessageSender;
if (!sender) {
throw new Error('Unable to extract message sender');
}
const from = isExtension
? 'extension'
: (sender.tab && sender.tab.url) || sender.url || '<unknown>';
: (sender.tab?.url) || sender.url || '<unknown>';
const source = `${from}: ${id}: ${message}`;
console.log(` [in] ${source}`); // :: ${JSON.stringify(request)}`);

View File

@ -47,7 +47,7 @@ export type AccountWithChildren = AccountJson & {
children?: AccountWithChildren[];
}
export type AccountsContext = {
export interface AccountsContext {
accounts: AccountJson[];
hierarchy: AccountWithChildren[];
master?: AccountJson;

View File

@ -50,7 +50,7 @@ export default class PostMessageProvider implements InjectedProvider {
}
public get isClonable (): boolean {
return true;
return !!true;
}
/**
@ -83,7 +83,7 @@ export default class PostMessageProvider implements InjectedProvider {
*/
public get hasSubscriptions (): boolean {
// FIXME This should see if the extension's state's provider has subscriptions
return true;
return !!true;
}
/**

View File

@ -22,10 +22,10 @@
"main": "index.js",
"dependencies": {
"@polkadot/extension-inject": "0.46.6-2-x",
"@polkadot/networks": "^12.3.2",
"@polkadot/util": "^12.3.2",
"@polkadot/util-crypto": "^12.3.2",
"tslib": "^2.6.0"
"@polkadot/networks": "^12.4.1",
"@polkadot/util": "^12.4.1",
"@polkadot/util-crypto": "^12.4.1",
"tslib": "^2.6.1"
},
"peerDependencies": {
"@polkadot/api": "*",

View File

@ -24,9 +24,9 @@
"@metamask/detect-provider": "^2.0.0",
"@polkadot/extension-inject": "0.46.6-2-x",
"@polkadot/types": "^10.9.1",
"@polkadot/util": "^12.3.2",
"tslib": "^2.6.0",
"web3": "^1.10.0"
"@polkadot/util": "^12.4.1",
"tslib": "^2.6.1",
"web3": "^1.10.1"
},
"peerDependencies": {
"@polkadot/api": "*",

View File

@ -22,9 +22,9 @@
"main": "index.js",
"dependencies": {
"@polkadot/extension-inject": "0.46.6-2-x",
"@polkadot/util": "^12.3.2",
"@polkadot/util-crypto": "^12.3.2",
"tslib": "^2.6.0"
"@polkadot/util": "^12.4.1",
"@polkadot/util-crypto": "^12.4.1",
"tslib": "^2.6.1"
},
"peerDependencies": {
"@polkadot/api": "*",

View File

@ -21,13 +21,13 @@
"@polkadot/api": "^10.9.1",
"@polkadot/rpc-provider": "^10.9.1",
"@polkadot/types": "^10.9.1",
"@polkadot/util": "^12.3.2",
"@polkadot/util-crypto": "^12.3.2",
"@polkadot/x-global": "^12.3.2",
"tslib": "^2.6.0"
"@polkadot/util": "^12.4.1",
"@polkadot/util-crypto": "^12.4.1",
"@polkadot/x-global": "^12.4.1",
"tslib": "^2.6.1"
},
"devDependencies": {
"@types/chrome": "^0.0.240",
"@types/chrome": "^0.0.243",
"@types/firefox-webext-browser": "^111.0.1"
},
"peerDependencies": {

View File

@ -19,6 +19,6 @@
"main": "index.js",
"dependencies": {
"sinon-chrome": "^3.0.1",
"tslib": "^2.6.0"
"tslib": "^2.6.1"
}
}

View File

@ -17,27 +17,27 @@
"type": "module",
"version": "0.46.6-2-x",
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^6.4.0",
"@fortawesome/free-brands-svg-icons": "^6.4.0",
"@fortawesome/free-regular-svg-icons": "^6.4.0",
"@fortawesome/free-solid-svg-icons": "^6.4.0",
"@fortawesome/fontawesome-svg-core": "^6.4.2",
"@fortawesome/free-brands-svg-icons": "^6.4.2",
"@fortawesome/free-regular-svg-icons": "^6.4.2",
"@fortawesome/free-solid-svg-icons": "^6.4.2",
"@fortawesome/react-fontawesome": "^0.2.0",
"@polkadot/api": "^10.9.1",
"@polkadot/extension-base": "0.46.6-2-x",
"@polkadot/extension-chains": "0.46.6-2-x",
"@polkadot/extension-dapp": "0.46.6-2-x",
"@polkadot/extension-inject": "0.46.6-2-x",
"@polkadot/hw-ledger": "^12.3.2",
"@polkadot/keyring": "^12.3.2",
"@polkadot/networks": "^12.3.2",
"@polkadot/hw-ledger": "^12.4.1",
"@polkadot/keyring": "^12.4.1",
"@polkadot/networks": "^12.4.1",
"@polkadot/react-identicon": "^3.5.1",
"@polkadot/react-qr": "^3.5.1",
"@polkadot/types": "^10.9.1",
"@polkadot/types-augment": "^10.9.1",
"@polkadot/ui-keyring": "^3.5.1",
"@polkadot/ui-settings": "^3.5.1",
"@polkadot/util": "^12.3.2",
"@polkadot/util-crypto": "^12.3.2",
"@polkadot/util": "^12.4.1",
"@polkadot/util-crypto": "^12.4.1",
"file-saver": "^2.0.5",
"i18next": "^23.2.8",
"react": "^18.2.0",
@ -48,7 +48,7 @@
"react-router": "^5.3.4",
"react-router-dom": "^5.3.4",
"styled-components": "^5.3.11",
"tslib": "^2.6.0"
"tslib": "^2.6.1"
},
"devDependencies": {
"@polkadot/extension-mocks": "0.46.6-2-x",
@ -56,7 +56,7 @@
"@types/enzyme-adapter-react-16": "^1.0.6",
"@types/file-saver": "^2.0.5",
"@types/react-copy-to-clipboard": "^5.0.4",
"@types/react-dom": "^18.2.6",
"@types/react-dom": "^18.2.7",
"@types/react-router": "^5.1.20",
"@types/react-router-dom": "^5.3.3",
"@types/sinon-chrome": "^2.2.11",

View File

@ -36,7 +36,7 @@ function WebsiteEntry ({ className = '', info: { authorizedAccounts, isAllowed }
className='connectedAccounts'
to={`/url/manage/${url}`}
>{
authorizedAccounts && authorizedAccounts.length
authorizedAccounts?.length
? t('{{total}} accounts', {
replace: {
total: authorizedAccounts.length

View File

@ -28,7 +28,7 @@ function ImportSeed (): React.ReactElement {
const [name, setName] = useState<string | null>(null);
const [step1, setStep1] = useState(true);
const [type, setType] = useState(DEFAULT_TYPE);
const chain = useMetadata(account && account.genesis, true);
const chain = useMetadata(account?.genesis, true);
useEffect((): void => {
!accounts.length && onAction();

View File

@ -112,8 +112,8 @@ export default function Request ({ account: { accountIndex, addressOffset, genes
}
{isHardware && (
<LedgerSign
accountIndex={accountIndex as number || 0}
addressOffset={addressOffset as number || 0}
accountIndex={accountIndex || 0}
addressOffset={addressOffset || 0}
error={error}
genesisHash={json.genesisHash}
onSignature={_onSignature}

View File

@ -129,11 +129,11 @@ export default function Popup (): React.ReactElement {
}
const Root = isWelcomeDone
? authRequests && authRequests.length
? authRequests?.length
? wrapWithErrorBoundary(<Authorize />, 'authorize')
: metaRequests && metaRequests.length
: metaRequests?.length
? wrapWithErrorBoundary(<Metadata />, 'metadata')
: signRequests && signRequests.length
: signRequests?.length
? wrapWithErrorBoundary(<Signing />, 'signing')
: wrapWithErrorBoundary(<Accounts />, 'accounts')
: wrapWithErrorBoundary(<Welcome />, 'welcome');

View File

@ -342,7 +342,7 @@ describe('Address', () => {
});
it('shows the parent account and suri', () => {
const expectedParentNameSuri = getParentNameSuri(childAccount.parentName as string, childAccount.suri);
const expectedParentNameSuri = getParentNameSuri(childAccount.parentName, childAccount.suri);
expect(wrapper.find('.parentName').text()).toEqual(expectedParentNameSuri);
});

View File

@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/react-components authors & contributors
// Copyright 2017-2023 @polkadot/extension-ui authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { DropzoneRef } from 'react-dropzone';
@ -74,7 +74,7 @@ function InputFile ({ accept, className = '', clearContent, convertHex, isDisabl
reader.onerror = NOOP;
reader.onload = ({ target }: ProgressEvent<FileReader>): void => {
if (target && target.result) {
if (target?.result) {
const name = file.name;
const data = convertResult(target.result as ArrayBuffer, convertHex);

View File

@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/react-components authors & contributors
// Copyright 2017-2023 @polkadot/extension-ui authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { ThemeProps } from '../types.js';

View File

@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/react-components authors & contributors
// Copyright 2017-2023 @polkadot/extension-ui authors & contributors
// SPDX-License-Identifier: Apache-2.0
import languageCache from './cache.js';
@ -10,9 +10,9 @@ type LoadResult = [string | null, Record<string, string> | boolean];
const loaders: Record<string, Promise<LoadResult>> = {};
export default class Backend {
type = <const> 'backend';
type = 'backend' as const;
static type = <const> 'backend';
static type = 'backend' as const;
async read (lng: string, _namespace: string, responder: Callback): Promise<void> {
if (languageCache[lng]) {

View File

@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/react-components authors & contributors
// Copyright 2017-2023 @polkadot/extension-ui authors & contributors
// SPDX-License-Identifier: Apache-2.0
const languageCache: Record<string, Record<string, string>> = {};

View File

@ -21,10 +21,10 @@
"@polkadot/extension-base": "0.46.6-2-x",
"@polkadot/extension-inject": "0.46.6-2-x",
"@polkadot/extension-ui": "0.46.6-2-x",
"tslib": "^2.6.0"
"tslib": "^2.6.1"
},
"devDependencies": {
"@polkadot/dev": "^0.75.27",
"@polkadot/dev": "^0.76.16",
"browser-resolve": "^2.0.0",
"buffer": "^6.0.3",
"copy-webpack-plugin": "^11.0.0",

2159
yarn.lock

File diff suppressed because it is too large Load Diff