Update deps (& berry) (#4765)

* Update deps (& berry)

* linting

* Additional

* Bumps

* jest babel helpers esm
This commit is contained in:
Jaco Greeff 2021-03-03 11:52:39 +01:00 committed by GitHub
parent adf36bd5bb
commit 7d2d1842d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
36 changed files with 474 additions and 450 deletions

File diff suppressed because one or more lines are too long

View File

@ -10,4 +10,4 @@ plugins:
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs - path: .yarn/plugins/@yarnpkg/plugin-version.cjs
spec: "@yarnpkg/plugin-version" spec: "@yarnpkg/plugin-version"
yarnPath: .yarn/releases/yarn-2.4.0.cjs yarnPath: .yarn/releases/yarn-2.4.1.cjs

View File

@ -3,7 +3,7 @@
const config = require('@polkadot/dev/config/jest.cjs'); const config = require('@polkadot/dev/config/jest.cjs');
const findPackages = require('./scripts/findPackages'); const findPackages = require('./scripts/findPackages.cjs');
const internalModules = findPackages() const internalModules = findPackages()
.filter(({ name }) => !['@polkadot/apps'].includes(name)) .filter(({ name }) => !['@polkadot/apps'].includes(name))
@ -22,9 +22,7 @@ const defaultConfig = {
'\\.(md)$': '<rootDir>/jest/mocks/empty.js' '\\.(md)$': '<rootDir>/jest/mocks/empty.js'
}, },
setupFilesAfterEnv: ['<rootDir>/jest/jest-setup.ts'], setupFilesAfterEnv: ['<rootDir>/jest/jest-setup.ts'],
transformIgnorePatterns: [ transformIgnorePatterns: ['/node_modules/(?!@polkadot|@babel/runtime/helpers/esm/|rxjs/_esm5)']
'<rootDir>/node_modules'
]
}; };
module.exports = Object.assign({}, config, { module.exports = Object.assign({}, config, {

View File

@ -12,37 +12,37 @@
"packages/*" "packages/*"
], ],
"resolutions": { "resolutions": {
"@polkadot/api": "^3.11.2-3", "@polkadot/api": "^4.0.1-4",
"@polkadot/api-contract": "^3.11.2-3", "@polkadot/api-contract": "^4.0.1-4",
"@polkadot/hw-ledger": "^5.9.3-0", "@polkadot/hw-ledger": "^6.0.1-5",
"@polkadot/keyring": "^5.9.3-0", "@polkadot/keyring": "^6.0.1-5",
"@polkadot/networks": "^5.9.3-0", "@polkadot/networks": "^6.0.1-5",
"@polkadot/phishing": "^0.6.2", "@polkadot/phishing": "^0.6.2",
"@polkadot/types": "^3.11.2-3", "@polkadot/types": "^4.0.1-4",
"@polkadot/util": "^5.9.3-0", "@polkadot/util": "^6.0.1-5",
"@polkadot/util-crypto": "^5.9.3-0", "@polkadot/util-crypto": "^6.0.1-5",
"@polkadot/wasm-crypto": "^3.2.4", "@polkadot/wasm-crypto": "^4.0.1-5",
"@polkadot/x-rxjs": "^5.9.3-0", "@polkadot/x-rxjs": "^6.0.1-5",
"babel-core": "^7.0.0-bridge.0", "babel-core": "^7.0.0-bridge.0",
"styled-components": "^5.2.0", "styled-components": "^5.2.0",
"typescript": "^4.1.5" "typescript": "^4.2.2"
}, },
"scripts": { "scripts": {
"analyze": "yarn clean && BUILD_ANALYZE=1 yarn run build:code && yarn source-map-explorer packages/apps/build/main.*.js", "analyze": "yarn clean && BUILD_ANALYZE=1 yarn run build:code && yarn source-map-explorer packages/apps/build/main.*.js",
"build": "yarn run build:i18n && yarn run build:code", "build": "yarn run build:i18n && yarn run build:code",
"build:code": "NODE_ENV=production yarn polkadot-dev-build-ts", "build:code": "NODE_ENV=production yarn polkadot-dev-build-ts",
"build:i18n": "i18next-scanner --config i18next-scanner.config.js && node ./scripts/i18nSort.js", "build:i18n": "i18next-scanner --config i18next-scanner.config.js && node ./scripts/i18nSort.cjs",
"build:release:electron": "yarn build && yarn build:electron && yarn postinstall:electron", "build:release:electron": "yarn build && yarn build:electron && yarn postinstall:electron",
"build:release:ipfs": "node scripts/ipfsUpload.js", "build:release:ipfs": "node scripts/ipfsUpload.cjs",
"build:release:ghpages": "yarn polkadot-ci-ghact-docs", "build:release:ghpages": "yarn polkadot-ci-ghact-docs",
"build:release:www": "yarn polkadot-ci-ghact-build && yarn build:release:ipfs && yarn build:release:ghpages", "build:release:www": "yarn polkadot-ci-ghact-build && yarn build:release:ipfs && yarn build:release:ghpages",
"build:robohash": "node scripts/robohash.js", "build:robohash": "node scripts/robohash.cjs",
"build:www": "rm -rf packages/apps/build && mkdir -p packages/apps/build && yarn run build:i18n && cd packages/apps && yarn webpack --config webpack.config.js", "build:www": "rm -rf packages/apps/build && mkdir -p packages/apps/build && yarn run build:i18n && cd packages/apps && yarn webpack --config webpack.config.cjs",
"build:electron": "yarn clean:electronBuild && yarn build:electronMain && yarn build:electronRenderer", "build:electron": "yarn clean:electronBuild && yarn build:electronMain && yarn build:electronRenderer",
"build:devElectronRenderer": "cd packages/apps-electron && yarn webpack --config webpack.renderer.js", "build:devElectronRenderer": "cd packages/apps-electron && yarn webpack --config webpack.renderer.cjs",
"build:electronRenderer": "cd packages/apps-electron && NODE_ENV=production yarn webpack --config webpack.renderer.js", "build:electronRenderer": "cd packages/apps-electron && NODE_ENV=production yarn webpack --config webpack.renderer.cjs",
"build:devElectronMain": "cd packages/apps-electron && yarn webpack --config webpack.main.js", "build:devElectronMain": "cd packages/apps-electron && yarn webpack --config webpack.main.cjs",
"build:electronMain": "cd packages/apps-electron && NODE_ENV=production yarn webpack --config webpack.main.js", "build:electronMain": "cd packages/apps-electron && NODE_ENV=production yarn webpack --config webpack.main.cjs",
"packElectron:test": "yarn build:release:electron && electron-builder --dir", "packElectron:test": "yarn build:release:electron && electron-builder --dir",
"packElectron:mac": "yarn build:release:electron && electron-builder build --mac", "packElectron:mac": "yarn build:release:electron && electron-builder build --mac",
"packElectron:win": "yarn build:release:electron && electron-builder build --win", "packElectron:win": "yarn build:release:electron && electron-builder build --win",
@ -60,7 +60,7 @@
"test": "polkadot-dev-run-test --selectProjects=fast-tests --silent --testPathIgnorePatterns slow --testNamePattern='^((?!--SLOW--).)*$'", "test": "polkadot-dev-run-test --selectProjects=fast-tests --silent --testPathIgnorePatterns slow --testNamePattern='^((?!--SLOW--).)*$'",
"test:all": "polkadot-dev-run-test --selectProjects=all-tests --silent", "test:all": "polkadot-dev-run-test --selectProjects=all-tests --silent",
"test:one": "polkadot-dev-run-test", "test:one": "polkadot-dev-run-test",
"start": "yarn clean && cd packages/apps && yarn webpack-cli serve --config webpack.serve.js --port 3000", "start": "yarn clean && cd packages/apps && yarn webpack-cli serve --config webpack.serve.cjs --port 3000",
"start:electron": "yarn clean:electronBuild && concurrently 'yarn build:devElectronMain && cd packages/apps-electron && electron ./build/electron.js' 'yarn build:devElectronRenderer'" "start:electron": "yarn clean:electronBuild && concurrently 'yarn build:devElectronMain && cd packages/apps-electron && electron ./build/electron.js' 'yarn build:devElectronRenderer'"
}, },
"devDependencies": { "devDependencies": {
@ -68,8 +68,8 @@
"@babel/register": "^7.13.8", "@babel/register": "^7.13.8",
"@babel/runtime": "^7.13.9", "@babel/runtime": "^7.13.9",
"@pinata/sdk": "^1.1.13", "@pinata/sdk": "^1.1.13",
"@polkadot/dev": "^0.61.31", "@polkadot/dev": "^0.62.5",
"@polkadot/ts": "^0.3.60", "@polkadot/ts": "^0.3.61",
"@types/bn.js": "^4.11.6", "@types/bn.js": "^4.11.6",
"@types/chart.js": "^2.9.31", "@types/chart.js": "^2.9.31",
"@types/file-saver": "^2.0.1", "@types/file-saver": "^2.0.1",

View File

@ -1,6 +1,7 @@
{ {
"name": "@polkadot/apps-config", "name": "@polkadot/apps-config",
"version": "0.82.2-6", "version": "0.82.2-6",
"type": "module",
"main": "index.js", "main": "index.js",
"sideEffects": true, "sideEffects": true,
"repository": "github:polkadot-js/apps", "repository": "github:polkadot-js/apps",
@ -15,9 +16,9 @@
"@edgeware/node-types": "^3.3.2", "@edgeware/node-types": "^3.3.2",
"@interlay/polkabtc-types": "^0.5.2", "@interlay/polkabtc-types": "^0.5.2",
"@laminar/type-definitions": "^0.3.1", "@laminar/type-definitions": "^0.3.1",
"@polkadot/networks": "^5.9.3-0", "@polkadot/networks": "^6.0.1-5",
"@snowfork/snowbridge-types": "^0.2.3", "@snowfork/snowbridge-types": "^0.2.3",
"@sora-substrate/type-definitions": "^0.4.9", "@sora-substrate/type-definitions": "^0.4.10",
"@subsocial/types": "^0.4.33-w3f-grant2", "@subsocial/types": "^0.4.33-w3f-grant2",
"moonbeam-types-bundle": "1.1.6" "moonbeam-types-bundle": "1.1.6"
}, },

View File

@ -6,7 +6,7 @@
"dependencies": { "dependencies": {
"@babel/core": "^7.13.8", "@babel/core": "^7.13.8",
"@babel/polyfill": "^7.12.1", "@babel/polyfill": "^7.12.1",
"@polkadot/dev": "^0.61.31", "@polkadot/dev": "^0.62.5",
"@polkadot/react-components": "^0.82.2-6", "@polkadot/react-components": "^0.82.2-6",
"electron-log": "^4.3.1", "electron-log": "^4.3.1",
"electron-updater": "^4.3.7" "electron-updater": "^4.3.7"

View File

@ -8,7 +8,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path'); const path = require('path');
const { merge } = require('webpack-merge'); const { merge } = require('webpack-merge');
const baseConfig = require('../apps/webpack.base.js'); const baseConfig = require('../apps/webpack.base.cjs');
const context = __dirname; const context = __dirname;

View File

@ -16,7 +16,7 @@
"@babel/runtime": "^7.13.9", "@babel/runtime": "^7.13.9",
"@polkadot/apps-config": "^0.82.2-6", "@polkadot/apps-config": "^0.82.2-6",
"@polkadot/apps-routing": "^0.82.2-6", "@polkadot/apps-routing": "^0.82.2-6",
"@polkadot/dev": "^0.61.31", "@polkadot/dev": "^0.62.5",
"@polkadot/react-api": "^0.82.2-6", "@polkadot/react-api": "^0.82.2-6",
"@polkadot/react-components": "^0.82.2-6", "@polkadot/react-components": "^0.82.2-6",
"@polkadot/react-hooks": "^0.82.2-6", "@polkadot/react-hooks": "^0.82.2-6",

View File

@ -9,7 +9,7 @@ const CopyWebpackPlugin = require('copy-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const webpack = require('webpack'); const webpack = require('webpack');
const findPackages = require('../../scripts/findPackages'); const findPackages = require('../../scripts/findPackages.cjs');
function mapChunks (name, regs, inc) { function mapChunks (name, regs, inc) {
return regs.reduce((result, test, index) => ({ return regs.reduce((result, test, index) => ({

View File

@ -6,7 +6,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path'); const path = require('path');
const { merge } = require('webpack-merge'); const { merge } = require('webpack-merge');
const baseConfig = require('./webpack.base.js'); const baseConfig = require('./webpack.base.cjs');
const context = __dirname; const context = __dirname;
const hasPublic = fs.existsSync(path.join(context, 'public')); const hasPublic = fs.existsSync(path.join(context, 'public'));

View File

@ -6,7 +6,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin');
const webpack = require('webpack'); const webpack = require('webpack');
const { merge } = require('webpack-merge'); const { merge } = require('webpack-merge');
const baseConfig = require('./webpack.base.js'); const baseConfig = require('./webpack.base.cjs');
module.exports = merge( module.exports = merge(
baseConfig(__dirname, 'development'), baseConfig(__dirname, 'development'),

View File

@ -12,7 +12,7 @@
"@babel/runtime": "^7.13.9", "@babel/runtime": "^7.13.9",
"@polkadot/phishing": "^0.6.2", "@polkadot/phishing": "^0.6.2",
"@polkadot/react-components": "^0.82.2-6", "@polkadot/react-components": "^0.82.2-6",
"@polkadot/vanitygen": "^0.30.1", "@polkadot/vanitygen": "^0.30.2-1",
"detect-browser": "^5.2.0", "detect-browser": "^5.2.0",
"file-saver": "^2.0.5" "file-saver": "^2.0.5"
}, },

View File

@ -19,7 +19,7 @@ import { ApiPromise } from '@polkadot/api';
import { AddressInfo, AddressMini, AddressSmall, Badge, Button, ChainLock, CryptoType, Forget, Icon, IdentityIcon, LinkExternal, Menu, Popup, StatusContext, Tags } from '@polkadot/react-components'; import { AddressInfo, AddressMini, AddressSmall, Badge, Button, ChainLock, CryptoType, Forget, Icon, IdentityIcon, LinkExternal, Menu, Popup, StatusContext, Tags } from '@polkadot/react-components';
import { useAccountInfo, useApi, useCall, useLedger, useToggle } from '@polkadot/react-hooks'; import { useAccountInfo, useApi, useCall, useLedger, useToggle } from '@polkadot/react-hooks';
import { keyring } from '@polkadot/ui-keyring'; import { keyring } from '@polkadot/ui-keyring';
import { BN_ZERO, formatBalance, formatNumber } from '@polkadot/util'; import { BN_ZERO, formatBalance, formatNumber, isFunction } from '@polkadot/util';
import Backup from '../modals/Backup'; import Backup from '../modals/Backup';
import ChangePass from '../modals/ChangePass'; import ChangePass from '../modals/ChangePass';
@ -209,7 +209,7 @@ function Account ({ account: { address, meta }, className = '', delegation, filt
const menuItems = useMemo(() => [ const menuItems = useMemo(() => [
createMenuGroup([ createMenuGroup([
api.api.tx.identity?.setIdentity && !isHardware && ( isFunction(api.api.tx.identity?.setIdentity) && !isHardware && (
<Menu.Item <Menu.Item
key='identityMain' key='identityMain'
onClick={toggleIdentityMain} onClick={toggleIdentityMain}
@ -217,7 +217,7 @@ function Account ({ account: { address, meta }, className = '', delegation, filt
{t('Set on-chain identity')} {t('Set on-chain identity')}
</Menu.Item> </Menu.Item>
), ),
api.api.tx.identity?.setSubs && identity?.display && !isHardware && ( isFunction(api.api.tx.identity?.setSubs) && identity?.display && !isHardware && (
<Menu.Item <Menu.Item
key='identitySub' key='identitySub'
onClick={toggleIdentitySub} onClick={toggleIdentitySub}
@ -225,7 +225,7 @@ function Account ({ account: { address, meta }, className = '', delegation, filt
{t('Set on-chain sub-identities')} {t('Set on-chain sub-identities')}
</Menu.Item> </Menu.Item>
), ),
api.api.tx.democracy?.unlock && democracyUnlockTx && ( isFunction(api.api.tx.democracy?.unlock) && democracyUnlockTx && (
<Menu.Item <Menu.Item
key='clearDemocracy' key='clearDemocracy'
onClick={_clearDemocracyLocks} onClick={_clearDemocracyLocks}
@ -233,7 +233,7 @@ function Account ({ account: { address, meta }, className = '', delegation, filt
{t('Clear expired democracy locks')} {t('Clear expired democracy locks')}
</Menu.Item> </Menu.Item>
), ),
api.api.tx.vesting?.vest && vestingVestTx && ( isFunction(api.api.tx.vesting?.vest) && vestingVestTx && (
<Menu.Item <Menu.Item
key='vestingVest' key='vestingVest'
onClick={_vestingVest} onClick={_vestingVest}
@ -286,7 +286,7 @@ function Account ({ account: { address, meta }, className = '', delegation, filt
</Menu.Item> </Menu.Item>
) )
]), ]),
api.api.tx.recovery?.createRecovery && createMenuGroup([ isFunction(api.api.tx.recovery?.createRecovery) && createMenuGroup([
!recoveryInfo && ( !recoveryInfo && (
<Menu.Item <Menu.Item
key='makeRecoverable' key='makeRecoverable'
@ -302,7 +302,7 @@ function Account ({ account: { address, meta }, className = '', delegation, filt
{t('Initiate recovery for another')} {t('Initiate recovery for another')}
</Menu.Item> </Menu.Item>
]), ]),
api.api.tx.multisig?.asMulti && isMultisig && createMenuGroup([ isFunction(api.api.tx.multisig?.asMulti) && isMultisig && createMenuGroup([
<Menu.Item <Menu.Item
disabled={!multiInfos || !multiInfos.length} disabled={!multiInfos || !multiInfos.length}
key='multisigApprovals' key='multisigApprovals'
@ -311,7 +311,7 @@ function Account ({ account: { address, meta }, className = '', delegation, filt
{t('Multisig approvals')} {t('Multisig approvals')}
</Menu.Item> </Menu.Item>
]), ]),
api.api.query.democracy?.votingOf && delegation?.accountDelegated && createMenuGroup([ isFunction(api.api.query.democracy?.votingOf) && delegation?.accountDelegated && createMenuGroup([
<Menu.Item <Menu.Item
key='changeDelegate' key='changeDelegate'
onClick={toggleDelegate} onClick={toggleDelegate}
@ -325,7 +325,7 @@ function Account ({ account: { address, meta }, className = '', delegation, filt
{t('Undelegate')} {t('Undelegate')}
</Menu.Item> </Menu.Item>
]), ]),
api.api.query.democracy?.votingOf && !delegation?.accountDelegated && createMenuGroup([ isFunction(api.api.query.democracy?.votingOf) && !delegation?.accountDelegated && createMenuGroup([
<Menu.Item <Menu.Item
key='delegate' key='delegate'
onClick={toggleDelegate} onClick={toggleDelegate}
@ -333,7 +333,7 @@ function Account ({ account: { address, meta }, className = '', delegation, filt
{t('Delegate democracy votes')} {t('Delegate democracy votes')}
</Menu.Item> </Menu.Item>
]), ]),
api.api.query.proxy?.proxies && createMenuGroup([ isFunction(api.api.query.proxy?.proxies) && createMenuGroup([
<Menu.Item <Menu.Item
key='proxy-overview' key='proxy-overview'
onClick={toggleProxyOverview} onClick={toggleProxyOverview}
@ -590,7 +590,7 @@ function Account ({ account: { address, meta }, className = '', delegation, filt
/> />
</td> </td>
<td className='button'> <td className='button'>
{api.api.tx.balances?.transfer && ( {isFunction(api.api.tx.balances?.transfer) && (
<Button <Button
icon='paper-plane' icon='paper-plane'
label={t<string>('send')} label={t<string>('send')}

View File

@ -182,7 +182,7 @@ function Transfer ({ className = '', onClose, recipientId: propRecipientId, send
</> </>
) )
} }
{api.tx.balances.transferKeepAlive && ( {isFunction(api.tx.balances.transferKeepAlive) && (
<Toggle <Toggle
className='typeToggle' className='typeToggle'
label={ label={

View File

@ -13,7 +13,7 @@ import Transfer from '@polkadot/app-accounts/modals/Transfer';
import { AddressInfo, AddressSmall, Button, ChainLock, Forget, Icon, LinkExternal, Menu, Popup, Tags } from '@polkadot/react-components'; import { AddressInfo, AddressSmall, Button, ChainLock, Forget, Icon, LinkExternal, Menu, Popup, Tags } from '@polkadot/react-components';
import { useApi, useCall } from '@polkadot/react-hooks'; import { useApi, useCall } from '@polkadot/react-hooks';
import { keyring } from '@polkadot/ui-keyring'; import { keyring } from '@polkadot/ui-keyring';
import { BN_ZERO, formatNumber } from '@polkadot/util'; import { BN_ZERO, formatNumber, isFunction } from '@polkadot/util';
import { useTranslation } from '../translate'; import { useTranslation } from '../translate';
@ -60,7 +60,7 @@ function Address ({ address, className = '', filter, isFavorite, toggleFavorite
useEffect((): void => { useEffect((): void => {
const { identity, nickname } = info || {}; const { identity, nickname } = info || {};
if (api.api.query.identity && api.api.query.identity.identityOf) { if (isFunction(api.api.query.identity?.identityOf)) {
if (identity?.display) { if (identity?.display) {
setAccName(identity.display); setAccName(identity.display);
} }
@ -197,7 +197,7 @@ function Address ({ address, className = '', filter, isFavorite, toggleFavorite
/> />
</td> </td>
<td className='button'> <td className='button'>
{api.api.tx.balances?.transfer && ( {isFunction(api.api.tx.balances?.transfer) && (
<Button <Button
icon='paper-plane' icon='paper-plane'
key='send' key='send'

View File

@ -18,7 +18,12 @@ interface Props {
item: EntryInfoTyped; item: EntryInfoTyped;
} }
const options = { day: 'numeric', month: 'long', weekday: 'long', year: 'numeric' }; const FORMAT_OPTIONS: Intl.DateTimeFormatOptions = {
day: 'numeric',
month: 'long',
weekday: 'long',
year: 'numeric'
};
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
function assertUnreachable (x: never): never { function assertUnreachable (x: never): never {
@ -160,7 +165,7 @@ function DayItem ({ className, item: { date, info, type }, showAllEvents }: Prop
return ( return (
<div className={className}> <div className={className}>
{showAllEvents && {showAllEvents &&
<div className='itemDate'>{date.toLocaleString(undefined, options)}</div> <div className='itemDate'>{date.toLocaleString(undefined, FORMAT_OPTIONS)}</div>
} }
<div className='itemTime'>{date.toLocaleTimeString().split(':').slice(0, 2).join(':')}</div> <div className='itemTime'>{date.toLocaleTimeString().split(':').slice(0, 2).join(':')}</div>
{desc} {desc}

View File

@ -10,6 +10,6 @@
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.13.9", "@babel/runtime": "^7.13.9",
"@polkadot/api-contract": "^3.11.2-3" "@polkadot/api-contract": "^4.0.1-4"
} }
} }

View File

@ -8,6 +8,7 @@ import React, { useMemo } from 'react';
import { AddressMini, Expander, MarkWarning } from '@polkadot/react-components'; import { AddressMini, Expander, MarkWarning } from '@polkadot/react-components';
import { useApi, useCall } from '@polkadot/react-hooks'; import { useApi, useCall } from '@polkadot/react-hooks';
import { isFunction } from '@polkadot/util';
import { useTranslation } from '../../translate'; import { useTranslation } from '../../translate';
import useInactives from '../useInactives'; import useInactives from '../useInactives';
@ -68,7 +69,7 @@ function ListNominees ({ nominating, stashId }: Props): React.ReactElement<Props
const { api } = useApi(); const { api } = useApi();
const { nomsActive, nomsChilled, nomsInactive, nomsOver, nomsWaiting } = useInactives(stashId, nominating); const { nomsActive, nomsChilled, nomsInactive, nomsOver, nomsWaiting } = useInactives(stashId, nominating);
const sessionInfo = useCall<DeriveSessionIndexes>(api.query.staking && api.derive.session?.indexes); const sessionInfo = useCall<DeriveSessionIndexes>(api.query.staking && api.derive.session?.indexes);
const eraExposure = useCall<DeriveEraExposure>(api.query.staking.erasStakers && api.derive.staking.eraExposure, [sessionInfo?.activeEra]); const eraExposure = useCall<DeriveEraExposure>(isFunction(api.query.staking.erasStakers) && api.derive.staking.eraExposure, [sessionInfo?.activeEra]);
const [renActive, renChilled, renInactive, renOver, renWaiting] = useMemo( const [renActive, renChilled, renInactive, renOver, renWaiting] = useMemo(
() => [renderNominators(stashId, nomsActive, eraExposure), renderNominators(stashId, nomsChilled), renderNominators(stashId, nomsInactive), renderNominators(stashId, nomsOver), renderNominators(stashId, nomsWaiting)], () => [renderNominators(stashId, nomsActive, eraExposure), renderNominators(stashId, nomsChilled), renderNominators(stashId, nomsInactive), renderNominators(stashId, nomsOver), renderNominators(stashId, nomsWaiting)],
[eraExposure, nomsActive, nomsChilled, nomsInactive, nomsOver, nomsWaiting, stashId] [eraExposure, nomsActive, nomsChilled, nomsInactive, nomsOver, nomsWaiting, stashId]

View File

@ -15,7 +15,7 @@ import styled from 'styled-components';
import { ApiPromise } from '@polkadot/api'; import { ApiPromise } from '@polkadot/api';
import { AddressInfo, AddressMini, AddressSmall, Badge, Button, Menu, Popup, StakingBonded, StakingRedeemable, StakingUnbonding, StatusContext, TxButton } from '@polkadot/react-components'; import { AddressInfo, AddressMini, AddressSmall, Badge, Button, Menu, Popup, StakingBonded, StakingRedeemable, StakingUnbonding, StatusContext, TxButton } from '@polkadot/react-components';
import { useApi, useCall, useToggle } from '@polkadot/react-hooks'; import { useApi, useCall, useToggle } from '@polkadot/react-hooks';
import { formatNumber } from '@polkadot/util'; import { formatNumber, isFunction } from '@polkadot/util';
import { useTranslation } from '../../translate'; import { useTranslation } from '../../translate';
import BondExtra from './BondExtra'; import BondExtra from './BondExtra';
@ -324,7 +324,7 @@ function Account ({ allSlashes, className = '', info: { controllerId, destinatio
> >
{t<string>('Change validator preferences')} {t<string>('Change validator preferences')}
</Menu.Item> </Menu.Item>
{api.tx.staking.kick && ( {isFunction(api.tx.staking.kick) && (
<Menu.Item <Menu.Item
disabled={!isOwnController} disabled={!isOwnController}
onClick={toggleKick} onClick={toggleKick}

View File

@ -8,7 +8,7 @@ import React, { useCallback, useEffect, useRef, useState } from 'react';
import { Dropdown, InputAddress, InputNumber, Modal } from '@polkadot/react-components'; import { Dropdown, InputAddress, InputNumber, Modal } from '@polkadot/react-components';
import { useApi } from '@polkadot/react-hooks'; import { useApi } from '@polkadot/react-hooks';
import { BN_HUNDRED as MAX_COMM } from '@polkadot/util'; import { BN_HUNDRED as MAX_COMM, isFunction } from '@polkadot/util';
import { useTranslation } from '../../translate'; import { useTranslation } from '../../translate';
@ -90,7 +90,7 @@ function Validate ({ className = '', controllerId, onChange, stashId, withSender
<p>{t<string>('The commission is deducted from all rewards before the remainder is split with nominators.')}</p> <p>{t<string>('The commission is deducted from all rewards before the remainder is split with nominators.')}</p>
</Modal.Column> </Modal.Column>
</Modal.Columns> </Modal.Columns>
{api.tx.staking.kick && ( {isFunction(api.tx.staking.kick) && (
<Modal.Columns> <Modal.Columns>
<Modal.Column> <Modal.Column>
<Dropdown <Dropdown

View File

@ -154,7 +154,7 @@ function Payouts ({ className = '', isInElection, ownValidators }: Props): React
const { t } = useTranslation(); const { t } = useTranslation();
const { api } = useApi(); const { api } = useApi();
const [hasOwnValidators] = useState(() => ownValidators.length !== 0); const [hasOwnValidators] = useState(() => ownValidators.length !== 0);
const [myStashesIndex, setMyStashesIndex] = useState(() => (api.tx.staking.payoutStakers && hasOwnValidators) ? 0 : 1); const [myStashesIndex, setMyStashesIndex] = useState(() => (isFunction(api.tx.staking.payoutStakers) && hasOwnValidators) ? 0 : 1);
const [eraSelectionIndex, setEraSelectionIndex] = useState(0); const [eraSelectionIndex, setEraSelectionIndex] = useState(0);
const eraLength = useCall<BN>(api.derive.session.eraLength); const eraLength = useCall<BN>(api.derive.session.eraLength);
const historyDepth = useCall<BN>(api.query.staking.historyDepth); const historyDepth = useCall<BN>(api.query.staking.historyDepth);
@ -204,9 +204,11 @@ function Payouts ({ className = '', isInElection, ownValidators }: Props): React
</tr> </tr>
), [stashTotal]); ), [stashTotal]);
const hasPayouts = isFunction(api.tx.staking.payoutStakers);
return ( return (
<div className={className}> <div className={className}>
{api.tx.staking.payoutStakers && ( {hasPayouts && (
<Button.Group> <Button.Group>
<ToggleGroup <ToggleGroup
onChange={setMyStashesIndex} onChange={setMyStashesIndex}
@ -226,7 +228,7 @@ function Payouts ({ className = '', isInElection, ownValidators }: Props): React
</Button.Group> </Button.Group>
)} )}
<ElectionBanner isInElection={isInElection} /> <ElectionBanner isInElection={isInElection} />
{api.tx.staking.payoutStakers && !isLoadingRewards && !stashes?.length && ( {hasPayouts && !isLoadingRewards && !stashes?.length && (
<article className='warning centered'> <article className='warning centered'>
<p>{t('Payouts of rewards for a validator can be initiated by any account. This means that as soon as a validator or nominator requests a payout for an era, all the nominators for that validator will be rewarded. Each user does not need to claim individually and the suggestion is that validators should claim rewards for everybody as soon as an era ends.')}</p> <p>{t('Payouts of rewards for a validator can be initiated by any account. This means that as soon as a validator or nominator requests a payout for an era, all the nominators for that validator will be rewarded. Each user does not need to claim individually and the suggestion is that validators should claim rewards for everybody as soon as an era ends.')}</p>
<p>{t('If you have not claimed rewards straight after the end of the era, the validator is in the active set and you are seeing no rewards, this would mean that the reward payout transaction was made by another account on your behalf. Always check your favorite explorer to see any historic payouts made to your accounts.')}</p> <p>{t('If you have not claimed rewards straight after the end of the era, the validator is in the active set and you are seeing no rewards, this would mean that the reward payout transaction was made by another account on your behalf. Always check your favorite explorer to see any historic payouts made to your accounts.')}</p>
@ -248,7 +250,7 @@ function Payouts ({ className = '', isInElection, ownValidators }: Props): React
/> />
))} ))}
</Table> </Table>
{api.tx.staking.payoutStakers && (myStashesIndex === 1) && !isLoadingRewards && validators && (validators.length !== 0) && ( {hasPayouts && (myStashesIndex === 1) && !isLoadingRewards && validators && (validators.length !== 0) && (
<Table <Table
header={headerValidatorsRef.current} header={headerValidatorsRef.current}
isFixed isFixed

View File

@ -8,6 +8,7 @@ import React, { useCallback, useRef, useState } from 'react';
import { Button, Table, TxButton } from '@polkadot/react-components'; import { Button, Table, TxButton } from '@polkadot/react-components';
import { useApi } from '@polkadot/react-hooks'; import { useApi } from '@polkadot/react-hooks';
import { isFunction } from '@polkadot/util';
import { useTranslation } from '../translate'; import { useTranslation } from '../translate';
import Row from './Row'; import Row from './Row';
@ -65,7 +66,7 @@ function Slashes ({ buttons, councilId, councilThreshold, slash }: Props): React
<Summary slash={slash} /> <Summary slash={slash} />
<Button.Group> <Button.Group>
{buttons} {buttons}
{api.tx.council?.propose && ( {isFunction(api.tx.council?.propose) && (
<> <>
<TxButton <TxButton
accountId={councilId} accountId={councilId}

View File

@ -13,6 +13,7 @@ import styled from 'styled-components';
import { HelpOverlay } from '@polkadot/react-components'; import { HelpOverlay } from '@polkadot/react-components';
import Tabs from '@polkadot/react-components/Tabs'; import Tabs from '@polkadot/react-components/Tabs';
import { useAccounts, useApi, useAvailableSlashes, useCall, useFavorites, useOwnStashInfos } from '@polkadot/react-hooks'; import { useAccounts, useApi, useAvailableSlashes, useCall, useFavorites, useOwnStashInfos } from '@polkadot/react-hooks';
import { isFunction } from '@polkadot/util';
import basicMd from './md/basic.md'; import basicMd from './md/basic.md';
import Summary from './Overview/Summary'; import Summary from './Overview/Summary';
@ -71,7 +72,7 @@ function StakingApp ({ basePath, className = '' }: Props): React.ReactElement<Pr
name: 'actions', name: 'actions',
text: t<string>('Account actions') text: t<string>('Account actions')
}, },
api.query.staking.activeEra && { isFunction(api.query.staking.activeEra) && {
name: 'payout', name: 'payout',
text: t<string>('Payouts') text: t<string>('Payouts')
}, },

View File

@ -9,7 +9,7 @@ import styled from 'styled-components';
import { Button, Extrinsic, Icon, InputNumber, Toggle, TxButton } from '@polkadot/react-components'; import { Button, Extrinsic, Icon, InputNumber, Toggle, TxButton } from '@polkadot/react-components';
import { useApi, useToggle } from '@polkadot/react-hooks'; import { useApi, useToggle } from '@polkadot/react-hooks';
import { BN_ZERO } from '@polkadot/util'; import { BN_ZERO, isFunction } from '@polkadot/util';
import { useTranslation } from './translate'; import { useTranslation } from './translate';
@ -44,7 +44,7 @@ function Sudo ({ className, isMine, sudoKey }: Props): React.ReactElement<Props>
label={t<string>('submit the following change')} label={t<string>('submit the following change')}
onChange={_onChangeExtrinsic} onChange={_onChangeExtrinsic}
/> />
{api.tx.sudo.sudoUncheckedWeight && ( {isFunction(api.tx.sudo.sudoUncheckedWeight) && (
<InputNumber <InputNumber
help={t<string>('The unchecked weight as specified for the sudoUncheckedWeight call.')} help={t<string>('The unchecked weight as specified for the sudoUncheckedWeight call.')}
isDisabled={!withWeight} isDisabled={!withWeight}

View File

@ -15,9 +15,9 @@
"homepage": "https://github.com/polkadot-js/apps/tree/master/packages/react-api#readme", "homepage": "https://github.com/polkadot-js/apps/tree/master/packages/react-api#readme",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.13.9", "@babel/runtime": "^7.13.9",
"@polkadot/api": "^3.11.2-3", "@polkadot/api": "^4.0.1-4",
"@polkadot/extension-dapp": "^0.37.2", "@polkadot/extension-dapp": "^0.37.3-2",
"@polkadot/x-rxjs": "^5.9.3-0", "@polkadot/x-rxjs": "^6.0.1-5",
"fflate": "^0.6.7" "fflate": "^0.6.7"
} }
} }

View File

@ -12,15 +12,15 @@
"@fortawesome/fontawesome-svg-core": "^1.2.34", "@fortawesome/fontawesome-svg-core": "^1.2.34",
"@fortawesome/free-solid-svg-icons": "^5.15.2", "@fortawesome/free-solid-svg-icons": "^5.15.2",
"@fortawesome/react-fontawesome": "^0.1.14", "@fortawesome/react-fontawesome": "^0.1.14",
"@polkadot/keyring": "^5.9.3-0", "@polkadot/keyring": "^6.0.1-5",
"@polkadot/react-api": "^0.82.2-6", "@polkadot/react-api": "^0.82.2-6",
"@polkadot/react-identicon": "^0.70.1", "@polkadot/react-identicon": "^0.70.2-2",
"@polkadot/react-qr": "^0.70.1", "@polkadot/react-qr": "^0.70.2-2",
"@polkadot/react-query": "^0.82.2-6", "@polkadot/react-query": "^0.82.2-6",
"@polkadot/ui-keyring": "^0.70.1", "@polkadot/ui-keyring": "^0.70.2-2",
"@polkadot/ui-settings": "^0.70.1", "@polkadot/ui-settings": "^0.70.2-2",
"@polkadot/util": "^5.9.3-0", "@polkadot/util": "^6.0.1-5",
"@polkadot/util-crypto": "^5.9.3-0", "@polkadot/util-crypto": "^6.0.1-5",
"chart.js": "^2.9.4", "chart.js": "^2.9.4",
"codeflask": "^1.4.1", "codeflask": "^1.4.1",
"i18next": "^19.9.1", "i18next": "^19.9.1",

View File

@ -5,6 +5,7 @@ import type { DeriveAccountInfo } from '@polkadot/api-derive/types';
import { ApiPromise } from '@polkadot/api'; import { ApiPromise } from '@polkadot/api';
import { keyring } from '@polkadot/ui-keyring'; import { keyring } from '@polkadot/ui-keyring';
import { isFunction } from '@polkadot/util';
export default function checkVisibility (api: ApiPromise, address: string, accountInfo: DeriveAccountInfo, filterName = '', onlyNamed = false): boolean { export default function checkVisibility (api: ApiPromise, address: string, accountInfo: DeriveAccountInfo, filterName = '', onlyNamed = false): boolean {
let isVisible = false; let isVisible = false;
@ -16,8 +17,9 @@ export default function checkVisibility (api: ApiPromise, address: string, accou
if (!onlyNamed && (accountId?.toString().includes(filterName) || accountIndex?.toString().includes(filterName))) { if (!onlyNamed && (accountId?.toString().includes(filterName) || accountIndex?.toString().includes(filterName))) {
isVisible = true; isVisible = true;
} else if (api.query.identity && api.query.identity.identityOf) { } else if (isFunction(api.query.identity?.identityOf)) {
isVisible = (!!identity?.display && identity.display.toLowerCase().includes(filterLower)) || isVisible =
(!!identity?.display && identity.display.toLowerCase().includes(filterLower)) ||
(!!identity?.displayParent && identity.displayParent.toLowerCase().includes(filterLower)); (!!identity?.displayParent && identity.displayParent.toLowerCase().includes(filterLower));
} else if (nickname) { } else if (nickname) {
isVisible = nickname.toLowerCase().includes(filterLower); isVisible = nickname.toLowerCase().includes(filterLower);

View File

@ -9,6 +9,7 @@ import type { AddressFlags, AddressIdentity, UseAccountInfo } from './types';
import { useCallback, useEffect, useState } from 'react'; import { useCallback, useEffect, useState } from 'react';
import { keyring } from '@polkadot/ui-keyring'; import { keyring } from '@polkadot/ui-keyring';
import { isFunction } from '@polkadot/util';
import { useAccounts } from './useAccounts'; import { useAccounts } from './useAccounts';
import { useAddresses } from './useAddresses'; import { useAddresses } from './useAddresses';
@ -86,7 +87,7 @@ export function useAccountInfo (value: string | null, isContract = false): UseAc
let name; let name;
if (api.query.identity && api.query.identity.identityOf) { if (isFunction(api.query.identity?.identityOf)) {
if (identity?.display) { if (identity?.display) {
name = identity.display; name = identity.display;
} }

View File

@ -6,7 +6,7 @@ const pinataSDK = require('@pinata/sdk');
const cloudflare = require('dnslink-cloudflare'); const cloudflare = require('dnslink-cloudflare');
const execSync = require('@polkadot/dev/scripts/execSync.cjs'); const execSync = require('@polkadot/dev/scripts/execSync.cjs');
const { createWsEndpoints } = require('../packages/apps-config/build/endpoints'); const { createWsEndpoints } = require('../packages/apps-config/build/endpoints.cjs');
const pkgJson = require('../package.json'); const pkgJson = require('../package.json');
// https://gateway.pinata.cloud/ipfs/ // https://gateway.pinata.cloud/ipfs/

742
yarn.lock

File diff suppressed because it is too large Load Diff