diff --git a/package.json b/package.json index 0a8a8fd741..cb9610b5d8 100644 --- a/package.json +++ b/package.json @@ -33,10 +33,10 @@ "afterSign": "electron-builder-notarize" }, "resolutions": { - "@polkadot/api": "^1.34.0-beta.10", - "@polkadot/api-contract": "^1.34.0-beta.10", + "@polkadot/api": "^1.34.0-beta.12", + "@polkadot/api-contract": "^1.34.0-beta.12", "@polkadot/keyring": "^3.4.1", - "@polkadot/types": "^1.34.0-beta.10", + "@polkadot/types": "^1.34.0-beta.12", "@polkadot/util": "^3.4.1", "@polkadot/util-crypto": "^3.4.1", "@polkadot/wasm-crypto": "^1.4.1", diff --git a/packages/page-contracts/package.json b/packages/page-contracts/package.json index 87f0de179b..1c746c12a2 100644 --- a/packages/page-contracts/package.json +++ b/packages/page-contracts/package.json @@ -12,6 +12,6 @@ "license": "Apache-2.0", "dependencies": { "@babel/runtime": "^7.11.2", - "@polkadot/api-contract": "^1.34.0-beta.10" + "@polkadot/api-contract": "^1.34.0-beta.12" } } diff --git a/packages/page-democracy/src/Overview/ProposalCell.tsx b/packages/page-democracy/src/Overview/ProposalCell.tsx index de164e3bd6..89d30b00e6 100644 --- a/packages/page-democracy/src/Overview/ProposalCell.tsx +++ b/packages/page-democracy/src/Overview/ProposalCell.tsx @@ -4,7 +4,6 @@ import { Hash, Proposal, ProposalIndex } from '@polkadot/types/interfaces'; import React from 'react'; -import { registry } from '@polkadot/react-api'; import { CallExpander } from '@polkadot/react-components'; import { Compact } from '@polkadot/types'; @@ -34,7 +33,7 @@ function ProposalCell ({ className = '', imageHash, proposal }: Props): React.Re ); } - const { method, section } = registry.findMetaCall(proposal.callIndex); + const { method, section } = proposal.registry.findMetaCall(proposal.callIndex); const isTreasury = section === 'treasury' && METHOD_TREA.includes(method); const isExternal = section === 'democracy' && METHOD_EXTE.includes(method); diff --git a/packages/page-explorer/src/BlockInfo/Extrinsic.tsx b/packages/page-explorer/src/BlockInfo/Extrinsic.tsx index fbcf6f2955..8f023bca70 100644 --- a/packages/page-explorer/src/BlockInfo/Extrinsic.tsx +++ b/packages/page-explorer/src/BlockInfo/Extrinsic.tsx @@ -6,7 +6,6 @@ import { KeyedEvent } from '@polkadot/react-query/types'; import React from 'react'; import styled from 'styled-components'; -import { registry } from '@polkadot/react-api'; import { AddressMini, Call, Expander, LinkExternal } from '@polkadot/react-components'; import { formatNumber } from '@polkadot/util'; @@ -37,7 +36,7 @@ function filterEvents (index: number, events: KeyedEvent[] = []): KeyedEvent[] { function ExtrinsicDisplay ({ blockNumber, className = '', events, index, value }: Props): React.ReactElement { const { t } = useTranslation(); - const { meta, method, section } = registry.findMetaCall(value.callIndex); + const { meta, method, section } = value.registry.findMetaCall(value.callIndex); const era = getEra(value, blockNumber); const thisEvents = filterEvents(index, events); diff --git a/packages/react-api/package.json b/packages/react-api/package.json index 597799147d..5503c151d2 100644 --- a/packages/react-api/package.json +++ b/packages/react-api/package.json @@ -31,7 +31,7 @@ "homepage": "https://github.com/polkadot-js/ui/tree/master/packages/ui-reactive#readme", "dependencies": { "@babel/runtime": "^7.11.2", - "@polkadot/api": "^1.34.0-beta.10", + "@polkadot/api": "^1.34.0-beta.12", "@polkadot/extension-dapp": "^0.35.0-beta.1", "rxjs-compat": "^6.6.3" } diff --git a/packages/react-components/src/CallExpander.tsx b/packages/react-components/src/CallExpander.tsx index 3ec0351396..fa4469bdd3 100644 --- a/packages/react-components/src/CallExpander.tsx +++ b/packages/react-components/src/CallExpander.tsx @@ -4,7 +4,6 @@ import { Call } from '@polkadot/types/interfaces'; import React from 'react'; -import { registry } from '@polkadot/react-api'; import CallDisplay from './Call'; import Expander from './Expander'; @@ -18,7 +17,7 @@ interface Props { } function CallExpander ({ children, className = '', labelHash, value, withHash }: Props): React.ReactElement { - const { meta, method, section } = registry.findMetaCall(value.callIndex); + const { meta, method, section } = value.registry.findMetaCall(value.callIndex); return (
diff --git a/packages/react-components/src/ProposedAction.tsx b/packages/react-components/src/ProposedAction.tsx index b7e5fe7af4..0b3db0cdda 100644 --- a/packages/react-components/src/ProposedAction.tsx +++ b/packages/react-components/src/ProposedAction.tsx @@ -6,7 +6,6 @@ import { Proposal } from '@polkadot/types/interfaces'; import BN from 'bn.js'; import React from 'react'; import styled from 'styled-components'; -import { registry } from '@polkadot/react-api'; import { formatNumber, isString } from '@polkadot/util'; import Call from './Call'; @@ -50,7 +49,7 @@ function ProposedAction ({ asInset, className = '', expandNested, idNumber, inse ); } - const { meta, method, section } = registry.findMetaCall(proposal.callIndex); + const { meta, method, section } = proposal.registry.findMetaCall(proposal.callIndex); const header = `#${stringId}: ${section}.${method}`; const documentation = meta?.documentation diff --git a/packages/react-components/src/Status/Queue.tsx b/packages/react-components/src/Status/Queue.tsx index 8ad0fd0a0c..ae26e93aad 100644 --- a/packages/react-components/src/Status/Queue.tsx +++ b/packages/react-components/src/Status/Queue.tsx @@ -63,7 +63,7 @@ function extractEvents (result?: SubmittableResult): ActionStatus[] { if (dispatchError.isModule) { try { const mod = dispatchError.asModule; - const error = registry.findMetaError(new Uint8Array([mod.index.toNumber(), mod.error.toNumber()])); + const error = dispatchError.registry.findMetaError(mod); message = `${error.section}.${error.name}`; } catch (error) { diff --git a/packages/react-components/src/Status/index.tsx b/packages/react-components/src/Status/index.tsx index 45e390df1e..f02b09c002 100644 --- a/packages/react-components/src/Status/index.tsx +++ b/packages/react-components/src/Status/index.tsx @@ -6,7 +6,6 @@ import { QueueStatus, QueueTx, QueueTxStatus } from './types'; import React, { useCallback, useContext, useEffect, useState } from 'react'; import styled from 'styled-components'; import { IconName } from '@fortawesome/fontawesome-svg-core'; -import { registry } from '@polkadot/react-api'; import AddressMini from '../AddressMini'; import Button from '../Button'; @@ -104,7 +103,7 @@ function renderItem ({ error, extrinsic, id, removeItem, rpc, status }: QueueTx) let { method, section } = rpc; if (extrinsic) { - const found = registry.findMetaCall(extrinsic.callIndex); + const found = extrinsic.registry.findMetaCall(extrinsic.callIndex); if (found.section !== 'unknown') { method = found.method; diff --git a/packages/react-components/src/Table/Body.tsx b/packages/react-components/src/Table/Body.tsx index c9f317e4d0..7369709f28 100644 --- a/packages/react-components/src/Table/Body.tsx +++ b/packages/react-components/src/Table/Body.tsx @@ -29,6 +29,8 @@ function Body ({ children, className = '', empty, emptySpinner }: Props): React. } export default React.memo(styled(Body)` + position: relative; + td { padding: 0.75rem 1rem; text-align: left; diff --git a/packages/react-components/src/util/isTreasuryProposalVote.ts b/packages/react-components/src/util/isTreasuryProposalVote.ts index e88e170f47..8ee1d8efb5 100644 --- a/packages/react-components/src/util/isTreasuryProposalVote.ts +++ b/packages/react-components/src/util/isTreasuryProposalVote.ts @@ -3,14 +3,12 @@ import { Proposal } from '@polkadot/types/interfaces'; -import { registry } from '@polkadot/react-api'; - export default function isTreasuryProposalVote (proposal?: Proposal | null): boolean { if (!proposal) { return false; } - const { method, section } = registry.findMetaCall(proposal.callIndex); + const { method, section } = proposal.registry.findMetaCall(proposal.callIndex); return section === 'treasury' && ['approveProposal', 'rejectProposal'].includes(method) && diff --git a/packages/react-params/src/Param/Call.tsx b/packages/react-params/src/Param/Call.tsx index 86ad8bccd8..deea88db56 100644 --- a/packages/react-params/src/Param/Call.tsx +++ b/packages/react-params/src/Param/Call.tsx @@ -5,7 +5,6 @@ import { Extrinsic } from '@polkadot/types/interfaces'; import { Props } from '../types'; import React from 'react'; -import { registry } from '@polkadot/react-api'; import { Call, Static } from '@polkadot/react-components'; import Bare from './Bare'; @@ -21,7 +20,7 @@ function CallDisplay (props: Props): React.ReactElement { } const call = value as Extrinsic; - const { method, section } = registry.findMetaCall(call.callIndex); + const { method, section } = call.registry.findMetaCall(call.callIndex); return ( diff --git a/packages/react-params/src/Param/DispatchError.tsx b/packages/react-params/src/Param/DispatchError.tsx index 4dd1d088e3..394af45032 100644 --- a/packages/react-params/src/Param/DispatchError.tsx +++ b/packages/react-params/src/Param/DispatchError.tsx @@ -5,7 +5,6 @@ import { DispatchError } from '@polkadot/types/interfaces'; import { Props } from '../types'; import React, { useEffect, useState } from 'react'; -import { registry } from '@polkadot/react-api'; import { Input } from '@polkadot/react-components'; import { useTranslation } from '../translate'; @@ -34,7 +33,8 @@ function ErrorDisplay (props: Props): React.ReactElement { if (isModuleError(value as ModuleErrorDefault)) { try { - const { documentation, name, section } = registry.findMetaError((value as DispatchError).asModule); + const mod = (value as DispatchError).asModule; + const { documentation, name, section } = mod.registry.findMetaError(mod); return setDetails({ details: documentation.join(', '), diff --git a/packages/react-signer/src/Address.tsx b/packages/react-signer/src/Address.tsx index d51a701228..de23d508d7 100644 --- a/packages/react-signer/src/Address.tsx +++ b/packages/react-signer/src/Address.tsx @@ -9,7 +9,6 @@ import { AddressFlags, AddressProxy } from './types'; import React, { useEffect, useMemo, useState } from 'react'; import { ApiPromise } from '@polkadot/api'; -import { registry } from '@polkadot/react-api'; import { InputAddress, Modal, Toggle } from '@polkadot/react-components'; import { useAccounts, useApi, useIsMountedRef } from '@polkadot/react-hooks'; import { Option, Vec } from '@polkadot/types'; @@ -44,7 +43,7 @@ interface ProxyState { function findCall (tx: Call | SubmittableExtrinsic<'promise'>): { method: string; section: string } { try { - const { method, section } = registry.findMetaCall(tx.callIndex); + const { method, section } = tx.registry.findMetaCall(tx.callIndex); return { method, section }; } catch (error) { diff --git a/packages/react-signer/src/Transaction.tsx b/packages/react-signer/src/Transaction.tsx index 43ae68aa7b..134fde6236 100644 --- a/packages/react-signer/src/Transaction.tsx +++ b/packages/react-signer/src/Transaction.tsx @@ -6,7 +6,6 @@ import { QueueTx } from '@polkadot/react-components/Status/types'; import BN from 'bn.js'; import React from 'react'; import styled from 'styled-components'; -import { registry } from '@polkadot/react-api'; import { Call, Expander, Modal } from '@polkadot/react-components'; import { useTranslation } from './translate'; @@ -27,7 +26,7 @@ function Transaction ({ className, currentItem: { accountId, extrinsic, isUnsign return null; } - const { meta, method, section } = registry.findMetaCall(extrinsic.callIndex); + const { meta, method, section } = extrinsic.registry.findMetaCall(extrinsic.callIndex); const args = meta?.args.map(({ name }) => name).join(', ') || ''; return ( diff --git a/yarn.lock b/yarn.lock index 61081395ad..8b3d5c368a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3061,57 +3061,57 @@ __metadata: languageName: node linkType: hard -"@polkadot/api-contract@npm:^1.34.0-beta.10": - version: 1.34.0-beta.10 - resolution: "@polkadot/api-contract@npm:1.34.0-beta.10" +"@polkadot/api-contract@npm:^1.34.0-beta.12": + version: 1.34.0-beta.12 + resolution: "@polkadot/api-contract@npm:1.34.0-beta.12" dependencies: "@babel/runtime": ^7.11.2 - "@polkadot/api": 1.34.0-beta.10 - "@polkadot/rpc-core": 1.34.0-beta.10 - "@polkadot/types": 1.34.0-beta.10 + "@polkadot/api": 1.34.0-beta.12 + "@polkadot/rpc-core": 1.34.0-beta.12 + "@polkadot/types": 1.34.0-beta.12 "@polkadot/util": ^3.4.1 bn.js: ^5.1.3 rxjs: ^6.6.3 - checksum: 2d989c60adfb887642c91baf92ed329db8faa15cab300e2924a975973f275375719b1b3ab363667778827b919bbd1c3721bcf3ecff8487ccd3f89161e32d6440 + checksum: 0fcaf1ae5e77a9e6bb9fc006deb9908a388d0880c08d7877bb603d15cbebc04b4bf02b66785829e50328a14b51d7d301e6854173a29c8160a580c854b3f2f720 languageName: node linkType: hard -"@polkadot/api-derive@npm:1.34.0-beta.10": - version: 1.34.0-beta.10 - resolution: "@polkadot/api-derive@npm:1.34.0-beta.10" +"@polkadot/api-derive@npm:1.34.0-beta.12": + version: 1.34.0-beta.12 + resolution: "@polkadot/api-derive@npm:1.34.0-beta.12" dependencies: "@babel/runtime": ^7.11.2 - "@polkadot/api": 1.34.0-beta.10 - "@polkadot/rpc-core": 1.34.0-beta.10 - "@polkadot/rpc-provider": 1.34.0-beta.10 - "@polkadot/types": 1.34.0-beta.10 + "@polkadot/api": 1.34.0-beta.12 + "@polkadot/rpc-core": 1.34.0-beta.12 + "@polkadot/rpc-provider": 1.34.0-beta.12 + "@polkadot/types": 1.34.0-beta.12 "@polkadot/util": ^3.4.1 "@polkadot/util-crypto": ^3.4.1 bn.js: ^5.1.3 memoizee: ^0.4.14 rxjs: ^6.6.3 - checksum: e819b50e6915887c7173bd035d0682ddba46369555036f6895d0f94bcffc69a75353b0f5b907068b3130cd897c5516d1c72b6dd0995c93e577584b73df55205a + checksum: f903a2279e5a0ff84111e1b20b347d45611b798e6d6c2b227c85a362b88ef1c60837f57ec42f453922eea20cff9f9dcd2d932a4bfef8342c45290772faf061d2 languageName: node linkType: hard -"@polkadot/api@npm:^1.34.0-beta.10": - version: 1.34.0-beta.10 - resolution: "@polkadot/api@npm:1.34.0-beta.10" +"@polkadot/api@npm:^1.34.0-beta.12": + version: 1.34.0-beta.12 + resolution: "@polkadot/api@npm:1.34.0-beta.12" dependencies: "@babel/runtime": ^7.11.2 - "@polkadot/api-derive": 1.34.0-beta.10 + "@polkadot/api-derive": 1.34.0-beta.12 "@polkadot/keyring": ^3.4.1 - "@polkadot/metadata": 1.34.0-beta.10 - "@polkadot/rpc-core": 1.34.0-beta.10 - "@polkadot/rpc-provider": 1.34.0-beta.10 - "@polkadot/types": 1.34.0-beta.10 - "@polkadot/types-known": 1.34.0-beta.10 + "@polkadot/metadata": 1.34.0-beta.12 + "@polkadot/rpc-core": 1.34.0-beta.12 + "@polkadot/rpc-provider": 1.34.0-beta.12 + "@polkadot/types": 1.34.0-beta.12 + "@polkadot/types-known": 1.34.0-beta.12 "@polkadot/util": ^3.4.1 "@polkadot/util-crypto": ^3.4.1 bn.js: ^5.1.3 eventemitter3: ^4.0.7 rxjs: ^6.6.3 - checksum: 93b6bc3cc6b033a0842eaee6e1da63b501d063b9ad7241b6459a588d5d459f702b013880c4606f9a402ab0b907b0e8ceb08dc561a3bc17364fa5c1d7c1abf6a3 + checksum: 35fbb6e63ef3cd01a6be7472186b26e572a5829548aaa10e81b48cb711e9f9249fa0ffb88247e315191ed072b984ee16a4292f1cf15d19690641797eb987f2c6 languageName: node linkType: hard @@ -3167,7 +3167,7 @@ __metadata: resolution: "@polkadot/app-contracts@workspace:packages/page-contracts" dependencies: "@babel/runtime": ^7.11.2 - "@polkadot/api-contract": ^1.34.0-beta.10 + "@polkadot/api-contract": ^1.34.0-beta.12 languageName: unknown linkType: soft @@ -3553,17 +3553,17 @@ __metadata: languageName: node linkType: hard -"@polkadot/metadata@npm:1.34.0-beta.10": - version: 1.34.0-beta.10 - resolution: "@polkadot/metadata@npm:1.34.0-beta.10" +"@polkadot/metadata@npm:1.34.0-beta.12": + version: 1.34.0-beta.12 + resolution: "@polkadot/metadata@npm:1.34.0-beta.12" dependencies: "@babel/runtime": ^7.11.2 - "@polkadot/types": 1.34.0-beta.10 - "@polkadot/types-known": 1.34.0-beta.10 + "@polkadot/types": 1.34.0-beta.12 + "@polkadot/types-known": 1.34.0-beta.12 "@polkadot/util": ^3.4.1 "@polkadot/util-crypto": ^3.4.1 bn.js: ^5.1.3 - checksum: 09075b88e497ac7fc7d4ba6fd0655c9d0fc8932fccbec732d41fa74b0b9f637276c27b89d5bd38679ac94a3f832404cafd7865d21a5d9068c8b60826bc2b7fd6 + checksum: 65afd44d6af92604e5dcc31e7f3823e8ec70087803f12cb3a46798d2b74281c15b99ca199b380c9f78c025ff2ee917e6a84e74f8c1d4738baad8a332516bb381 languageName: node linkType: hard @@ -3572,7 +3572,7 @@ __metadata: resolution: "@polkadot/react-api@workspace:packages/react-api" dependencies: "@babel/runtime": ^7.11.2 - "@polkadot/api": ^1.34.0-beta.10 + "@polkadot/api": ^1.34.0-beta.12 "@polkadot/extension-dapp": ^0.35.0-beta.1 rxjs-compat: ^6.6.3 languageName: unknown @@ -3695,35 +3695,35 @@ __metadata: languageName: unknown linkType: soft -"@polkadot/rpc-core@npm:1.34.0-beta.10": - version: 1.34.0-beta.10 - resolution: "@polkadot/rpc-core@npm:1.34.0-beta.10" +"@polkadot/rpc-core@npm:1.34.0-beta.12": + version: 1.34.0-beta.12 + resolution: "@polkadot/rpc-core@npm:1.34.0-beta.12" dependencies: "@babel/runtime": ^7.11.2 - "@polkadot/metadata": 1.34.0-beta.10 - "@polkadot/rpc-provider": 1.34.0-beta.10 - "@polkadot/types": 1.34.0-beta.10 + "@polkadot/metadata": 1.34.0-beta.12 + "@polkadot/rpc-provider": 1.34.0-beta.12 + "@polkadot/types": 1.34.0-beta.12 "@polkadot/util": ^3.4.1 memoizee: ^0.4.14 rxjs: ^6.6.3 - checksum: 604ccbf49097a1d331726b9421013dc239769c6e34e863b113c7496575c6464060d7b3bbca01a2f8d66d0a7c613f3f63bd3679a4e598bc981dce6fafbe269104 + checksum: fe8947cf85f9dd30158ae938bf88f9b34fd8c8fb7116d71aca04094c0f220417b02a36e6d9bb15f01138f8a2d03d426e7ebc541ff33d526b3d37bf43d22e61f4 languageName: node linkType: hard -"@polkadot/rpc-provider@npm:1.34.0-beta.10": - version: 1.34.0-beta.10 - resolution: "@polkadot/rpc-provider@npm:1.34.0-beta.10" +"@polkadot/rpc-provider@npm:1.34.0-beta.12": + version: 1.34.0-beta.12 + resolution: "@polkadot/rpc-provider@npm:1.34.0-beta.12" dependencies: "@babel/runtime": ^7.11.2 - "@polkadot/metadata": 1.34.0-beta.10 - "@polkadot/types": 1.34.0-beta.10 + "@polkadot/metadata": 1.34.0-beta.12 + "@polkadot/types": 1.34.0-beta.12 "@polkadot/util": ^3.4.1 "@polkadot/util-crypto": ^3.4.1 "@polkadot/x-fetch": ^0.3.2 "@polkadot/x-ws": ^0.3.2 bn.js: ^5.1.3 eventemitter3: ^4.0.7 - checksum: fda6679813d042b679157cb8501989ab5d01e6d7fb6f2072310bd8a9bfd16dcd01fd6933c2817bc12eff4aa2b6859d8e1ad8d107c452d347811201203f35c6f7 + checksum: 05cfa74a97836c643678de9a3d47e8da3358ae4d8bae8e6c09e85a6c2e8585423cc7b77b541ce2d5b36714ef08a66ad4a615e58b8c3eac97360703d9488741f4 languageName: node linkType: hard @@ -3736,31 +3736,31 @@ __metadata: languageName: node linkType: hard -"@polkadot/types-known@npm:1.34.0-beta.10": - version: 1.34.0-beta.10 - resolution: "@polkadot/types-known@npm:1.34.0-beta.10" +"@polkadot/types-known@npm:1.34.0-beta.12": + version: 1.34.0-beta.12 + resolution: "@polkadot/types-known@npm:1.34.0-beta.12" dependencies: "@babel/runtime": ^7.11.2 - "@polkadot/types": 1.34.0-beta.10 + "@polkadot/types": 1.34.0-beta.12 "@polkadot/util": ^3.4.1 bn.js: ^5.1.3 - checksum: 3d2783b8d2d7c12e2f1897640035f8e4f42ff83f8fc147d5406aa7678a06b96c14ba1e197d4432a1442c0e7c9da2836a504e777ecc83aa7f830a38d9a52665ee + checksum: 8588dc71eadb1d4c51cd01fbef90c513b16a371190ffd5aac071f628bf7cda5275ad766a6fa739aebe60881d54a950312b383c45edf87e2a5cecfb3121923f6f languageName: node linkType: hard -"@polkadot/types@npm:^1.34.0-beta.10": - version: 1.34.0-beta.10 - resolution: "@polkadot/types@npm:1.34.0-beta.10" +"@polkadot/types@npm:^1.34.0-beta.12": + version: 1.34.0-beta.12 + resolution: "@polkadot/types@npm:1.34.0-beta.12" dependencies: "@babel/runtime": ^7.11.2 - "@polkadot/metadata": 1.34.0-beta.10 + "@polkadot/metadata": 1.34.0-beta.12 "@polkadot/util": ^3.4.1 "@polkadot/util-crypto": ^3.4.1 "@types/bn.js": ^4.11.6 bn.js: ^5.1.3 memoizee: ^0.4.14 rxjs: ^6.6.3 - checksum: d8513376b5e2b503173198d96a3052381af384aae12ff5e988dd398f1647f383face8f37fd06f0f7e85d2208069d6d2b16e8d78ca9be24ccb99c8d8f322a2cd4 + checksum: ab031773ab8da1944e0d9479046dc677c1fd4cac84b9ea8d02186c522a0f1b494daa24c04551d598de54af2eddb831b7a4dc4eae879f43d5c6674af7b2b1cba7 languageName: node linkType: hard