Skip to content

Commit

Permalink
Bump pjs deps (#9794)
Browse files Browse the repository at this point in the history
* Bump pjs deps

* Some cleanups

* Additional fixes

* Additional fixes

* kilt

* Additional fixes

* Headers

* Additional headers

* Additional

* Additional

* Additional

* Additional

* It seems to lint... locally.

* It seems to build... locally.

* Review adjustments
  • Loading branch information
jacogr authored Aug 19, 2023
1 parent f6bded7 commit e23c8cf
Show file tree
Hide file tree
Showing 228 changed files with 1,347 additions and 1,110 deletions.
2 changes: 1 addition & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/dev authors & contributors
// Copyright 2017-2023 @polkadot/apps authors & contributors
// SPDX-License-Identifier: Apache-2.0

import baseConfig from '@polkadot/dev/config/eslint';
Expand Down
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"devDependencies": {
"@crustio/crust-pin": "^1.0.0",
"@pinata/sdk": "^1.2.1",
"@polkadot/dev": "^0.75.26",
"@polkadot/dev": "^0.76.16",
"@types/chart.js": "^2.9.37",
"@types/file-saver": "^2.0.5",
"@types/react-beautiful-dnd": "^13.1.4",
Expand Down Expand Up @@ -99,9 +99,9 @@
"@polkadot/api-base": "^10.9.1",
"@polkadot/api-contract": "^10.9.1",
"@polkadot/api-derive": "^10.9.1",
"@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/phishing": "^0.21.5",
"@polkadot/rpc-augment": "^10.9.1",
"@polkadot/rpc-core": "^10.9.1",
Expand All @@ -112,16 +112,16 @@
"@polkadot/types-create": "^10.9.1",
"@polkadot/types-known": "^10.9.1",
"@polkadot/types-support": "^10.9.1",
"@polkadot/util": "^12.3.2",
"@polkadot/util-crypto": "^12.3.2",
"@polkadot/wasm-crypto": "^7.2.1",
"@polkadot/x-bigint": "^12.3.2",
"@polkadot/x-fetch": "^12.3.2",
"@polkadot/x-global": "^12.3.2",
"@polkadot/x-randomvalues": "^12.3.2",
"@polkadot/x-textdecoder": "^12.3.2",
"@polkadot/x-textencoder": "^12.3.2",
"@polkadot/x-ws": "^12.3.2",
"@polkadot/util": "^12.4.1",
"@polkadot/util-crypto": "^12.4.1",
"@polkadot/wasm-crypto": "^7.2.2",
"@polkadot/x-bigint": "^12.4.1",
"@polkadot/x-fetch": "^12.4.1",
"@polkadot/x-global": "^12.4.1",
"@polkadot/x-randomvalues": "^12.4.1",
"@polkadot/x-textdecoder": "^12.4.1",
"@polkadot/x-textencoder": "^12.4.1",
"@polkadot/x-ws": "^12.4.1",
"styled-components": "^5.3.1",
"typescript": "^5.1.6"
}
Expand Down
10 changes: 5 additions & 5 deletions packages/apps-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@
"@phala/typedefs": "0.2.33",
"@polkadot/api": "^10.9.1",
"@polkadot/api-derive": "^10.9.1",
"@polkadot/networks": "^12.3.2",
"@polkadot/networks": "^12.4.1",
"@polkadot/react-identicon": "^3.5.1",
"@polkadot/types": "^10.9.1",
"@polkadot/types-codec": "^10.9.1",
"@polkadot/util": "^12.3.2",
"@polkadot/wasm-util": "^7.2.1",
"@polkadot/x-fetch": "^12.3.2",
"@polkadot/x-ws": "^12.3.2",
"@polkadot/util": "^12.4.1",
"@polkadot/wasm-util": "^7.2.2",
"@polkadot/x-fetch": "^12.4.1",
"@polkadot/x-ws": "^12.4.1",
"@polymeshassociation/polymesh-types": "5.4.1",
"@snowfork/snowbridge-types": "0.2.7",
"@sora-substrate/type-definitions": "1.17.16",
Expand Down
4 changes: 4 additions & 0 deletions packages/apps-config/src/api/chain/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import type { OverrideBundleDefinition } from '@polkadot/types/types';
import cere from './cere.js';
import kilt from './kilt.js';

if (!kilt) {
throw new Error('Unable to retrieve kilt');
}

// NOTE: The mapping is done from chain name in system.chain
const chain: Record<string, OverrideBundleDefinition> = {
'Cere Mainnet Beta': cere,
Expand Down
8 changes: 5 additions & 3 deletions packages/apps-config/src/api/chain/kilt.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// Copyright 2017-2023 @polkadot/apps-config authors & contributors
// SPDX-License-Identifier: Apache-2.0

import type { OverrideBundleDefinition } from '@polkadot/types/types';

import { typesBundle } from '@kiltprotocol/type-definitions';

export default typesBundle.chain as Record<string, OverrideBundleDefinition>;
if (!typesBundle.chain) {
throw new Error('Unable to find chain defintions');
}

export default typesBundle.chain;
4 changes: 2 additions & 2 deletions packages/apps-config/src/api/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/app-accounts authors & contributors
// Copyright 2017-2023 @polkadot/apps-config authors & contributors
// SPDX-License-Identifier: Apache-2.0

import type { HexString } from '@polkadot/util/types';
Expand All @@ -9,7 +9,7 @@ import { assert, BN } from '@polkadot/util';
function getGenesis (name: string): HexString {
const network = Object.entries(knownGenesis).find(([network]) => network === name);

assert(network && network[1][0], `Unable to find genesisHash for ${name}`);
assert(network?.[1][0], `Unable to find genesisHash for ${name}`);

return network[1][0];
}
Expand Down
2 changes: 1 addition & 1 deletion packages/apps-config/src/api/derives.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const mapping: [OverrideBundleDefinition, string[]][] = [
export function applyDerives (typesBundle: OverrideBundleType): OverrideBundleType {
mapping.forEach(([{ derives }, chains]): void => {
chains.forEach((chain): void => {
if (typesBundle.spec && typesBundle.spec[chain]) {
if (typesBundle.spec?.[chain]) {
typesBundle.spec[chain].derives = derives;
}
});
Expand Down
2 changes: 1 addition & 1 deletion packages/apps-config/src/api/params/inflation.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/app-config authors & contributors
// Copyright 2017-2023 @polkadot/apps-config authors & contributors
// SPDX-License-Identifier: Apache-2.0

import type { ApiPromise } from '@polkadot/api';
Expand Down
2 changes: 1 addition & 1 deletion packages/apps-config/src/api/params/teleport.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/app-config authors & contributors
// Copyright 2017-2023 @polkadot/apps-config authors & contributors
// SPDX-License-Identifier: Apache-2.0

import type { ApiPromise } from '@polkadot/api';
Expand Down
4 changes: 2 additions & 2 deletions packages/apps-config/src/api/params/tracks/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/app-config authors & contributors
// Copyright 2017-2023 @polkadot/apps-config authors & contributors
// SPDX-License-Identifier: Apache-2.0

import type { ApiPromise } from '@polkadot/api';
Expand Down Expand Up @@ -31,5 +31,5 @@ const KNOWN_SPEC_TRACKS: Record<string, Record<string, TrackInfo[]>> = {
export function getGovernanceTracks (api: ApiPromise, specName: string, palletReferenda: string): TrackInfo[] | undefined {
const lookup = KNOWN_GENE_TRACKS[api.genesisHash.toHex()] || KNOWN_SPEC_TRACKS[specName];

return lookup && lookup[palletReferenda];
return lookup?.[palletReferenda];
}
2 changes: 1 addition & 1 deletion packages/apps-config/src/api/params/tracks/kusama.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/app-config authors & contributors
// Copyright 2017-2023 @polkadot/apps-config authors & contributors
// SPDX-License-Identifier: Apache-2.0

import type { TrackInfo } from './types.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/apps-config/src/api/params/tracks/polkadot.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/app-config authors & contributors
// Copyright 2017-2023 @polkadot/apps-config authors & contributors
// SPDX-License-Identifier: Apache-2.0

import type { TrackInfo } from './types.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/apps-config/src/api/params/tracks/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/app-config authors & contributors
// Copyright 2017-2023 @polkadot/apps-config authors & contributors
// SPDX-License-Identifier: Apache-2.0

import type { BN } from '@polkadot/util';
Expand Down
2 changes: 1 addition & 1 deletion packages/apps-config/src/api/params/tracks/util.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/app-config authors & contributors
// Copyright 2017-2023 @polkadot/apps-config authors & contributors
// SPDX-License-Identifier: Apache-2.0

import type { BN } from '@polkadot/util';
Expand Down
6 changes: 3 additions & 3 deletions packages/apps-config/src/ci/fetch.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/apps authors & contributors
// Copyright 2017-2023 @polkadot/apps-config authors & contributors
// SPDX-License-Identifier: Apache-2.0

import { fetch } from '@polkadot/x-fetch';
Expand Down Expand Up @@ -37,9 +37,9 @@ function fetchWithTimeout (url: string, timeout = 2_000): Promise<Response | nul
}

export function fetchJson <T> (url: string, timeout?: number): Promise<T | null> {
return fetchWithTimeout(url, timeout).then<T | null>((r) => r && r.json());
return fetchWithTimeout(url, timeout).then<T | null>((r) => r?.json() || null);
}

export function fetchText (url: string, timeout?: number): Promise<string | null> {
return fetchWithTimeout(url, timeout).then((r) => r && r.text());
return fetchWithTimeout(url, timeout).then((r) => r?.text() || null);
}
18 changes: 10 additions & 8 deletions packages/apps-config/src/endpoints/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,23 @@ describe('urls are sorted', (): void => {
lastHeader = text as string;
} else {
it(`${lastHeader}:: ${text as string}:: ${textBy}`, (): void => {
const item = filtered[index - 1];

assert((
filtered[index - 1].isHeader ||
filtered[index - 1].linked ||
item.isHeader ||
item.linked ||
(
isNumber(filtered[index - 1].paraId) &&
isNumber(item.paraId) &&
(
(filtered[index - 1].paraId as number) < 2000
item.paraId < 2000
? isNumber(paraId) && paraId >= 2000
: false
)
) ||
filtered[index - 1].text === '' ||
text === filtered[index - 1].text ||
(text as string).localeCompare(filtered[index - 1].text as string) === 1
), `${lastHeader}:: ${text as string} needs to be before ${filtered[index - 1].text as string}`);
item.text === '' ||
text === item.text ||
(text as string).localeCompare(item.text as string) === 1
), `${lastHeader}:: ${text as string} needs to be before ${item.text as string}`);
});
}
});
Expand Down
2 changes: 1 addition & 1 deletion packages/apps-config/src/settings/ss58.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/ui-settings authors & contributors
// Copyright 2017-2023 @polkadot/apps-config authors & contributors
// SPDX-License-Identifier: Apache-2.0

import type { TFunction } from '../types.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/apps-electron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"electron-updater": "^5.3.0"
},
"devDependencies": {
"@polkadot/dev": "^0.75.26",
"@polkadot/dev": "^0.76.16",
"@types/tmp": "^0.2.3",
"copy-webpack-plugin": "^11.0.0",
"electron": "25.0.1",
Expand Down
4 changes: 1 addition & 3 deletions packages/apps-electron/src/main/ipc-main-handler.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// Copyright 2017-2023 @polkadot/apps authors & contributors
// SPDX-License-Identifier: Apache-2.0

export type IpcMainHandler = {
[channel: string]: (...args: any[]) => unknown
}
export type IpcMainHandler = Record<string, (...args: any[]) => unknown>;
2 changes: 1 addition & 1 deletion packages/apps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"dependencies": {
"@polkadot/apps-config": "^0.132.2-55-x",
"@polkadot/apps-routing": "^0.132.2-55-x",
"@polkadot/dev": "^0.75.26",
"@polkadot/dev": "^0.76.16",
"@polkadot/react-api": "^0.132.2-55-x",
"@polkadot/react-components": "^0.132.2-55-x",
"@polkadot/react-hooks": "^0.132.2-55-x",
Expand Down
4 changes: 2 additions & 2 deletions packages/page-accounts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
"type": "module",
"version": "0.132.2-55-x",
"dependencies": {
"@polkadot/hw-ledger": "^12.3.2",
"@polkadot/hw-ledger": "^12.4.1",
"@polkadot/phishing": "^0.21.5",
"@polkadot/react-components": "^0.132.2-55-x",
"@polkadot/react-hooks": "^0.132.2-55-x",
"@polkadot/util": "^12.3.2",
"@polkadot/util": "^12.4.1",
"@polkadot/vanitygen": "^0.55.3",
"detect-browser": "^5.3.0",
"file-saver": "^2.0.5"
Expand Down
10 changes: 5 additions & 5 deletions packages/page-accounts/src/Accounts/Account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ function createClearReferendaTx (api: ApiPromise, address: string, ids: [BN, BN]
async function showLedgerAddress (getLedger: () => Ledger, meta: KeyringJson$Meta): Promise<void> {
const ledger = getLedger();

await ledger.getAddress(true, meta.accountOffset as number || 0, meta.addressOffset as number || 0);
await ledger.getAddress(true, meta.accountOffset || 0, meta.addressOffset || 0);
}

const transformRecovery = {
Expand Down Expand Up @@ -405,7 +405,7 @@ function Account ({ account: { address, meta }, className = '', delegation, filt
isFunction(api.api.tx.multisig?.asMulti) && isMultisig && createMenuGroup('multisigGroup', [
<Menu.Item
icon='file-signature'
isDisabled={!multiInfos || !multiInfos.length}
isDisabled={!multiInfos?.length}
key='multisigApprovals'
label={t('Multisig approvals')}
onClick={toggleMultisig}
Expand Down Expand Up @@ -471,7 +471,7 @@ function Account ({ account: { address, meta }, className = '', delegation, filt
/>
<td className='address all relative'>
<AddressSmall
parentAddress={meta.parentAddress as string}
parentAddress={meta.parentAddress}
value={address}
withShortAddress
/>
Expand Down Expand Up @@ -549,8 +549,8 @@ function Account ({ account: { address, meta }, className = '', delegation, filt
key='multisig-approve'
onClose={toggleMultisig}
ongoing={multiInfos}
threshold={meta.threshold as number}
who={meta.who as string[]}
threshold={meta.threshold}
who={meta.who}
/>
)}
{isRecoverAccountOpen && (
Expand Down
2 changes: 1 addition & 1 deletion packages/page-accounts/src/Accounts/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/page-accounts authors & contributors
// Copyright 2017-2023 @polkadot/app-accounts authors & contributors
// SPDX-License-Identifier: Apache-2.0

/// <reference types="@polkadot/dev-test/globals.d.ts" />
Expand Down
2 changes: 1 addition & 1 deletion packages/page-accounts/src/Accounts/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function groupAccounts (accounts: SortedAccount[]): Record<GroupName, string[]>
testing: []
};

for (let i = 0; i < accounts.length; i++) {
for (let i = 0, count = accounts.length; i < count; i++) {
const { account, address } = accounts[i];
const cryptoType = getAccountCryptoType(address);

Expand Down
4 changes: 2 additions & 2 deletions packages/page-accounts/src/Accounts/useProxies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ function useProxiesImpl (address?: string | null): State | null {
useEffect((): void => {
setState(null);

address && api.query.proxy &&
address &&
api.query.proxy
.proxies<ITuple<[Vec<ITuple<[AccountId, KitchensinkRuntimeProxyType]> | PalletProxyProxyDefinition>, BalanceOf]>>(address)
?.proxies<ITuple<[Vec<ITuple<[AccountId, KitchensinkRuntimeProxyType]> | PalletProxyProxyDefinition>, BalanceOf]>>(address)
.then(([_proxies]): void => {
const proxies = api.tx.proxy.addProxy.meta.args.length === 3
? (_proxies as PalletProxyProxyDefinition[]).map(({ delay, delegate, proxyType }) =>
Expand Down
2 changes: 1 addition & 1 deletion packages/page-accounts/src/modals/Create.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/page-accounts authors & contributors
// Copyright 2017-2023 @polkadot/app-accounts authors & contributors
// SPDX-License-Identifier: Apache-2.0

/// <reference types="@polkadot/dev-test/globals.d.ts" />
Expand Down
4 changes: 2 additions & 2 deletions packages/page-accounts/src/modals/CreateConfirmation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ interface Props {
function CreateConfirmation ({ address, derivePath, name, pairType, seed }: Props): React.ReactElement<Props> | null {
const { t } = useTranslation();

const splitSeed = seed && seed.split(' ');
const splitSeed = seed?.split(' ');
const shortSeed = isHex(seed)
? `${seed.slice(10)}${seed.slice(-8)}`
: splitSeed && splitSeed.map((value, index) => (index % 3) ? '…' : value).join(' ');
: splitSeed?.map((value, index) => (index % 3) ? '…' : value).join(' ');

return (
<Modal.Content>
Expand Down
2 changes: 1 addition & 1 deletion packages/page-accounts/src/modals/CreateSuriLedger.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function CreateSuriLedger ({ className, onChange, seedType }: Props): React.Reac
useEffect((): void => {
const network = ledgerNets.find(({ network }) => network === chainType);

onChange(`m/44'/${network?.slip44 as number}'/${accIndex}'/0'/${addIndex}'`);
onChange(`m/44'/${network?.slip44}'/${accIndex}'/0'/${addIndex}'`);
}, [accIndex, addIndex, chainType, onChange]);

return (
Expand Down
4 changes: 2 additions & 2 deletions packages/page-accounts/src/modals/IdentitySub.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ function IdentitySubModal ({ address, className, onClose }: Props): React.ReactE
}, [allAccounts, queryIds, queryInfos]);

const _rowAdd = useCallback(
() => setInfos((infos) => infos && infos.concat([[allAccounts[0], '']])),
() => setInfos((infos) => infos?.concat([[allAccounts[0], '']])),
[allAccounts]
);

const _rowRemove = useCallback(
() => setInfos((infos) => infos && infos.slice(0, infos.length - 1)),
() => setInfos((infos) => infos?.slice(0, infos.length - 1)),
[]
);

Expand Down
2 changes: 1 addition & 1 deletion packages/page-accounts/src/modals/Import.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ function Import ({ className = '', onClose, onStatusChange }: Props): React.Reac
<Modal.Content>
<Modal.Columns>
<AddressRow
defaultName={(pair?.meta.name as string) || null}
defaultName={pair?.meta.name || null}
noDefaultNameOpacity
value={pair?.address || null}
/>
Expand Down
Loading

0 comments on commit e23c8cf

Please sign in to comment.