parent
fefd707995
commit
7b711316e9
@ -11,6 +11,7 @@ module.exports = {
|
||||
},
|
||||
rules: {
|
||||
...base.rules,
|
||||
'@typescript-eslint/no-explicit-any': 'off'
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'react-hooks/exhaustive-deps': 'warn'
|
||||
}
|
||||
};
|
||||
|
||||
15
package.json
15
package.json
@ -8,14 +8,13 @@
|
||||
"packages/*"
|
||||
],
|
||||
"resolutions": {
|
||||
"@polkadot/api": "^1.14.0-beta.20",
|
||||
"@polkadot/api-contract": "^1.14.0-beta.20",
|
||||
"@polkadot/api": "^1.14.1",
|
||||
"@polkadot/api-contract": "^1.14.1",
|
||||
"@polkadot/keyring": "^2.10.1",
|
||||
"@polkadot/types": "^1.14.0-beta.20",
|
||||
"@polkadot/types": "^1.14.1",
|
||||
"@polkadot/util": "^2.10.1",
|
||||
"@polkadot/util-crypto": "^2.10.1",
|
||||
"babel-core": "^7.0.0-bridge.0",
|
||||
"typescript": "^3.8.3"
|
||||
"babel-core": "^7.0.0-bridge.0"
|
||||
},
|
||||
"scripts": {
|
||||
"analyze": "yarn run build && cd packages/apps && yarn run source-map-explorer build/main.*.js",
|
||||
@ -38,13 +37,13 @@
|
||||
"@babel/core": "^7.9.6",
|
||||
"@babel/register": "^7.9.0",
|
||||
"@babel/runtime": "^7.9.6",
|
||||
"@polkadot/dev": "^0.52.19",
|
||||
"@polkadot/ts": "^0.3.21",
|
||||
"@polkadot/dev": "^0.53.5",
|
||||
"@polkadot/ts": "^0.3.22",
|
||||
"@types/bn.js": "^4.11.6",
|
||||
"@types/chart.js": "^2.9.20",
|
||||
"@types/file-saver": "^2.0.1",
|
||||
"@types/i18next": "^13.0.0",
|
||||
"@types/jest": "^25.2.1",
|
||||
"@types/jest": "^25.2.2",
|
||||
"@types/react-beautiful-dnd": "^12.1.2",
|
||||
"@types/react-copy-to-clipboard": "^4.3.0",
|
||||
"@types/react-dom": "^16.9.8",
|
||||
|
||||
@ -10,6 +10,7 @@ export default function create (t: (key: string, text: string, options: { ns: st
|
||||
return {
|
||||
Component: Claims,
|
||||
display: {
|
||||
needsAccounts: true,
|
||||
needsApi: [
|
||||
'query.claims.claims'
|
||||
]
|
||||
|
||||
@ -10,6 +10,7 @@ export default function create (t: (key: string, text: string, options: { ns: st
|
||||
return {
|
||||
Component: Society,
|
||||
display: {
|
||||
needsAccounts: true,
|
||||
needsApi: [
|
||||
'query.society.pot'
|
||||
]
|
||||
|
||||
@ -10,6 +10,7 @@ export default function create (t: (key: string, text: string, options: { ns: st
|
||||
return {
|
||||
Component: TechComm,
|
||||
display: {
|
||||
needsAccounts: true,
|
||||
needsApi: [
|
||||
'query.technicalCommittee.members'
|
||||
]
|
||||
|
||||
@ -10,7 +10,6 @@ export default function create (t: (key: string, text: string, options: { ns: st
|
||||
return {
|
||||
Component: Treasury,
|
||||
display: {
|
||||
needsAccounts: true,
|
||||
needsApi: [
|
||||
'tx.treasury.proposeSpend'
|
||||
]
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
"dependencies": {
|
||||
"@babel/polyfill": "^7.8.7",
|
||||
"@babel/runtime": "^7.9.6",
|
||||
"@polkadot/dev": "^0.52.19",
|
||||
"@polkadot/dev": "^0.53.5",
|
||||
"@polkadot/react-components": "0.42.0-beta.130",
|
||||
"@polkadot/react-signer": "0.42.0-beta.130",
|
||||
"query-string": "^6.12.1"
|
||||
|
||||
@ -13,8 +13,8 @@
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.9.6",
|
||||
"@polkadot/react-components": "0.42.0-beta.130",
|
||||
"@polkadot/react-qr": "^0.53.0-beta.6",
|
||||
"@polkadot/vanitygen": "^0.12.0-beta.1",
|
||||
"@polkadot/react-qr": "^0.53.1",
|
||||
"@polkadot/vanitygen": "^0.12.1",
|
||||
"detect-browser": "^5.1.0",
|
||||
"file-saver": "^2.0.2"
|
||||
}
|
||||
|
||||
@ -12,6 +12,6 @@
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.9.6",
|
||||
"@polkadot/api-contract": "^1.14.0-beta.20"
|
||||
"@polkadot/api-contract": "^1.14.1"
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,9 +13,10 @@ import { withRouter } from 'react-router-dom';
|
||||
import { SubmittableResult } from '@polkadot/api';
|
||||
import { Abi } from '@polkadot/api-contract';
|
||||
import { withApi, withMulti } from '@polkadot/react-api/hoc';
|
||||
import keyring from '@polkadot/ui-keyring';
|
||||
import { Dropdown, InputBalance, TxButton } from '@polkadot/react-components';
|
||||
import createValues from '@polkadot/react-params/values';
|
||||
import keyring from '@polkadot/ui-keyring';
|
||||
import { isFunction } from '@polkadot/util';
|
||||
|
||||
import MessageSignature from './MessageSignature';
|
||||
import ContractModal, { ContractModalProps, ContractModalState } from './Modal';
|
||||
@ -237,7 +238,7 @@ class Deploy extends ContractModal<Props, State> {
|
||||
onSuccess={this.onSuccess}
|
||||
params={this.constructCall}
|
||||
tx={
|
||||
api.tx.contracts.instantiate
|
||||
isFunction(api.tx.contracts.instantiate)
|
||||
? 'contracts.instantiate' // V2 (new)
|
||||
: 'contracts.create' // V2 (old)
|
||||
}
|
||||
|
||||
@ -4,15 +4,16 @@
|
||||
|
||||
import { DeriveCollectiveProposals } from '@polkadot/api-derive/types';
|
||||
|
||||
import { useApi, useCall } from '@polkadot/react-hooks';
|
||||
import { useAccounts, useApi, useCall } from '@polkadot/react-hooks';
|
||||
|
||||
function transform (motions: DeriveCollectiveProposals): number {
|
||||
return motions.filter(({ votes }): boolean => !!votes).length;
|
||||
}
|
||||
|
||||
export default function useCounter (): number {
|
||||
const { hasAccounts } = useAccounts();
|
||||
const { api, isApiReady } = useApi();
|
||||
const counter = useCall<number>(isApiReady && api.derive.council?.proposals, [], {
|
||||
const counter = useCall<number>(isApiReady && hasAccounts && api.derive.council?.proposals, [], {
|
||||
transform
|
||||
}) || 0;
|
||||
|
||||
|
||||
@ -3,13 +3,14 @@
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { useState, useEffect } from 'react';
|
||||
import { useApi, useCall, useIsMountedRef } from '@polkadot/react-hooks';
|
||||
import { useAccounts, useApi, useCall, useIsMountedRef } from '@polkadot/react-hooks';
|
||||
|
||||
export default function useCounter (): number {
|
||||
const { hasAccounts } = useAccounts();
|
||||
const { api, isApiReady } = useApi();
|
||||
const mountedRef = useIsMountedRef();
|
||||
const proposals = useCall<any[]>(isApiReady && api.derive.democracy?.proposals, []);
|
||||
const referenda = useCall<any[]>(isApiReady && api.derive.democracy?.referendumsActive, []);
|
||||
const proposals = useCall<any[]>(isApiReady && hasAccounts && api.derive.democracy?.proposals, []);
|
||||
const referenda = useCall<any[]>(isApiReady && hasAccounts && api.derive.democracy?.referendumsActive, []);
|
||||
const [counter, setCounter] = useState(0);
|
||||
|
||||
useEffect((): void => {
|
||||
|
||||
@ -26,12 +26,8 @@ function ParachainInfo ({ children, className, info, isBig }: Props): React.Reac
|
||||
className={className}
|
||||
icon={
|
||||
info?.icon
|
||||
? (
|
||||
<img src={info.icon} />
|
||||
)
|
||||
: (
|
||||
<i className='icon chain' />
|
||||
)
|
||||
? <img src={info.icon} />
|
||||
: <i className='icon chain' />
|
||||
}
|
||||
isBig={isBig}
|
||||
subtitle={parachainOwner(t, info)}
|
||||
|
||||
@ -8,11 +8,12 @@ import BN from 'bn.js';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useApi, useCall } from '@polkadot/react-hooks';
|
||||
import { Option } from '@polkadot/types';
|
||||
import { isFunction } from '@polkadot/util';
|
||||
|
||||
export default function useStakerPayouts (): BN {
|
||||
const { api } = useApi();
|
||||
const [stakerPayoutAfter, setState] = useState<BN>(
|
||||
api.tx.staking.payoutStakers
|
||||
isFunction(api.tx.staking.payoutStakers)
|
||||
? new BN(0)
|
||||
: new BN(1_000_000_000)
|
||||
);
|
||||
|
||||
@ -24,7 +24,7 @@ export default function useBlockCounts (accountId: string, sessionRewards: Sessi
|
||||
if (filtered.length) {
|
||||
Promise
|
||||
.all(filtered.map(({ parentHash, sessionIndex }): Promise<u32> =>
|
||||
api.query.imOnline.authoredBlocks.at(parentHash, sessionIndex.subn(1), accountId) as Promise<u32>
|
||||
api.query.imOnline.authoredBlocks.at(parentHash, sessionIndex.subn(1), accountId)
|
||||
))
|
||||
.then((historic): void => {
|
||||
mountedRef.current && setHistoric(historic);
|
||||
|
||||
@ -13,6 +13,7 @@ import styled from 'styled-components';
|
||||
import { HelpOverlay } from '@polkadot/react-components';
|
||||
import Tabs from '@polkadot/react-components/Tabs';
|
||||
import { useAccounts, useApi, useCall, useOwnStashInfos, useStashIds } from '@polkadot/react-hooks';
|
||||
import { isFunction } from '@polkadot/util';
|
||||
|
||||
import basicMd from './md/basic.md';
|
||||
import Actions from './Actions';
|
||||
@ -62,7 +63,7 @@ function StakingApp ({ basePath, className }: Props): React.ReactElement<Props>
|
||||
name: 'actions',
|
||||
text: t('Account actions')
|
||||
},
|
||||
api.query.staking.activeEra
|
||||
isFunction(api.query.staking.activeEra)
|
||||
? {
|
||||
name: 'payout',
|
||||
text: 'Payouts'
|
||||
|
||||
@ -5,11 +5,12 @@
|
||||
import { DeriveTreasuryProposals } from '@polkadot/api-derive/types';
|
||||
|
||||
import { useState, useEffect } from 'react';
|
||||
import { useApi, useCall } from '@polkadot/react-hooks';
|
||||
import { useAccounts, useApi, useCall } from '@polkadot/react-hooks';
|
||||
|
||||
export default function useCounter (): number {
|
||||
const { hasAccounts } = useAccounts();
|
||||
const { api, isApiReady } = useApi();
|
||||
const proposals = useCall<DeriveTreasuryProposals>(isApiReady && api.derive.treasury?.proposals, []);
|
||||
const proposals = useCall<DeriveTreasuryProposals>(isApiReady && hasAccounts && api.derive.treasury?.proposals, []);
|
||||
const [counter, setCounter] = useState(0);
|
||||
|
||||
useEffect((): void => {
|
||||
|
||||
@ -31,8 +31,8 @@
|
||||
"homepage": "https://github.com/polkadot-js/ui/tree/master/packages/ui-reactive#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.9.6",
|
||||
"@polkadot/api": "^1.14.0-beta.20",
|
||||
"@polkadot/extension-dapp": "^0.25.0-beta.7",
|
||||
"@polkadot/api": "^1.14.1",
|
||||
"@polkadot/extension-dapp": "^0.25.1",
|
||||
"rxjs-compat": "^6.5.5"
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,10 +13,10 @@
|
||||
"@babel/runtime": "^7.9.6",
|
||||
"@polkadot/keyring": "^2.10.1",
|
||||
"@polkadot/react-api": "0.42.0-beta.130",
|
||||
"@polkadot/react-identicon": "^0.53.0-beta.6",
|
||||
"@polkadot/react-identicon": "^0.53.1",
|
||||
"@polkadot/react-query": "0.42.0-beta.130",
|
||||
"@polkadot/ui-keyring": "^0.53.0-beta.6",
|
||||
"@polkadot/ui-settings": "^0.53.0-beta.6",
|
||||
"@polkadot/ui-keyring": "^0.53.1",
|
||||
"@polkadot/ui-settings": "^0.53.1",
|
||||
"chart.js": "^2.9.3",
|
||||
"codeflask": "^1.4.1",
|
||||
"i18next": "^19.4.4",
|
||||
|
||||
@ -11,7 +11,7 @@ import styled from 'styled-components';
|
||||
import registry from '@polkadot/react-api/typeRegistry';
|
||||
import { AccountSidebarToggle } from '@polkadot/app-accounts/Sidebar';
|
||||
import { useCall, useApi } from '@polkadot/react-hooks';
|
||||
import { stringToU8a } from '@polkadot/util';
|
||||
import { isFunction, stringToU8a } from '@polkadot/util';
|
||||
|
||||
import { getAddressName } from './util';
|
||||
import Badge from './Badge';
|
||||
@ -148,7 +148,7 @@ function AccountName ({ children, className, defaultName, label, noLookup, onCli
|
||||
const { accountId, accountIndex, identity, nickname } = info || {};
|
||||
const cacheAddr = (accountId || value || '').toString();
|
||||
|
||||
if (api.query.identity?.identityOf) {
|
||||
if (isFunction(api.query.identity?.identityOf)) {
|
||||
setName(() =>
|
||||
identity?.display
|
||||
? extractIdentity(cacheAddr, identity)
|
||||
|
||||
@ -23,7 +23,7 @@ interface Props extends BareProps {
|
||||
function transform (api: ApiPromise, { value }: Props): (method: string) => StorageEntryPromise {
|
||||
return function (method: string): StorageEntryPromise {
|
||||
return api.query[value.creator.section]
|
||||
? api.query[value.creator.section][method]
|
||||
? api.query[value.creator.section][method] as any
|
||||
: value;
|
||||
};
|
||||
}
|
||||
|
||||
@ -55,7 +55,7 @@ function InputStorage ({ className, defaultValue, help, label, onChange, style,
|
||||
const optionsMethod = keyOptions(api, section);
|
||||
|
||||
setOptionsMethod(optionsMethod);
|
||||
_onKeyChange(api.query[section][optionsMethod[0].value]);
|
||||
_onKeyChange(api.query[section][optionsMethod[0].value] as any);
|
||||
},
|
||||
[_onKeyChange, api, value]
|
||||
);
|
||||
|
||||
@ -12,6 +12,6 @@
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.9.6",
|
||||
"@polkadot/react-components": "0.42.0-beta.130",
|
||||
"@polkadot/react-qr": "^0.53.0-beta.6"
|
||||
"@polkadot/react-qr": "^0.53.1"
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user