Bump API for hash-value signatures (#665)

* Bump API for hash-value signatures

* Imports, hide tabs, not apps

* Update with derive-fixed API

* Remove unused type import
This commit is contained in:
Jaco Greeff 2019-01-31 21:19:36 +01:00 committed by GitHub
parent 348b30bdeb
commit 1e86fb745c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 99 additions and 75 deletions

View File

@ -45,7 +45,7 @@ class TxButtonInner extends React.PureComponent<Props & InjectedProps> {
queueExtrinsic({
accountId,
extrinsic: api.tx[section][method](...params)
extrinsic: api.tx[section][method](...params) as any // ???
});
}
}

View File

@ -4,16 +4,20 @@
import { I18nProps } from '@polkadot/ui-app/types';
import { QueueProps } from '@polkadot/ui-app/Status/types';
import { SubjectInfo } from '@polkadot/ui-keyring/observable/types';
import BN from 'bn.js';
import React from 'react';
import { InputAddress } from '@polkadot/ui-app/index';
import { QueueConsumer } from '@polkadot/ui-app/Status/Context';
import accountObservable from '@polkadot/ui-keyring/observable/accounts';
import { withMulti, withObservable } from '@polkadot/ui-api/index';
import VotingButtons from './VotingButtons';
import translate from './translate';
type Props = I18nProps & {
allAccounts?: SubjectInfo,
referendumId: BN | number
};
@ -25,7 +29,12 @@ class Voting extends React.PureComponent<Props, State> {
state: State = {};
render () {
const { t } = this.props;
const { allAccounts, t } = this.props;
const hasAccounts = allAccounts && Object.keys(allAccounts).length !== 0;
if (!hasAccounts) {
return null;
}
return (
<div className='democracy--Referendum-vote'>
@ -67,4 +76,8 @@ class Voting extends React.PureComponent<Props, State> {
}
}
export default translate(Voting);
export default withMulti(
Voting,
translate,
withObservable(accountObservable.subject, { propName: 'allAccounts' })
);

View File

@ -5,13 +5,15 @@
import { DerivedBalancesMap } from '@polkadot/api-derive/types';
import { AppProps, I18nProps } from '@polkadot/ui-app/types';
import { ApiProps } from '@polkadot/ui-api/types';
import { SubjectInfo } from '@polkadot/ui-keyring/observable/types';
import { ComponentProps } from './types';
import React from 'react';
import { Route, Switch } from 'react-router';
import { AccountId, Balance } from '@polkadot/types';
import Tabs, { TabItem } from '@polkadot/ui-app/Tabs';
import { withCalls } from '@polkadot/ui-api/index';
import accountObservable from '@polkadot/ui-keyring/observable/accounts';
import { withCalls, withMulti, withObservable } from '@polkadot/ui-api/index';
import './index.css';
@ -20,6 +22,7 @@ import Overview from './Overview';
import translate from './translate';
type Props = AppProps & ApiProps & I18nProps & {
allAccounts?: SubjectInfo,
balances?: DerivedBalancesMap,
intentions?: Array<AccountId>,
session_validators?: Array<AccountId>
@ -67,15 +70,22 @@ class App extends React.PureComponent<Props, State> {
}
render () {
const { allAccounts } = this.props;
const { tabs } = this.state;
const { basePath } = this.props;
const hasAccounts = allAccounts && Object.keys(allAccounts).length !== 0;
const filteredTabs = hasAccounts
? tabs
: tabs.filter(({ name }) =>
!['actions'].includes(name)
);
return (
<main className='staking--App'>
<header>
<Tabs
basePath={basePath}
items={tabs}
items={filteredTabs}
/>
</header>
<Switch>
@ -120,10 +130,13 @@ class App extends React.PureComponent<Props, State> {
}
}
export default translate(
export default withMulti(
App,
translate,
withObservable(accountObservable.subject, { propName: 'allAccounts' }),
withCalls<Props>(
'query.session.validators',
['query.staking.intentions', { propName: 'intentions' }],
['derive.staking.intentionsBalances', { propName: 'balances' }]
)(App)
)
);

View File

@ -55,9 +55,9 @@ class ToolboxApp extends React.PureComponent<Props, State> {
};
}
render () {
const { allAccounts = {}, basePath } = this.props;
const { allAccounts, basePath } = this.props;
const { tabs } = this.state;
const hasAccounts = Object.keys(allAccounts).length !== 0;
const hasAccounts = allAccounts && Object.keys(allAccounts).length !== 0;
const filteredTabs = hasAccounts
? tabs
: tabs.filter(({ name }) =>

View File

@ -10,7 +10,6 @@ export default ([
{
Component: Democracy,
display: {
needsAccounts: true,
needsApi: [
'query.democracy.nextTally'
]

View File

@ -10,7 +10,6 @@ export default ([
{
Component: Staking,
display: {
needsAccounts: true,
needsApi: [
'tx.staking.stake'
]

View File

@ -31,8 +31,8 @@
"homepage": "https://github.com/polkadot-js/ui/tree/master/packages/ui-reactive#readme",
"dependencies": {
"@babel/runtime": "^7.2.0",
"@polkadot/api": "^0.41.11",
"@polkadot/types": "^0.41.11",
"@polkadot/api": "^0.42.2",
"@polkadot/types": "^0.42.2",
"rxjs-compat": "^6.3.2"
}
}

View File

@ -11,10 +11,10 @@
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.2.0",
"@polkadot/extrinsics": "^0.41.11",
"@polkadot/extrinsics": "^0.42.2",
"@polkadot/keyring": "^0.33.36",
"@polkadot/storage": "^0.41.11",
"@polkadot/types": "^0.41.11",
"@polkadot/storage": "^0.42.2",
"@polkadot/types": "^0.42.2",
"@polkadot/ui-api": "^0.22.58",
"@polkadot/ui-identicon": "^0.25.8",
"@polkadot/ui-keyring": "^0.25.8",

View File

@ -10,7 +10,7 @@ import React from 'react';
import jsonrpc from '@polkadot/jsonrpc';
import { QueueProvider } from './Context';
import { SubmittableSendResult } from '@polkadot/api/types';
import { SubmittableResult } from '@polkadot/api/SubmittableExtrinsic';
export type Props = BareProps & {
children: React.ReactNode
@ -82,7 +82,7 @@ export default class Queue extends React.Component<Props, State> {
return id;
}
queueSetTxStatus = (id: number, status: QueueTx$Status, result?: SubmittableSendResult, error?: Error): void => {
queueSetTxStatus = (id: number, status: QueueTx$Status, result?: SubmittableResult, error?: Error): void => {
this.setState(
(prevState: State): State => ({
txqueue: prevState.txqueue.map((item) =>
@ -121,7 +121,7 @@ export default class Queue extends React.Component<Props, State> {
}
}
private addResultEvents ({ events = [] }: Partial<SubmittableSendResult> = {}) {
private addResultEvents ({ events = [] }: Partial<SubmittableResult> = {}) {
events.filter((record) => record.event).forEach(({ event: { method, section } }) => {
// filter events handled globally, or those we are not interested in
// NOTE We are not splitting balances, since we want to see the transfer - even if

View File

@ -31,8 +31,8 @@
"homepage": "https://github.com/polkadot-js/ui/tree/master/packages/ui-reactive#readme",
"dependencies": {
"@babel/runtime": "^7.2.0",
"@polkadot/api": "^0.41.11",
"@polkadot/types": "^0.41.11",
"@polkadot/api": "^0.42.2",
"@polkadot/types": "^0.42.2",
"rxjs-compat": "^6.3.2"
}
}

View File

@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { SubmittableSendResult } from '@polkadot/api/types';
import { SubmittableResult } from '@polkadot/api/SubmittableExtrinsic';
import { SubmittableExtrinsic } from '@polkadot/api/promise/types';
import { ApiProps } from '@polkadot/ui-api/types';
import { I18nProps, BareProps } from '@polkadot/ui-app/types';
@ -296,7 +296,7 @@ class Signer extends React.PureComponent<Props, State> {
console.log('makeExtrinsicCall: extrinsic ::', extrinsic.toHex());
try {
const unsubscribe = await extrinsicCall.apply(extrinsic, [..._params, async (result: SubmittableSendResult) => {
const unsubscribe = await extrinsicCall.apply(extrinsic, [..._params, async (result: SubmittableResult) => {
if (!result || !result.type || !result.status) {
return;
}

104
yarn.lock
View File

@ -1385,31 +1385,31 @@
resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz#2b5a3ab3f918cca48a8c754c08168e3f03eba61b"
integrity sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw==
"@polkadot/api-derive@^0.41.11":
version "0.41.11"
resolved "https://registry.yarnpkg.com/@polkadot/api-derive/-/api-derive-0.41.11.tgz#5304a5a8bf5caf3aa99f71fb79992820f7021cdc"
integrity sha512-31PUN2Yegk0vI9LlqlY+otFjRkD+/b9+AQg+GabqcjBy6MpRCB+X8pj7QilMiEbdBseR5w50q14RZSuCh9ikOQ==
"@polkadot/api-derive@^0.42.2":
version "0.42.2"
resolved "https://registry.yarnpkg.com/@polkadot/api-derive/-/api-derive-0.42.2.tgz#f9170ac454b42bfcb5cb0d1ea02f6f6783183f63"
integrity sha512-iLZGPAkA6owVPg8NBXgaYaBZ8w91HNJQEfx3u4MJHNcqc9ZibX0sK8eJB53QAGEOWsjY851lr9S988/ZU8ruWw==
dependencies:
"@babel/runtime" "^7.2.0"
"@polkadot/api" "^0.41.11"
"@polkadot/types" "^0.41.11"
"@polkadot/api" "^0.42.2"
"@polkadot/types" "^0.42.2"
"@types/memoizee" "^0.4.2"
"@types/rx" "^4.1.1"
memoizee "^0.4.14"
rxjs "^6.3.3"
"@polkadot/api@^0.41.11":
version "0.41.11"
resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-0.41.11.tgz#2d2b45055dad0cca09ffd408a99127c98b7ba198"
integrity sha512-NJ8mCHEbnuA3Ml5Z3yLoXW2lnA3z+8IRdapu1xOhNOCFXvHKRsQ0qp7YRUW64jZ4Oz7bUR4KzYInyBjdt5khcQ==
"@polkadot/api@^0.42.2":
version "0.42.2"
resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-0.42.2.tgz#122f6efb4aa7b47ecfd3186342fbc8726abb9b53"
integrity sha512-wEvX7tC24ln7Yh3+hwmIkevCYrK6ai5ho1JG5r0LgmkcxgOeyNhxoRzpYXoJKDUWc/pn/EPUgRBq0KCn6yGOxA==
dependencies:
"@babel/runtime" "^7.2.0"
"@polkadot/api-derive" "^0.41.11"
"@polkadot/extrinsics" "^0.41.11"
"@polkadot/rpc-provider" "^0.41.11"
"@polkadot/rpc-rx" "^0.41.11"
"@polkadot/storage" "^0.41.11"
"@polkadot/types" "^0.41.11"
"@polkadot/api-derive" "^0.42.2"
"@polkadot/extrinsics" "^0.42.2"
"@polkadot/rpc-provider" "^0.42.2"
"@polkadot/rpc-rx" "^0.42.2"
"@polkadot/storage" "^0.42.2"
"@polkadot/types" "^0.42.2"
"@types/rx" "^4.1.1"
rxjs "^6.3.3"
@ -1489,19 +1489,19 @@
typedoc-plugin-no-inherit "^1.1.2"
typescript "^3.2.2"
"@polkadot/extrinsics@^0.41.11":
version "0.41.11"
resolved "https://registry.yarnpkg.com/@polkadot/extrinsics/-/extrinsics-0.41.11.tgz#ff613bbf15fe7e3d0b6d5a14288f795776b0f41f"
integrity sha512-RRAT/WSTnB+CgN4r9AV/2ltDVmJ/e2T8TQU0tn9hARuGq157wAZRO/GFPqBl4AjzU2eDRTDU0safbgpUe5O/hw==
"@polkadot/extrinsics@^0.42.2":
version "0.42.2"
resolved "https://registry.yarnpkg.com/@polkadot/extrinsics/-/extrinsics-0.42.2.tgz#ea77c3d2769172ce66adb07f37ed3e95122f791e"
integrity sha512-gVGdiWfpFrF7mgNgtYdArGVzAkAIhv2CImAlW50W7cXBjk3SSvFLZSQzggCSDUq5dS6nzecIxyamKlFXZESOtA==
dependencies:
"@babel/runtime" "^7.2.0"
"@polkadot/types" "^0.41.11"
"@polkadot/types" "^0.42.2"
"@polkadot/util" "^0.33.36"
"@polkadot/jsonrpc@^0.41.11":
version "0.41.11"
resolved "https://registry.yarnpkg.com/@polkadot/jsonrpc/-/jsonrpc-0.41.11.tgz#6ccd1472afaf9dcf3209e4eba095cec849dd87a9"
integrity sha512-rQ1msTHujTbCa5sptdA8iZa+lRA/9shs1b2gukP2mbgksuebZauoRlk7swCB7+ylY/Y6iF5B82cqrVCNEg/Zgg==
"@polkadot/jsonrpc@^0.42.2":
version "0.42.2"
resolved "https://registry.yarnpkg.com/@polkadot/jsonrpc/-/jsonrpc-0.42.2.tgz#4ef4ef56202d7cbfeb4929fc0a4160824bcad61e"
integrity sha512-RCDaI2KESAtwkBIMDJFPZNRTGpo84s0jFTG5mqr9Z+FXGKK8ezAr/nYBZS3nPSYnHC+IQfJpzjFzmnE4fb9AVw==
dependencies:
"@babel/runtime" "^7.2.0"
@ -1516,25 +1516,25 @@
"@types/bs58" "^4.0.0"
bs58 "^4.0.1"
"@polkadot/rpc-core@^0.41.11":
version "0.41.11"
resolved "https://registry.yarnpkg.com/@polkadot/rpc-core/-/rpc-core-0.41.11.tgz#ab52acbe4e948951e7b2f76c935dbf79a950d750"
integrity sha512-eX8xVjLJiz3kNF8JtHGOnkw7Q5nN7qvU5LeFNI8cz+7UjPcYplVOfXU2Rjd6X4X2a2jOJ7bg9vPkGTSYjfeH3g==
"@polkadot/rpc-core@^0.42.2":
version "0.42.2"
resolved "https://registry.yarnpkg.com/@polkadot/rpc-core/-/rpc-core-0.42.2.tgz#42a35cf2f689d96baba9ec328af343fd6a4e8ec8"
integrity sha512-h4oJeOW8F89uqzIA6nN3kMRvGRfOP11KswJoOnDL/NCn1Grmwzl7juMjoSW8y2dg0hWnCEPkTq1FtInGEamDQg==
dependencies:
"@babel/runtime" "^7.2.0"
"@polkadot/jsonrpc" "^0.41.11"
"@polkadot/rpc-provider" "^0.41.11"
"@polkadot/types" "^0.41.11"
"@polkadot/jsonrpc" "^0.42.2"
"@polkadot/rpc-provider" "^0.42.2"
"@polkadot/types" "^0.42.2"
"@polkadot/util" "^0.33.36"
"@polkadot/rpc-provider@^0.41.11":
version "0.41.11"
resolved "https://registry.yarnpkg.com/@polkadot/rpc-provider/-/rpc-provider-0.41.11.tgz#7a5678d53a09655c022c73d907f74b13f22db8e8"
integrity sha512-HqGwKGCI3v1PpTbG92auXLeXSNtHQQMBzKmgUFjmHp3kg4rSK5yT/bLSU9u6B1KkOUWdY9+24gjFyHNX/eLrWQ==
"@polkadot/rpc-provider@^0.42.2":
version "0.42.2"
resolved "https://registry.yarnpkg.com/@polkadot/rpc-provider/-/rpc-provider-0.42.2.tgz#6928d975d63013b2da1833bec7248972d336617e"
integrity sha512-RGJSqpbVSN2VuJn8IoxmSWeHgXWXdnzqDuVgU5basnbrn3P0US0VVPVlq1hl1meJf8RIVKHm58icflehD8lhNQ==
dependencies:
"@babel/runtime" "^7.2.0"
"@polkadot/keyring" "^0.33.36"
"@polkadot/storage" "^0.41.11"
"@polkadot/storage" "^0.42.2"
"@polkadot/util" "^0.33.36"
"@polkadot/util-crypto" "^0.33.36"
"@types/nock" "^9.3.0"
@ -1542,27 +1542,27 @@
isomorphic-fetch "^2.2.1"
websocket "^1.0.28"
"@polkadot/rpc-rx@^0.41.11":
version "0.41.11"
resolved "https://registry.yarnpkg.com/@polkadot/rpc-rx/-/rpc-rx-0.41.11.tgz#4a4d041e20d5d120fb6def485581a8f14fc016c6"
integrity sha512-RGoXZf/ZIgZGMyVgtt/lh8y0DFusqpouq4R0wq0m7YK6CcCOcqKYpXln4UZshbEWc5MHE/vY2EVTJ1NSV8OSsQ==
"@polkadot/rpc-rx@^0.42.2":
version "0.42.2"
resolved "https://registry.yarnpkg.com/@polkadot/rpc-rx/-/rpc-rx-0.42.2.tgz#162a6446d5c279e2571aa559d601e6f215b5bdcf"
integrity sha512-S05pATaLmYJRzb6ArlafMXjEqZZlXDOux66tvljNWKIQeGQ7qKk9lZHmrp5Dho6+zAW4JGlj4RgjxPoDobOEIA==
dependencies:
"@babel/runtime" "^7.2.0"
"@polkadot/rpc-core" "^0.41.11"
"@polkadot/rpc-provider" "^0.41.11"
"@polkadot/rpc-core" "^0.42.2"
"@polkadot/rpc-provider" "^0.42.2"
"@types/memoizee" "^0.4.2"
"@types/rx" "^4.1.1"
memoizee "^0.4.14"
rxjs "^6.3.3"
"@polkadot/storage@^0.41.11":
version "0.41.11"
resolved "https://registry.yarnpkg.com/@polkadot/storage/-/storage-0.41.11.tgz#86dab4a1e13a05b5a4d7278acae2eb0431279c23"
integrity sha512-MIrntyF4xClw0PgIksJFCH2LPSgv1zez/VzUMHP2JSl4CJTlrdab/ZxzJ/1vv7c2uR33FNMGK7ZjxaMFeWbY6w==
"@polkadot/storage@^0.42.2":
version "0.42.2"
resolved "https://registry.yarnpkg.com/@polkadot/storage/-/storage-0.42.2.tgz#4661027c8cf782f38e7d71977075380949e301c4"
integrity sha512-Q6ZM6fKLP1/3SrbEByD3dvahN/Wr6xsWQYTeyPaa/S0ad/899yKir6OdR4wyKmC76N3wigOfhQQpotBngCnFlQ==
dependencies:
"@babel/runtime" "^7.2.0"
"@polkadot/keyring" "^0.33.36"
"@polkadot/types" "^0.41.11"
"@polkadot/types" "^0.42.2"
"@polkadot/util" "^0.33.36"
"@polkadot/util-crypto" "^0.33.36"
@ -1571,10 +1571,10 @@
resolved "https://registry.yarnpkg.com/@polkadot/ts/-/ts-0.1.52.tgz#6fb09e494d244dad4b3a9ca581bfe13beec66565"
integrity sha512-sij1O0x4CY51A394RYD4/aQwDPwIxIeTOpYI4AZgdF/vq5nvF14b4XFq9vAcSnblaIosf0sYKoz1f3dkN3QqLw==
"@polkadot/types@^0.41.11":
version "0.41.11"
resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-0.41.11.tgz#ef9c5e7d16c2a5beb40dd1e8344a4fcb33f6627d"
integrity sha512-uhKHze2NqZFesDi+iR+5bTtEX2gm20PzrDBcGQjR2qiMEolt4O/0PMbLVL5stjDiXv5AZcZrKcpmaFujDJISbA==
"@polkadot/types@^0.42.2":
version "0.42.2"
resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-0.42.2.tgz#1cf2ce7108b490bebbb389412d36433bade93053"
integrity sha512-h4O9/wpiWKeZ4DNLuBjloMFxUatJSGNw34hYoq/QkRMeZswXCUI1l91xqYElXkhcZmfMzhjlekdaF7+RIQatMg==
dependencies:
"@babel/runtime" "^7.2.0"
"@polkadot/keyring" "^0.33.36"