Bump deps (type for parachains, crowdloads, auctions) (#4815)

* Bump deps (type for parachains, crowdloads, auctions)

* indexes
This commit is contained in:
Jaco Greeff 2021-03-10 23:05:55 +01:00 committed by GitHub
parent 9898c078be
commit 9cb68cd08e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 86 additions and 84 deletions

View File

@ -12,13 +12,13 @@
"packages/*"
],
"resolutions": {
"@polkadot/api": "^4.0.4-7",
"@polkadot/api-contract": "^4.0.4-7",
"@polkadot/api": "^4.0.4-9",
"@polkadot/api-contract": "^4.0.4-9",
"@polkadot/hw-ledger": "^6.0.5",
"@polkadot/keyring": "^6.0.5",
"@polkadot/networks": "^6.0.5",
"@polkadot/phishing": "^0.6.20",
"@polkadot/types": "^4.0.4-7",
"@polkadot/types": "^4.0.4-9",
"@polkadot/util": "^6.0.5",
"@polkadot/util-crypto": "^6.0.5",
"@polkadot/wasm-crypto": "^4.0.2",

View File

@ -10,6 +10,6 @@
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.13.10",
"@polkadot/api-contract": "^4.0.4-7"
"@polkadot/api-contract": "^4.0.4-9"
}
}

View File

@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
import type BN from 'bn.js';
import type { FundIndex, FundInfo } from '@polkadot/types/interfaces';
import type { FundInfo, ParaId } from '@polkadot/types/interfaces';
import React, { useMemo } from 'react';
@ -13,18 +13,18 @@ import { formatNumber } from '@polkadot/util';
interface Props {
bestNumber?: BN;
className?: string;
id: FundIndex;
info: FundInfo;
paraId: ParaId;
}
function Fund ({ bestNumber, className, info: { cap, end, owner, parachain, raised } }: Props): React.ReactElement<Props> {
function Fund ({ bestNumber, className, info: { cap, depositor, end, raised }, paraId }: Props): React.ReactElement<Props> {
const remaining = useMemo(() => bestNumber && end.sub(bestNumber), [bestNumber, end]);
return (
<tr className={className}>
<td className='number'><h1>{parachain}</h1></td>
<td><ParaLink id={parachain} /></td>
<td className='address'><AddressMini value={owner} /></td>
<td className='number'><h1>{paraId}</h1></td>
<td><ParaLink id={paraId} /></td>
<td className='address'><AddressMini value={depositor} /></td>
<td className='number'><FormatBalance value={raised} /></td>
<td className='number'><FormatBalance value={cap} /></td>
<td className='number'>{remaining && (

View File

@ -31,6 +31,8 @@ function FundAdd ({ bestNumber, className }: Props): React.ReactElement<Props> {
const isEndError = !bestNumber || !endBlock || endBlock.lt(bestNumber);
const isLastError = !lastSlot || !firstSlot || lastSlot.eq(BN_ZERO) || lastSlot.lte(firstSlot) || lastSlot.gt(firstSlot.addn(3));
// TODO Add verifier
return (
<>
<Button
@ -121,7 +123,7 @@ function FundAdd ({ bestNumber, className }: Props): React.ReactElement<Props> {
icon='plus'
isDisabled={!paraId?.gt(BN_ZERO) || !cap?.gt(BN_ZERO) || !firstSlot?.gt(BN_ZERO) || isEndError || isLastError}
onStart={toggleOpen}
params={[paraId, cap, firstSlot, lastSlot, endBlock]}
params={[paraId, cap, firstSlot, lastSlot, endBlock, null]}
tx={api.tx.crowdloan.create}
/>
</Modal.Actions>

View File

@ -3,7 +3,7 @@
import type BN from 'bn.js';
import type { Option } from '@polkadot/types';
import type { FundIndex, FundInfo } from '@polkadot/types/interfaces';
import type { FundIndex, FundInfo, ParaId } from '@polkadot/types/interfaces';
import React, { useEffect, useRef, useState } from 'react';
@ -16,18 +16,18 @@ import { useTranslation } from './translate';
interface Props {
bestNumber?: BN;
className?: string;
fundIndexes: FundIndex[];
paraIds: FundIndex[];
}
interface Fund {
id: FundIndex;
info: FundInfo;
paraId: ParaId;
}
function Funds ({ bestNumber, className, fundIndexes }: Props): React.ReactElement<Props> {
function Funds ({ bestNumber, className, paraIds }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const { api } = useApi();
const optFunds = useCallMulti<Option<FundInfo>[]>(fundIndexes.map((id) => [api.query.crowdloan.funds, id]));
const optFunds = useCallMulti<Option<FundInfo>[]>(paraIds.map((id) => [api.query.crowdloan.funds, id]));
const [funds, setFunds] = useState<Fund[] | undefined>();
const headerRef = useRef([
@ -39,12 +39,12 @@ function Funds ({ bestNumber, className, fundIndexes }: Props): React.ReactEleme
// we actually want to split this further info completed and ongoing
useEffect((): void => {
optFunds && fundIndexes.length === optFunds.length && setFunds(
fundIndexes
.map((id, i) => ({ id, info: optFunds[i].unwrapOr(null) }))
optFunds && paraIds.length === optFunds.length && setFunds(
paraIds
.map((paraId, i) => ({ info: optFunds[i].unwrapOr(null), paraId }))
.filter((fund): fund is Fund => !!fund.info)
);
}, [fundIndexes, optFunds]);
}, [optFunds, paraIds]);
return (
<Table
@ -52,12 +52,12 @@ function Funds ({ bestNumber, className, fundIndexes }: Props): React.ReactEleme
empty={funds && t<string>('No campaigns found')}
header={headerRef.current}
>
{funds?.map(({ id, info }) => (
{funds?.map(({ info, paraId }) => (
<Fund
bestNumber={bestNumber}
id={id}
info={info}
key={id.toString()}
key={paraId.toString()}
paraId={paraId}
/>
))}
</Table>

View File

@ -20,17 +20,17 @@ interface Props {
function Overview ({ className }: Props): React.ReactElement<Props> {
const { api } = useApi();
const bestNumber = useCall<BN>(api.derive.chain.bestNumber);
const fundIndexes = useFundIndexes();
const paraIds = useFundIndexes();
return (
<div className={className}>
<Summary fundCount={fundIndexes.length} />
<Summary fundCount={paraIds.length} />
<Button.Group>
<FundAdd bestNumber={bestNumber} />
</Button.Group>
<Funds
bestNumber={bestNumber}
fundIndexes={fundIndexes}
paraIds={paraIds}
/>
</div>
);

View File

@ -1,22 +1,22 @@
// Copyright 2017-2021 @polkadot/app-crowdloan authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { FundIndex } from '@polkadot/types/interfaces';
import type { ParaId } from '@polkadot/types/interfaces';
import { useEffect, useState } from 'react';
import { useApi, useEventTrigger } from '@polkadot/react-hooks';
export default function useFundIndexes (): FundIndex[] {
export default function useFundIndexes (): ParaId[] {
const { api } = useApi();
const [indexes, setIndexes] = useState<FundIndex[]>([]);
const [indexes, setIndexes] = useState<ParaId[]>([]);
const trigger = useEventTrigger([api.events.crowdloan.Created]);
useEffect((): void => {
trigger &&
api.query.crowdloan.funds
.keys()
.then((indexes) => setIndexes(indexes.map(({ args }) => args[0] as FundIndex)))
.then((indexes) => setIndexes(indexes.map(({ args }) => args[0] as ParaId)))
.catch(console.error);
}, [api, trigger]);

View File

@ -15,7 +15,7 @@
"homepage": "https://github.com/polkadot-js/apps/tree/master/packages/react-api#readme",
"dependencies": {
"@babel/runtime": "^7.13.10",
"@polkadot/api": "^4.0.4-7",
"@polkadot/api": "^4.0.4-9",
"@polkadot/extension-dapp": "^0.37.3-5",
"@polkadot/x-rxjs": "^6.0.5",
"fflate": "^0.6.7"

106
yarn.lock
View File

@ -2086,54 +2086,54 @@ __metadata:
languageName: node
linkType: hard
"@polkadot/api-contract@npm:^4.0.4-7":
version: 4.0.4-7
resolution: "@polkadot/api-contract@npm:4.0.4-7"
"@polkadot/api-contract@npm:^4.0.4-9":
version: 4.0.4-9
resolution: "@polkadot/api-contract@npm:4.0.4-9"
dependencies:
"@babel/runtime": ^7.13.9
"@polkadot/api": 4.0.4-7
"@polkadot/types": 4.0.4-7
"@polkadot/api": 4.0.4-9
"@polkadot/types": 4.0.4-9
"@polkadot/util": ^6.0.5
"@polkadot/x-rxjs": ^6.0.5
bn.js: ^4.11.9
checksum: bd21f7b053ff2d630964975929d6edd3b47c76e313421b6e623cbde99eff26f7d17378f97245dee775c4fbbfbf6cf156969e13dc88247c0004a9aeb1311abe7b
checksum: 34e2ee179056f24fd30dc81174823a4bc2dda9d0aba3d72fbe52f4337f3d8160a99fd2f150fae2e632b6464f01f1210b2d3e45515d3ad0cad747d56c5ac25750
languageName: node
linkType: hard
"@polkadot/api-derive@npm:4.0.4-7":
version: 4.0.4-7
resolution: "@polkadot/api-derive@npm:4.0.4-7"
"@polkadot/api-derive@npm:4.0.4-9":
version: 4.0.4-9
resolution: "@polkadot/api-derive@npm:4.0.4-9"
dependencies:
"@babel/runtime": ^7.13.9
"@polkadot/api": 4.0.4-7
"@polkadot/rpc-core": 4.0.4-7
"@polkadot/types": 4.0.4-7
"@polkadot/api": 4.0.4-9
"@polkadot/rpc-core": 4.0.4-9
"@polkadot/types": 4.0.4-9
"@polkadot/util": ^6.0.5
"@polkadot/util-crypto": ^6.0.5
"@polkadot/x-rxjs": ^6.0.5
bn.js: ^4.11.9
checksum: 55fa77e306922e0de7dbdb9443c14aa39bd84e366e69249cc270572580ebe871e22d7380e98589fc258088a4aacbe169c332cb68a8232469786db25f709c21ab
checksum: 0c61697bad2b926988bc68e0928f321eeeef182c0385ec5ce3a5fd2fc1a3b72007fed0a65a33ed4b529748cc688ed789575a3bb564f2dce466889eab17fdfa81
languageName: node
linkType: hard
"@polkadot/api@npm:^4.0.4-7":
version: 4.0.4-7
resolution: "@polkadot/api@npm:4.0.4-7"
"@polkadot/api@npm:^4.0.4-9":
version: 4.0.4-9
resolution: "@polkadot/api@npm:4.0.4-9"
dependencies:
"@babel/runtime": ^7.13.9
"@polkadot/api-derive": 4.0.4-7
"@polkadot/api-derive": 4.0.4-9
"@polkadot/keyring": ^6.0.5
"@polkadot/metadata": 4.0.4-7
"@polkadot/rpc-core": 4.0.4-7
"@polkadot/rpc-provider": 4.0.4-7
"@polkadot/types": 4.0.4-7
"@polkadot/types-known": 4.0.4-7
"@polkadot/metadata": 4.0.4-9
"@polkadot/rpc-core": 4.0.4-9
"@polkadot/rpc-provider": 4.0.4-9
"@polkadot/types": 4.0.4-9
"@polkadot/types-known": 4.0.4-9
"@polkadot/util": ^6.0.5
"@polkadot/util-crypto": ^6.0.5
"@polkadot/x-rxjs": ^6.0.5
bn.js: ^4.11.9
eventemitter3: ^4.0.7
checksum: ac34ba363e13563581afb744fe1d56058c938c3ca8436002da7f6bcd7ebe7339fd515df3f40ab04cd867c747622ea13ed2e20085af41f959d82ae125f91928ff
checksum: d63903dbe6b1fe6823e2cb4ad5627488932b79cb38f515b9f3a6ed46e19651dcfa710cbfd0aa067260f0b8d513474462f2f26930a1ceeddb7fc42d847d2dc048
languageName: node
linkType: hard
@ -2206,7 +2206,7 @@ __metadata:
resolution: "@polkadot/app-contracts@workspace:packages/page-contracts"
dependencies:
"@babel/runtime": ^7.13.10
"@polkadot/api-contract": ^4.0.4-7
"@polkadot/api-contract": ^4.0.4-9
languageName: unknown
linkType: soft
@ -2625,17 +2625,17 @@ __metadata:
languageName: node
linkType: hard
"@polkadot/metadata@npm:4.0.4-7":
version: 4.0.4-7
resolution: "@polkadot/metadata@npm:4.0.4-7"
"@polkadot/metadata@npm:4.0.4-9":
version: 4.0.4-9
resolution: "@polkadot/metadata@npm:4.0.4-9"
dependencies:
"@babel/runtime": ^7.13.9
"@polkadot/types": 4.0.4-7
"@polkadot/types-known": 4.0.4-7
"@polkadot/types": 4.0.4-9
"@polkadot/types-known": 4.0.4-9
"@polkadot/util": ^6.0.5
"@polkadot/util-crypto": ^6.0.5
bn.js: ^4.11.9
checksum: b112f2ad74369d3a4e1ba244fe335918675482ab44edb6268e9a40e6dbc1d66234c3f953def375da1f9fc69860456bedc8b7dd79d980b3d345fe83983a2cb74c
checksum: fa3b195a16e96530fb668b9ea2b9f0447f8b37c5580d282a0e18303f48b3459a9e33d1254533e32d24780edc450bc0af3c35b5d2b0c8fb98de31da10ca7c4ad7
languageName: node
linkType: hard
@ -2665,7 +2665,7 @@ __metadata:
resolution: "@polkadot/react-api@workspace:packages/react-api"
dependencies:
"@babel/runtime": ^7.13.10
"@polkadot/api": ^4.0.4-7
"@polkadot/api": ^4.0.4-9
"@polkadot/extension-dapp": ^0.37.3-5
"@polkadot/x-rxjs": ^6.0.5
fflate: ^0.6.7
@ -2796,26 +2796,26 @@ __metadata:
languageName: unknown
linkType: soft
"@polkadot/rpc-core@npm:4.0.4-7":
version: 4.0.4-7
resolution: "@polkadot/rpc-core@npm:4.0.4-7"
"@polkadot/rpc-core@npm:4.0.4-9":
version: 4.0.4-9
resolution: "@polkadot/rpc-core@npm:4.0.4-9"
dependencies:
"@babel/runtime": ^7.13.9
"@polkadot/metadata": 4.0.4-7
"@polkadot/rpc-provider": 4.0.4-7
"@polkadot/types": 4.0.4-7
"@polkadot/metadata": 4.0.4-9
"@polkadot/rpc-provider": 4.0.4-9
"@polkadot/types": 4.0.4-9
"@polkadot/util": ^6.0.5
"@polkadot/x-rxjs": ^6.0.5
checksum: 75fd1f0d6735b115c6fb468bc311494a9e51c6beff75d0c0f242c83abc2a08d40a37d19587058eabd9740339b2fea98470335c6c0bd4419f61a11dc275f34a4a
checksum: b7f4e37e623d0cc97f907c4c3c664d993cd5550ac4c4f00dc03e48fedfd63ce4c600383e6f0d9030b22fe0d9765b959b720082c668831477efed35a5707762dc
languageName: node
linkType: hard
"@polkadot/rpc-provider@npm:4.0.4-7":
version: 4.0.4-7
resolution: "@polkadot/rpc-provider@npm:4.0.4-7"
"@polkadot/rpc-provider@npm:4.0.4-9":
version: 4.0.4-9
resolution: "@polkadot/rpc-provider@npm:4.0.4-9"
dependencies:
"@babel/runtime": ^7.13.9
"@polkadot/types": 4.0.4-7
"@polkadot/types": 4.0.4-9
"@polkadot/util": ^6.0.5
"@polkadot/util-crypto": ^6.0.5
"@polkadot/x-fetch": ^6.0.5
@ -2823,7 +2823,7 @@ __metadata:
"@polkadot/x-ws": ^6.0.5
bn.js: ^4.11.9
eventemitter3: ^4.0.7
checksum: 738174f47aea79f5e6679e965999718764b419b005edd28191ea5cea98ba5375b29d9721a46a22178d1ef3f884bda76c3338c6c4b37ca9d69553a86410388ef0
checksum: 0c408a9989fb5ff4b8123e991ea7b0d9905602a1e390852486058f3949f7845515262f78dbb593e72c19b6af62783061b1cd0083624953a18d7e9117dde799e9
languageName: node
linkType: hard
@ -2848,31 +2848,31 @@ __metadata:
languageName: node
linkType: hard
"@polkadot/types-known@npm:4.0.4-7":
version: 4.0.4-7
resolution: "@polkadot/types-known@npm:4.0.4-7"
"@polkadot/types-known@npm:4.0.4-9":
version: 4.0.4-9
resolution: "@polkadot/types-known@npm:4.0.4-9"
dependencies:
"@babel/runtime": ^7.13.9
"@polkadot/networks": ^6.0.5
"@polkadot/types": 4.0.4-7
"@polkadot/types": 4.0.4-9
"@polkadot/util": ^6.0.5
bn.js: ^4.11.9
checksum: 6b7c176ccf5efff89272a4b92e65a0d3a35f3bc4992be56005d25edcca9fe52397e030f09e8c646b13859ee5036b01c4b1bf9919dcbda3992d9a49af8cfbfbdc
checksum: 021e92d9e27334d24f1d067c3dc03e62b93a82b2fcb7c2fae17d7b1a7ca72b15190a39523f0a55e754ea1b77c410c9d8f90945e7b463489cda61d17fe8d2b1bc
languageName: node
linkType: hard
"@polkadot/types@npm:^4.0.4-7":
version: 4.0.4-7
resolution: "@polkadot/types@npm:4.0.4-7"
"@polkadot/types@npm:^4.0.4-9":
version: 4.0.4-9
resolution: "@polkadot/types@npm:4.0.4-9"
dependencies:
"@babel/runtime": ^7.13.9
"@polkadot/metadata": 4.0.4-7
"@polkadot/metadata": 4.0.4-9
"@polkadot/util": ^6.0.5
"@polkadot/util-crypto": ^6.0.5
"@polkadot/x-rxjs": ^6.0.5
"@types/bn.js": ^4.11.6
bn.js: ^4.11.9
checksum: 7a78af2d6225a5054ec2f43797c5e5914b945377d5da342e4e5ebbaa5504ca25093313b28bdfd2b6fc72e8b8bd69ae0204f9618ac1a1d527d0470282adb2f986
checksum: 55ece42f9f5b9e2ee6e11fae5e76b7971627919e6cc9a60820ab3f0a923272ad0957e62dfd6ac8743417051fbc66ee084e164d257cd7408bab6f31ace395acb5
languageName: node
linkType: hard