Update with latest API (with derive) (#611)
* Pull in latest API * Use derive from api * Update with latest API
This commit is contained in:
parent
cc5271d9ff
commit
c3821bdb1b
@ -16,7 +16,7 @@
|
||||
"@types/yargs": "^12.0.5",
|
||||
"babel-plugin-module-resolver": "^3.1.1",
|
||||
"file-saver": "^2.0.0",
|
||||
"libsodium-wrappers": "^0.7.4",
|
||||
"libsodium-wrappers": "^0.7.3",
|
||||
"yargs": "^12.0.5"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
|
||||
@ -89,8 +89,6 @@ class Creator extends React.PureComponent<Props, State> {
|
||||
render () {
|
||||
const { address, isSeedValid } = this.state;
|
||||
|
||||
console.error('passthrough', this.props.passthrough);
|
||||
|
||||
return (
|
||||
<div className='accounts--Creator'>
|
||||
<div className='ui--grid'>
|
||||
@ -390,7 +388,6 @@ class Creator extends React.PureComponent<Props, State> {
|
||||
this.onHideWarning();
|
||||
|
||||
onCreateAccount();
|
||||
|
||||
onStatusChange(status);
|
||||
}
|
||||
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { DerivedReferendumVote } from '@polkadot/api-derive/types';
|
||||
import { I18nProps } from '@polkadot/ui-app/types';
|
||||
import { RawParam } from '@polkadot/ui-params/types';
|
||||
import { DerivedReferendumVote } from '@polkadot/ui-api/derive/types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import React from 'react';
|
||||
|
||||
@ -8,7 +8,6 @@ import { QueueTx$ExtrinsicAdd } from '@polkadot/ui-app/Status/types';
|
||||
import { ApiProps } from '@polkadot/ui-api/types';
|
||||
|
||||
import React from 'react';
|
||||
import SubmittableExtrinsic from '@polkadot/api/promise/SubmittableExtrinsic';
|
||||
import { Method } from '@polkadot/types';
|
||||
import { Button } from '@polkadot/ui-app/index';
|
||||
import { withApi, withMulti } from '@polkadot/ui-api/index';
|
||||
@ -131,11 +130,13 @@ class Selection extends React.PureComponent<Props, State> {
|
||||
return;
|
||||
}
|
||||
|
||||
const fn = Method.findFunction(method.callIndex);
|
||||
|
||||
queueExtrinsic({
|
||||
accountId: isUnsigned
|
||||
? undefined
|
||||
: accountId,
|
||||
extrinsic: new SubmittableExtrinsic(apiPromise, method),
|
||||
extrinsic: apiPromise.tx[fn.section][fn.method](...method.args),
|
||||
isUnsigned
|
||||
});
|
||||
}
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { DerivedBalancesMap } from '@polkadot/api-derive/types';
|
||||
import { I18nProps } from '@polkadot/ui-app/types';
|
||||
import { DerivedBalancesMap } from '@polkadot/ui-api/derive/types';
|
||||
|
||||
import React from 'react';
|
||||
import { AccountId, Balance } from '@polkadot/types';
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { DerivedBalances, DerivedBalancesMap } from '@polkadot/api-derive/types';
|
||||
import { I18nProps } from '@polkadot/ui-app/types';
|
||||
import { DerivedBalances, DerivedBalancesMap } from '@polkadot/ui-api/derive/types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import React from 'react';
|
||||
|
||||
@ -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 { DerivedBalancesMap } from '@polkadot/ui-api/derive/types';
|
||||
import { DerivedBalancesMap } from '@polkadot/api-derive/types';
|
||||
import { I18nProps } from '@polkadot/ui-app/types';
|
||||
|
||||
import './index.css';
|
||||
|
||||
@ -2,13 +2,13 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { SubmittableExtrinsic } from '@polkadot/api/promise/types';
|
||||
import { DerivedBalancesMap } from '@polkadot/api-derive/types';
|
||||
import { I18nProps } from '@polkadot/ui-app/types';
|
||||
import { QueueTx$ExtrinsicAdd } from '@polkadot/ui-app/Status/types';
|
||||
import { DerivedBalancesMap } from '@polkadot/ui-api/derive/types';
|
||||
import { ApiProps } from '@polkadot/ui-api/types';
|
||||
|
||||
import React from 'react';
|
||||
import SubmittableExtrinsic from '@polkadot/api/promise/SubmittableExtrinsic';
|
||||
import { AccountId, Balance } from '@polkadot/types';
|
||||
import { AddressMini, AddressSummary, Button } from '@polkadot/ui-app/index';
|
||||
import { withCall, withMulti } from '@polkadot/ui-api/index';
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { DerivedBalancesMap } from '@polkadot/api-derive/types';
|
||||
import { I18nProps } from '@polkadot/ui-app/types';
|
||||
import { QueueProps } from '@polkadot/ui-app/Status/types';
|
||||
import { DerivedBalancesMap } from '@polkadot/ui-api/derive/types';
|
||||
import { AccountId, Balance } from '@polkadot/types';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { DerivedBalancesMap } from '@polkadot/api-derive/types';
|
||||
import { I18nProps } from '@polkadot/ui-app/types';
|
||||
import { ActionStatus } from '@polkadot/ui-app/Status/types';
|
||||
import { DerivedBalancesMap } from '@polkadot/ui-api/derive/types';
|
||||
|
||||
import React from 'react';
|
||||
import { AccountId, Balance } from '@polkadot/types';
|
||||
@ -21,10 +21,10 @@ type Actions = 'actions' | 'overview';
|
||||
|
||||
type Props = I18nProps & {
|
||||
basePath: string,
|
||||
balances?: DerivedBalancesMap,
|
||||
intentions?: Array<AccountId>,
|
||||
onStatusChange: (status: ActionStatus) => void,
|
||||
query_staking_intentions?: Array<AccountId>,
|
||||
query_session_validators?: Array<AccountId>,
|
||||
derive_balances_validatingBalances?: DerivedBalancesMap
|
||||
query_session_validators?: Array<AccountId>
|
||||
};
|
||||
|
||||
type State = {
|
||||
@ -51,9 +51,9 @@ class App extends React.PureComponent<Props, State> {
|
||||
};
|
||||
}
|
||||
|
||||
static getDerivedStateFromProps ({ query_session_validators, query_staking_intentions }: Props): State {
|
||||
static getDerivedStateFromProps ({ query_session_validators, intentions }: Props): State {
|
||||
return {
|
||||
intentions: (query_staking_intentions || []).map((accountId) =>
|
||||
intentions: (intentions || []).map((accountId) =>
|
||||
accountId.toString()
|
||||
),
|
||||
validators: (query_session_validators || []).map((authorityId) =>
|
||||
@ -64,7 +64,7 @@ class App extends React.PureComponent<Props, State> {
|
||||
|
||||
render () {
|
||||
const { action, intentions, validators } = this.state;
|
||||
const { t, derive_balances_validatingBalances = {} } = this.props;
|
||||
const { t, balances = {} } = this.props;
|
||||
const Component = Components[action];
|
||||
const items = [
|
||||
{
|
||||
@ -87,7 +87,7 @@ class App extends React.PureComponent<Props, State> {
|
||||
/>
|
||||
</header>
|
||||
<Component
|
||||
balances={derive_balances_validatingBalances}
|
||||
balances={balances}
|
||||
balanceArray={this.balanceArray}
|
||||
intentions={intentions}
|
||||
validators={validators}
|
||||
@ -101,7 +101,7 @@ class App extends React.PureComponent<Props, State> {
|
||||
}
|
||||
|
||||
private balanceArray = (_address: AccountId | string): Array<Balance> | undefined => {
|
||||
const { derive_balances_validatingBalances = {} } = this.props;
|
||||
const { balances = {} } = this.props;
|
||||
|
||||
if (!_address) {
|
||||
return undefined;
|
||||
@ -109,10 +109,10 @@ class App extends React.PureComponent<Props, State> {
|
||||
|
||||
const address = _address.toString();
|
||||
|
||||
return derive_balances_validatingBalances[address]
|
||||
return balances[address]
|
||||
? [
|
||||
derive_balances_validatingBalances[address].stakingBalance,
|
||||
derive_balances_validatingBalances[address].nominatedBalance
|
||||
balances[address].stakingBalance,
|
||||
balances[address].nominatedBalance
|
||||
]
|
||||
: undefined;
|
||||
}
|
||||
@ -121,7 +121,7 @@ class App extends React.PureComponent<Props, State> {
|
||||
export default withMulti(
|
||||
App,
|
||||
translate,
|
||||
withCall('query.staking.intentions'),
|
||||
withCall('query.session.validators'),
|
||||
withCall('derive.balances.validatingBalances', { paramProp: 'stakingIntentions' })
|
||||
withCall('query.staking.intentions', { propName: 'intentions' }),
|
||||
withCall('derive.staking.intentionsBalances', { propName: 'balances' })
|
||||
);
|
||||
|
||||
@ -2,11 +2,11 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { SubmittableExtrinsic } from '@polkadot/api/promise/types';
|
||||
import { I18nProps } from '@polkadot/ui-app/types';
|
||||
import { QueueTx$Extrinsic, QueueTx$ExtrinsicAdd } from '@polkadot/ui-app/Status/types';
|
||||
|
||||
import React from 'react';
|
||||
import SubmittableExtrinsic from '@polkadot/api/promise/SubmittableExtrinsic';
|
||||
import { Index } from '@polkadot/types';
|
||||
import Button from '@polkadot/ui-app/Button';
|
||||
import { withCall, withMulti } from '@polkadot/ui-api/index';
|
||||
|
||||
@ -139,6 +139,8 @@ class Transfer extends React.PureComponent<Props, State> {
|
||||
? apiPromise.tx.balances.transfer(recipientId, amount)
|
||||
: null;
|
||||
|
||||
console.log('extrinsic', extrinsic);
|
||||
|
||||
return {
|
||||
accountId,
|
||||
amount,
|
||||
|
||||
@ -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.39.12",
|
||||
"@polkadot/types": "^0.39.12",
|
||||
"@polkadot/api": "^0.40.5",
|
||||
"@polkadot/types": "^0.40.5",
|
||||
"rxjs-compat": "^6.3.2"
|
||||
}
|
||||
}
|
||||
|
||||
@ -76,8 +76,8 @@ export default class ApiWrapper extends React.PureComponent<Props, State> {
|
||||
|
||||
private subscribeChain = async (api: ApiPromise) => {
|
||||
const [properties = new ChainProperties(), value] = await Promise.all([
|
||||
api.rpc.system.properties(),
|
||||
api.rpc.system.chain()
|
||||
api.rpc.system.properties() as Promise<ChainProperties | undefined>,
|
||||
api.rpc.system.chain() as Promise<any>
|
||||
]);
|
||||
|
||||
const chain = value
|
||||
@ -90,7 +90,7 @@ export default class ApiWrapper extends React.PureComponent<Props, State> {
|
||||
tokenSymbol: undefined
|
||||
};
|
||||
|
||||
console.log('found chain', chain, [...properties.entries()]);
|
||||
console.log('api: found chain', chain, [...properties.entries()]);
|
||||
|
||||
balanceFormat.setDefaultDecimals(properties.get('tokenDecimals') || found.tokenDecimals);
|
||||
InputNumber.setUnit(properties.get('tokenSymbol') || found.tokenSymbol);
|
||||
|
||||
@ -1,47 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/ui-api authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { PromiseSubscription } from '@polkadot/api/promise/types';
|
||||
import { DeriveSubscription } from '../types';
|
||||
|
||||
import { decodeAddress } from '@polkadot/keyring';
|
||||
import ApiPromise from '@polkadot/api/promise';
|
||||
import { AccountId, AccountIndex } from '@polkadot/types';
|
||||
|
||||
import accountIdToIndex from './accountIdToIndex';
|
||||
import accountIndexToId from './accountIndexToId';
|
||||
|
||||
export type IdAndIndex = [AccountId | undefined, AccountIndex | undefined];
|
||||
|
||||
export default function accountIdAndIndex (api: ApiPromise): DeriveSubscription {
|
||||
return async (address: AccountId | AccountIndex | string | null | undefined, cb: (idAndIndex: IdAndIndex) => any): PromiseSubscription => {
|
||||
try {
|
||||
// yes, this can fail, don't care too much, catch will catch it
|
||||
const decoded = decodeAddress((address as any).toString());
|
||||
|
||||
if (decoded.length === 32) {
|
||||
const accountId = new AccountId(decoded);
|
||||
|
||||
return accountIdToIndex(api)(accountId, (accountIndex?: AccountIndex) =>
|
||||
cb([accountId, accountIndex])
|
||||
);
|
||||
}
|
||||
|
||||
const accountIndex = new AccountIndex(address as string);
|
||||
|
||||
return accountIndexToId(api)(accountIndex, (accountId?: AccountId) =>
|
||||
cb([accountId, accountIndex])
|
||||
);
|
||||
} catch (error) {
|
||||
// swallow
|
||||
}
|
||||
|
||||
cb([undefined, undefined]);
|
||||
|
||||
// just return empties
|
||||
return (): void => {
|
||||
// nothing to unsubscribe from
|
||||
};
|
||||
};
|
||||
}
|
||||
@ -1,18 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/ui-api authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { PromiseSubscription } from '@polkadot/api/promise/types';
|
||||
import { DeriveSubscription } from '../types';
|
||||
|
||||
import ApiPromise from '@polkadot/api/promise';
|
||||
import { AccountId, AccountIndex } from '@polkadot/types';
|
||||
|
||||
import accountIndexes, { AccountIndexes } from './accountIndexes';
|
||||
|
||||
export default function accountIdToIndex (api: ApiPromise): DeriveSubscription {
|
||||
return async (accountId: AccountId | string | null, cb: (index?: AccountIndex) => any): PromiseSubscription =>
|
||||
accountIndexes(api)((indexes?: AccountIndexes) =>
|
||||
cb((indexes || {})[(accountId || '').toString()])
|
||||
);
|
||||
}
|
||||
@ -1,22 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/ui-api authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { PromiseSubscription } from '@polkadot/api/promise/types';
|
||||
import { DeriveSubscription } from '../types';
|
||||
|
||||
import ApiPromise from '@polkadot/api/promise';
|
||||
import { AccountId, AccountIndex } from '@polkadot/types';
|
||||
import { ENUMSET_SIZE } from '@polkadot/types/AccountIndex';
|
||||
|
||||
export default function accountIndexToId (api: ApiPromise): DeriveSubscription {
|
||||
return async (_accountIndex: AccountIndex | string, cb: (accountId?: AccountId) => any): PromiseSubscription => {
|
||||
const accountIndex = _accountIndex instanceof AccountIndex
|
||||
? _accountIndex
|
||||
: new AccountIndex(_accountIndex);
|
||||
|
||||
return api.query.balances.enumSet(accountIndex, (accounts: Array<AccountId>) =>
|
||||
cb((accounts || [])[accountIndex.mod(ENUMSET_SIZE).toNumber()])
|
||||
);
|
||||
};
|
||||
}
|
||||
@ -1,57 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/ui-api authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { QueryableStorageFunction, PromiseSubscription } from '@polkadot/api/promise/types';
|
||||
import { DeriveSubscription } from '../types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import ApiPromise from '@polkadot/api/promise';
|
||||
import { AccountId, AccountIndex } from '@polkadot/types';
|
||||
import { ENUMSET_SIZE } from '@polkadot/types/AccountIndex';
|
||||
|
||||
export type AccountIndexes = { [index: string]: AccountIndex };
|
||||
|
||||
export default function accountIndexes (api: ApiPromise): DeriveSubscription {
|
||||
return async (cb: (indexes: AccountIndexes) => any): PromiseSubscription => {
|
||||
let combineDestroy: PromiseSubscription | undefined;
|
||||
const nextEnumSetDestory = api.query.balances.nextEnumSet(async (next: AccountIndex) => {
|
||||
const setSize = ENUMSET_SIZE.toNumber();
|
||||
const enumRange = [...Array((next || new BN(0)).div(ENUMSET_SIZE).toNumber() + 1).keys()].map((index) =>
|
||||
[api.query.balances.enumSet, index] as [QueryableStorageFunction, ...Array<any>]
|
||||
);
|
||||
|
||||
if (combineDestroy) {
|
||||
const unsubscribe = await combineDestroy;
|
||||
|
||||
unsubscribe();
|
||||
}
|
||||
|
||||
combineDestroy = api.combineLatest(enumRange, (all: Array<Array<AccountId> | undefined>) => {
|
||||
cb(
|
||||
(all || []).reduce((result, list, outerIndex) => {
|
||||
(list || []).forEach((accountId, innerIndex) => {
|
||||
const index = (outerIndex * setSize) + innerIndex;
|
||||
|
||||
result[accountId.toString()] = new AccountIndex(index);
|
||||
});
|
||||
|
||||
return result;
|
||||
}, {} as AccountIndexes)
|
||||
);
|
||||
});
|
||||
}) as any as PromiseSubscription; // wtf???
|
||||
|
||||
return async (): Promise<void> => {
|
||||
let unsubscribe = await nextEnumSetDestory;
|
||||
|
||||
unsubscribe();
|
||||
|
||||
if (combineDestroy) {
|
||||
unsubscribe = await combineDestroy;
|
||||
|
||||
unsubscribe();
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
@ -1,28 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/ui-api authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { PromiseSubscription } from '@polkadot/api/promise/types';
|
||||
import { DeriveSubscription, DerivedBalancesFees } from '../types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import ApiPromise from '@polkadot/api/promise';
|
||||
|
||||
export default function fees (api: ApiPromise): DeriveSubscription {
|
||||
return async (cb: (fees: DerivedBalancesFees) => any): PromiseSubscription =>
|
||||
api.combineLatest([
|
||||
api.query.balances.creationFee,
|
||||
api.query.balances.existentialDeposit,
|
||||
api.query.balances.transactionBaseFee,
|
||||
api.query.balances.transactionByteFee,
|
||||
api.query.balances.transferFee
|
||||
], ([creationFee, existentialDeposit, transactionBaseFee, transactionByteFee, transferFee]) =>
|
||||
cb({
|
||||
creationFee: creationFee || new BN(0),
|
||||
existentialDeposit: existentialDeposit || new BN(0),
|
||||
transactionBaseFee: transactionBaseFee || new BN(0),
|
||||
transactionByteFee: transactionByteFee || new BN(0),
|
||||
transferFee: transferFee || new BN(0)
|
||||
})
|
||||
);
|
||||
}
|
||||
@ -1,14 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/ui-api authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
export { default as accountIdAndIndex } from './accountIdAndIndex';
|
||||
export { default as accountIdToIndex } from './accountIdToIndex';
|
||||
export { default as accountIndexes } from './accountIndexes';
|
||||
export { default as accountIndexToId } from './accountIndexToId';
|
||||
export { default as fees } from './fees';
|
||||
export { default as validatingBalance } from './votingBalance';
|
||||
export { default as validatingBalances } from './validatingBalances';
|
||||
export { default as votingBalance } from './votingBalance';
|
||||
export { default as votingBalances } from './votingBalances';
|
||||
export { default as votingBalancesNominatorsFor } from './votingBalancesNominatorsFor';
|
||||
@ -1,35 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/ui-api authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { CombinatorFunction } from '@polkadot/api/promise/Combinator';
|
||||
import { PromiseSubscription } from '@polkadot/api/promise/types';
|
||||
import { DeriveSubscription, DerivedBalances } from '../types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import ApiPromise from '@polkadot/api/promise';
|
||||
import { AccountId, Balance } from '@polkadot/types';
|
||||
|
||||
import votingBalance from './votingBalance';
|
||||
import votingBalancesNominatorsFor from './votingBalancesNominatorsFor';
|
||||
|
||||
export default function validatingBalance (api: ApiPromise): DeriveSubscription {
|
||||
return async (accountId: AccountId | string, cb: (balance: DerivedBalances) => any): PromiseSubscription =>
|
||||
api.combineLatest([
|
||||
[votingBalance(api), accountId] as [CombinatorFunction, ...Array<any>],
|
||||
[votingBalancesNominatorsFor(api), accountId] as [CombinatorFunction, ...Array<any>]
|
||||
], ([balance, nominators]) => {
|
||||
const nominatedBalance = nominators.reduce((total: BN, nominatorBalance: DerivedBalances) => {
|
||||
return total.add(nominatorBalance.votingBalance);
|
||||
}, new BN(0));
|
||||
|
||||
cb({
|
||||
...balance,
|
||||
nominators,
|
||||
nominatedBalance: new Balance(nominatedBalance),
|
||||
stakingBalance: new Balance(
|
||||
nominatedBalance.add(balance.votingBalance)
|
||||
)
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -1,32 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/ui-api authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { CombinatorFunction } from '@polkadot/api/promise/Combinator';
|
||||
import { PromiseSubscription } from '@polkadot/api/promise/types';
|
||||
import { DeriveSubscription, DerivedBalancesMap } from '../types';
|
||||
|
||||
import ApiPromise from '@polkadot/api/promise';
|
||||
import { AccountId } from '@polkadot/types';
|
||||
|
||||
import validatingBalance from './validatingBalance';
|
||||
|
||||
export default function votingBalances (api: ApiPromise): DeriveSubscription {
|
||||
return async (...params: Array<any>): PromiseSubscription => {
|
||||
const accountIds: Array<AccountId | string> = params.slice(0, params.length - 1);
|
||||
const cb: (balanceMap: DerivedBalancesMap) => any = params[params.length - 1];
|
||||
|
||||
return api.combineLatest(
|
||||
accountIds.map((accountId) =>
|
||||
[validatingBalance(api), accountId] as [CombinatorFunction, ...Array<any>]
|
||||
), (result) =>
|
||||
cb(
|
||||
result.reduce((balances, balance) => {
|
||||
balances[balance.address.toString()] = balance;
|
||||
|
||||
return balances;
|
||||
}, {} as DerivedBalancesMap)
|
||||
)
|
||||
);
|
||||
};
|
||||
}
|
||||
@ -1,63 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/ui-api authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { PromiseSubscription } from '@polkadot/api/promise/types';
|
||||
import { DeriveSubscription, DerivedBalances } from '../types';
|
||||
|
||||
import ApiPromise from '@polkadot/api/promise';
|
||||
import { AccountId, AccountIndex, Balance } from '@polkadot/types';
|
||||
|
||||
import accountIdAndIndex from './accountIdAndIndex';
|
||||
|
||||
const EMPTY_ACCOUNT = new AccountId(new Uint8Array(32));
|
||||
|
||||
export default function votingBalance (api: ApiPromise): DeriveSubscription {
|
||||
return async (address: AccountIndex | AccountId | string, cb: (balance: DerivedBalances) => any): PromiseSubscription => {
|
||||
let combineDestroy: PromiseSubscription | undefined;
|
||||
const idDestory = accountIdAndIndex(api)(address, async ([accountId]: [AccountId | undefined]) => {
|
||||
const handler = (freeBalance?: Balance, reservedBalance?: Balance) => {
|
||||
cb({
|
||||
accountId: accountId || EMPTY_ACCOUNT,
|
||||
freeBalance: freeBalance || new Balance(0),
|
||||
nominatedBalance: new Balance(0),
|
||||
reservedBalance: reservedBalance || new Balance(0),
|
||||
stakingBalance: new Balance(0),
|
||||
votingBalance: new Balance(
|
||||
(freeBalance || new Balance(0)).add(reservedBalance || new Balance(0))
|
||||
)
|
||||
});
|
||||
};
|
||||
|
||||
if (combineDestroy) {
|
||||
const unsubscribe = await combineDestroy;
|
||||
|
||||
unsubscribe();
|
||||
combineDestroy = undefined;
|
||||
}
|
||||
|
||||
if (!accountId) {
|
||||
return handler();
|
||||
}
|
||||
|
||||
combineDestroy = api.combineLatest([
|
||||
[api.query.balances.freeBalance, accountId],
|
||||
[api.query.balances.reservedBalance, accountId]
|
||||
], ([freeBalance, reservedBalance]) =>
|
||||
handler(freeBalance, reservedBalance)
|
||||
);
|
||||
});
|
||||
|
||||
return async () => {
|
||||
let unsubscribe = await idDestory;
|
||||
|
||||
unsubscribe();
|
||||
|
||||
if (combineDestroy) {
|
||||
let unsubscribe = await combineDestroy;
|
||||
|
||||
unsubscribe();
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
@ -1,25 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/ui-api authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { CombinatorFunction } from '@polkadot/api/promise/Combinator';
|
||||
import { PromiseSubscription } from '@polkadot/api/promise/types';
|
||||
import { DeriveSubscription, DerivedBalances } from '../types';
|
||||
|
||||
import ApiPromise from '@polkadot/api/promise';
|
||||
import { AccountId, AccountIndex } from '@polkadot/types';
|
||||
|
||||
import votingBalance from './votingBalance';
|
||||
|
||||
export default function votingBalances (api: ApiPromise): DeriveSubscription {
|
||||
return async (...params: Array<any>): PromiseSubscription => {
|
||||
const addresses: Array<AccountIndex | AccountId | string> = params.slice(0, params.length - 1);
|
||||
const cb: (balance: Array<DerivedBalances>) => any = params[params.length - 1];
|
||||
|
||||
return api.combineLatest(
|
||||
addresses.map((address) =>
|
||||
[votingBalance(api), address] as [CombinatorFunction, ...Array<any>]
|
||||
), cb
|
||||
);
|
||||
};
|
||||
}
|
||||
@ -1,38 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/ui-api authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { PromiseSubscription } from '@polkadot/api/promise/types';
|
||||
import { DeriveSubscription, DerivedBalances } from '../types';
|
||||
|
||||
import ApiPromise from '@polkadot/api/promise';
|
||||
import { AccountId } from '@polkadot/types';
|
||||
|
||||
import votingBalances from './votingBalances';
|
||||
|
||||
export default function votingBalancesNominatorsFor (api: ApiPromise): DeriveSubscription {
|
||||
return async (accountId: AccountId | string, cb: (balance: Array<DerivedBalances>) => any): PromiseSubscription => {
|
||||
let combineDestroy: PromiseSubscription | undefined;
|
||||
const nominatorDestroy = api.query.staking.nominatorsFor(accountId, async (nominators?: Array<AccountId>) => {
|
||||
if (combineDestroy) {
|
||||
const unsubscribe = await combineDestroy;
|
||||
|
||||
unsubscribe();
|
||||
}
|
||||
|
||||
combineDestroy = votingBalances(api)(...(nominators || []), cb);
|
||||
});
|
||||
|
||||
return async () => {
|
||||
let unsubscribe = await nominatorDestroy;
|
||||
|
||||
unsubscribe();
|
||||
|
||||
if (combineDestroy) {
|
||||
unsubscribe = await combineDestroy;
|
||||
|
||||
unsubscribe();
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
@ -1,18 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/ui-api authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { PromiseSubscription } from '@polkadot/api/promise/types';
|
||||
import { DeriveSubscription } from '../types';
|
||||
|
||||
import ApiPromise from '@polkadot/api/promise';
|
||||
import { BlockNumber, Header } from '@polkadot/types';
|
||||
|
||||
export default function bestNumber (api: ApiPromise): DeriveSubscription {
|
||||
return (cb: (blockNumber: BlockNumber) => any): PromiseSubscription =>
|
||||
api.rpc.chain.subscribeNewHead((header?: Header) => {
|
||||
if (header && header.blockNumber) {
|
||||
cb(header.blockNumber);
|
||||
}
|
||||
}) as PromiseSubscription;
|
||||
}
|
||||
@ -1,18 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/ui-api authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { PromiseSubscription } from '@polkadot/api/promise/types';
|
||||
import { DeriveSubscription } from '../types';
|
||||
|
||||
import ApiPromise from '@polkadot/api/promise';
|
||||
import { BlockNumber, Header } from '@polkadot/types';
|
||||
|
||||
export default function bestNumberFinalised (api: ApiPromise): DeriveSubscription {
|
||||
return (cb: (blockNumber: BlockNumber) => any): PromiseSubscription =>
|
||||
api.rpc.chain.subscribeFinalisedHeads((header?: Header) => {
|
||||
if (header && header.blockNumber) {
|
||||
cb(header.blockNumber);
|
||||
}
|
||||
}) as PromiseSubscription;
|
||||
}
|
||||
@ -1,6 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/ui-api authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
export { default as bestNumber } from './bestNumber';
|
||||
export { default as bestNumberFinalised } from './bestNumberFinalised';
|
||||
@ -1,8 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/ui-api authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
export { default as referendumInfos } from './referendumInfos';
|
||||
export { default as referendums } from './referendums';
|
||||
export { default as referendumVotesFor } from './referendumVotesFor';
|
||||
export { default as votes } from './votes';
|
||||
@ -1,27 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/ui-api authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { CombinatorFunction } from '@polkadot/api/promise/Combinator';
|
||||
import { PromiseSubscription } from '@polkadot/api/promise/types';
|
||||
import { DeriveSubscription } from '../types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import ApiPromise from '@polkadot/api/promise';
|
||||
import { ReferendumInfo } from '@polkadot/types';
|
||||
|
||||
export default function referendumInfos (api: ApiPromise): DeriveSubscription {
|
||||
return async (...params: Array<any>): PromiseSubscription => {
|
||||
const ids: Array<BN | number> = params.slice(0, params.length - 1);
|
||||
const cb: (infos: Array<ReferendumInfo>) => any = params[params.length - 1];
|
||||
|
||||
return api.combineLatest(
|
||||
ids.map((id) =>
|
||||
[api.query.democracy.referendumInfoOf, id] as [CombinatorFunction, ...Array<any>]
|
||||
), (infos: Array<ReferendumInfo | undefined>) =>
|
||||
cb(
|
||||
(infos || []).filter((info) => info) as Array<ReferendumInfo>
|
||||
)
|
||||
);
|
||||
};
|
||||
}
|
||||
@ -1,57 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/ui-api authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { CombinatorFunction } from '@polkadot/api/promise/Combinator';
|
||||
import { PromiseSubscription } from '@polkadot/api/promise/types';
|
||||
import { DeriveSubscription, DerivedReferendumVote } from '../types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import ApiPromise from '@polkadot/api/promise';
|
||||
import { AccountId, Balance, Vote } from '@polkadot/types';
|
||||
|
||||
import votingBalances from '../balances/votingBalances';
|
||||
import votes from './votes';
|
||||
|
||||
export default function referendumVotesFor (api: ApiPromise): DeriveSubscription {
|
||||
return async (referendumId: BN | number, cb: (votes: Array<DerivedReferendumVote>) => any): PromiseSubscription => {
|
||||
let innerDispose: PromiseSubscription | undefined;
|
||||
const outerDispose = api.query.democracy.votersFor(referendumId, async (votersFor: Array<AccountId>) => {
|
||||
if (innerDispose) {
|
||||
const unsubscribe = await innerDispose;
|
||||
|
||||
unsubscribe();
|
||||
innerDispose = undefined;
|
||||
}
|
||||
|
||||
if (!votersFor || !votersFor.length) {
|
||||
return cb([]);
|
||||
}
|
||||
|
||||
innerDispose = api.combineLatest([
|
||||
[votes(api), referendumId, ...votersFor] as [CombinatorFunction, ...Array<any>],
|
||||
[votingBalances(api), ...votersFor] as [CombinatorFunction, ...Array<any>]
|
||||
], ([votes, balances]) =>
|
||||
cb(
|
||||
votersFor.map((accountId, index): DerivedReferendumVote => ({
|
||||
accountId,
|
||||
balance: balances[index].votingBalance || new Balance(0),
|
||||
vote: votes[index] || new Vote(0)
|
||||
}))
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
return async () => {
|
||||
let unsubscribe = await outerDispose;
|
||||
|
||||
unsubscribe();
|
||||
|
||||
if (innerDispose) {
|
||||
unsubscribe = await innerDispose;
|
||||
|
||||
unsubscribe();
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
@ -1,50 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/ui-api authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { PromiseSubscription } from '@polkadot/api/promise/types';
|
||||
import { DeriveSubscription } from '../types';
|
||||
|
||||
import ApiPromise from '@polkadot/api/promise';
|
||||
import { ReferendumInfo } from '@polkadot/types';
|
||||
|
||||
import referendumInfos from './referendumInfos';
|
||||
|
||||
export default function referendums (api: ApiPromise): DeriveSubscription {
|
||||
return async (cb: (referendums: Array<ReferendumInfo>) => any): PromiseSubscription => {
|
||||
let innerDispose: PromiseSubscription | undefined;
|
||||
const outerDispose = api.combineLatest([
|
||||
api.query.democracy.nextTally,
|
||||
api.query.democracy.referendumCount
|
||||
], async ([nextTally, referendumCount]) => {
|
||||
if (innerDispose) {
|
||||
const unsubscribe = await innerDispose;
|
||||
|
||||
unsubscribe();
|
||||
innerDispose = undefined;
|
||||
}
|
||||
|
||||
if (referendumCount && nextTally && referendumCount.gt(nextTally) && referendumCount.gtn(0)) {
|
||||
innerDispose = referendumInfos(api)(
|
||||
...[...Array(referendumCount.sub(nextTally).toNumber())].map((_, i) =>
|
||||
nextTally.addn(i)
|
||||
), cb
|
||||
);
|
||||
} else {
|
||||
cb([]);
|
||||
}
|
||||
});
|
||||
|
||||
return async () => {
|
||||
let unsubscribe = await outerDispose;
|
||||
|
||||
unsubscribe();
|
||||
|
||||
if (innerDispose) {
|
||||
unsubscribe = await innerDispose;
|
||||
|
||||
unsubscribe();
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
@ -1,23 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/ui-api authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { QueryableStorageFunction, PromiseSubscription } from '@polkadot/api/promise/types';
|
||||
import { DeriveSubscription } from '../types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import ApiPromise from '@polkadot/api/promise';
|
||||
import { AccountId, bool as Bool } from '@polkadot/types';
|
||||
|
||||
export default function votes (api: ApiPromise): DeriveSubscription {
|
||||
return async (...params: Array<any>): PromiseSubscription => {
|
||||
const referendumId: BN = params[0];
|
||||
const accountIds: Array<AccountId> = params.slice(1, params.length - 1);
|
||||
const cb: (infos: Array<Bool>) => any = params[params.length - 1];
|
||||
|
||||
return api.combineLatest(
|
||||
accountIds.map((accountId) =>
|
||||
[api.query.democracy.voteOf, [referendumId, accountId]] as [QueryableStorageFunction, ...Array<any>]
|
||||
), cb);
|
||||
};
|
||||
}
|
||||
@ -1,15 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/ui-api authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import * as balances from './balances';
|
||||
import * as chain from './chain';
|
||||
import * as democracy from './democracy';
|
||||
import * as session from './session';
|
||||
|
||||
export default {
|
||||
balances,
|
||||
chain,
|
||||
democracy,
|
||||
session
|
||||
};
|
||||
@ -1,19 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/ui-api authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { PromiseSubscription } from '@polkadot/api/promise/types';
|
||||
import { DeriveSubscription } from '../types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import ApiPromise from '@polkadot/api/promise';
|
||||
|
||||
export default function eraLength (api: ApiPromise): DeriveSubscription {
|
||||
return (cb: (count: BN) => any): PromiseSubscription =>
|
||||
api.combineLatest([
|
||||
api.query.session.sessionLength,
|
||||
api.query.staking.sessionsPerEra
|
||||
], ([sessionLength, sessionsPerEra]) =>
|
||||
cb((sessionLength || new BN(1)).mul(sessionsPerEra || new BN(1)))
|
||||
);
|
||||
}
|
||||
@ -1,30 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/ui-api authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { PromiseSubscription } from '@polkadot/api/promise/types';
|
||||
import { DeriveSubscription } from '../types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import ApiPromise from '@polkadot/api/promise';
|
||||
|
||||
import sessionProgress from './sessionProgress';
|
||||
|
||||
export default function eraProgress (api: ApiPromise): DeriveSubscription {
|
||||
return (cb: (count: BN) => any): PromiseSubscription =>
|
||||
api.combineLatest([
|
||||
sessionProgress(api),
|
||||
api.query.session.currentIndex,
|
||||
api.query.session.sessionLength,
|
||||
api.query.staking.lastEraLengthChange,
|
||||
api.query.staking.sessionsPerEra
|
||||
], ([sessionProgress, currentIndex, sessionLength, lastEraLengthChange, sessionsPerEra]) =>
|
||||
cb(
|
||||
(currentIndex || new BN(0))
|
||||
.sub(lastEraLengthChange || new BN(0))
|
||||
.mod(sessionsPerEra || new BN(1))
|
||||
.mul(sessionLength || new BN(1))
|
||||
.add(sessionProgress || new BN(0))
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/ui-api authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
export { default as eraLength } from './eraLength';
|
||||
export { default as eraProgress } from './eraProgress';
|
||||
export { default as sessionProgress } from './sessionProgress';
|
||||
@ -1,27 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/ui-api authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { PromiseSubscription } from '@polkadot/api/promise/types';
|
||||
import { DeriveSubscription } from '../types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import ApiPromise from '@polkadot/api/promise';
|
||||
|
||||
import bestNumber from '../chain/bestNumber';
|
||||
|
||||
export default function sessionProgress (api: ApiPromise): DeriveSubscription {
|
||||
return (cb: (count: BN) => any): PromiseSubscription =>
|
||||
api.combineLatest([
|
||||
bestNumber(api),
|
||||
api.query.session.sessionLength,
|
||||
api.query.session.lastLengthChange
|
||||
], ([bestNumber, sessionLength, lastLengthChange]) =>
|
||||
cb(
|
||||
(bestNumber || new BN(0))
|
||||
.sub(lastLengthChange || new BN(0))
|
||||
.add(sessionLength || new BN(1))
|
||||
.mod(sessionLength || new BN(1))
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -1,40 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/ui-api authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { PromiseSubscription } from '@polkadot/api/promise/types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import { AccountId, Balance, Vote } from '@polkadot/types';
|
||||
|
||||
export interface DeriveSubscription {
|
||||
(...params: Array<any>): PromiseSubscription;
|
||||
}
|
||||
|
||||
export type DerivedBalancesFees = {
|
||||
creationFee: BN,
|
||||
existentialDeposit: BN,
|
||||
transactionBaseFee: BN,
|
||||
transactionByteFee: BN,
|
||||
transferFee: BN
|
||||
};
|
||||
|
||||
export type DerivedBalances = {
|
||||
accountId: AccountId,
|
||||
freeBalance: Balance,
|
||||
nominatedBalance: Balance,
|
||||
reservedBalance: Balance,
|
||||
votingBalance: Balance,
|
||||
stakingBalance: Balance,
|
||||
nominators?: Array<DerivedBalances>
|
||||
};
|
||||
|
||||
export type DerivedBalancesMap = {
|
||||
[index: string]: DerivedBalances
|
||||
};
|
||||
|
||||
export type DerivedReferendumVote = {
|
||||
accountId: AccountId,
|
||||
balance: Balance,
|
||||
vote: Vote
|
||||
};
|
||||
@ -3,14 +3,12 @@
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import intervalObservable from './intervalObservable';
|
||||
import intervalTimer from './intervalTimer';
|
||||
import isEqual from './isEqual';
|
||||
import isTestChain from './isTestChain';
|
||||
import triggerChange from './triggerChange';
|
||||
|
||||
export {
|
||||
intervalObservable,
|
||||
intervalTimer,
|
||||
isEqual,
|
||||
isTestChain,
|
||||
triggerChange
|
||||
|
||||
@ -1,18 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/ui-api authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { CallProps } from '../types';
|
||||
|
||||
const TIMEOUT = 500;
|
||||
|
||||
export default function intervalTimer<T, Props, State extends CallProps> (that: React.Component<Props, State>): number {
|
||||
return window.setInterval(() => {
|
||||
const elapsed = Date.now() - ((that.state.callUpdatedAt as number) || 0);
|
||||
const callUpdated = elapsed <= 1500;
|
||||
|
||||
if (callUpdated !== that.state.callUpdated) {
|
||||
that.setState({ callUpdated });
|
||||
}
|
||||
}, TIMEOUT);
|
||||
}
|
||||
@ -12,16 +12,10 @@ import { ApiConsumer } from '../ApiContext';
|
||||
|
||||
export default function withApi <P extends ApiProps> (Inner: React.ComponentType<P>, defaultProps: DefaultProps = {}): React.ComponentType<any> {
|
||||
return class WithApi extends React.PureComponent<Subtract<P, ApiProps>> {
|
||||
constructor (props: any) {
|
||||
super(props);
|
||||
|
||||
assert(Inner, `Expected 'withApi' to wrap a React Component`);
|
||||
}
|
||||
|
||||
render () {
|
||||
return (
|
||||
<ApiConsumer>
|
||||
{(apiProps: ApiProps) => {
|
||||
{(apiProps?: ApiProps) => {
|
||||
assert(apiProps && apiProps.apiPromise, `Application root must be wrapped inside 'rx-react/Api' to provide API context`);
|
||||
|
||||
return (
|
||||
|
||||
@ -8,8 +8,7 @@ import { HOC, Options } from './types';
|
||||
import React from 'react';
|
||||
import { assert, isUndefined } from '@polkadot/util';
|
||||
|
||||
import derive from '../derive/index';
|
||||
import { intervalTimer, isEqual, triggerChange } from '../util/index';
|
||||
import { isEqual, triggerChange } from '../util/index';
|
||||
import echoTransform from '../transform/echo';
|
||||
import withApi from './api';
|
||||
|
||||
@ -32,6 +31,7 @@ export default function withCall<P extends ApiProps> (endpoint: string, { at, at
|
||||
return (Inner: React.ComponentType<ApiProps>): React.ComponentType<any> => {
|
||||
class WithPromise extends React.Component<P, State> {
|
||||
state: State;
|
||||
isActive: boolean = true;
|
||||
|
||||
constructor (props: P) {
|
||||
super(props);
|
||||
@ -51,7 +51,7 @@ export default function withCall<P extends ApiProps> (endpoint: string, { at, at
|
||||
const newParams = this.getParams(this.props);
|
||||
const oldParams = this.getParams(prevProps);
|
||||
|
||||
if (!isEqual(newParams, oldParams)) {
|
||||
if (this.isActive && !isEqual(newParams, oldParams)) {
|
||||
this
|
||||
.subscribe(newParams)
|
||||
.then(NOOP)
|
||||
@ -60,8 +60,17 @@ export default function withCall<P extends ApiProps> (endpoint: string, { at, at
|
||||
}
|
||||
|
||||
componentDidMount () {
|
||||
this.setState({
|
||||
timerId: intervalTimer(this)
|
||||
const timerId = window.setInterval(() => {
|
||||
const elapsed = Date.now() - (this.state.callUpdatedAt || 0);
|
||||
const callUpdated = elapsed <= 1500;
|
||||
|
||||
if (callUpdated !== this.state.callUpdated) {
|
||||
this.nextState({ callUpdated });
|
||||
}
|
||||
}, 500);
|
||||
|
||||
this.nextState({
|
||||
timerId
|
||||
});
|
||||
|
||||
this
|
||||
@ -73,6 +82,8 @@ export default function withCall<P extends ApiProps> (endpoint: string, { at, at
|
||||
componentWillUnmount () {
|
||||
const { timerId } = this.state;
|
||||
|
||||
this.isActive = false;
|
||||
|
||||
if (timerId !== -1) {
|
||||
clearInterval(timerId);
|
||||
}
|
||||
@ -80,6 +91,12 @@ export default function withCall<P extends ApiProps> (endpoint: string, { at, at
|
||||
this.unsubscribe();
|
||||
}
|
||||
|
||||
private nextState (state: Partial<State>) {
|
||||
if (this.isActive) {
|
||||
this.setState(state as State);
|
||||
}
|
||||
}
|
||||
|
||||
private getParams (props: any): Array<any> {
|
||||
const paramValue = props[paramProp];
|
||||
|
||||
@ -115,18 +132,6 @@ export default function withCall<P extends ApiProps> (endpoint: string, { at, at
|
||||
assert(['rpc', 'query', 'derive'].includes(area), `Unknown api.${area}, expected rpc, query or derive`);
|
||||
assert(!at || area === 'query', 'Only able todo an at query on the api.query interface');
|
||||
|
||||
if (area === 'derive') {
|
||||
const apiSection = (derive as any)[section];
|
||||
|
||||
assert(apiSection && apiSection[method], `Unable to find api.derive.${section}.${method}`);
|
||||
|
||||
return [
|
||||
apiSection[method](apiPromise),
|
||||
newParams,
|
||||
true
|
||||
];
|
||||
}
|
||||
|
||||
const apiSection = (apiPromise as any)[area][section];
|
||||
|
||||
assert(apiSection && apiSection[method], `Unable to find api.${area}.${section}.${method}`);
|
||||
@ -134,7 +139,7 @@ export default function withCall<P extends ApiProps> (endpoint: string, { at, at
|
||||
return [
|
||||
apiSection[method],
|
||||
newParams,
|
||||
(area === 'query' && (!at && !atProp)) || method.startsWith('subscribe')
|
||||
area === 'derive' || (area === 'query' && (!at && !atProp)) || method.startsWith('subscribe')
|
||||
];
|
||||
}
|
||||
|
||||
@ -155,7 +160,7 @@ export default function withCall<P extends ApiProps> (endpoint: string, { at, at
|
||||
this.triggerUpdate(this.props, value)
|
||||
);
|
||||
|
||||
this.setState({ destroy });
|
||||
this.nextState({ destroy });
|
||||
} else {
|
||||
const value: any = at
|
||||
? await apiMethod.at(at, ...params)
|
||||
@ -180,13 +185,13 @@ export default function withCall<P extends ApiProps> (endpoint: string, { at, at
|
||||
try {
|
||||
const callResult = (props.transform || transform)(value);
|
||||
|
||||
if (isEqual(callResult, this.state.callResult)) {
|
||||
if (!this.isActive || isEqual(callResult, this.state.callResult)) {
|
||||
return;
|
||||
}
|
||||
|
||||
triggerChange(callResult, callOnResult, props.callOnResult);
|
||||
|
||||
this.setState({
|
||||
this.nextState({
|
||||
callResult,
|
||||
callUpdated: true,
|
||||
callUpdatedAt: Date.now()
|
||||
|
||||
@ -11,10 +11,10 @@
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.2.0",
|
||||
"@polkadot/extrinsics": "^0.39.12",
|
||||
"@polkadot/extrinsics": "^0.40.5",
|
||||
"@polkadot/keyring": "^0.33.34",
|
||||
"@polkadot/storage": "^0.39.12",
|
||||
"@polkadot/types": "^0.39.12",
|
||||
"@polkadot/storage": "^0.40.5",
|
||||
"@polkadot/types": "^0.40.5",
|
||||
"@polkadot/ui-api": "^0.22.21",
|
||||
"@polkadot/ui-identicon": "^0.25.5",
|
||||
"@polkadot/ui-keyring": "^0.25.5",
|
||||
|
||||
@ -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 SubmittableExtrinsic from '@polkadot/api/promise/SubmittableExtrinsic';
|
||||
import { SubmittableExtrinsic } from '@polkadot/api/promise/types';
|
||||
import { RpcMethod } from '@polkadot/jsonrpc/types';
|
||||
import { AccountId, Address } from '@polkadot/types';
|
||||
|
||||
|
||||
@ -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.39.12",
|
||||
"@polkadot/types": "^0.39.12",
|
||||
"@polkadot/api": "^0.40.5",
|
||||
"@polkadot/types": "^0.40.5",
|
||||
"rxjs-compat": "^6.3.2"
|
||||
}
|
||||
}
|
||||
|
||||
@ -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 { DerivedBalancesFees } from '@polkadot/ui-api/derive/types';
|
||||
import { DerivedFees } from '@polkadot/api-derive/types';
|
||||
import { I18nProps } from '@polkadot/ui-app/types';
|
||||
import { ExtraFees } from './types';
|
||||
|
||||
@ -17,7 +17,7 @@ import translate from '../translate';
|
||||
|
||||
type Props = I18nProps & {
|
||||
deposit: BN | Compact,
|
||||
fees: DerivedBalancesFees,
|
||||
fees: DerivedFees,
|
||||
query_democracy_minimumDeposit?: BN
|
||||
onChange: (fees: ExtraFees) => void
|
||||
};
|
||||
|
||||
@ -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 { DerivedBalances, DerivedBalancesFees } from '@polkadot/ui-api/derive/types';
|
||||
import { DerivedBalances, DerivedFees } from '@polkadot/api-derive/types';
|
||||
import { I18nProps } from '@polkadot/ui-app/types';
|
||||
import { ExtraFees } from './types';
|
||||
|
||||
@ -18,7 +18,7 @@ import { ZERO_BALANCE } from './constants';
|
||||
|
||||
type Props = I18nProps & {
|
||||
amount: BN | Compact,
|
||||
fees: DerivedBalancesFees,
|
||||
fees: DerivedFees,
|
||||
derive_balances_votingBalance?: DerivedBalances,
|
||||
recipientId: string,
|
||||
onChange: (fees: ExtraFees) => void
|
||||
|
||||
@ -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 { DerivedBalancesFees, DerivedBalances } from '@polkadot/ui-api/derive/types';
|
||||
import { DerivedFees, DerivedBalances } from '@polkadot/api-derive/types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
|
||||
@ -18,4 +18,4 @@ export const ZERO_FEES = {
|
||||
creationFee: new BN(0),
|
||||
existentialDeposit: new BN(0),
|
||||
transferFee: new BN(0)
|
||||
} as DerivedBalancesFees;
|
||||
} as DerivedFees;
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { I18nProps } from '@polkadot/ui-app/types';
|
||||
import { DerivedBalancesFees, DerivedBalances } from '@polkadot/ui-api/derive/types';
|
||||
import { DerivedFees, DerivedBalances } from '@polkadot/api-derive/types';
|
||||
import { ExtraFees } from './types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
@ -31,7 +31,7 @@ type State = ExtraFees & {
|
||||
};
|
||||
|
||||
type Props = I18nProps & {
|
||||
derive_balances_fees?: DerivedBalancesFees,
|
||||
derive_balances_fees?: DerivedFees,
|
||||
derive_balances_votingBalance?: DerivedBalances,
|
||||
accountId?: string | null,
|
||||
extrinsic: Extrinsic | null,
|
||||
|
||||
@ -3,14 +3,13 @@
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { SubmittableSendResult } from '@polkadot/api/types';
|
||||
import { PromiseSubscription } from '@polkadot/api/promise/types';
|
||||
import { PromiseSubscription, SubmittableExtrinsic } from '@polkadot/api/promise/types';
|
||||
import { ApiProps } from '@polkadot/ui-api/types';
|
||||
import { I18nProps, BareProps } from '@polkadot/ui-app/types';
|
||||
import { RpcMethod } from '@polkadot/jsonrpc/types';
|
||||
import { QueueTx, QueueTx$MessageSetStatus, QueueTx$Result, QueueTx$Status } from '@polkadot/ui-app/Status/types';
|
||||
|
||||
import React from 'react';
|
||||
import SubmittableExtrinsic from '@polkadot/api/promise/SubmittableExtrinsic';
|
||||
import { Button, Modal } from '@polkadot/ui-app/index';
|
||||
import keyring from '@polkadot/ui-keyring';
|
||||
import { withApi, withMulti } from '@polkadot/ui-api/index';
|
||||
|
||||
116
yarn.lock
116
yarn.lock
@ -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.39.12":
|
||||
version "0.39.12"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/api-derive/-/api-derive-0.39.12.tgz#ba71228bdbeedc19fee309aa9433a47a227160a5"
|
||||
integrity sha512-oIzedZur3dl4tgZyrEUd0CZY3E1gp3jZKUokshEqqUqL2ZpDAGLJzmd2OIghgg4BOpTDCQ+DA0xheP43s+W/kw==
|
||||
"@polkadot/api-derive@^0.40.5":
|
||||
version "0.40.5"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/api-derive/-/api-derive-0.40.5.tgz#eb70c942c1a027c5e4dfceab37acb63b00397ef0"
|
||||
integrity sha512-c7s7PLDTJRdIkP7mtwsuEAx9A2T6vM3w1mWDgwQdJOVAHE8dYD2ntEkgBjzHdZZW1OBqYiAQf00KaPoJH2eevg==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.2.0"
|
||||
"@polkadot/api" "^0.39.12"
|
||||
"@polkadot/types" "^0.39.12"
|
||||
"@polkadot/api" "^0.40.5"
|
||||
"@polkadot/types" "^0.40.5"
|
||||
"@types/memoizee" "^0.4.2"
|
||||
"@types/rx" "^4.1.1"
|
||||
memoizee "^0.4.14"
|
||||
rxjs "^6.3.3"
|
||||
|
||||
"@polkadot/api@^0.39.12":
|
||||
version "0.39.12"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-0.39.12.tgz#97f2573b85cdf8c522ff64f9f4c39eb50c1b251e"
|
||||
integrity sha512-KvljNOWGUPlW4QXEjmUQwK4OE19t+veoCNfpk9U9wwHs+96qBdznBXvU79IMb3mJn3sH/TV6Nj8Ac7kCL0ForA==
|
||||
"@polkadot/api@^0.40.5":
|
||||
version "0.40.5"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-0.40.5.tgz#710445599743f7b6d0b1c56a6bb149c145e31fb6"
|
||||
integrity sha512-fAWQmvOWmxrexVwyUOB/c4nzkk93/Ydc0yXboFfE71l6NYBbf42nf6cha3WP7gY39iRVFX2rpgSUg6Lva65StA==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.2.0"
|
||||
"@polkadot/api-derive" "^0.39.12"
|
||||
"@polkadot/extrinsics" "^0.39.12"
|
||||
"@polkadot/rpc-provider" "^0.39.12"
|
||||
"@polkadot/rpc-rx" "^0.39.12"
|
||||
"@polkadot/storage" "^0.39.12"
|
||||
"@polkadot/types" "^0.39.12"
|
||||
"@polkadot/api-derive" "^0.40.5"
|
||||
"@polkadot/extrinsics" "^0.40.5"
|
||||
"@polkadot/rpc-provider" "^0.40.5"
|
||||
"@polkadot/rpc-rx" "^0.40.5"
|
||||
"@polkadot/storage" "^0.40.5"
|
||||
"@polkadot/types" "^0.40.5"
|
||||
"@types/rx" "^4.1.1"
|
||||
rxjs "^6.3.3"
|
||||
|
||||
@ -1503,19 +1503,19 @@
|
||||
typedoc-plugin-no-inherit "^1.1.2"
|
||||
typescript "^3.2.2"
|
||||
|
||||
"@polkadot/extrinsics@^0.39.12":
|
||||
version "0.39.12"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/extrinsics/-/extrinsics-0.39.12.tgz#dc0ed7c4cf46d6709d2647dd7e8bad0e6f2df609"
|
||||
integrity sha512-hOCh+dnjBhLG0j+YxX40qCe6ftGRVjr9M7vScz4ZLSiSq7AtBOaYwj4/J5qUdyEnrKLlxCEqN1DCUzS7PMtYbA==
|
||||
"@polkadot/extrinsics@^0.40.5":
|
||||
version "0.40.5"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/extrinsics/-/extrinsics-0.40.5.tgz#0db250d23dbc8c64df1aed59c8bac4cb90eb0321"
|
||||
integrity sha512-+a2XSHOY1vPbxSRr9FLJieOKcpNZE/vEjeXrQD6CxtH+PJIFY/1Cfg/qNYNRH5/68ezwceWbYPr/rM47MJWp5w==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.2.0"
|
||||
"@polkadot/types" "^0.39.12"
|
||||
"@polkadot/types" "^0.40.5"
|
||||
"@polkadot/util" "^0.33.34"
|
||||
|
||||
"@polkadot/jsonrpc@^0.39.12":
|
||||
version "0.39.12"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/jsonrpc/-/jsonrpc-0.39.12.tgz#1cddca39fbcd4d6782c2ffc14896180ab87f1071"
|
||||
integrity sha512-MhtC3pqW4XS+b184RxAoNfKCriw7gAy5oSI1nx/AbsHpMikjzRLgg9PDVo2M9vgAL2cvPlQkq8WcP2GcWZ1iiQ==
|
||||
"@polkadot/jsonrpc@^0.40.5":
|
||||
version "0.40.5"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/jsonrpc/-/jsonrpc-0.40.5.tgz#df35983cea429a4252967daa9cb0678a79b2750c"
|
||||
integrity sha512-y1e9rodqQ4zxpn02vRM5eOMK63mnRuEv9t7KAxOowK67Hg8qaY86eEMjaquBGtso8qPK87qRX7FWhBwOGAHdog==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.2.0"
|
||||
|
||||
@ -1530,25 +1530,25 @@
|
||||
"@types/bs58" "^4.0.0"
|
||||
bs58 "^4.0.1"
|
||||
|
||||
"@polkadot/rpc-core@^0.39.12":
|
||||
version "0.39.12"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/rpc-core/-/rpc-core-0.39.12.tgz#065eacdd15fa05f496115fb0f4d4dbed95110418"
|
||||
integrity sha512-IIuJDmr9z3txC7WZPon5kBQDJJbjODeoFEdqY1oZUnm/Ikxzwd+CW1VvWtgjYmfJvm4JNyqp+z5bzSFV6AA9lQ==
|
||||
"@polkadot/rpc-core@^0.40.5":
|
||||
version "0.40.5"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/rpc-core/-/rpc-core-0.40.5.tgz#94ae335cda19d7e0477e1382d90e0b32aa5fc649"
|
||||
integrity sha512-tX9KFHNViaHJ0/BH5eFEsoDsL4TqJnifLPv+bseNJvsVANm4/z1BykBudezkXKM5FzbPcsJbOFeh9if7ucYa/Q==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.2.0"
|
||||
"@polkadot/jsonrpc" "^0.39.12"
|
||||
"@polkadot/rpc-provider" "^0.39.12"
|
||||
"@polkadot/types" "^0.39.12"
|
||||
"@polkadot/jsonrpc" "^0.40.5"
|
||||
"@polkadot/rpc-provider" "^0.40.5"
|
||||
"@polkadot/types" "^0.40.5"
|
||||
"@polkadot/util" "^0.33.34"
|
||||
|
||||
"@polkadot/rpc-provider@^0.39.12":
|
||||
version "0.39.12"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/rpc-provider/-/rpc-provider-0.39.12.tgz#4edbffac1cb867a72dc79be9db3cb67da6826346"
|
||||
integrity sha512-0HAwhELx1AnWQixNIwaRWF1zdX/t9gd3pA+/TFLQ6KZs9TjgQlELDeFcwqHzY755Ce4yrFq5SX9zHO+z7UKS4A==
|
||||
"@polkadot/rpc-provider@^0.40.5":
|
||||
version "0.40.5"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/rpc-provider/-/rpc-provider-0.40.5.tgz#86343190a8e604171eb815e86a00d1ce415965cb"
|
||||
integrity sha512-NZnpP19izoaaoUCtF0MKYzraqdnJX4/xbm8cP+O4Q3scW6VJR0WP+MLqgRQZirA44lsy7Qh0+HTaLqYIv6dKUw==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.2.0"
|
||||
"@polkadot/keyring" "^0.33.34"
|
||||
"@polkadot/storage" "^0.39.12"
|
||||
"@polkadot/storage" "^0.40.5"
|
||||
"@polkadot/util" "^0.33.34"
|
||||
"@polkadot/util-crypto" "^0.33.34"
|
||||
"@types/nock" "^9.3.0"
|
||||
@ -1556,25 +1556,25 @@
|
||||
isomorphic-fetch "^2.2.1"
|
||||
websocket "^1.0.28"
|
||||
|
||||
"@polkadot/rpc-rx@^0.39.12":
|
||||
version "0.39.12"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/rpc-rx/-/rpc-rx-0.39.12.tgz#b71cffb43790ee794a14c8581375aa14f8d4cf08"
|
||||
integrity sha512-syGXoFwsh1DZrlpzqQqvjMz3BYJ14IU80eraWOml7dQXEE19f+2qkWTogxQ0YnYBBbI5EJE/PwjbrnsoQ76ySg==
|
||||
"@polkadot/rpc-rx@^0.40.5":
|
||||
version "0.40.5"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/rpc-rx/-/rpc-rx-0.40.5.tgz#cfd078aa500e2f6d9e762ef36842b5210a7947c9"
|
||||
integrity sha512-ZqcynFZioS9QeGwTVL3VarFwwEtnL89AjYdpW0PuViE4nqXd4TJzxG8TL9gaklPIwrZH3CJUZa+tyTpvJ3dDsw==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.2.0"
|
||||
"@polkadot/rpc-core" "^0.39.12"
|
||||
"@polkadot/rpc-provider" "^0.39.12"
|
||||
"@polkadot/rpc-core" "^0.40.5"
|
||||
"@polkadot/rpc-provider" "^0.40.5"
|
||||
"@types/rx" "^4.1.1"
|
||||
rxjs "^6.3.3"
|
||||
|
||||
"@polkadot/storage@^0.39.12":
|
||||
version "0.39.12"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/storage/-/storage-0.39.12.tgz#cab5d86eec3620a61921983a44dcb8263d0e38ee"
|
||||
integrity sha512-9+OfUVa7OpOED9nQNvEGtocZhIeMl4HNZbFYuNkyy6kFxeOv9gavm4rBgH+keBGTxjqQ3+WcFrUXBPQn+pWobg==
|
||||
"@polkadot/storage@^0.40.5":
|
||||
version "0.40.5"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/storage/-/storage-0.40.5.tgz#9a82c662913bbe28a787993ce5a4f09b990423e1"
|
||||
integrity sha512-d95FojPAmSDPmLckqw0PP6yDXQstEHhRsEtlEAKGAYdebANluP1b5LX9qzBaYhE9n1BINFOC8ifFl4hvbWUZ/Q==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.2.0"
|
||||
"@polkadot/keyring" "^0.33.34"
|
||||
"@polkadot/types" "^0.39.12"
|
||||
"@polkadot/types" "^0.40.5"
|
||||
"@polkadot/util" "^0.33.34"
|
||||
"@polkadot/util-crypto" "^0.33.34"
|
||||
|
||||
@ -1583,10 +1583,10 @@
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/ts/-/ts-0.1.50.tgz#29a7982203f34e1b6a1215ddaab4efdc4010a099"
|
||||
integrity sha512-yKRJ7+EKW4rZxuSyAvQvjJsImNBqMsWF1NZTkMSfPsLFC5daC9eFuL6O+DdpvOnIKWbrLu2iLCwC9pzFLe7Low==
|
||||
|
||||
"@polkadot/types@^0.39.12":
|
||||
version "0.39.12"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-0.39.12.tgz#2c9e085589b6dc49eb3f28faaec5e0f2953cb946"
|
||||
integrity sha512-pwjf9YBh4osJ/alnFBvZ0I/TUyZrDstz3DSpGT1g6aBGrAZTnXFLu5GTSaGogOUj6i86UdboI7QwNtf/7WaIQg==
|
||||
"@polkadot/types@^0.40.5":
|
||||
version "0.40.5"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-0.40.5.tgz#ff35d953f6277049eb69b990fc36874b47fbe8a8"
|
||||
integrity sha512-OcBvydAtHkrIkKJHxHVftllhQQfRRZpXVqBuJN7/5pxlQOhnA76FFiFhtXhdM8a8rbdz9dbKeOiMC2SN1lQAVA==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.2.0"
|
||||
"@polkadot/keyring" "^0.33.34"
|
||||
@ -7972,23 +7972,11 @@ libsodium-wrappers@^0.7.3:
|
||||
dependencies:
|
||||
libsodium "0.7.3"
|
||||
|
||||
libsodium-wrappers@^0.7.4:
|
||||
version "0.7.4"
|
||||
resolved "https://registry.yarnpkg.com/libsodium-wrappers/-/libsodium-wrappers-0.7.4.tgz#cdb3ce6553e4864c0a68070c4313583489bd765d"
|
||||
integrity sha512-axKkW01L0q+urLeE7UMSZKWwk4LrRbi6s5pjKBAvbgDBYnsSaolK1oN/Syilm1dqJFkJQNi6qodwOp8dzSoc9Q==
|
||||
dependencies:
|
||||
libsodium "0.7.4"
|
||||
|
||||
libsodium@0.7.3:
|
||||
version "0.7.3"
|
||||
resolved "https://registry.yarnpkg.com/libsodium/-/libsodium-0.7.3.tgz#35faf57293ba5485049d5072d0e96feda12f1f35"
|
||||
integrity sha512-ld+deUNqSsZYbAobUs63UyduPq8ICp/Ul/5lbvBIYpuSNWpPRU0PIxbW+xXipVZtuopR6fIz9e0tTnNuPMNeqw==
|
||||
|
||||
libsodium@0.7.4:
|
||||
version "0.7.4"
|
||||
resolved "https://registry.yarnpkg.com/libsodium/-/libsodium-0.7.4.tgz#a5bccd65e3a13b34147ea109be3c65d89f90b074"
|
||||
integrity sha512-fTU3vUdrxQzhPAAjmTSqKk4LzYbR0OtcYjp1P92AlH50JIxXZFEIXWh1yryCmU6RLGfwS2IzBdZjbmpYf/TlyQ==
|
||||
|
||||
lightercollective@^0.1.0:
|
||||
version "0.1.0"
|
||||
resolved "https://registry.yarnpkg.com/lightercollective/-/lightercollective-0.1.0.tgz#70df102c530dcb8d0ccabfe6175a8d00d5f61300"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user